add favicon`s on google search page.
目前為
// ==UserScript==
// @name GiCon
// @namespace http://tampermonkey.net/
// @version 0.1
// @description add favicon`s on google search page.
// @author gvvad
// @match http*://*.google.com/*
// @match http*://*.google.com.ua/*
// @match http*://*.google.ru/*
// @match http*://*.google.de/*
// @match http*://*.google.fr/*
// @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);
})();