从谷歌 百度 必应搜索结果中屏蔽自定义关键字 增强版(基于AC的脚本优化)

从谷歌 百度 必应搜索结果中屏蔽自定义关键字,关键字自己确定吧,想想大概2-3个版本就不会更新了,因为每个人的关键字不一样

目前为 2017-08-06 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 从谷歌 百度 必应搜索结果中屏蔽自定义关键字 增强版(基于AC的脚本优化)
  3. // @namespace BlockAnyThingYouWant Plus
  4. // @include http://www.baidu.com/*
  5. // @include https://www.baidu.com/*
  6. // @include https://www.google.com/*
  7. // @include /^https?\:\/\/encrypted.google.[^\/]+/
  8. // @include /^https?\:\/\/www.google.[^\/]+/
  9. // @include /^https?\:\/\/www.so.com/
  10. // @include /^https?\:\/\/www.youdao.com/
  11. // @require http://code.jquery.com/jquery-1.8.0.min.js
  12. // @icon https://coding.net/u/zb227/p/zbImg/git/raw/master/img0/icon.jpg
  13. // @author zzhjim( Based on AC)
  14. // @version 1.2.1.170806
  15. //@grant note @zzhjim:原脚本已经许久没有更新,我将一些常见的恶意网站名称加入了进去,修改了360搜索的网址。如果还有合适的关键词,欢迎提交讨论。(本脚本配合AC的其他脚本使用更加)
  16. // @description 从谷歌 百度 必应搜索结果中屏蔽自定义关键字,关键字自己确定吧,想想大概2-3个版本就不会更新了,因为每个人的关键字不一样
  17. // @grant note 2015.11.26 第一版,规则自己写吧,觉得要反馈的关键字可以在卡饭回个帖,我合适的加入
  18. // ==/UserScript==
  19.  
  20.  
  21. /*
  22. 变量x用于 百度=谷歌=必应=360搜索=有道
  23. 就是黑名单,自己加入自己想要屏蔽的关键字
  24. */
  25. var blankList = "小学生作文||快播||出轨||男友||绯闻||婚恋交友||戒色||返利||百合网||算命||解梦||八卦||电子商务平台||棋牌||成人电影||加QQ||聚乙烯||合彩||机械厂||在线聊天室||聊天室||伦理片||115os||人体艺术||不雅照片||网站流量||2345||hao123||腾讯电脑管家||旅游信息"; //自己看着格式差不多加入就好
  26. var x = blankList.split("||");
  27. //===================================================主入口=======================================================
  28. mo = new MutationObserver(function(allmutations) {
  29. var href = window.location.href;
  30. if(href.indexOf("www.baidu") > -1){
  31. $(".c-container").each(deal); // 百度
  32.  
  33. } else if(href.indexOf("www.google") > -1){
  34. $(".g").each(deal); // 谷歌
  35. } else if(href.indexOf("so.com") > -1){
  36. $(".res-list").each(deal); // 360搜索
  37. $(".spread ").each(deal); // 360搜索
  38. $(".brand").each(deal); // 360搜索
  39. } else if(href.indexOf("bing.com") > -1){
  40. $(".b_algo").each(deal); // 必应1
  41. $(".b_ans").each(deal); // 必应2
  42. } else if(href.indexOf("youdao.com") > -1){
  43. $(".res-list").each(deal); // 有道
  44. }
  45. });
  46. var targets = document.body;
  47. mo.observe(targets, {'childList': true,'characterData':true,'subtree': true});
  48.  
  49. // ================================================通用处理函数==========================================================
  50. function deal(){
  51. var curText = $(this).attr
  52. var curText = $(this).text();
  53. if(checkIndexof(curText) == true){
  54. $(this).remove();
  55. //console.log("dealing with");
  56. }
  57. }
  58. /*遍历查表,如果在表中则返回true*/
  59. function checkIndexof(element){
  60. var result = (element.indexOf(x[0]) > -1);
  61. for(var i = 1; i <= x.length; i++){
  62. //alert("check");
  63. result = result || (element.indexOf(x[i]) > - 1);
  64. }
  65. return result;
  66. }