// ==UserScript== // @name 1024综合助手 // @namespace http://tampermonkey.net/ // @version 1.4.1 // @description 去除1024的60秒屏蔽、菜区助手(直播、算分、统计) // @require https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js // @require https://greasyfork.org/scripts/398240-gm-config-zh-cn/code/GM_lazyloadconfig_zh-CN.js // @match http*://*/htm_data/*.html // @match http*://*/htm_mob/*.html // @match http*://*/read.php* // @match http*://*/personal.php* // @match http*://*/post.php* // @match http*://*/thread0806.php* // @grant GM_getValue // @grant GM_setValue // @grant GM_download // @grant GM_addStyle // @grant GM_openInTab // @grant GM_notification // @grant GM_setClipboard // @grant GM_registerMenuCommand // @license LGPL-2.0-or-later // @run-at document-idle // @downloadURL none // ==/UserScript== var table = document.querySelectorAll('.sptable_do_not_remove'); if (document.querySelectorAll('.sptable_do_not_remove span').length > 0) { var str = document.querySelectorAll('.sptable_do_not_remove span') [0].className; for (var j = 0; j < table.length; j++) { var td = table[j].querySelectorAll('td'); for (var i = 0; i < td.length; i++) { td[i].innerHTML = ' '; } } } else { for (var k = 0; k < table.length; k++) { table[k].style.display = 'none'; } } (function() { 'use strict'; //var newVersion = 'v1.5'; var localHref = window.location.href, disable_contextmenu = false, mouse_right_panel = null, img_src = null, asyncGMAPI = false, getValue, last_update = 0; var localTitle = document.title; var blackList = ''.split(','); var spamList = ''.split(','); var whiteList = ''.split(','); var blackPostList = ''.split(','); var userName = ''; var isMob = false; var tid = 0; var page = 0; var game_data = []; var win_item = []; var cache_key = 'pf_game_data_'; var zhibo_board_data = []; var zhibo_board_htm = ''; var zhibo_board_reply; var loading_gif = 'https://cdn.jsdelivr.net/gh/zxf10608/JavaScript/icon/loading00.gif'; var clearImgBtn = '整理图片'; var boardBtn = '打开计分板'; let css = '.s3 a {color:#FA891B;} .hide {display:none;}'; css += '#zhibo_board { position: fixed; right: 10px; bottom: 150px;background: #FFF;border: 1px solid #A6CBE7;padding: 3px;} #zhibo_board .item {padding: 5px 0;} #zhibo_board .item .tm {width: 250px;display: inline-block;} #zhibo_board .item .code_short {width: 40px; margin-left: 3px;} #zhibo_board .item .code_medium {width: 60px; margin-left: 3px;}'; css += '#zhibo_board .tools {padding:10px 0 0 0;} #zhibo_board .tools .right {float:right;padding-right:15px;}'; css += '#zhibo_tools_message {position: fixed;width: 300px; display:none; font-size:16px;background: #FFFFFF; padding: 15px;left: 45%; top: 30%;z-index: 999;border: 2px solid #ff9900;text-align: center;}'; css += '#htmlarea,#textarea{height:500px!important;}'; css += '.s3 a {color:#FA891B;} .hide {display:none!important;}'; css += '#pf_board {font-size:14px; position: fixed; right: 0px; bottom: 175px;background: #FFF;border: 1px solid #A6CBE7;padding: 3px;} #pf_board .item {padding: 3px 0;} #pf_board .item .tm {display: inline-block;} #pf_board .item .code_short {width: 40px; margin-left: 3px;} #pf_board .item .code_medium {width: 60px; margin-left: 3px;}'; css += '#pf_board .tools {padding:10px 0 0 0;text-align:center;} #pf_board .tools .right {float:right;padding-right:15px;}'; css += '#pf_board .s3 {width:50px;height:20px;overflow:hidden;text-align:left;display:inline-block;} #pf_board .check_half {width:80px;display:inline-block;}'; css += '#pf_board .tm_a,#pf_board .tm_b {width:150px;display:inline-block;padding-left:10px;}'; css += '#pf_board .item_list {max-height:400px;overflow-y:scroll;}'; css += '#pf_tools_message {position: fixed;width: 300px; display:none; font-size:16px;background: #FFFFFF; padding: 15px;left: 45%; top: 30%;z-index: 999;border: 2px solid #ff9900;text-align: center;}'; css += `.tools_btn {line-height:150%;} #btn_pinfen { position: absolute; right: 50px; background: #008000; border-radius: 3px; padding: 10px 20px; color: #FFFFFF; margin: 0 auto; font-size: 20px; text-align: center; width: max-content; cursor: pointer;}`; css += `.points_tips { position: absolute; left: 250px; z-index:9999; background: #F4FBFF; border: #D4EFF7 1px solid; padding: 5px 1rem; margin: 0; bottom: -13px; font-size:16px; text-align: center; }`; if (typeof GM_config == 'undefined') { alert('小草助手:GM_config库文件加载失败,脚本无法正常使用,请刷新网页重新加载!'); return; } else { console.log('小草助手:相关库文件加载成功'); }; GM_addStyle(css); Date.prototype.format = function (format) { var args = { "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), //quarter "S": this.getMilliseconds() }; if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var i in args) { var n = args[i]; if (new RegExp("(" + i + ")").test(format)) format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? n : ("00" + n).substr(("" + n).length)); } return format; } String.prototype.format = function(args) { if (arguments.length > 0) { var result = this; if (arguments.length == 1 && typeof(args) == "object") { for (var key in args) { var reg = new RegExp("({" + key + "})", "g"); result = result.replace(reg, args[key]); } } else { for (var i = 0; i < arguments.length; i++) { if (arguments[i] == undefined) { return ""; } else { var regex = new RegExp("({[" + i + "]})", "g"); result = result.replace(regex, arguments[i]); } } } return result; } else { return this; } } function config() { var windowCss = '#Cfg .nav-tabs {margin: 15px 2px; text-align: center;} #Cfg .config_var textarea{width: 100%; height: 100px;resize: none;} #Cfg .inline {padding-bottom:0px;} #Cfg .config_header a:hover {color:#1e90ff;} #Cfg .config_var {margin:0;} #Cfg input[type="checkbox"] {margin: 3px 3px 3px 0px;} #Cfg input[type="text"] {width:100%; margin-top:5px;} #Cfg {background-color: #B1D3E0;} #Cfg .reset_holder {float: left; position: relative; bottom: -1em;} #Cfg .saveclose_buttons {margin: .7em;} #Cfg .section_desc {font-size: 10pt;} #Cfg_field_whiteTxt,#Cfg_field_blackPostTxt {height:60px!important;}'; GM_registerMenuCommand('设置', opencfg); function opencfg() { GM_config.open(); }; GM_config.init( { id: 'Cfg', title: GM_config.create('a', { //href: 'javascript:void(0);', //target: '_blank', textContent: '小草助手', title: '小草综合助手'//'版本:' + newVersion + ' 点击访问主页' }), isTabs: true, skin: 'tab', css: windowCss, frameStyle: { height: '600px', width: '500px', zIndex: '2147483648', }, fields: { readEnable: { section: ['内容页'], labelPos: 'right', label: '启用内容页优化', type: 'checkbox', 'default': 1 }, likeFixEnable: { labelPos: 'right', label: '启用主题点赞按钮浮动', type: 'checkbox', 'default': 1 }, whiteFloor: { 'label': '保留楼层(半角逗号 , 分割)', 'type': 'input', 'default': '' }, spamTxt: { 'label': '屏蔽内容(完整匹配回复内容)', 'type': 'textarea', 'default': '1024,1025,1026,1021,10024,1024感谢分享,多谢分享,感谢分享,感谢你的分享,感谢大佬分享,感谢分享~,谢谢分享,感謝分享,发码好人,1024.,感谢分享!,感谢分享。,经典,路过,支持分享,路过看一下,继续继续,勿忘提肛' }, blackPostTxt: { 'label': '黑名单ID(回复楼层不显示)', 'type': 'textarea', 'default': '' }, whiteTxt: { 'label': '白名单ID', 'type': 'textarea', 'default': '' }, listEnable: { section: ['列表页'], labelPos: 'right', label: '启用列表页优化', type: 'checkbox', 'default': 1 }, blackTxt: { 'label': '黑名单ID(列表页不显示)', 'type': 'textarea', 'class': 'line', 'default': '' }, pingfenEnable: { section: ['算分助手'], labelPos: 'right', label: '启用算分', type: 'checkbox', 'default': 1 }, suanfenKey: { 'label': '算分助手匹配标题关键字', 'type': 'input', 'default': '開盤|對賭|下注有效楼层|竞猜|冲刺赛' }, betsCopyEnable: { labelPos: 'right', label: '启用复制下注信息', type: 'checkbox', 'default': 1 }, betsCopyOnlyBets: { labelPos: 'right', label: '只复制下注信息(适配涛姐统计模板)', type: 'checkbox', 'default': 0 }, betsCopyHead: { labelPos: 'right', label: '自动生成表头(首页)', type: 'checkbox', 'default': 1 }, zhiboEnable: { section: ['直播助手'], labelPos: 'right', label: '启用直播助手', type: 'checkbox', 'default': 1 }, zhiboCodeKey: { 'label': '提取直播代码匹配标题关键字', 'type': 'input', 'default': '開盤|對賭|下注有效楼层' }, boardTemplate: { 'label': '计分板简易代码', 'type': 'textarea', 'default': '{ta} {pk} {tb}\r\n比分:{bf_a} - {bf_b}  {state}\r\n\r\n' }, boardRichTemplate: { 'label': '计分板花里胡哨代码', 'type': 'textarea', 'default': '[color=green]{ta}[/color] [color=#FF6600]{pk}[/color] [color=green]{tb}[/color] [color=orange]{state}[/color]\r\n[size=4][backcolor=blue][color=white] {bf_a} [/color][/backcolor] - [backcolor=blue][color=white] {bf_b} [/color][/backcolor][/size]\r\n' }, zhiboCodeLM: { section: ['配置'], 'label': '赛事关键字', 'type': 'input', 'default': '賽事|赛事' }, zhiboCodeTime: { 'label': '时间关键字', 'type': 'input', 'default': '比賽時間|時間|比赛时间|时间' }, zhiboCodeTa: { 'label': '主队关键字', 'type': 'input', 'default': '主隊|主队|主' }, zhiboCodePK: { 'label': '让球关键字', 'type': 'input', 'default': '讓球|让球|让|讓|盘口' }, zhiboCodeTb: { 'label': '客队关键字', 'type': 'input', 'default': '客隊|客队|客' }, }, events: { save: function() { GM_config.close(); //location.reload(); } }, }); }; config(); var G = GM_config; spamList = G.get('spamTxt').split(','); whiteList = G.get('whiteTxt').split(','); blackList = G.get('blackTxt').split(','); blackPostList = G.get('blackPostTxt').split(','); pageInit(); function pageInit() { userName = $.trim($('.guide span').text()); whiteList.push(userName); if (localHref.match(/htm_mob\S*\.html/) != null ){ isMob = true; } tid = parseInt(getQueryVariable('tid')); tid = isNaN(tid) ? 1 : tid; page = parseInt(getQueryVariable('page')); page = isNaN(page) ? 1 : page; if(G.get('listEnable')) { listFix(); } if(G.get('readEnable')) { postFix(); } if(G.get('zhiboEnable')) { zhiboTools(); if(localStorage.getItem('zhibo_board_open') == '1') { /* var data = localStorage.getItem('zhibo_data_board'); if(data != '' && data != null) { setTimeout(zhiboBoard, 500); } */ } var tpc_content = $('#conttpc'); $(tpc_content).css({position:'relative'}); var key = eval('/'+ G.get('suanfenKey') +'/'); if(G.get('pingfenEnable') && !(/(直播)/).test(localTitle) && localTitle.match(key) != null) { if($('#btn_pinfen').length == 0) { $(tpc_content).prepend('
提取算分信息
'); var copyBtn = '
下注信息
'; $('body').append(copyBtn); $('#copy_bets_btn').click(copy_bets); } get_game_data(); $('#btn_pinfen').click(function() { get_game_info(); pf_board_toggle(1); $('#pf_board .tm [class^="tm_"]').click(function (){ let i = $(this).attr('i'); if(!$(this).hasClass('sred')) { $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred'); $(this).addClass('sred'); $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val($(this).text()); } else { $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred'); $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val('走盘'); } save_game(); }); //location.href = location.href; }); $('#close_code').click(function(){ pf_board_toggle(0); //$('#pf_board').hide(); }); $('#save_game').click(function(){ save_game(); }); $('#pf_board .tm [class^="tm_"]').click(function (){ let i = $(this).attr('i'); if(!$(this).hasClass('sred')) { $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred'); $(this).addClass('sred'); $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val($(this).text()); } else { $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred'); $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val('走盘'); } save_game(); }); if(GM_getValue('auto_settle_up') == 1) { setTimeout(function() {save_game();},300); } } } if (localHref.match(/post\.php/) != null ){ $('a[onclick^=checklength]').parent().append(clearImgBtn).append(boardBtn); $('#clearImg').click(clearImg); $('#openBoard').click(zhiboBoard); var title_input = $('#atc_title'); if(title_input != null) { $(title_input).parent().html(''); } } personalFix(); }; function pf_board_toggle(show) { console.log(show); show = parseInt(show); if(isNaN(show)) { show = GM_getValue('pf_board_show') > 0 ? 0 : 1; } GM_setValue('pf_board_show', show); let board = $('#pf_board .item_list'); //let board_show = GM_getValue('pf_board_show')==1; console.log(show); if(show>0) { GM_setValue('pf_board_show',1); $(board).removeClass('hide'); $('#hide_tools').val('隐藏面板'); } else { GM_setValue('pf_board_show',0); $(board).addClass('hide'); $('#hide_tools').val('显示面板'); } //console.log($(board).hasClass('hide')); /* if($(board).hasClass('hide')) { GM_setValue('pf_board_show',1); $(board).removeClass('hide'); $('#hide_tools').text('隐藏面板'); } else { GM_setValue('pf_board_show',0); $(board).addClass('hide'); $('#hide_tools').text('显示面板'); } */ } function zhiboTools() { var key =eval('/'+ G.get('zhiboCodeKey') +'/'); var zhiboBtn = '
直播代码
'; zhiboBtn += '' if (localTitle.match(key) != null){ // localTitle.match(/對賭/) != null || localTitle.match(/下注有效楼层/) != null $('#conttpc').append(zhiboBtn); $('#zhibo_btn').click(getZhiboCode); } } function get_zhibo_data(){ for(var key in localStorage){ } } //生成计分板 function zhiboBoard(){ localStorage.setItem('zhibo_board_open', '1'); if($('#zhibo_board').length == 0) { $('body').append('
'); // $('form[action^="post.php"] .t').css({position: 'relative'}).append('
') } var data = getBoardData(); data = JSON.parse(data); if(data == '' || data == null || data.length == 0) { message('木有提取到比赛信息,先去开盘贴提取代码再来生成计分板', 5); return; } //console.log(data); var htm_tmp = '
{ta} {pk} {tb} 比分: - '; htm_tmp += ' '; htm_tmp += ''; htm_tmp += '
' var htm_pk_tmp = '
{0}
'; var htm = ''; $.each(data, function(pi, pd){ if(countItem(pd.items)>0) { htm += htm_pk_tmp.format(cutTitle(pd.title)); } $.each(pd.items, function(index, item){ item.index = index; item.pi = pi; if(item.deleted==0) { htm += htm_tmp.format(item); } }); }); htm += '
'; zhibo_board_htm = htm; $('#zhibo_board').html(htm).show(); $('#close_code').click(function(){ updateBoardData(); $('#zhibo_board').hide(); }); $('#clear_data').click(function() { if (confirm("确认清空记分板数据?")==true) { localStorage.removeItem('zhibo_data_board', ''); for(var key in localStorage){ if(key.indexOf('zhibo_data_') > -1) { localStorage.removeItem(key); } } $('#zhibo_board').hide(); localStorage.removeItem('zhibo_board_open'); } }); $('#zhibo_board .tm_a,#zhibo_board .tm_b').click(function (){ }); $('#zhibo_board .item .delete').click(function(){ //if (confirm("确认删除此项?")==true) { /* clearTimeout(st); var st = setTimeout(updateBoardData, 2000); */ var data = getBoardData(); data = JSON.parse(data); var pi = $(this).parent().attr('pi'); var i = $(this).parent().attr('i'); data[pi].items[i].deleted = 1; /* if(data[pi].items.length == 0) { data.splice(pi,1); } */ setBoardData(data); $(this).parent().remove(); //} }); var board_code = ''; zhibo_board_reply = $('textarea[name=atc_content]'); $('#rich_code').click(function() { board_code = '\r\n'; var board_code_tmp = G.get('boardRichTemplate'); if(board_code_tmp == null) { board_code_tmp = '[color=green]{ta}[/color] [color=#FF6600]{pk}[/color] [color=green]{tb}[/color] [color=orange]{state}[/color]\r\n'; board_code_tmp += '[size=4][backcolor=blue][color=white] {bf_a} [/color][/backcolor] - [backcolor=blue][color=white] {bf_b} [/color][/backcolor][/size]\r\n'; } /* $.each(zhibo_board_data, function(index, item){ if(item.checked == 'checked') { board_code += board_code_tmp.format(item); } }); */ setPost(board_code_tmp, zhibo_board_reply); }); $('#simple_code').click(function(){ board_code = '\r\n'; var board_code_tmp = G.get('boardTemplate'); if(board_code_tmp == null) { board_code_tmp = '{ta} {pk} {tb}\r\n比分:{bf_a} - {bf_b}  {state}\r\n\r\n'; } setPost(board_code_tmp, zhibo_board_reply); }); } function setPost(board_code_tmp, zhibo_board_reply) { var board_code = ''; updateBoardData(); $.each(zhibo_board_data, function(pi, pd){ if(countChecked(pd.items)==0) return; var title = cutTitle(pd.title); title = title.substring(0,title.lastIndexOf(']')+1); board_code += '\r\n{0}\r\n'.format(title); $.each(pd.items, function(index, item){ if(item.checked == 'checked' && item.deleted == 0) { board_code += board_code_tmp.format(item); } }); }); $(zhibo_board_reply).val(board_code); } function countChecked(items){ var count = 0; $.each(items, function(index, item){ if(item.deleted == 1) return; if(item.checked == 'checked') { count ++; } }); return count; } function countItem(items){ var count = 0; $.each(items, function(index, item){ if(item.deleted == 1) return; count ++; }); return count; } function cutTitle(title) { if(typeof(title) != 'string') return ''; title = title.replace(/\s*/g,'').replace(/(\[開盤\])/,'');; title = title.substring(0,title.indexOf('下注')); return title; } //更新计分板数据 function updateBoardData() { //不重置,保证加入多盘信息 //zhibo_board_data = []; //console.log(JSON.stringify(zhibo_board_data)); zhibo_board_data = JSON.parse(getBoardData()); var data = {}; var new_index = []; $.each($('#zhibo_board .item:not(".pk")'), function(index, item){ data = {}; data.pi = $(item).attr('pi'); data.index = $(item).attr('i'); data.ta = $('input[name=ta]', item).val(); data.tb = $('input[name=tb]', item).val(); data.pk = $('input[name=pk]', item).val(); data.state = $('input[name=state]', item).val(); data.bf_a = $('input[name=bf_a]', item).val(); data.bf_b = $('input[name=bf_b]', item).val(); data.tid = $('input[name=tid]', item).val(); data.checked = $('input:checkbox', item).get(0).checked ? 'checked' : ''; new_index.push('{0}_{1}'.format(data.pi, data.index)); //zhibo_board_data.push(data); //console.log(typeof(data.bf_a) + '_____' + (zhibo_board_data[data.pi].items[data.index] == null)); if(typeof(data.bf_a) == 'string') { zhibo_board_data[data.pi].items[data.index].bf_a = data.bf_a; zhibo_board_data[data.pi].items[data.index].bf_b = data.bf_b; zhibo_board_data[data.pi].items[data.index].state = data.state; zhibo_board_data[data.pi].items[data.index].checked = data.checked; } }); //var new_board = []; //new_board = clone(zhibo_board_data); $.each(zhibo_board_data, function(i, d){ $.each(d.items, function(index, item){ if(!new_index.includes('{0}_{1}'.format(i,index))) { item.deleted = 1; } }); }); setBoardData(zhibo_board_data); } function clone(obj) { return JSON.parse(JSON.stringify(obj)); } function setPingFenData(data) { if(typeof(data) != 'string') { data = JSON.stringify(data); } var cache_key = 'pf_game_data_' + tid; return localStorage.setItem(cache_key, data); } function getPingFenData() { var cache_key = 'pf_game_data_' + tid; return localStorage.getItem(cache_key); } //获取计分板缓存数据 function setBoardData(data) { if(typeof(data) != 'string') { data = JSON.stringify(data); } var cache_key = 'pf_game_data_' + tid; cache_key = 'zhibo_data_board'; return localStorage.setItem(cache_key, data); } //获取计分板缓存数据 function getBoardData() { var cache_key = 'pf_game_data_' + tid; cache_key = 'zhibo_data_board'; return localStorage.getItem(cache_key); } //提取直播代码(计分板数据) 直播主题表格代码 function getZhiboCode() { var postid = 0; var fid = 23; var month = ''; var game_name = $('.t.t2 tr.do_not_catch th:first b:first').text().trim(); if((/[a-zA-z]+:\/\/[^\s]*\.html/).test(localHref)){ postid = localHref.substring(localHref.lastIndexOf('/')+1, localHref.lastIndexOf('.')); var m = localHref.match(/\/(\d{4})\/(\d{2})\/(\d{6,})\.html/); month = m[1]; fid = m[2]; } if((/read.php\?tid=(\d*)*/).test(localHref)){ postid = getQueryVariable('tid'); } var title = $('#conttpc').prevAll('h4.f16').text(); var data = []; var idx = {}; $('#zhibo_code').css({width:$('#t_like').width()}); var trs = $('#conttpc table tr').not($('#conttpc table tr:has("td[colspan]")')); $.each($(trs).eq(0).find('td'), function(i,item) { //console.log($(item).text()); var tmp_head = $(item).text().trim(); /* console.log(tmp_head.match(/让球/)); switch(tmp_head) { case '比賽時間': case '比赛时间': idx.time = i; break; case '賽事': case '赛事': idx.lm = i; break; case '主隊': case '主队': idx.ta = i; break; case '客隊': case '客队': idx.tb = i; break; case '讓球': case '让球': idx.pk = i; break; }*/ var key =eval('/'+ G.get('zhiboCodeLM') +'/'); if(tmp_head.match(key) != null) { idx.lm = i; } key =eval('/'+ G.get('zhiboCodeTime') +'/'); if(tmp_head.match(key) != null) { idx.time = i; } key =eval('/'+ G.get('zhiboCodeTa') +'/'); if(tmp_head.match(key) != null) { idx.ta = i; } key =eval('/'+ G.get('zhiboCodePK') +'/'); if(tmp_head.match(key) != null) { idx.pk = i; } key =eval('/'+ G.get('zhiboCodeTb') +'/'); if(tmp_head.match(key) != null) { idx.tb = i; } }); //不重置,支持多盘数据,需要手动删除或清空 //zhibo_board_data = JSON.parse(localStorage.getItem('zhibo_data_board')); var board = {}; board.tid = postid; board.fid = fid; board.month = month; board.title = title; board.duidu = localTitle.match(/對賭|对赌"/) != null; board.zhuang = ''; board.cai = ''; board.items = []; if(board.duidu) { //console.log($('#conttpc').html()); //var mc = $('#conttpc').text().match(/(楼主|庄家)走\s{0,}(\S*?)\s{0,}[,|,]/); var mc = $('#conttpc').html().match(/下注(球|选)(\S)(:|:)(?\S*)
-1) { game.time = $td.eq(idx.time).text().trim(); } game.lm = $td.eq(idx.lm).text().trim(); game.ta = $td.eq(idx.ta).text().trim(); game.pk = $td.eq(idx.pk).text().trim(); game.tb = $td.eq(idx.tb).text().trim(); //console.log(JSON.stringify(board)); //console.log(JSON.stringify(game)); if(board.cai.length > 0) { board.zhuang = board.cai==game.ta ? game.tb : game.ta; game.ta = (game.ta==board.zhuang ? "[庄]" : "") + game.ta; game.tb = (game.tb==board.zhuang ? "[庄]" : "") + game.tb; } game.tid = '{0}_{1}'.format(postid,i); game.bf_a = ''; game.bf_b = ''; game.state = ''; game.checked = 'checked'; game.deleted = 0; if(game.lm+game.ta == '') return; data.push(game); if(i > 0) { board.items.push(game); //var new_data = zhibo_board_data; /* if(zhibo_board_data.length == 0) { zhibo_board_data.push(board); } else { console.log(zhibo_board_data.length); $.each(zhibo_board_data, function(bi, bd){ if(bd.tid == board.tid) { //console.log(bd.tid == board.tid); //zhibo_board_data.splice(bi,1); } }); zhibo_board_data.push(board); } */ //zhibo_board_data = new_data; //console.log(JSON.stringify(zhibo_board_data)); } }); //console.log(JSON.stringify(board)); zhibo_board_data = JSON.parse(getBoardData()); var new_data = []; $.each(zhibo_board_data, function(bi, bd){ //console.log(bd.tid + '___' + bi); //console.log(bd.tid == board.tid); if(bd.tid != board.tid) { new_data.unshift(bd); //delete zhibo_board_data[bi]; //zhibo_board_data.splice(bi, 1); //console.log(JSON.stringify(zhibo_board_data[bi])); } }); new_data.push(board); /* data.sort((a,b)=>{ return a.tid-b.tid; }); */ new_data.sort((a,b)=>{ return a.tid-b.tid; }); var cache_key = 'zhibo_data_' + postid; localStorage.setItem(cache_key, JSON.stringify(data)); cache_key = 'zhibo_data_board'; localStorage.setItem(cache_key, JSON.stringify(new_data)); //console.log(cache_key+'_2'); var html = '';//'[align=center][b][color=red][size=4]{0}[/size][/color][/b][/align]\r\n'.format(title); //楼主走 html += '[table]'; //\r\n //[tid=5228787-23-2208]标题[/tid] /* if(board.zhuang.length > 0) { } else { html += '[tr][td=7,1] [align=center][b][color=red][size=4]{0}[/size][/color][/b][/align] [/td][/tr]'.format(title); // }*/ html += '[tr][td=7,1] [align=center][b][color=red][size=4]{0}[/size][/color][/b]\r\n[tid={1}-{2}-{3}]{4}[/tid][/align] [/td][/tr]'.format(title.replace('【看清规则后下注、乱入者按恶意灌水处理】',''), board.tid, board.fid,board.month, game_name); // var template1 = '[tr]';//\r\n //template1 += '[td][align=center][b][color=orange][size=3]{lm}[/size][/color][/b][/align][/td]'; //template1 += '[td][align=center][b][color=purple][size=3]{time}[/size][/color][/b][/align][/td]'; template1 += '[td][align=center][b][color=green][size=3]{time}[/size][/color][/b][/align][/td]'; template1 += '[td][align=center][b][color=orange][size=3]{lm}[/size][/color][/b][/align][/td]'; template1 += '[td][align=center][b][color=green][size=3]{ta}[/size][/color][/b][/align][/td]'; template1 += '[td][align=center][b][color=red][size=3]{pk}[/size][/color][/b][/align][/td]'; template1 += '[td][align=center][b][color=green][size=3]{tb}[/size][/color][/b][/align][/td]'; template1 += '[td][align=center][b][color=red][size=3]{bf}\r\n[/size][/color][/b][/align][/td]'; template1 += '[td][align=center][b][color=blue][size=3]{win}\r\n[/size][/color][/b][/align][/td]'; template1 += '[/tr]'; // $.each(data, function(i, item){ if (i==0) { html += template1.replace(/\[color\=.*?\]/g, '[color=purple]').format(item); } else { html += template1.format(item); } }); html += '[/table]' $('#zhibo_code').val(html).show(); GM_setClipboard(html,'text'); message('神秘代码已提取,试试Ctrl+V。
计分板数据已更新,直播可用。', 3); //console.log(html); //JSON.stringify(data) } function postFix(){ if (localHref.match(/htm_(data|mob)\S*\.html|read\.php\?/) != null ){ isMob = $('.banner h3').length>0; var $t_like = $('.t_like'); if($t_like.length>0) { var $t_like_top = $t_like.offset().top; //console.log($t_like.offset()); //点赞浮动 if(G.get('likeFixEnable')) { $t_like.css({position: "fixed", top: 580, right: 20}); } $(window).scroll(function(event){ }); $(window).resize(function() { //$t_like.css({left: $('#conttpc').offset().left-135}); }); } var save_code_btn = ''; var set_code_btn = ' '; var open_board_btn = ' '; var content = $('textarea[name=atc_content]'); //$('#atc_title').parent().html(''); if(content != null) { $('textarea[name=atc_content]').prev('div').append(save_code_btn).append(set_code_btn).append(open_board_btn); //$('input[name=Submit]').parent().append(open_board_btn); $('#open_board').click(function() { zhiboBoard(); }); $('#save_code').click(function(){ var code = $(content).val(); if(code != null) { var code_cache = localStorage.getItem('reply_code'); if(code_cache != null && code_cache != '' && code_cache != code) { if (confirm("更新已保存代码?")==true) { localStorage.setItem('reply_code', code); } } else { localStorage.setItem('reply_code', code); } } }); $('#set_code').click(function(){ var code = localStorage.getItem('reply_code'); //var content = $('textarea[name=atc_content]'); //console.log($(content).val()); if(code != null) { var txt = $.trim($(content).val()); $(content).val((txt != null ? txt + '\r\n' : '') + code); } }); } $('.post_comm_face').each(function(){ var $li = $(this).parent(); //var tpc_author = $li.next().find('span a:first').text(); //console.log($li.html()); var tpc_author = isMob ? $li.next().find('.gray:first').text() : $li.next().find('span[style] a:first').text(); $li.html('' + $li.html() + ''); }) $('body .t').each(function(i, item){ var tpc_content = $.trim($('.tpc_content', this).text()); var tpc_auther_html = $('.tr1 th:first b:first', this); var tpc_author = $.trim($('.tr1 th:first b:first', this).text()).replace(/\s\S*/,''); var tpc_floor = $.trim($('.tipad .s3', this).text()).replace(/[^0-9]/ig,''); //$(tpc_auther_html).html() if(tpc_author){ var link = '' + tpc_author + ''; var tmp = $('.tr1 th:first b:first', this).html(); tmp = tmp.replace(tpc_author, link); $('.tr1 th:first b:first', this).html(tmp); } if($.inArray(tpc_floor, G.get('whiteFloor').split(','))>-1) { return true; } if($.inArray(tpc_author, whiteList)>-1) { return true; } //console.log(i); if($.inArray(tpc_author, blackPostList)>-1 && tpc_author.length>0 && i>1) { $(this).remove(); } if($('.post_comm', this).length>0) { return true; } if($.inArray(tpc_content, spamList)>-1 && localTitle.match('博彩區') == null) { $(this).remove(); } }); $('.tpc_cont').parent().each(function(){ var tpc_content = $.trim($('.tpc_cont', this).text()); var tpc_author = $('.tpc_detail:first li', this).html().replace(/(\S*)<.*/,'$1'); //tpc_author = tpc_author.substring(0, tpc_author.indexOf('#')); //console.log(tpc_author); if(tpc_author){ var link = '' + tpc_author + ''; var tmp = $('.tpc_detail:first li', this).html(); tmp = tmp.replace(tpc_author, link); $('.tpc_detail:first li', this).html(tmp); } if($.inArray(tpc_author, whiteList)>-1) { return true; } if($('.post_comm', this).length>0) { return true; } if($.inArray(tpc_content, spamList)>-1) { $(this).next('.tpc_line').remove(); $(this).prev('.tpc_face').remove(); $(this).prev('a[name]').remove(); $(this).remove(); } }); } } function listFix() { if (localHref.match(/thread0806\.php\?fid=/) != null ){ $('#tbody tr').each(function(){ var poster = $.trim($('a.bl', this).text()); if($.inArray(poster, blackList)>-1) { //console.log(poster); $(this).remove(); } }); $('.list.t_one').each(function(){ var poster = $.trim($('.f10.fl', this).text()); poster = poster [0]; if($.inArray(poster, blackList)>-1) { $(this).remove(); } }); } } function copy_bets(){ let bets_copy = ''; let copy_head = '楼层 ID 得分 下注点数'; let copy_tample = '{floor} {author} {points} {bet_points}';//'{0} {1} {2}\r\n'; $.each($("div[id^='cont']:not(#conttpc)"), function(i, bet) { var ratio = 0; var points = 0; var bet_points = 0; let points_item = {}; points_item.author = $('.r_two b:first', $(bet).parent().parent()).text().replace('[樓主]',''); points_item.floor = $('.tipad .s3', $(bet).parent().parent().parent()).text(); points_item.bet_points = 0; points_item.points = 0; let points_tips = $('.points_tips', $(bet)); if($(points_tips).length > 0) { points_item.points = $(points_tips).text(); } let mp = points_item.floor.match(/(?\d+)/); if(mp != null) { points_item.floor = parseInt(mp.groups['floor'].trim()); } var bet_html = $(bet).html().replaceAll('>','>\r\n'); var re_bet=/(\d+)\.(\S*?)(:|:)(\s*)(?.*)/g; var points_bet=/(下注点数|下註點數|點數|点数)(:|:)\s*(?\d+)/; mp = bet_html.match(points_bet); if(mp != null) { bet_points = parseInt(mp.groups['points'].trim()); points_item.bet_points = bet_points; } if(G.get('betsCopyOnlyBets')) { let copy_tample = '{author}\r\n'; /* 級別:精靈王 ( 12 ) 發帖:256 威望:822 點 金錢:200483 USD 貢獻:20083 點 赞(0) | 資料 短信 推薦 編輯 */ //bets_copy += copy_tample.format(points_item); let author_html = $('.r_two',$(bet).parent().parent().parent()).text().trim(); let author_info = {}; ///級別:(.*)/; author_info.name = points_item.author; author_info.group = /級別:(.*)/.exec(author_html)[1]; author_info.p = /發帖:(.*)/.exec(author_html)[1]; author_info.v = /威望:(.*)/.exec(author_html)[1]; author_info.u = /金錢:(.*)/.exec(author_html)[1]; author_info.g = /貢獻:(.*)/.exec(author_html)[1]; author_info.c = /認證:(.*)/.test(author_html) ? /認證:(.*)/gs.exec(author_html)[1].trim() : ""; author_info.c =author_info.c.replaceAll(" ","").replaceAll('\t','').replaceAll('\r','').replaceAll('\n',''); bets_copy += '{name}\r\n級別:{group}\r\n發帖:{p}\r\n威望:{v}\r\n金錢:{u}\r\n貢獻:{g}\r\n認證:{c}\r\n'.format(author_info); bet_html = $(bet).html().replaceAll('\t','').replaceAll('\r','').replaceAll('\n',''); bet_html = bet_html.replaceAll('
','\r\n').replaceAll('
','\r\n').replaceAll('
','\r\n'); bet_html = bet_html.replace(/
\S*<\/div>/g,""); bets_copy += bet_html; bets_copy += '\r\n'; let tipad = $('.tipad', $(bet).parent().parent().parent()).text().replaceAll('\r','').replaceAll('\n','').replaceAll('\t',''); bets_copy += tipad; } else { bets_copy += copy_tample.format(points_item); var ms = bet_html.match(re_bet); $.each(ms, function(k, m){ //console.log(m + ' ' + m.match(/(:|:)\s*(?.*)/)); let mc = m.match(/(:|:)\s*(?.*)/);//m.match(/\d+\.(\S)(:|:)\s*(?.*)
',''); //if(/^\d+$/.test(bet_item)) //{ // bet_item = '\''+bet_item //} bets_copy += ' '+ bet_item; } else { bets_copy += ' '; } if(i==0) { copy_head += ' ' + (k+1); } }); } bets_copy += '\r\n'; }) if(page == 1 && G.get('betsCopyHead') && !G.get('betsCopyOnlyBets')) { bets_copy = '{0}\r\n{1}'.format(copy_head,bets_copy); } //let page = parseInt(getQueryVariable('page')); //page = isNaN(page) ? 1 : parseInt(page); GM_setClipboard(bets_copy,'text'); message('下注信息提取到剪贴板,当前第 {0} 页'.format(page), 5); } //提取算分信息 function get_game_info() { var postid = 0; var fid = 23; var month = ''; var game_name = $('.t.t2 tr.do_not_catch th:first b:first').text().trim(); if((/[a-zA-z]+:\/\/[^\s]*\.html/).test(localHref)){ postid = localHref.substring(localHref.lastIndexOf('/')+1, localHref.lastIndexOf('.')); var m = localHref.match(/\/(\d{4})\/(\d{2})\/(\d{6,})\.html/); month = m[1]; fid = m[2]; } if((/read.php\?tid=(\d*)*/).test(localHref)){ postid = getQueryVariable('tid'); tid = postid; if((/page=(\d*)*/).test(localHref)){ page = getQueryVariable('page'); }; } var title = $('#conttpc').prevAll('h4.f16').text(); var data = []; var idx = {}; var trs = $('#conttpc table tr').not($('#conttpc table tr:has("td[colspan]")')); $.each($(trs).eq(0).find('td'), function(i,item) { //$(trs).eq(0); var tmp_head = $(item).text().trim(); var key =eval('/'+ G.get('zhiboCodeLM') +'/'); if(tmp_head.match(key) != null) { idx.lm = i; } key =eval('/'+ G.get('zhiboCodeTime') +'/'); if(tmp_head.match(key) != null) { idx.time = i; } key =eval('/'+ G.get('zhiboCodeTa') +'/'); if(tmp_head.match(key) != null) { idx.ta = i; } key =eval('/'+ G.get('zhiboCodePK') +'/'); if(tmp_head.match(key) != null) { idx.pk = i; } key =eval('/'+ G.get('zhiboCodeTb') +'/'); if(tmp_head.match(key) != null) { idx.tb = i; } }); $.each(trs, function(i,item) { var game = {}; var $td = $('td',item); if($td.length<3) return; game.time = ''; game.bf = i == 0 ? '比分' : '比分'+i; game.win = '走盘'; game.half = 0; if(idx.time > -1) { game.time = $td.eq(idx.time).text().trim(); } //game.lm = $td.eq(idx.lm).text().trim(); game.ta = $td.eq(idx.ta).text().trim(); game.pk = $td.eq(idx.pk).text().trim(); game.tb = $td.eq(idx.tb).text().trim(); game.pi = tid; game.tid = '{0}_{1}'.format(postid,i); game.bf_a = ''; game.bf_b = ''; game.state = ''; game.checked = ''; game.half_show = ''; game.css_a = ''; game.css_b = ''; if(game.lm+game.ta == '') return; data.push(game); }); var new_data = []; var cache_key = 'pf_game_data_' + postid; localStorage.setItem(cache_key, JSON.stringify(data)); get_game_data(); } function get_game_data(){ if($('#pf_board').length == 0) { let pf_board_show = GM_getValue('pf_board_show') == 1 ? '' : 'hide'; let pf_board_show_text = GM_getValue('pf_board_show') == 1 ? '隐藏面板' : '显示面板'; //console.log(pf_board_show); $('body').append(`
`); } var game_data = getPingFenData(); if(game_data == '' || game_data == null || game_data.length == 0) { GM_setValue('auto_settle_up',0); get_game_info(); } game_data = JSON.parse(game_data); //console.log(data); var htm_tmp = '
{index}.{ta} {pk} {tb}赢半'; htm_tmp += ''; htm_tmp += '
' var htm_pk_tmp = '
{0}
'; var htm = ''; var key =eval('/'+ G.get('zhiboCodeTa') +'/'); let tmp_i = 0; $.each(game_data, function(index, item){ tmp_i ++; if(item.ta.match(key) != null) { tmp_i --; return } item.half_show = item.pk.indexOf('/')>-1 ? '' : 'hide'; item.css_a = (item.win == item.ta ? 'sred' : ''); item.css_b = (item.win == item.tb ? 'sred' : ''); item.index = tmp_i; htm += htm_tmp.format(item); }); //htm = '
{0}
'.format(htm); //htm += '
'; //console.log(htm); $('#pf_board .item_list').html(htm).show(); $('#hide_tools').click(function() { pf_board_toggle(); //$('#pf_board .item_list').addClass('hide'); }); $('#clear_pf_data').click(function() { setPingFenData([]); GM_setValue('auto_settle_up',0); get_game_data(); }); /* $('#pf_board .tm [class^="tm_"]').click(function (){ let i = $(this).attr('i'); if(!$(this).hasClass('sred')) { $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred'); $(this).addClass('sred'); $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val($(this).text()); } else { $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred'); $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val('走盘'); } save_game(); }); */ } function save_game() { win_item = []; new_data = []; game_data = JSON.parse(getPingFenData()); var data = {}; var new_data = []; $.each($('#pf_board .item'), function(index, item){ data = {}; data.pi = $(item).attr('pi'); data.index = $(item).attr('i'); data.ta = $('input[name=ta]', item).val(); data.tb = $('input[name=tb]', item).val(); data.pk = $('input[name=pk]', item).val(); data.state = $('input[name=state]', item).val(); data.bf_a = $('input[name=bf_a]', item).val(); data.bf_b = $('input[name=bf_b]', item).val(); data.win = $('input[name=win_team]', item).val(); data.tid = $('input[name=tid]', item).val(); data.checked = $('input:checkbox', item).get(0).checked ? 'checked' : ''; data.half = data.checked == '' ? 0 : 1; var win = {}; win.idx = index; win.team = data.win; win.half = data.half; win.ratio = 1; var m = win.team.match(/\[\S+\]/); //console.log(m); if(m != null) { win.ratio = parseFloat(m[0].replace('[','').replace(']','').trim(),0).toFixed(2); } data.css_a = (data.win == data.ta ? 'sred' : ''); data.css_b = (data.win == data.tb ? 'sred' : ''); win_item.push(win); //console.log($('input[name=win_team]', item).val()); new_data.push(data); }); game_data = new_data; game_data = new_data; //console.log(JSON.stringify(game_data)); //console.log(JSON.stringify(game_data)); setPingFenData(game_data); settle_up(); } var points_tips = '
{0}
'; //保存 function settle_up(){ GM_setValue('auto_settle_up',1); console.log(JSON.stringify(win_item)); let points_list_copy = ''; let copy_tample = '{floor} {author} {points}\r\n';//'{0} {1} {2}\r\n'; $.each($("div[id^='cont']:not(#conttpc)"), function(i, bet) { var ratio = 0; var points = 0; var bet_points = 0; var bet_html = $(bet).html().replaceAll('>','>\r\n'); var re_bet=/下注(球|选)(\S)(:|:)\s*(?.*?)
\d+)/; var mp = bet_html.match(points_bet); if(mp!= null) { bet_points = parseInt(mp.groups['points'].trim()); } //console.log(mp); var ms = bet_html.match(re_bet); $.each(ms, function(k, m){ var win = win_item[k]; //console.log(win); var half = win.half > 0 ? 0.5 : 1; var mc = m.match(/下注(球|选)(\S)(:|:)\s*(?.*?)
\d+)/); if(mp != null) { points_item.floor = parseInt(mp.groups['floor'].trim()); } points_item.points = points; points_list_copy += copy_tample.format(points_item);//(points,points,points); }) //111 2 2 //测试 111 222 GM_setClipboard(points_list_copy,'text'); } function clearImg() { var txt = $('#textarea').val(); txt = txt.replace(/\[url(.*?)\](.*?)\[\/url\](\s{0,2})/gi,'$2\n'); //txt = txt.replace(/(\r\n){2,}/g,'\r\n'); $('#textarea').val(txt); } function personalFix(){ if (localHref.match(/personal.php/) == null ){ return; } $('#main div.t3:eq(1) table td div.t:eq(1) tr.tr3').each(function() { var $tr = $(this); var $tal = $tr.find('th.tal'); var $td_reply = $tr.find('td:eq(2)'); var $td_like = $tr.find('td:eq(3)'); var $td_time = $tr.find('td:eq(4)'); var tid = 0; var title = ''; var pattern = /read.php\?tid=(?\d*).*?>(?.*?)</ var res = pattern.exec($tal.html()); if(res.length>2) { tid = res[1]; title = res[2]; } if(tid>0) { var $link = '<a href="/read.php?tid=' + tid + '&toread=5" target="_blank">' + $td_time.html() + '</a>'; //按时间排序 $td_time.html($link); $link = '<a href="/read.php?tid=' + tid + '&toread=1&page=e" target="_blank">' + $td_reply.html() + '</a>'; //最后一页 $td_reply.html($link); } var count_like = parseInt($td_like.text()); if(count_like>0) { $td_like.html('<a href="/message.php?action=likes&type=id&id=' + tid + '" target="_blank">' + $td_like.html() + '</a>'); } }); } ///提示消息,定时关闭,默认秒 function message(msg, time) { var msgbox = $('#zhibo_tools_message'); if($(msgbox).length == 0) { $('body').append('<div id="zhibo_tools_message"></div>'); $('#zhibo_tools_message').click(function() { $(this).hide();}); } msgbox = $('#zhibo_tools_message'); let win_width = $(window).width(); let left = (win_width - $(msgbox).width())/2; $(msgbox).css({left:left}).html(msg).show(); if(typeof(time) == 'number') { clearTimeout(st); var st = setTimeout(function() { $('#zhibo_tools_message').hide(); }, time*1000); } } function getUrlParam(name, url) { //window.location.search.substr(1) var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 var r = url.match(reg); //匹配目标参数 if (r!=null) return unescape(r[2]); return null; //返回参数值 } function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); if(pair[0] == variable){return pair[1];} } return(false); } function addStyle(css) { var pi = document.createProcessingInstruction( 'xml-stylesheet', 'type="text/css" href="data:text/css;utf-8,' + encodeURIComponent(css) + '"' ); return document.insertBefore(pi, document.documentElement); } })();