// ==UserScript== // @name 贴吧广告自动删除及黑名单自动封禁 // @description 根据设置的广告关键字和广告图片,扫描帖子并自动删除广告。另外也可以自动删除和封禁黑名单用户 // @include http://tieba.baidu.com/f?* // @connect imgsrc.baidu.com // @connect hiphotos.baidu.com // @version 0.9.2 // @author yechenyin // @namespace https://greasyfork.org/users/3586-yechenyin // @require https://code.jquery.com/jquery-1.11.2.min.js // @grant GM_xmlhttpRequest // @grant GM_setClipboard // @grant GM_setValue // @grant GM_getValue // @downloadURL none // ==/UserScript== default_settings = { 'scan_threads':10, 'scan_interval_seconds':120, 'scan_floors':20, 'below_level':2, 'only_last':false, 'also_delete':true, 'also_blockid':false, 'block_days':10 }; append_settings = { 'block_rules':'/^[a-zA-Z0-9?a-zA-Z0-9?①-⑳]*[??]+[a-zA-Z0-9?a-zA-Z0-9?①-⑳]*$/ @高清网盘看头像 ', 'block_users': '', 'block_images': 'http://imgsrc.baidu.com/forum/w=580/sign=04d3cea28ab1cb133e693c1bed5556da/e3a430d12f2eb938ab2bdfbfd2628535e4dd6ff8.jpg?v=tbs'+'\n'+ 'http://imgsrc.baidu.com/forum/w=580/sign=c657712f044f78f0800b9afb49300a83/2c7a4b36acaf2edd9e76a6928a1001e9380193bd.jpg?v=tbs'+'\n'+ 'http://a.hiphotos.baidu.com/image/pic/item/8718367adab44aed8e96e356b41c8701a08bfbac.jpg?v=tbs'+'\n'+ 'http://imgsrc.baidu.com/forum/pic/item/889866c379310a550e1704aeb04543a9832610ec.jpg?v=tbs', 'fixed_ETags': ' 15389725661213149746 17692237048646853765 4461156921076104320 6137503168619420662 ' }; function get(name) { if (typeof GM_getValue !== 'undefined') { //console.log(name + ': ' + GM_getValue(name)); return GM_getValue(name); } else { var value = ''; name = 'gm_'+name; //console.log(name + ': ' + localStorage[name]); if (typeof localStorage[name] !== 'undefined' && localStorage[name]) value = JSON.parse(localStorage[name]); return value; } } function set(name, value) { if (typeof GM_setValue !== 'undefined') { GM_setValue(name, value); console.log(name + ' = ' + GM_getValue(name)); } else { name = 'gm_'+name; localStorage[name] = JSON.stringify(value); console.log(name + ' = ' + localStorage[name]); } } if (get('initialization_v1.0')) { for (var prop in append_settings) { if (!get(prop)) set(prop, ''); if (get(prop) && /\S/.test(get(prop)[0])) set(prop, ' ' + get(prop)); var keywords = append_settings[prop].match(/\S+/g); if (keywords) { for (var i = 0; i < keywords.length; i++) { if (get(prop).indexOf(keywords[i]) < 0) { set(prop, ' ' + keywords[i] + get(prop)); } } } } set('initialization_v1.0', true); } if (get('first_initialization')) { for (var prop in default_settings) { if (!get(prop)) set(prop, default_settings[prop]); } show_setting(); set('first_initialization', true); } function show_setting() { var setting = $('
', {css:{padding:'5px 16px', background:'#fff'}}); setting.append($('
', {text:'×', css:{width:'20px', height:'20px', color:'#999', 'font-size':'20px', float:'right', cursor:'pointer', margin:'-4px -15px 0 0'}, click:function() { $('.delete_setting').remove(); }})); setting.append($('
', {text:'扫描设置', css:{color:'#bbb', 'margin':'4px 0 0px'}})); setting.append($('', {text:'每次扫描'})); setting.append($('', {name:'scan_threads', type:'text', css:{width:'30px', height:'12px', margin:'0 3px'}})); setting.append($('', {text:'个帖子'})); setting.append($('
', {css:{'margin':'2px'}})); setting.append($('', {text:'每次扫描间隔'})); setting.append($('', {name:'scan_interval_seconds', type:'text', css:{width:'30px', height:'12px', margin:'0 3px'}})); setting.append($('', {text:'秒'})); setting.append($('
', {css:{'margin':'2px'}})); setting.append($('', {text:'每个帖子扫描'})); setting.append($('', {name:'scan_floors', type:'text', css:{width:'30px', height:'12px', margin:'0 3px'}})); setting.append($('', {text:'楼'})); setting.append($('
', {text:'广告搜索设置', css:{color:'#bbb', 'margin':'12px 0 0px'}})); setting.append($('', {text:'仅检查小于等于等级'})); setting.append($('', {name:'below_level', type:'text', css:{width:'20px', height:'12px', margin:'0 3px'}})); setting.append($('', {text:'以下的用户'})); setting.append($('
', {css:{'margin':'4px'}})); setting.append($('', {text:'广告包含的关键字'})); setting.append($('', {text:'(每个关键字使用空格或者换行隔开,中间可以用*表示任意长度文字。另外可以使用以/开头和结尾的正则表达式)', css:{color:'#999'}})); setting.append($('