// ==UserScript== // @name Google Favicons // @description Adds favicons to Google search results. // @include https://www.google.*/* // @exclude https://www.google.*/voice/* // @exclude https://www.google.*/maps/* // @version 1.02 // @grant GM_addStyle // @icon http://i.imgur.com/ezjWmEO.png // @namespace https://greasyfork.org/users/14186 // @downloadURL none // ==/UserScript== /** * CSS INFO * #res div.mnr-c div.g = In the news Sub Results Favicon Position * #res div.mnr-c div.g img.favicon = In the news Favicon Alignment * div._OKe img.favicon = Special Results e.g. "Diamond Pushup” * #res div.mnr-c div.card-section = In the news Block Adjustments * #res div.mnr-c div._K2 img.favicon = In the news Picture Result Favicon Position * #res div._cnc img.favicon, #res div.card-section a._sQb img.favicon = News Tab Favicon Position * QUERY INFO * #res div.mnr-c div.g div._K2 div.thumb > a = In the news Picture Result * #res div.mnr-c div.g > div._I2:first-child > a._Dk = In the news First Result No Picture * #res li.g div.rc h3 a = Normal Results * #res div.g div.rc h3 a = Sub Site Results e.g. "Apple" * #res div.intrlu div.g h3 a = Local Results e.g. "Hair Salon" * #res div._cnc a = News Tab Results * #res div.mnr-c div.g > a._Dk = In the news Sub Results * #res div.card-section a._sQb = News Tab Sub Results */ (function(){ (typeof GM_addStyle != 'undefined' ? GM_addStyle : function addStyle(css) { var head = document.getElementsByTagName('head')[0]; var style = document.createElement("style"); style.type = "text/css"; style.appendChild(document.createTextNode(css)); head.appendChild(style); })("#res img.favicon {\ padding-right: 4px;\ vertical-align: middle;\ border: none;\ left: -24px;\ position: absolute;\ top: 2px;\ z-index: 9;\ }\ #res div.mnr-c div.g {\ position: relative;\ }\ #res div.mnr-c div.g img.favicon {\ top: 0;\ left: 1px\ }\ #res div.mnr-c div._K2 img.favicon {\ margin-left: -25px;\ }\ #res div.mnr-c div.card-section {\ padding-left: 25px;\ left: -25px;\ margin-right: -25px;\ }\ div._OKe img.favicon {\ display: none;\ }\ #res div.mnr-c div._I2 img.favicon {\ position: static;\ margin-left: -24px;\ padding-right: 8px;\ margin-top: -2px;\ }\ #res div._cnc img.favicon, #res div.card-section a._sQb img.favicon {\ position: static;\ left: 0px;\ padding-right: 6px;\ padding-bottom: 2.3px;\ }\ "); var FAVICON_GRABBER = 'https://www.google.com/s2/favicons?domain='; // 'http://favicon.yandex.net/favicon/' var QUERY = '#res li.g div.rc h3 a, #res div.g div.rc h3 a, #res div.intrlu div.g h3 a, #res div._cnc a, #res div.mnr-c div.g > a._Dk, #res div.mnr-c div.g div._K2 div.thumb > a, #res div.mnr-c div.g > div._I2:first-child > a._Dk, #res div.card-section a._sQb'; /** * @param {NodeList} links */ function add_favicons_to(links) { for (var i=0; i