GiCon

Add favicon`s on google search page.

Stan na 15-03-2018. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name           GiCon
// @version        0.1.3
// @description    Add favicon`s on google search page.
// @description:ru Добавляет иконки сайтов в поисковый ответ.
// @author         gvvad
// @run-at         document-start
// @include        http*://google.*/*
// @include        http*://www.google.*/*
// @include        http*://google.*.*/*
// @include        http*://www.google.*.*/*
// @noframes
// @grant          none
// @license        GPL-3.0+; http://www.gnu.org/licenses/gpl-3.0.txt
// @namespace      https://greasyfork.org/users/100160
// ==/UserScript==

(function() {
    'use strict';
    //custom css rule for icon
    document.styleSheets[0].insertRule(".gicofav{position:absolute; top:0.1em; left:-1.8em;}");

    //shedule on page load event
    document.documentElement.addEventListener("load", function() {
        try {
            let lst = rcnt.querySelectorAll(".g");
            if (!lst) {
                return;
            }

            let reg = /https?:\/\/.+?\//;
            for (let item of lst) {
                try {
                    if (item.querySelector(".gicofav")) {
                        continue;
                    }

                    let rc = item.querySelector(".rc");

                    let nhref = reg.exec(item.querySelector(".r").querySelector("a").href);
                    let nimg = document.createElement("img");
                    nimg.setAttribute("class", "gicofav");
                    nimg.setAttribute("src", "http://www.google.com/s2/favicons?domain=" + nhref);

                    rc.insertBefore(nimg, rc.childNodes[0]);
                } catch(e) {
                    continue;
                }
            }
        } catch(e) {}
    }, true);
})();