// ==UserScript== // @name Google 搜索结果屏蔽 // @name:en Google Search Results Block // @namespace Cheez.Search // @version 0.5 // @description 根据网站、网址和关键字来屏蔽不想要的搜索结果 // @author 以茄之名 // @author:en Cheez // @include https://www.google.*/search* // @include https://www.google.*.*/search* // @require http://cdn.staticfile.org/jquery-once/2.1.1/jquery.once.min.js // @grant GM_getValue // @grant GM_setValue // @downloadURL none // ==/UserScript== (function() { 'use strict'; var $=jQuery; var blacklist=GM_getValue('blacklist')&&JSON.parse(GM_getValue('blacklist'))||{ host:[], url:[] }; console.log(blacklist); $('[onmousedown]').attr('onmousedown',''); $.each(jQuery('[href*=webcache]'),function(i,o){jQuery(o).attr('href',jQuery(o).attr('href').replace('p:','ps:'));}); function hid(hosts,urls){ $('.r>a').filter(function(i,o){ if($.inArray(o.host,hosts)>-1){return true;} var flag=false; $.each(urls,function(i,o){ if(o.baseURI.match(oo)){ flag=true; return false; } }); if(!flag){ var p=$(o).parents('.g'); var menu=$(p).find('.action-menu-panel>ol'); if( menu.size() ){ menu.filter(':not(:has(.block))').append( '