Greasy Fork is available in English.
根据自定义关键字屏蔽相关微博,关键字之间使用||隔开
当前为
// ==UserScript==
// @name 根据关键字屏蔽微博
// @namespace Blockweibo
// @include http://weibo.com/*
// @author jiyue
// @version 1.1
// @description 根据自定义关键字屏蔽相关微博,关键字之间使用||隔开
// ==/UserScript==
/* 关键字名单 */
var List = "金正男||北京厨子||习近平||花1元围观";
var Tampermonkey_jQuery = document.createElement('script');
Tampermonkey_jQuery.src = 'http://lib.sinaapp.com/js/jquery/2.0.3/jquery-2.0.3.min.js';
Tampermonkey_jQuery.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(Tampermonkey_jQuery);
function Tampermonkey_jQuery_wait(){
if(typeof jQuery == 'undefined'){
window.setTimeout(Tampermonkey_jQuery_wait,100);
}else {
$ = jQuery; runjQuery();
}
console.log("waiting for jQuery prepared");
}
Tampermonkey_jQuery_wait();
function runjQuery(){
$(document).ready(function () {
var x = List.split("||");
mo = new MutationObserver(function(allmutations) {
$(".WB_text, .WB_info").each(block);
});
var targets = document.body;
mo.observe(targets, {'childList': true,'characterData':true,'subtree': true});
function block(){
var txt = $(this).text();
if(findwords(txt) === true){
$(this).text('... ... ... ... ...');
$(this).parent().children('.WB_media_wrap, .WB_tag_rec').remove();
$(this).parent().parent('.WB_feed_expand').remove();
}
}
function findwords(ele){
var result = (ele.indexOf(x[0]) > -1);
for(var i = 1; i <= x.length; i++){
result = result || (ele.indexOf(x[i]) > - 1);
}
return result;
}
// end
});
}