谷歌全面搜索按钮

给Google添加上全面搜索按钮,点击后可以关闭不良信息过滤。

  1. // ==UserScript==
  2. // @name GoogleFullSearchButton
  3. // @name:zh-CN 谷歌全面搜索按钮
  4. // @namespace http://www.coofly.com/
  5. // @version 1.4
  6. // @description Add to the Google Full Search button.
  7. // @description:zh-cn 给Google添加上全面搜索按钮,点击后可以关闭不良信息过滤。
  8. // @author Coofly
  9. // @match http://tampermonkey.net/scripts.php
  10. // @include /^https?://.+\.google\..+/.*$/
  11. // @exclude https://plus.google.*/*
  12. // @exclude http://plus.google.*/*
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. (function(){
  17. var intervalId = -1;
  18. var waitTime = 0;
  19. console.log('GoogleFullSearchButton执行, url = ' + location.href);
  20. function InsertButton(abCtls)
  21. {
  22. var targetUrl = '';
  23. var btnClass = '';
  24. var btnTitle = '';
  25. if (location.href.indexOf('&safe=off') >= 0)
  26. {
  27. targetUrl = location.href.replace('&safe=off', '');
  28. btnClass = 'ab_button selected';
  29. btnTitle = '取消全面搜索'
  30. }
  31. else
  32. {
  33. targetUrl = location.href + '&safe=off';
  34. btnClass = 'ab_button';
  35. btnTitle = '全面搜索'
  36. }
  37. console.log('targetUrl = ' + targetUrl);
  38. var buttonHtml = '<li class="ab_ctl" id="full_search_btn"><a href="' + targetUrl + '" class="' + btnClass + '">' + btnTitle + '</a></li>';
  39. abCtls.insertAdjacentHTML('afterbegin', buttonHtml);
  40. }
  41. function CheckAndInsert ()
  42. {
  43. var abCtls = document.getElementById('ab_ctls');
  44. if (null === abCtls) return;
  45.  
  46. var fullSearchElem = document.getElementById('full_search_btn');
  47. if (null === fullSearchElem) InsertButton(abCtls);
  48. }
  49. var abCtls = document.getElementById('ab_ctls');
  50. if(null === abCtls)
  51. {
  52. intervalId = setInterval(CheckAndInsert, 200);
  53. console.log('intervalId = ' + intervalId);
  54. return;
  55. }
  56. else
  57. {
  58. CheckAndInsert();
  59. }
  60. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址