// ==UserScript== // @name GoogleFullSearchButton // @name:zh-CN 谷歌全面搜索按钮 // @namespace http://www.coofly.com/ // @version 1.1 // @description Add to the Google Full Search button. // @description:zh-cn 给Google添加上全面搜索按钮。 // @author Coofly // @match http://tampermonkey.net/scripts.php // @include /^https?://.+\.google\..+/.*$/ // @exclude https://plus.google.*/* // @exclude http://plus.google.*/* // @grant none // @downloadURL none // ==/UserScript== (function(){ var intervalId = -1; var waitTime = 0; console.log('GoogleFullSearchButton执行, url = ' + location.href); function AddFullSearchButton () { var abCtls = document.getElementById('ab_ctls'); if (null === abCtls) { waitTime = waitTime + 200; if(waitTime >= 5000 && intervalId >= 0) { clearInterval(intervalId); console.log('GoogleFullSearchButton等待超时'); } return; } else { if (intervalId >= 0){ clearInterval(intervalId); console.log('intervalId已取消'); } } var targetUrl = ''; var btnClass = ''; if (location.href.indexOf('&safe=off') >= 0) { targetUrl = location.href.replace('&safe=off', ''); btnClass = 'ab_button selected'; } else { targetUrl = location.href + '&safe=off'; btnClass = 'ab_button'; } console.log('targetUrl = ' + targetUrl); var buttonHtml = '