// ==UserScript== // @name (已失效,代码仅供参考)贴吧广告自动删除及黑名单自动封禁 // @description 根据设置的广告关键字和广告图片,扫描帖子并自动删除广告。另外也可以自动删除和封禁黑名单用户 // @include http://tieba.baidu.com/f?* // @connect imgsrc.baidu.com // @connect hiphotos.baidu.com // @version 0.9.6 // @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 // @grant GM_info // @downloadURL none // ==/UserScript== default_settings = { 'scan_threads':5, 'scan_interval_seconds':60, 'scan_floors':20, 'below_level':2, 'only_last':false, 'also_delete':true, 'also_blockid':false, 'block_days':10, 'block_users':'', 'white_users':'', 'edit_ETags':'', }; append_settings = { 'append_rules':'hsn3660 /[YYyy][aаaα][nn][gg][SSss][hh][eeě][nn][gg]/ @高清网盘看头像 ', 'append_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(GM_info.script.version)) { for (var prop in default_settings) { if (typeof get(prop) == 'undefined') set(prop, default_settings[prop]); } for (var prop in append_settings) { if (typeof get(prop) == 'undefined') 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(GM_info.script.version, true); } if (!get('first_initialization')) { 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':'1px'}})); 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':'1px'}})); 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':'8px 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':'2px'}})); setting.append($('', {text:'广告包含的关键字'})); setting.append($('', {text:'(每个关键字使用空格或者换行隔开,中间可以用*表示任意长度文字。另外可以使用以/开头和结尾的正则表达式)', css:{color:'#999'}})); setting.append($('