Greasy Fork

Greasy Fork is available in English.

GiCon

add favicon`s on google search page.

当前为 2017-05-19 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         GiCon
// @namespace    http://greasyfork.icu/users/100160
// @version      0.1.1
// @description  add favicon`s on google search page.
// @author       gvvad
// @match        http*://www.google.*
// @match        http*://*.google.com/*
// @match        http*://*.google.com.ua/*
// @match        http*://*.google.ru/*
// @match        http*://*.google.de/*
// @match        http*://*.google.fr/*
// @exclude      http*://mail.google.*
// @noframes
// @grant        none
// ==/UserScript==

//!!! MAKE SHURE THAT SCRIPT IS RUNNING ON THE GOOGLE PAGE !!!
//if it is not, edit @match parametr for you region
(function() {
    'use strict';
    document.styleSheets[0].insertRule(".gicofav{position:absolute; top:0.1em; left:-1.8em;}");

    var s_seti = function() {
        try {
            var rcnt = document.querySelector("#rcnt");
            if (!rcnt) return;
            if (rcnt.querySelector(".gicofav")) return;
            
            var lst = rcnt.querySelectorAll(".g");
            if (!lst) return;
            
            var reg = /https?:\/\/.+?\//;
            for (var i = 0; i < lst.length; ++i) {
                try {
                    var rc = lst[i].querySelector(".rc");
                    var href = lst[i].querySelector(".r").firstChild.href;
                    
                    var nhref = reg.exec(href);
                    var el = document.createElement("img");
                    el.className = "gicofav";
                    el.src = "http://www.google.com/s2/favicons?domain=" + nhref;
                    
                    rc.insertBefore(el, rc.childNodes[0]);
                } catch(e) {
                    continue;
                }
            }
        } catch(e) {}
    };
    
    document.documentElement.addEventListener("load", function() {
        s_seti();
    }, true);
})();