1024综合助手

去除1024的60秒屏蔽、菜区助手(直播、算分、统计)、163右下角回家之路

  1. // ==UserScript==
  2. // @name 1024综合助手
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.5.15
  5. // @description 去除1024的60秒屏蔽、菜区助手(直播、算分、统计)、163右下角回家之路
  6. // @require https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js
  7. // @require https://gf.qytechs.cn/scripts/398240-gm-config-zh-cn/code/GM_lazyloadconfig_zh-CN.js
  8. // @author *.163.com
  9. // @match http*://*/htm_data/*.html
  10. // @match http*://*/htm_mob/*.html
  11. // @match http*://*/read.php*
  12. // @match http*://*/personal.php*
  13. // @match http*://*/post.php*
  14. // @match http*://*/thread0806.php*
  15. // @match *://*cl*
  16. // @match *://*.163.com
  17. // @match https://2023.redircdn.com/*
  18. // @connect get.xunfs.com
  19. // @grant GM_getValue
  20. // @grant GM_setValue
  21. // @grant GM_download
  22. // @grant GM_addStyle
  23. // @grant GM_openInTab
  24. // @grant GM_notification
  25. // @grant GM_setClipboard
  26. // @grant GM_xmlhttpRequest
  27. // @grant GM_registerMenuCommand
  28. // @license LGPL-2.0-or-later
  29. // @run-at document-idle
  30.  
  31.  
  32. // ==/UserScript==
  33.  
  34. // 去跳转
  35. (function() {
  36. 'use strict';
  37. let url = new URL(window.location.href);
  38. let src = url.searchParams.get("src");
  39. if (src) {
  40. window.location.href = decodeURIComponent(src);
  41. }
  42. })();
  43. //去广告
  44. $('.tips:has(table)').remove();
  45. $('.sptable_do_not_remove.f_one').parent().prev('.tpc_icon.fl').remove();
  46. $('.sptable_do_not_remove.f_one').parent().next('.line.tpc_line').remove();
  47. $('.sptable_do_not_remove.f_one').remove();
  48. $('.sptable_do_not_remove').parent().remove();
  49. $('.ftad-ct').remove();
  50. $('center.gray').css({'margin-top':'50px'});
  51.  
  52.  
  53. (function() {
  54. 'use strict';
  55. // 回家不迷路
  56. var enableGoHome = GM_getValue('enableGoHome',true);
  57.  
  58. if (enableGoHome && window.location.href.includes('163.com')) {
  59. // 创建一个悬浮按钮
  60. const button = document.createElement('button');
  61. button.style.position = 'fixed';
  62. button.style.bottom = '20px';
  63. button.style.right = '20px';
  64. button.style.zIndex = '9999';
  65. button.innerText = '☞神秘入口☜';
  66. document.body.appendChild(button);
  67.  
  68. // 给按钮添加点击事件监听器
  69. button.addEventListener('click', function() {
  70. // 创建POST请求的payload
  71. const payload = 'a=get18&system=android&v=2.2.9';
  72.  
  73. // 发起POST请求
  74. GM_xmlhttpRequest({
  75. method: 'POST',
  76. url: 'https://get.xunfs.com/app/listapp.php',
  77. headers: {
  78. 'Content-Type': 'application/x-www-form-urlencoded',
  79. },
  80. data: payload,
  81. responseType: 'text',
  82. onload: function(response) {
  83. // 解析响应中的JSON数据
  84. const responseData = JSON.parse(response.responseText);
  85.  
  86. // 提取所需的URL
  87. const url1 = responseData.url1;
  88. const url2 = responseData.url2;
  89. const url3 = responseData.url3;
  90.  
  91. // 创建一个悬浮div来显示URL
  92. const urlDiv = document.createElement('div');
  93. urlDiv.style.position = 'fixed';
  94. urlDiv.style.bottom = '60px';
  95. urlDiv.style.right = '20px';
  96. urlDiv.style.zIndex = '9999';
  97. urlDiv.style.backgroundColor = '#fff';
  98. urlDiv.style.padding = '10px';
  99. urlDiv.style.border = '1px solid #ccc';
  100.  
  101. // 生成URL的内容
  102. const urlsContent = `
  103. 最新地址为:
  104. <br>地址1: <a href="#" data-url="${url1}" style="text-decoration: underline; color: blue;">${url1}</a>
  105. <br>地址2: <a href="#" data-url="${url2}" style="text-decoration: underline; color: blue;">${url2}</a>
  106. <br>地址3: <a href="#" data-url="${url3}" style="text-decoration: underline; color: blue;">${url3}</a>
  107. `;
  108.  
  109. // 设置URL的内容到div中
  110. urlDiv.innerHTML = urlsContent;
  111.  
  112. // 将div添加到文档中
  113. document.body.appendChild(urlDiv);
  114.  
  115. // 为URL添加点击事件监听器
  116. const urlLinks = urlDiv.querySelectorAll('a');
  117. urlLinks.forEach(function(link) {
  118. link.addEventListener('click', function(event) {
  119. event.preventDefault();
  120. const url = this.getAttribute('data-url');
  121. copyToClipboard(url);
  122. });
  123. });
  124.  
  125. // 复制文本到剪贴板的函数
  126. function copyToClipboard(text) {
  127. const tempInput = document.createElement('input');
  128. tempInput.value = text;
  129. document.body.appendChild(tempInput);
  130. tempInput.select();
  131. document.execCommand('copy');
  132. document.body.removeChild(tempInput);
  133. showAlert(text + ' 复制成功');
  134. }
  135.  
  136. // 显示提示信息并在一段时间后隐藏
  137. function showAlert(message) {
  138. const alertDiv = document.createElement('div');
  139. alertDiv.style.position = 'fixed';
  140. alertDiv.style.bottom = '80px';
  141. alertDiv.style.right = '20px';
  142. alertDiv.style.zIndex = '9999';
  143. alertDiv.style.backgroundColor = '#fff';
  144. alertDiv.style.padding = '10px';
  145. alertDiv.style.border = '1px solid #ccc';
  146. alertDiv.innerText = message;
  147. document.body.appendChild(alertDiv);
  148. setTimeout(function() {
  149. document.body.removeChild(alertDiv);
  150. }, 2000);
  151. }
  152. },
  153. onerror: function(error) {
  154. console.error('POST请求失败:', error);
  155. }
  156. });
  157. });
  158. }
  159. // 获取页面上的所有链接
  160. var links = document.getElementsByTagName("a");
  161.  
  162. // 遍历链接
  163. for (var i = 0; i < links.length; i++) {
  164. // 获取链接的href属性
  165. var href = links[i].getAttribute("href");
  166.  
  167. // 检查href是否包含"redircdn.com"
  168. if (href && href.includes("redircdn.com")) {
  169. // 从href中提取原始链接
  170. var original = href.split("?")[1].split("&")[0];
  171.  
  172. // 把原始链接中的下划线替换成点
  173. original = original.replace(/______/g, ".");
  174.  
  175. // 把href属性设置为原始链接
  176. links[i].setAttribute("href", original);
  177.  
  178. // 把target属性设置为"_blank",以在新窗口打开
  179. links[i].setAttribute("target", "_blank");
  180. }
  181. }
  182. })();
  183.  
  184. /*-------------------------------------------------------------------------------------------------------------------------------------------*/
  185. //种子转磁力
  186. (function() {
  187. 'use strict';
  188.  
  189. var helper = {
  190. hash: function(url) {
  191. var hash = url.split('hash=');
  192. return hash[1].substring(3);
  193. },
  194. inurl: function(str) {
  195. var url = document.location.href;
  196. return url.indexOf(str) >= 0;
  197. }
  198. };
  199.  
  200. if (helper.inurl('/htm_data/')) {
  201. // 种子链接转磁力链
  202. var torLink = $("a[href*=\'?hash\=\']");
  203. if( torLink.length > 0 ){
  204. var tmpNode = '<summary>本页共有 ' + torLink.length + ' 个磁力链!</summary>';
  205. torLink.each(function() {
  206. var torrent = $(this).attr('href');
  207. var hash = helper.hash(torrent);
  208. var magnet = 'magnet:?xt=urn:btih:' + hash;
  209. tmpNode += '<p><a target="_blank" href="' + magnet + '">【 磁力链: ' + magnet + ' 】</a>  <a target="_blank" href="' + torrent + '">【 下载种子 】</a></p>';
  210. });
  211. $('body').append('<div style="position:fixed;top:0px;background:#def7d4;width:100%;padding:4px;text-align:center;"><details>' + tmpNode + '</details></div>');
  212. }
  213. }
  214. })();
  215.  
  216.  
  217. (function() {
  218. 'use strict';
  219. //var newVersion = 'v1.6';
  220. var localHref = window.location.href, disable_contextmenu = false, mouse_right_panel = null, img_src = null, asyncGMAPI = false, getValue, last_update = 0;
  221. var localTitle = document.title;
  222.  
  223. var blackList = ''.split(',');
  224. var spamList = ''.split(',');
  225. var whiteList = ''.split(',');
  226. var blackPostList = ''.split(',');
  227. var userName = '';
  228. var isMob = false;
  229.  
  230. var tid = 0;
  231. var page = 0;
  232. var floor = 0;
  233.  
  234. var game_data = [];
  235. var win_item = [];
  236. var cache_key = 'pf_game_data_';
  237.  
  238. var zhibo_board_data = [];
  239. var zhibo_board_htm = '';
  240. var zhibo_board_reply;
  241.  
  242. var loading_gif = 'https://cdn.jsdelivr.net/gh/zxf10608/JavaScript/icon/loading00.gif';
  243. var clearImgBtn = '<a style="cursor:pointer;border:1px solid #A6CBE7;color:#2f5fa1;padding:2px 8px 2px 8px;float:right;" id="clearImg" title="">整理图片</a>';
  244. var boardBtn = '<a style="cursor:pointer;border:1px solid #A6CBE7;color:#2f5fa1;padding:2px 8px 2px 8px;float:right;margin-right:3px;" id="openBoard" title="">打开计分板</a>';
  245. let css = '.s3 a {color:#FA891B;} .hide {display:none;}';
  246. 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;}';
  247. css += '#zhibo_board .tools {padding:10px 0 0 0;} #zhibo_board .tools .right {float:right;padding-right:15px;}';
  248. 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;}';
  249. css += '#htmlarea,#textarea{height:500px!important;}';
  250. css += '.s3 a {color:#FA891B;} .hide {display:none!important;}';
  251. css += '#pf_board {z-index:999;font-size:14px; position: fixed; right: 0px; bottom: 50px;background: #FFF;border: 1px solid #A6CBE7;padding: 3px;} #pf_board .item {padding: 3px 0;line-height:150%;} #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;}';
  252. css += '#pf_board .tools {padding:10px 0 0 0;text-align:center;} #pf_board .tools .right {float:right;padding-right:15px;}';
  253. css += '#pf_board .s3 {width:50px;height:20px;overflow:hidden;text-align:left;} #pf_board .check_half {/*width:80px;*/display:inline-block;}';
  254. css += `#pf_board .tm_a,#pf_board .tm_b,#pf_board .tm_pk {width:150px;display:inline-block;}
  255. #pf_board .tm_pk {text-align:center;} .tm_b {text-align:right;}
  256. `;
  257. css += '#pf_board .item_list {padding:0 10px;max-height:400px;overflow-y:scroll;}';
  258. 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;}';
  259. css += `.tools_btn {line-height:150%;}
  260. #btn_pinfen {
  261. position: absolute;
  262. right: 50px;
  263. background: #008000;
  264. border-radius: 3px;
  265. padding: 10px 20px;
  266. color: #FFFFFF;
  267. margin: 0 auto;
  268. font-size: 20px;
  269. text-align: center;
  270. width: max-content;
  271. cursor: pointer;}
  272. .points_tips {
  273. position: absolute;
  274. left: 250px;
  275. /*z-index:99;*/
  276. background: #F4FBFF;
  277. border: #D4EFF7 1px solid;
  278. padding: 5px 1rem;
  279. margin: 0;
  280. bottom: -13px;
  281. font-size:16px;
  282. text-align: center;
  283. }
  284. .pages a.last {border-width: 1px;margin-right:2px;}
  285. input.mininput {border:#D4EFF7 1px solid;padding:3px;background:#fff;width:100px;}`;
  286. if (typeof GM_config == 'undefined') {
  287. alert('小草助手:GM_config库文件加载失败,脚本无法正常使用,请刷新网页重新加载!');
  288. return;
  289. } else {
  290. console.log('小草助手:相关库文件加载成功');
  291. };
  292.  
  293. GM_addStyle(css);
  294.  
  295. Date.prototype.format = function (format) {
  296. var args = {
  297. "M+": this.getMonth() + 1,
  298. "d+": this.getDate(),
  299. "h+": this.getHours(),
  300. "m+": this.getMinutes(),
  301. "s+": this.getSeconds(),
  302. "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
  303. "S": this.getMilliseconds()
  304. };
  305. if (/(y+)/.test(format))
  306. format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  307. for (var i in args) {
  308. var n = args[i];
  309. if (new RegExp("(" + i + ")").test(format))
  310. format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? n : ("00" + n).substr(("" + n).length));
  311. }
  312. return format;
  313. }
  314.  
  315.  
  316. var sizeof = function (str, charset) {
  317. var total = 0,
  318. charCode,
  319. i,
  320. len;
  321. charset = charset ? charset.toLowerCase() : '';
  322. if (charset === 'utf-16' || charset === 'utf16') {
  323. for (i = 0, len = str.length; i < len; i++) {
  324. charCode = str.charCodeAt(i);
  325. if (charCode <= 0xffff) {
  326. total += 2;
  327. } else {
  328. total += 4;
  329. }
  330. }
  331. } else {
  332. for (i = 0, len = str.length; i < len; i++) {
  333. charCode = str.charCodeAt(i);
  334. if (charCode <= 0x007f) {
  335. total += 1;
  336. } else if (charCode <= 0x07ff) {
  337. total += 2;
  338. } else if (charCode <= 0xffff) {
  339. total += 3;
  340. } else {
  341. total += 4;
  342. }
  343. }
  344. }
  345. return total;
  346. }
  347.  
  348. String.prototype.byteLength = function () {
  349. /*
  350. var count = 0;
  351. for (var i = 0, l = this.length; i < l; i++) {
  352. count += this.charCodeAt(i) <= 128 ? 1 : 2;
  353. }
  354. return count;
  355. */
  356. return sizeof(this);
  357. }
  358.  
  359. String.prototype.format = function(args) {
  360. if (arguments.length > 0) {
  361. var result = this;
  362. if (arguments.length == 1 && typeof(args) == "object") {
  363. for (var key in args) {
  364. var reg = new RegExp("({" + key + "})", "g");
  365. result = result.replace(reg, args[key]);
  366. }
  367. } else {
  368. for (var i = 0; i < arguments.length; i++) {
  369. if (arguments[i] == undefined) {
  370. return "";
  371. } else {
  372. var regex = new RegExp("({[" + i + "]})", "g");
  373. result = result.replace(regex, arguments[i]);
  374. }
  375. }
  376. }
  377. return result;
  378. } else {
  379. return this;
  380. }
  381. }
  382.  
  383.  
  384. function config() {
  385. 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;}';
  386. GM_registerMenuCommand('设置', opencfg);
  387.  
  388. function opencfg() {
  389. GM_config.open();
  390. };
  391. GM_config.init(
  392. {
  393. id: 'Cfg',
  394. title: GM_config.create('a', {
  395. //href: 'javascript:void(0);',
  396. //target: '_blank',
  397. textContent: '小草助手',
  398. title: '小草综合助手'//'版本:' + newVersion + ' 点击访问主页'
  399. }),
  400. isTabs: true,
  401. skin: 'tab',
  402. css: windowCss,
  403. frameStyle:
  404. {
  405. height: '620px',
  406. width: '530px',
  407. zIndex: '2147483648',
  408. },
  409. fields:
  410. {
  411. readEnable:
  412. {
  413. section: ['内容页'],
  414. labelPos: 'right',
  415. label: '启用内容页优化',
  416. type: 'checkbox',
  417. 'default': 1
  418. },
  419. likeFixEnable:
  420. {
  421. labelPos: 'right',
  422. label: '启用主题点赞按钮浮动',
  423. type: 'checkbox',
  424. 'default': 1
  425. },
  426. whiteFloor:
  427. {
  428. 'label': '保留楼层(半角逗号 , 分割)',
  429. 'type': 'input',
  430. 'default': ''
  431. },
  432. spamTxt:
  433. {
  434. 'label': '屏蔽内容(完整匹配回复内容)',
  435. 'type': 'textarea',
  436. 'default': '1024,1025,1026,1021,10024,1024感谢分享,多谢分享,感谢分享,感谢你的分享,感谢大佬分享,感谢分享~,谢谢分享,感謝分享,发码好人,1024.,感谢分享!,感谢分享。,经典,路过,支持分享,路过看一下,继续继续,勿忘提肛'
  437. },
  438. blackPostTxt:
  439. {
  440. 'label': '黑名单ID(回复楼层不显示)',
  441. 'type': 'textarea',
  442. 'default': ''
  443. },
  444. whiteTxt:
  445. {
  446. 'label': '白名单ID',
  447. 'type': 'textarea',
  448. 'default': ''
  449. },
  450. listEnable:
  451. {
  452. section: ['列表页'],
  453. labelPos: 'right',
  454. label: '启用列表页优化',
  455. type: 'checkbox',
  456. 'default': 1
  457. },
  458. blackTxt:
  459. {
  460. 'label': '黑名单ID(列表页不显示)',
  461. 'type': 'textarea',
  462. 'class': 'line',
  463. 'default': ''
  464. },
  465. pingfenEnable:
  466. {
  467. section: ['算分助手'],
  468. labelPos: 'right',
  469. label: '启用算分',
  470. type: 'checkbox',
  471. 'default': 1
  472. },
  473. suanfenKey:
  474. {
  475. 'label': '算分助手匹配标题关键字',
  476. 'type': 'input',
  477. 'default': '開盤|對賭|下注有效楼层|竞猜|冲刺赛'
  478. },
  479. suanfenScoreKey:
  480. {
  481. 'label': '积分赛制(赢+3,走+0,输-1)',
  482. 'type': 'input',
  483. 'default': '积分赛'
  484. },
  485. suanfenScorePoints:
  486. {
  487. 'label': '积分赛制分值',
  488. 'type': 'input',
  489. 'default': '+3,0,-1'
  490. },
  491. suanfenCCScoreKey:
  492. {
  493. 'label': '冲刺赛制(赢加分,输走不扣)',
  494. 'type': 'input',
  495. 'default': '冲刺赛|世界杯活动场次'
  496. },
  497. suanfenCCScorePoints:
  498. {
  499. 'label': '冲刺赛默认点数(如果有下注点数则留空或填写0)',
  500. 'type': 'input',
  501. 'default': '0'
  502. },
  503. betsCopyEnable:
  504. {
  505. labelPos: 'right',
  506. label: '启用复制下注信息',
  507. type: 'checkbox',
  508. 'default': 1
  509. },
  510. betsCopyOnlyBets:
  511. {
  512. labelPos: 'right',
  513. label: '只复制下注信息(适配涛姐统计模板)',
  514. type: 'checkbox',
  515. 'default': 0
  516. },
  517. betsCopyHead:
  518. {
  519. labelPos: 'right',
  520. label: '自动生成表头(首页)',
  521. type: 'checkbox',
  522. 'default': 1
  523. },
  524. zhiboEnable:
  525. {
  526. section: ['直播助手'],
  527. labelPos: 'right',
  528. label: '启用直播助手',
  529. type: 'checkbox',
  530. 'default': 1
  531. },
  532. zhiboLinkEnable:
  533. {
  534. labelPos: 'right',
  535. label: '插入标题引用代码',
  536. type: 'checkbox',
  537. 'default': 1
  538. },
  539. zhiboCodeKey:
  540. {
  541. 'label': '提取直播代码匹配标题关键字',
  542. 'type': 'input',
  543. 'default': '開盤|對賭|下注有效楼层'
  544. },
  545. bodanCodeKey:
  546. {
  547. 'label': 'F1/赛马图片类主题',
  548. 'type': 'input',
  549. 'default': '賽馬|\\[F1|波胆|分差'
  550. },
  551. boardTemplate:
  552. {
  553. 'label': '计分板简易代码',
  554. 'type': 'textarea',
  555. 'default': '{ta} {pk} {tb}\r\n比分:{bf_a} - {bf_b}  {state}\r\n\r\n'
  556. },
  557. boardRichTemplate:
  558. {
  559. 'label': '计分板花里胡哨代码',
  560. 'type': 'textarea',
  561. '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'
  562. },
  563. zhiboLink22222Enable:
  564. {
  565. section: ['直播配置'],
  566. labelPos: 'right',
  567. label: '占位用(没实际效果)',
  568. type: 'checkbox',
  569. 'default': 1
  570. },
  571. zhiboCodeLM:
  572. {
  573. 'label': '赛事关键字',
  574. 'type': 'input',
  575. 'default': '賽事|赛事'
  576. },
  577. zhiboCodeEvent:
  578. {
  579. 'label': '比赛内容关键字',
  580. 'type': 'input',
  581. 'default': '比赛内容'
  582. },
  583. zhiboCodeTime:
  584. {
  585. 'label': '时间关键字',
  586. 'type': 'input',
  587. 'default': '比賽時間|時間|比赛时间|时间'
  588. },
  589. zhiboCodeTa:
  590. {
  591. 'label': '主队关键字',
  592. 'type': 'input',
  593. 'default': '主隊|主队|主'
  594. },
  595. zhiboCodePK:
  596. {
  597. 'label': '让球关键字',
  598. 'type': 'input',
  599. 'default': '讓球|让球|让|讓|盘口|平局'
  600. },
  601. zhiboCodeTb:
  602. {
  603. 'label': '客队关键字',
  604. 'type': 'input',
  605. 'default': '客隊|客队|客'
  606. },
  607. },
  608. events:
  609. {
  610. save: function() {
  611. GM_config.close();
  612. //location.reload();
  613. }
  614. },
  615. });
  616. };
  617.  
  618. config();
  619. var G = GM_config;
  620. spamList = G.get('spamTxt').split(',');
  621. whiteList = G.get('whiteTxt').split(',');
  622. blackList = G.get('blackTxt').split(',');
  623. blackPostList = G.get('blackPostTxt').split(',');
  624.  
  625. pageInit();
  626.  
  627. function pageInit() {
  628. userName = $.trim($('.guide span').text());
  629. whiteList.push(userName);
  630.  
  631. localHref = localHref.replace(/#\S+/g,'');
  632. if (localHref.match(/htm_mob\S*\.html/) != null ){
  633. isMob = true;
  634. }
  635.  
  636. tid = parseInt(getQueryVariable('tid'));
  637. tid = isNaN(tid) ? 1 : tid;
  638.  
  639.  
  640. page =getQueryVariable('page');
  641. if(page == 'e')
  642. {
  643. page = $('.pages:first a u').text();
  644. }
  645. page = parseInt(page);
  646. page = isNaN(page) ? 1 : page;
  647.  
  648. floor = parseInt(getQueryVariable('floor'));
  649. floor = isNaN(floor) ? 0 : floor;
  650.  
  651.  
  652.  
  653. if(G.get('listEnable'))
  654. {
  655. listFix();
  656. }
  657.  
  658.  
  659. if((/read.php|htm_data|htm_mob/).test(localHref)){
  660. if(tid==1)
  661. {
  662. tid = localHref.substring(localHref.lastIndexOf('/')+1, localHref.lastIndexOf('.'));
  663. // var m = localHref.match(/\/(\d{4})\/(\d{2})\/(\d{6,})\.html/);
  664.  
  665. // month = m[1];
  666. // fid = m[2];
  667. // tid = m[3];
  668. }
  669.  
  670. $.each($('.tipad .s3'), function(i, item){
  671. let floor = $(item).text().replace(/[^\d]/g,'');
  672. let $tiptop = $('.tiptop', $(item).parent().parent().parent().parent());
  673.  
  674. $tiptop.append(`<a name="${floor}" />`);
  675. })
  676.  
  677. let html = '<input id="floorinput" class="mininput" type="number" min="1" placeholder="楼层" maxlength="5" /> <a class="last" id="gofloor">跳转楼层</a>';
  678.  
  679. $('#last:first').parent().append(` ${html}`)
  680. //$('#main .t3 td[align=left]:first').append(` ${html}`)
  681.  
  682. let go = $('#gofloor');
  683. $(go).click(function() {
  684. let floor = parseInt($('#floorinput').val());
  685. if(!isNaN(floor))
  686. {
  687. if(floor>10000000)
  688. {
  689. window.location.href = `/read.php?tid=${tid}&pid=${floor}`;
  690. }
  691. else
  692. {
  693. let page_go = parseInt((floor+1)/25) + ((floor+1)%25 > 0 ? 1 :0);
  694. if(page_go == page)
  695. {
  696. window.location.href = `${localHref}#${floor}`;
  697. }
  698. else
  699. {
  700. window.location.href = `/read.php?tid=${tid}&toread=1&page=${page_go}&floor=${floor}#${floor}`;
  701. }
  702. }
  703. }
  704. });
  705.  
  706. $('#floorinput').bind("keydown",function(event){
  707. var e = window.event || event;
  708. if (e.keyCode == 13) {
  709. $(go).click();
  710. }
  711. });
  712.  
  713. if(floor>0){
  714. $('#floorinput').val(floor);
  715. $(go).click();
  716. }
  717.  
  718. //Funny();
  719. }
  720.  
  721.  
  722. if (localHref.match(/thread0806\.php\?fid=/) != null ){
  723. //if(getQueryVariable('search') == today)
  724. get_today_thread();
  725. //<a href="javascript:void(0);" class="last" id="get_thread"> 選取主題</a>
  726. }
  727.  
  728.  
  729. if(G.get('readEnable'))
  730. {
  731. postFix();
  732. }
  733.  
  734. if(G.get('zhiboEnable'))
  735. {
  736. zhiboTools();
  737.  
  738. if(localStorage.getItem('zhibo_board_open') == '1')
  739. {
  740. /*
  741. var data = localStorage.getItem('zhibo_data_board');
  742.  
  743. if(data != '' && data != null)
  744. {
  745. setTimeout(zhiboBoard, 500);
  746. }
  747. */
  748. }
  749.  
  750. var tpc_content = $('#conttpc');
  751. $(tpc_content).css({position:'relative'});
  752.  
  753.  
  754. var key = eval('/'+ G.get('suanfenKey') +'/');
  755. if(G.get('pingfenEnable') && localTitle.match('\\[直播\\]') == null && localTitle.match(key) != null && localHref.match('read\.php') != null)
  756. {
  757. if($('#btn_pinfen').length == 0)
  758. {
  759. $(tpc_content).prepend('<div class="tools_btn" id="btn_pinfen">提取算分信息</div>');
  760.  
  761. var copyBtn = '<div class="t_like tools_btn" id="copy_bets_btn" style="position: fixed; top: 60px; right: 20px;">下注信息</div>';
  762. $('body').append(copyBtn);
  763. $('#copy_bets_btn').click(copy_bets);
  764. }
  765.  
  766. get_game_data();
  767.  
  768.  
  769. $('#btn_pinfen').click(function() {
  770. get_game_info();
  771. pf_board_toggle(1);
  772.  
  773. $('#pf_board .tm [class^="tm_"]').click(function (){
  774.  
  775. let i = $(this).attr('i');
  776.  
  777. if(!$(this).hasClass('sred'))
  778. {
  779. $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred');
  780. $(this).addClass('sred');
  781. $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val($(this).text());
  782. }
  783. else
  784. {
  785. $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred');
  786. $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val('走盘');
  787. }
  788.  
  789. save_game();
  790. });
  791. //location.href = location.href;
  792. });
  793.  
  794.  
  795. $('#close_code').click(function(){
  796. pf_board_toggle(0);
  797. //$('#pf_board').hide();
  798. });
  799.  
  800.  
  801. $('#save_game').click(function(){
  802. save_game();
  803. });
  804.  
  805.  
  806. $('#pf_board .tm [class^="tm_"]').click(function (){
  807.  
  808. let i = $(this).attr('i');
  809.  
  810. if(!$(this).hasClass('sred'))
  811. {
  812. console.log('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i));
  813. $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred');
  814. $(this).addClass('sred');
  815.  
  816. $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val($(this).text());
  817. }
  818. else
  819. {
  820. $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred');
  821. $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val('走盘');
  822. }
  823.  
  824. save_game();
  825. });
  826.  
  827.  
  828. if(GM_getValue('auto_settle_up') == 1)
  829. {
  830. setTimeout(function() {save_game();},300);
  831. }
  832. }
  833. }
  834.  
  835. if (localHref.match(/post\.php/) != null ){
  836. $('a[onclick^=checklength]').parent().append(clearImgBtn).append(boardBtn);
  837. $('#clearImg').click(clearImg);
  838.  
  839. $('#openBoard').click(zhiboBoard);
  840.  
  841.  
  842. $('.tr3.f_one .t_one').css({position: "relative"});
  843.  
  844. var title_input = $('#atc_title');
  845.  
  846. if(title_input != null)
  847. {
  848. $(title_input).parent().html('<textarea name="atc_title" class="input" style="font: 14px Tahoma; padding-left:2px;height:60px;width:100%" id="atc_title">'+$(title_input).val()+'</textarea>');
  849. $('#atc_title').keyup(function(){
  850. title_tips();
  851. //console.log($(this).val().byteLength());
  852. });
  853. }
  854.  
  855. setTimeout(function() {title_tips();},300);
  856. }
  857.  
  858.  
  859. personalFix();
  860. };
  861.  
  862. function title_tips() {
  863.  
  864. if($('#title_tips').length == 0)
  865. {
  866. $('.tr3.f_one .t_one').append(`<div id="title_tips" style="position: absolute;right:5px;top: 30px;">当前字节数 <em>0</em></div>`);
  867. }
  868. var title_tips = $('#title_tips');
  869.  
  870. let len = $('#atc_title').val().byteLength();
  871. $('em',$(title_tips)).text(len);
  872. if(len>=300)
  873. {
  874. $(title_tips).addClass('sred');
  875. }
  876. else
  877. {
  878. $(title_tips).removeClass('sred');
  879. }
  880. }
  881.  
  882. function pf_board_toggle(show)
  883. {
  884. //console.log(show);
  885. show = parseInt(show);
  886. if(isNaN(show))
  887. {
  888. show = GM_getValue('pf_board_show') > 0 ? 0 : 1;
  889. }
  890. GM_setValue('pf_board_show', show);
  891. let board = $('#pf_board .item_list');
  892. //let board_show = GM_getValue('pf_board_show')==1;
  893.  
  894. //console.log(show);
  895.  
  896. if(show>0)
  897. {
  898. GM_setValue('pf_board_show',1);
  899. $(board).removeClass('hide');
  900. $('#hide_tools').val('隐藏面板');
  901. }
  902. else
  903. {
  904. GM_setValue('pf_board_show',0);
  905. $(board).addClass('hide');
  906. $('#hide_tools').val('显示面板');
  907. }
  908.  
  909.  
  910. //console.log($(board).hasClass('hide'));
  911. /*
  912. if($(board).hasClass('hide'))
  913. {
  914. GM_setValue('pf_board_show',1);
  915. $(board).removeClass('hide');
  916. $('#hide_tools').text('隐藏面板');
  917. }
  918. else
  919. {
  920. GM_setValue('pf_board_show',0);
  921. $(board).addClass('hide');
  922. $('#hide_tools').text('显示面板');
  923. }
  924. */
  925. }
  926.  
  927. function zhiboTools()
  928. {
  929. var key =eval('/'+ G.get('zhiboCodeKey') +'/');
  930. var zhiboBtn = '<div class="t_like tools_btn" id="zhibo_btn" style="position: fixed; top: 220px; right: 20px;">直播代码</div>';
  931. zhiboBtn += '<textarea id="zhibo_code" style="width:160px;height:200px;position: fixed;right:20px;top:284px;display: none;"></textarea>'
  932. if (localTitle.match(key) != null && localTitle.match(/直播/) == null ){ // localTitle.match(/對賭/) != null || localTitle.match(/下注有效楼层/) != null
  933. $('#conttpc').append(zhiboBtn);
  934. $('#zhibo_btn').click(getZhiboCode);
  935. }
  936. }
  937.  
  938.  
  939. function get_zhibo_data(){
  940. for(var key in localStorage){
  941.  
  942. }
  943. }
  944.  
  945.  
  946. //生成计分板
  947. function zhiboBoard(){
  948. localStorage.setItem('zhibo_board_open', '1');
  949. if($('#zhibo_board').length == 0)
  950. {
  951. $('body').append('<div id="zhibo_board"></div>');
  952. // $('form[action^="post.php"] .t').css({position: 'relative'}).append('<div id="zhibo_board"></div>')
  953. }
  954. var data = getBoardData();
  955. data = JSON.parse(data);
  956.  
  957. if(data == '' || data == null || data.length == 0)
  958. {
  959. message('木有提取到比赛信息,先去开盘贴提取代码再来生成计分板', 5);
  960. return;
  961. }
  962.  
  963. //console.log(data);
  964. var htm_tmp = '<div id="id_{pi}_{index}" pi="{pi}" i="{index}" class="item"><input class="check" {checked} type="checkbox"><span class="tm"><span class="tm_a">{ta}</span> <span class="s3">{pk}</span> <span class="tm_b">{tb}</span></span> <span class="bf">比分:<input type="text" class="code_short" placeholder="比分" value="{bf_a}" name="bf_a"> - <input type="text" class="code_short" placeholder="比分" name="bf_b" value={bf_b}><input type="text" class="code_medium" placeholder="进度" name="state" value="{state}"></span>';
  965. htm_tmp += ' <span class="delete">删</span>';
  966. htm_tmp += '<input type="hidden" value="{ta}" name="ta"><input type="hidden" value="{tb}" name="tb"><input type="hidden" value="{pk}" name="pk"><input type="hidden" value="{tid}" name="tid">';
  967. htm_tmp += '</div>'
  968.  
  969.  
  970. var htm_pk_tmp = '<div class="item pk">{0}</div>';
  971.  
  972. var htm = '';
  973. $.each(data, function(pi, pd){
  974. if(countItem(pd.items)>0)
  975. {
  976. htm += htm_pk_tmp.format(cutTitle(pd.title));
  977. }
  978. $.each(pd.items, function(index, item){
  979. item.index = index;
  980. item.pi = pi;
  981. if(item.deleted==0)
  982. {
  983. htm += htm_tmp.format(item);
  984. }
  985. });
  986. });
  987.  
  988. htm += '<div class="tools"><input type="button" id="simple_code" value="简易代码"> <input type="button" id="rich_code" value="花里胡哨"> <span class="right"><input type="button" id="clear_data" value="清空数据"> <input type="button" id="close_code" value="关闭"></div>';
  989.  
  990. zhibo_board_htm = htm;
  991. $('#zhibo_board').html(htm).show();
  992.  
  993. $('#close_code').click(function(){
  994. updateBoardData();
  995. $('#zhibo_board').hide();
  996. });
  997.  
  998. $('#clear_data').click(function() {
  999. if (confirm("确认清空记分板数据?")==true) {
  1000. localStorage.removeItem('zhibo_data_board', '');
  1001. for(var key in localStorage){
  1002. if(key.indexOf('zhibo_data_') > -1)
  1003. {
  1004. localStorage.removeItem(key);
  1005. }
  1006. }
  1007. $('#zhibo_board').hide();
  1008. localStorage.removeItem('zhibo_board_open');
  1009. }
  1010. });
  1011.  
  1012. $('#zhibo_board .tm_a,#zhibo_board .tm_b').click(function (){
  1013.  
  1014.  
  1015.  
  1016. });
  1017.  
  1018.  
  1019. $('#zhibo_board .item .delete').click(function(){
  1020.  
  1021. //if (confirm("确认删除此项?")==true) {
  1022. /*
  1023. clearTimeout(st);
  1024. var st = setTimeout(updateBoardData, 2000);
  1025. */
  1026.  
  1027. var data = getBoardData();
  1028. data = JSON.parse(data);
  1029. var pi = $(this).parent().attr('pi');
  1030. var i = $(this).parent().attr('i');
  1031.  
  1032. data[pi].items[i].deleted = 1;
  1033. /*
  1034. if(data[pi].items.length == 0)
  1035. {
  1036. data.splice(pi,1);
  1037. }
  1038. */
  1039.  
  1040. setBoardData(data);
  1041.  
  1042. $(this).parent().remove();
  1043. //}
  1044. });
  1045.  
  1046. var board_code = '';
  1047.  
  1048. zhibo_board_reply = $('textarea[name=atc_content]');
  1049.  
  1050. $('#rich_code').click(function() {
  1051. board_code = '\r\n';
  1052. var board_code_tmp = G.get('boardRichTemplate');
  1053.  
  1054. if(board_code_tmp == null)
  1055. {
  1056. board_code_tmp = '[color=green]{ta}[/color] [color=#FF6600]{pk}[/color] [color=green]{tb}[/color] [color=orange]{state}[/color]\r\n';
  1057. board_code_tmp += '[size=4][backcolor=blue][color=white] {bf_a} [/color][/backcolor] - [backcolor=blue][color=white] {bf_b} [/color][/backcolor][/size]\r\n';
  1058. }
  1059.  
  1060. /*
  1061. $.each(zhibo_board_data, function(index, item){
  1062. if(item.checked == 'checked')
  1063. {
  1064. board_code += board_code_tmp.format(item);
  1065. }
  1066. });
  1067. */
  1068.  
  1069.  
  1070. setPost(board_code_tmp, zhibo_board_reply);
  1071. });
  1072.  
  1073. $('#simple_code').click(function(){
  1074. board_code = '\r\n';
  1075. var board_code_tmp = G.get('boardTemplate');
  1076. if(board_code_tmp == null)
  1077. {
  1078. board_code_tmp = '{ta} {pk} {tb}\r\n比分:{bf_a} - {bf_b}  {state}\r\n\r\n';
  1079. }
  1080.  
  1081. setPost(board_code_tmp, zhibo_board_reply);
  1082.  
  1083. });
  1084. }
  1085.  
  1086. function setPost(board_code_tmp, zhibo_board_reply)
  1087. {
  1088. var board_code = '';
  1089. updateBoardData();
  1090. $.each(zhibo_board_data, function(pi, pd){
  1091. if(countChecked(pd.items)==0) return;
  1092. var title = cutTitle(pd.title);
  1093. title = title.substring(0,title.lastIndexOf(']')+1);
  1094. board_code += '\r\n{0}\r\n'.format(title);
  1095.  
  1096. $.each(pd.items, function(index, item){
  1097. if(item.checked == 'checked' && item.deleted == 0)
  1098. {
  1099. board_code += board_code_tmp.format(item);
  1100. }
  1101. });
  1102. });
  1103.  
  1104. $(zhibo_board_reply).val(board_code);
  1105. }
  1106.  
  1107. function countChecked(items){
  1108. var count = 0;
  1109. $.each(items, function(index, item){
  1110. if(item.deleted == 1) return;
  1111. if(item.checked == 'checked')
  1112. {
  1113. count ++;
  1114. }
  1115. });
  1116.  
  1117. return count;
  1118. }
  1119.  
  1120. function countItem(items){
  1121. var count = 0;
  1122. $.each(items, function(index, item){
  1123. if(item.deleted == 1) return;
  1124. count ++;
  1125. });
  1126.  
  1127. return count;
  1128. }
  1129.  
  1130. function cutTitle(title)
  1131. {
  1132. if(typeof(title) != 'string') return '';
  1133. title = title.replace(/\s*/g,'').replace(/(\[開盤\])/,'');;
  1134. title = title.substring(0,title.indexOf('下注'));
  1135. return title;
  1136. }
  1137.  
  1138. //更新计分板数据
  1139. function updateBoardData()
  1140. {
  1141. //不重置,保证加入多盘信息
  1142. //zhibo_board_data = [];
  1143. //console.log(JSON.stringify(zhibo_board_data));
  1144. zhibo_board_data = JSON.parse(getBoardData());
  1145. var data = {};
  1146. var new_index = [];
  1147. $.each($('#zhibo_board .item:not(".pk")'), function(index, item){
  1148. data = {};
  1149. data.pi = $(item).attr('pi');
  1150. data.index = $(item).attr('i');
  1151. data.ta = $('input[name=ta]', item).val();
  1152. data.tb = $('input[name=tb]', item).val();
  1153. data.pk = $('input[name=pk]', item).val();
  1154. data.state = $('input[name=state]', item).val();
  1155. data.bf_a = $('input[name=bf_a]', item).val();
  1156. data.bf_b = $('input[name=bf_b]', item).val();
  1157. data.tid = $('input[name=tid]', item).val();
  1158. data.checked = $('input:checkbox', item).get(0).checked ? 'checked' : '';
  1159.  
  1160. new_index.push('{0}_{1}'.format(data.pi, data.index));
  1161.  
  1162. //zhibo_board_data.push(data);
  1163.  
  1164. //console.log(typeof(data.bf_a) + '_____' + (zhibo_board_data[data.pi].items[data.index] == null));
  1165.  
  1166. if(typeof(data.bf_a) == 'string')
  1167. {
  1168. zhibo_board_data[data.pi].items[data.index].bf_a = data.bf_a;
  1169. zhibo_board_data[data.pi].items[data.index].bf_b = data.bf_b;
  1170. zhibo_board_data[data.pi].items[data.index].state = data.state;
  1171. zhibo_board_data[data.pi].items[data.index].checked = data.checked;
  1172. }
  1173. });
  1174.  
  1175. //var new_board = [];
  1176. //new_board = clone(zhibo_board_data);
  1177. $.each(zhibo_board_data, function(i, d){
  1178. $.each(d.items, function(index, item){
  1179. if(!new_index.includes('{0}_{1}'.format(i,index)))
  1180. {
  1181. item.deleted = 1;
  1182. }
  1183. });
  1184. });
  1185.  
  1186. setBoardData(zhibo_board_data);
  1187. }
  1188.  
  1189. function clone(obj)
  1190. {
  1191. return JSON.parse(JSON.stringify(obj));
  1192. }
  1193.  
  1194.  
  1195. function setPingFenData(data)
  1196. {
  1197. if(typeof(data) != 'string')
  1198. {
  1199. data = JSON.stringify(data);
  1200. }
  1201. var cache_key = 'pf_game_data_' + tid;
  1202. return localStorage.setItem(cache_key, data);
  1203. }
  1204.  
  1205. function getPingFenData()
  1206. {
  1207. var cache_key = 'pf_game_data_' + tid;
  1208. return localStorage.getItem(cache_key);
  1209. }
  1210.  
  1211.  
  1212. //获取计分板缓存数据
  1213. function setBoardData(data)
  1214. {
  1215. if(typeof(data) != 'string')
  1216. {
  1217. data = JSON.stringify(data);
  1218. }
  1219. var cache_key = 'pf_game_data_' + tid;
  1220. cache_key = 'zhibo_data_board';
  1221. return localStorage.setItem(cache_key, data);
  1222. }
  1223.  
  1224.  
  1225.  
  1226. //获取计分板缓存数据
  1227. function getBoardData()
  1228. {
  1229. var cache_key = 'pf_game_data_' + tid;
  1230. cache_key = 'zhibo_data_board';
  1231. return localStorage.getItem(cache_key);
  1232. }
  1233.  
  1234. //提取直播代码(计分板数据) 直播主题表格代码
  1235. function getZhiboCode()
  1236. {
  1237. var postid = 0;
  1238. var fid = 23;
  1239. var month = '';
  1240. var game_name = $('.t.t2 tr.do_not_catch th:first b:first').text().trim();
  1241. if((/[a-zA-z]+:\/\/[^\s]*\.html/).test(localHref)){
  1242. postid = localHref.substring(localHref.lastIndexOf('/')+1, localHref.lastIndexOf('.'));
  1243. var m = localHref.match(/\/(\d{4})\/(\d{2})\/(\d{6,})\.html/);
  1244.  
  1245. month = m[1];
  1246. fid = m[2];
  1247. }
  1248.  
  1249. if((/read.php\?tid=(\d*)*/).test(localHref)){
  1250. postid = getQueryVariable('tid');
  1251. }
  1252.  
  1253. var title = $('#conttpc').prevAll('h4.f16').text();
  1254. var data = [];
  1255. var idx = {};
  1256.  
  1257. $('#zhibo_code').css({width:$('#t_like').width()});
  1258.  
  1259.  
  1260. var trs = $('#conttpc table tr').not($('#conttpc table tr:has("td[colspan]")'));
  1261. $.each($(trs).eq(0).find('td'), function(i,item) {
  1262. //console.log($(item).text());
  1263. var tmp_head = $(item).text().trim();
  1264. /*
  1265. console.log(tmp_head.match(/让球/));
  1266. switch(tmp_head)
  1267. {
  1268. case '比賽時間':
  1269. case '比赛时间':
  1270. idx.time = i;
  1271. break;
  1272. case '賽事':
  1273. case '赛事':
  1274. idx.lm = i;
  1275. break;
  1276. case '主隊':
  1277. case '主队':
  1278. idx.ta = i;
  1279. break;
  1280. case '客隊':
  1281. case '客队':
  1282. idx.tb = i;
  1283. break;
  1284. case '讓球':
  1285. case '让球':
  1286. idx.pk = i;
  1287. break;
  1288. }*/
  1289. var key = eval('/'+ G.get('zhiboCodeLM') +'/');
  1290. //idx.lm = -1;
  1291. if(tmp_head.match(key) != null)
  1292. {
  1293. idx.lm = i;
  1294. }
  1295.  
  1296. key = eval('/'+ G.get('zhiboCodeEvent') +'/');
  1297. //idx.event = -1;
  1298. if(tmp_head.match(key) != null)
  1299. {
  1300. idx.event = i;
  1301. }
  1302.  
  1303. key = eval('/'+ G.get('zhiboCodeTime') +'/');
  1304. if(tmp_head.match(key) != null)
  1305. {
  1306. idx.time = i;
  1307. }
  1308. key = eval('/'+ G.get('zhiboCodeTa') +'/');
  1309. if(tmp_head.match(key) != null)
  1310. {
  1311. idx.ta = i;
  1312. }
  1313. key =eval('/'+ G.get('zhiboCodePK') +'/');
  1314. if(tmp_head.match(key) != null)
  1315. {
  1316. idx.pk = i;
  1317. }
  1318.  
  1319. key =eval('/'+ G.get('zhiboCodeTb') +'/');
  1320. if(tmp_head.match(key) != null)
  1321. {
  1322. idx.tb = i;
  1323. }
  1324. });
  1325.  
  1326.  
  1327. //console.log(idx.lm);
  1328.  
  1329. //不重置,支持多盘数据,需要手动删除或清空
  1330. //zhibo_board_data = JSON.parse(localStorage.getItem('zhibo_data_board'));
  1331. var board = {};
  1332. board.tid = postid;
  1333. board.fid = fid;
  1334. board.month = month;
  1335. board.title = title;
  1336. board.duidu = localTitle.match(/對賭|对赌"/) != null;
  1337. board.zhuang = '';
  1338. board.cai = '';
  1339. board.items = [];
  1340.  
  1341. if(board.duidu)
  1342. {
  1343. //console.log($('#conttpc').html());
  1344. //var mc = $('#conttpc').text().match(/(楼主|庄家)走\s{0,}(\S*?)\s{0,}[,|,]/);
  1345. var mc = $('#conttpc').html().match(/下注(球|选)(\S)(:|:)(?<team>\S*?)<br/);
  1346. if(mc != null)
  1347. {
  1348. board.cai = mc.groups['team'].trim();
  1349. //console.log(board.cai);
  1350. }
  1351.  
  1352. }
  1353. //console.log(board.zhuang);
  1354.  
  1355. $.each(trs, function(i,item) {
  1356.  
  1357. var game = {};
  1358. var $td = $('td',item);
  1359. if($td.length<3) return;
  1360. game.time = i == 0 ? '开赛时间' : (new Date()).format('yyyy/MM/dd 待定'+i);
  1361. game.bf = i == 0 ? '比分' : '比分'+i;
  1362. game.win = i == 0 ? '赢盘球队' : '赢盘'+i;
  1363.  
  1364. if(idx.time > -1)
  1365. {
  1366. game.time = $td.eq(idx.time).text().trim();
  1367. }
  1368.  
  1369. if(idx.lm > -1)
  1370. {
  1371. game.lm = $td.eq(idx.lm).text().trim();
  1372. }
  1373. else
  1374. {
  1375. game.lm = '';
  1376. }
  1377. if(idx.event > -1)
  1378. {
  1379. game.event = $td.eq(idx.event).text().trim();
  1380. }
  1381. game.ta = $td.eq(idx.ta).text().trim();
  1382. game.pk = $td.eq(idx.pk).text().trim();
  1383. game.tb = $td.eq(idx.tb).text().trim();
  1384.  
  1385. //console.log(JSON.stringify(board));
  1386. //console.log(JSON.stringify(game));
  1387. if(board.cai.length > 0 && game.ta!='主隊')
  1388. {
  1389. board.zhuang = board.cai==game.ta ? game.tb : game.ta;
  1390.  
  1391. game.ta = (game.ta==board.zhuang ? "[庄]" : "") + game.ta;
  1392. game.tb = (game.tb==board.zhuang ? "[庄]" : "") + game.tb;
  1393. }
  1394.  
  1395. game.tid = '{0}_{1}'.format(postid,i);
  1396. game.bf_a = '';
  1397. game.bf_b = '';
  1398. game.state = '';
  1399. game.checked = 'checked';
  1400. game.deleted = 0;
  1401.  
  1402. if(game.lm+game.ta == '') return;
  1403. data.push(game);
  1404.  
  1405. if(i > 0)
  1406. {
  1407. board.items.push(game);
  1408.  
  1409. //var new_data = zhibo_board_data;
  1410. /*
  1411. if(zhibo_board_data.length == 0)
  1412. {
  1413. zhibo_board_data.push(board);
  1414. }
  1415. else
  1416. {
  1417. console.log(zhibo_board_data.length);
  1418. $.each(zhibo_board_data, function(bi, bd){
  1419. if(bd.tid == board.tid)
  1420. {
  1421. //console.log(bd.tid == board.tid);
  1422. //zhibo_board_data.splice(bi,1);
  1423. }
  1424. });
  1425.  
  1426.  
  1427. zhibo_board_data.push(board);
  1428. }
  1429. */
  1430. //zhibo_board_data = new_data;
  1431. //console.log(JSON.stringify(zhibo_board_data));
  1432. }
  1433. });
  1434.  
  1435. //console.log(JSON.stringify(board));
  1436. zhibo_board_data = JSON.parse(getBoardData());
  1437.  
  1438. var new_data = [];
  1439. $.each(zhibo_board_data, function(bi, bd){
  1440. //console.log(bd.tid + '___' + bi);
  1441. //console.log(bd.tid == board.tid);
  1442. if(bd.tid != board.tid)
  1443. {
  1444. new_data.unshift(bd);
  1445. //delete zhibo_board_data[bi];
  1446. //zhibo_board_data.splice(bi, 1);
  1447. //console.log(JSON.stringify(zhibo_board_data[bi]));
  1448. }
  1449. });
  1450.  
  1451. new_data.push(board);
  1452.  
  1453.  
  1454. /*
  1455. data.sort((a,b)=>{
  1456. return a.tid-b.tid;
  1457. });
  1458. */
  1459. new_data.sort((a,b)=>{
  1460. return a.tid-b.tid;
  1461. });
  1462.  
  1463. var cache_key = 'zhibo_data_' + postid;
  1464. localStorage.setItem(cache_key, JSON.stringify(data));
  1465. cache_key = 'zhibo_data_board';
  1466. localStorage.setItem(cache_key, JSON.stringify(new_data));
  1467. //console.log(cache_key+'_2');
  1468.  
  1469. var html = '';//'[align=center][b][color=red][size=4]{0}[/size][/color][/b][/align]\r\n'.format(title);
  1470.  
  1471. let title_code = '[align=center][b][color=red][size=4]{0}[/size][/color][/b]';
  1472. if(G.get('zhiboLinkEnable'))
  1473. {
  1474. title_code += '\r\n[tid={1}-{2}-{3}]{4}[/tid]';
  1475. }
  1476.  
  1477. title_code += '[/align]';
  1478.  
  1479. title_code = title_code.format(title.replace('【看清规则后下注、乱入者按恶意灌水处理】',''), board.tid, board.fid,board.month, game_name);
  1480. title_code = title_code.replace('[其他] ','').replace('[開盤]','').replace('【无关队伍误入请及时申请删除】','').replace('【看清规则后下注、乱入者按恶意灌水处理】','');
  1481.  
  1482. let key = eval('/'+ G.get('bodanCodeKey') +'/');
  1483. if (key.test(localTitle))
  1484. {
  1485. html += '[table=100%][tr]';
  1486. //html += '[td=4,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); //
  1487. html += '[td=4,1]{0}[/td][/tr]'.format(title_code);
  1488. html += '[/tr][tr]';
  1489. //post.content += '[td][align=center][b][color=purple][size=4]賽事[/size][/color][/b][/align][/td]';
  1490. html += '[td][align=center][b][color=purple][size=4]比賽時間[/size][/color][/b][/align][/td]';
  1491. html += '[td][align=center][b][color=purple][size=4]比賽内容[/size][/color][/b][/align][/td]';
  1492. html += '[td][align=center][b][color=purple][size=4]结果[/size][/color][/b][/align][/td]';
  1493. html += '[td][align=center][b][color=purple][size=4]赔率[/size][/color][/b][/align][/td]';
  1494. html += '[/tr]';
  1495.  
  1496. let template1 = '[tr]';//\r\n
  1497. //template1 += '[td][img]{img}[/img][/td]';
  1498. template1 += '[td][align=center][b][color=blue][size=3]{time}\r\n[/size][/color][/b][/align][/td]';
  1499. template1 += '[td][align=center][b][color=green][size=3]{lm}\r\n[/size][/color][/b][/align][/td]';
  1500. template1 += '[td][align=center][b][color=red][size=3]{bf}\r\n[/size][/color][/b][/align][/td]';
  1501. template1 += '[td][align=center][b][color=blue][size=3]{win}\r\n[/size][/color][/b][/align][/td]';
  1502. template1 += '[/tr]'; //
  1503.  
  1504. var bet_html = $('#conttpc').html().replaceAll('>','>\r\n');
  1505. var re_bet=/下注(球|选)(\S)(:|:)\s*(?<team>.*?)<br/g;
  1506.  
  1507. //console.log(mp);
  1508.  
  1509. var ms = bet_html.match(re_bet);
  1510.  
  1511. let imgs = $('#conttpc img[ess-data]');
  1512.  
  1513. let fix_num = (imgs.length - ms.length);
  1514.  
  1515. $.each(ms, function(k, m){
  1516.  
  1517. let item = {};
  1518. //item.img = $(imgs).eq(k+fix_num).attr('ess-data');
  1519. item.time = '时间'+(k+1);
  1520. item.lm = '赛事'+(k+1);
  1521. item.bf = '结果'+(k+1);
  1522. item.win = '赔率'+(k+1);
  1523.  
  1524. html += template1.format(item);
  1525. });
  1526.  
  1527. let img_code = '';
  1528. $.each(imgs, function(k,img_item){
  1529. let img = $(img_item).attr('ess-data').trim();
  1530. if(img != '')
  1531. {
  1532. img_code += '[img]{0}[/img]'.format(img);
  1533. }
  1534. });
  1535.  
  1536. html += '[tr]';
  1537. html += '[td=4,1]{0}[/td][/tr]'.format(img_code); //
  1538. html += '[/tr]';
  1539.  
  1540. /*
  1541. $('#conttpc img[ess-data]').each(function(i, img)
  1542. {
  1543. let item = {};
  1544. item.img = $(img).attr('ess-data');
  1545. item.bf = '比分'+(i+1);
  1546. item.win = '赔率'+(i+1);
  1547.  
  1548. html += template1.format(item);
  1549. });
  1550. */
  1551.  
  1552. html += '[/table]'
  1553. }
  1554. else if(/串一/.test(localTitle))
  1555. {
  1556. html += '[table=100%][tr]';
  1557. //html += '[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); //
  1558. html += '[td=7,1]{0}[/td][/tr]'.format(title_code);
  1559. html += '[/tr][tr]';
  1560. html += '[td][align=center][b][color=purple][size=4]比賽時間[/size][/color][/b][/align][/td]';
  1561. html += '[td][align=center][b][color=purple][size=4]賽事[/size][/color][/b][/align][/td]';
  1562. html += '[td][align=center][b][color=purple][size=4]主隊[/size][/color][/b][/align][/td]';
  1563. html += '[td][align=center][b][color=purple][size=4]平局[/size][/color][/b][/align][/td]';
  1564. html += '[td][align=center][b][color=purple][size=4]客隊[/size][/color][/b][/align][/td]';
  1565. html += '[td][align=center][b][color=purple][size=4]比分[/size][/color][/b][/align][/td]';
  1566. html += '[td][align=center][b][color=purple][size=4]贏盤隊[/size][/color][/b][/align][/td]';
  1567. html += '[/tr]';
  1568.  
  1569. let template1 = '[tr]';//\r\n
  1570. template1 += '[td][align=center][b][color=blue][size=3]{time}\r\n[/size][/color][/b][/align][/td]';
  1571. template1 += '[td][align=center][b][color=orange][size=3]{lm}\r\n[/size][/color][/b][/align][/td]';
  1572. template1 += '[td][align=center][b][color=green][size=3]{ta}\r\n[/size][/color][/b][/align][/td]';
  1573. template1 += '[td][align=center][b][color=green][size=3]{pk}\r\n[/size][/color][/b][/align][/td]';
  1574. template1 += '[td][align=center][b][color=green][size=3]{tb}\r\n[/size][/color][/b][/align][/td]';
  1575. template1 += '[td][align=center][b][color=red][size=3]{bf}\r\n[/size][/color][/b][/align][/td]';
  1576. template1 += '[td][align=center][b][color=blue][size=3]{win}\r\n[/size][/color][/b][/align][/td]';
  1577. template1 += '[/tr]'; //
  1578. $.each(data, function(i, item){
  1579. if (i==0) return;
  1580. html += template1.format(item);
  1581. });
  1582.  
  1583. html += '[/table]'
  1584. }
  1585. else
  1586. {
  1587.  
  1588. let count_td = 8;
  1589. idx.lm = isNaN(idx.lm) ? -1 : idx.lm;
  1590. idx.event = isNaN(idx.event) ? -1 : idx.event;
  1591. count_td = count_td + idx.event + idx.lm;
  1592.  
  1593. //console.log('----');
  1594. //console.log(count_td);
  1595.  
  1596. html += '[table]'; //\r\n
  1597. //html += '[tr][td='+ count_td +',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('[其他] ','').replace('[開盤]','').replace('【无关队伍误入请及时申请删除】','').replace('【看清规则后下注、乱入者按恶意灌水处理】',''), board.tid, board.fid,board.month, game_name); //
  1598. html += '[tr][td='+ count_td +',1]{0}[/td][/tr]'.format(title_code);
  1599.  
  1600. let template1 = '[tr]';//\r\n
  1601. template1 += '[td][align=center][b][color=green][size=3]{time}\r\n[/size][/color][/b][/align][/td]';
  1602. if(idx.lm > -1){
  1603. template1 += '[td][align=center][b][color=orange][size=3]{lm}\r\n[/size][/color][/b][/align][/td]';
  1604. }
  1605. if(idx.event > -1){
  1606. template1 += '[td][align=center][b][color=blue][size=3]{event}\r\n[/size][/color][/b][/align][/td]';
  1607. }
  1608. template1 += '[td][align=center][b][color=green][size=3]{ta}\r\n[/size][/color][/b][/align][/td]';
  1609. template1 += '[td][align=center][b][color=red][size=3]{pk}\r\n[/size][/color][/b][/align][/td]';
  1610. template1 += '[td][align=center][b][color=green][size=3]{tb}\r\n[/size][/color][/b][/align][/td]';
  1611. template1 += '[td][align=center][b][color=red][size=3]{bf}\r\n[/size][/color][/b][/align][/td]';
  1612. template1 += '[td][align=center][b][color=blue][size=3]{win}\r\n[/size][/color][/b][/align][/td]';
  1613. template1 += '[/tr]'; //
  1614. $.each(data, function(i, item){
  1615. if (i==0)
  1616. {
  1617. html += template1.replace(/\[color\=.*?\]/g, '[color=purple]').format(item);
  1618. }
  1619. else
  1620. {
  1621. html += template1.format(item);
  1622. }
  1623. });
  1624.  
  1625. html += '[/table]'
  1626. }
  1627.  
  1628.  
  1629. $('#zhibo_code').val(html).show();
  1630. GM_setClipboard(html,'text');
  1631.  
  1632. message('神秘代码已提取,试试Ctrl+V。<br />计分板数据已更新,直播可用。', 3);
  1633. //console.log(html); //JSON.stringify(data)
  1634. }
  1635.  
  1636. function postFix(){
  1637. if (localHref.match(/htm_(data|mob)\S*\.html|read\.php\?/) != null ){
  1638.  
  1639. isMob = $('.banner h3').length>0;
  1640.  
  1641. var $t_like = $('.t_like');
  1642. if($t_like.length>0)
  1643. {
  1644. var $t_like_top = $t_like.offset().top;
  1645. //console.log($t_like.offset());
  1646. //点赞浮动
  1647. if(G.get('likeFixEnable'))
  1648. {
  1649. $t_like.css({position: "fixed", top: 580, right: 20});
  1650. }
  1651. $(window).scroll(function(event){
  1652.  
  1653. });
  1654.  
  1655. $(window).resize(function() {
  1656. //$t_like.css({left: $('#conttpc').offset().left-135});
  1657. });
  1658. }
  1659.  
  1660.  
  1661.  
  1662. var save_code_btn = '<input type="button" class="s1" id="save_code" value="保存">';
  1663. var set_code_btn = ' <input type="button" class="s1" id="set_code" value="载入">';
  1664. var open_board_btn = ' <input type="button" class="s2" style="margin-left:20px;" id="open_board" value="计分板">';
  1665. var content = $('textarea[name=atc_content]');
  1666.  
  1667.  
  1668. //$('#atc_title').parent().html('<textarea name="atc_title" class="input" style="font: 14px Tahoma; padding-left:2px;height:60px;width:100%" id="atc_title">'+$('#atc_title').val()+'</textarea>');
  1669.  
  1670. if(content != null)
  1671. {
  1672. $('textarea[name=atc_content]').prev('div').append(save_code_btn).append(set_code_btn).append(open_board_btn);
  1673. //$('input[name=Submit]').parent().append(open_board_btn);
  1674.  
  1675. $('#open_board').click(function() {
  1676. zhiboBoard();
  1677. });
  1678.  
  1679. $('#save_code').click(function(){
  1680. var code = $(content).val();
  1681. if(code != null)
  1682. {
  1683. var code_cache = localStorage.getItem('reply_code');
  1684. if(code_cache != null && code_cache != '' && code_cache != code)
  1685. {
  1686. if (confirm("更新已保存代码?")==true) {
  1687. localStorage.setItem('reply_code', code);
  1688. }
  1689. }
  1690. else
  1691. {
  1692. localStorage.setItem('reply_code', code);
  1693. }
  1694. }
  1695. });
  1696.  
  1697. $('#set_code').click(function(){
  1698. var code = localStorage.getItem('reply_code');
  1699.  
  1700. //var content = $('textarea[name=atc_content]');
  1701.  
  1702. //console.log($(content).val());
  1703.  
  1704. if(code != null)
  1705. {
  1706. var txt = $.trim($(content).val());
  1707. $(content).val((txt != null ? txt + '\r\n' : '') + code);
  1708. }
  1709. });
  1710. }
  1711.  
  1712. $('.post_comm_face').each(function(){
  1713. var $li = $(this).parent();
  1714. //var tpc_author = $li.next().find('span a:first').text();
  1715. //console.log($li.html());
  1716. var tpc_author = isMob ? $li.next().find('.gray:first').text() : $li.next().find('span[style] a:first').text();
  1717. $li.html('<a href="/@' + tpc_author + '" target="_blank">' + $li.html() + '</a>');
  1718. })
  1719.  
  1720. $('body .t').each(function(i, item){
  1721. var tpc_content = $.trim($('.tpc_content', this).text());
  1722. var tpc_auther_html = $('.tr1 th:first b:first', this);
  1723. var tpc_author = $.trim($('.tr1 th:first b:first', this).text()).replace(/\s\S*/,'');
  1724. var tpc_floor = $.trim($('.tipad .s3', this).text()).replace(/[^0-9]/ig,'');
  1725.  
  1726. //$(tpc_auther_html).html()
  1727. if(tpc_author){
  1728. var link = '<a href="/@' + tpc_author + '" target="_blank">' + tpc_author + '</a>';
  1729. var tmp = $('.tr1 th:first b:first', this).html();
  1730. tmp = tmp.replace(tpc_author, link);
  1731. $('.tr1 th:first b:first', this).html(tmp);
  1732. }
  1733.  
  1734. if($.inArray(tpc_floor, G.get('whiteFloor').split(','))>-1)
  1735. {
  1736. return true;
  1737. }
  1738.  
  1739. if($.inArray(tpc_author, whiteList)>-1)
  1740. {
  1741. return true;
  1742. }
  1743. //console.log(i);
  1744.  
  1745. if($.inArray(tpc_author, blackPostList)>-1 && tpc_author.length>0 && i>1)
  1746. {
  1747. $(this).remove();
  1748. }
  1749.  
  1750. if($('.post_comm', this).length>0)
  1751. {
  1752. return true;
  1753. }
  1754.  
  1755. if($.inArray(tpc_content, spamList)>-1 && localTitle.match('博彩區') == null)
  1756. {
  1757. $(this).remove();
  1758. }
  1759. });
  1760.  
  1761.  
  1762. $('.tpc_cont').parent().each(function(){
  1763. var tpc_content = $.trim($('.tpc_cont', this).text());
  1764. var tpc_author = $('.tpc_detail:first li', this).html().replace(/(\S*)<.*/,'$1');
  1765. //tpc_author = tpc_author.substring(0, tpc_author.indexOf('#'));
  1766. //console.log(tpc_author);
  1767.  
  1768. if(tpc_author){
  1769. var link = '<a href="/@' + tpc_author + '" target="_blank">' + tpc_author + '</a>';
  1770. var tmp = $('.tpc_detail:first li', this).html();
  1771. tmp = tmp.replace(tpc_author, link);
  1772. $('.tpc_detail:first li', this).html(tmp);
  1773. }
  1774.  
  1775.  
  1776. if($.inArray(tpc_author, whiteList)>-1)
  1777. {
  1778. return true;
  1779. }
  1780.  
  1781. if($('.post_comm', this).length>0)
  1782. {
  1783. return true;
  1784. }
  1785.  
  1786. if($.inArray(tpc_content, spamList)>-1)
  1787. {
  1788. $(this).next('.tpc_line').remove();
  1789. $(this).prev('.tpc_face').remove();
  1790. $(this).prev('a[name]').remove();
  1791. $(this).remove();
  1792. }
  1793. });
  1794. }
  1795. }
  1796.  
  1797. function listFix() {
  1798. if (localHref.match(/thread0806\.php\?fid=/) != null ){
  1799. $('#tbody tr').each(function(){
  1800. var poster = $.trim($('a.bl', this).text());
  1801.  
  1802. if($.inArray(poster, blackList)>-1)
  1803. {
  1804. //console.log(poster);
  1805. $(this).remove();
  1806. }
  1807.  
  1808. if(/博彩區/.test(localTitle))
  1809. {
  1810. let html = $('td:eq(2) [data-timestamp]', this).attr('data-timestamp');//.attr('title');//.text().trim();
  1811. if(html)
  1812. {
  1813. html = html.replace('s','');
  1814.  
  1815. let ts = parseInt(html)*1000;
  1816. let dt = new Date(ts);
  1817. html = judgeTime(dt);
  1818.  
  1819. if(/(今天|昨天)/.test(html))
  1820. {
  1821. //let txt = /(今天)/.test(html)?'今天':'昨天';
  1822. let txt_css = /(今天)/.test(html)?'s5':'s3';
  1823. $('td:first', this).html('<span class="'+ txt_css +'">'+ html +'</span>');
  1824. }
  1825. }
  1826. }
  1827. });
  1828.  
  1829.  
  1830. /*
  1831. $('td:eq(2):contains("今")',$('#tbody tr')).each(function(){
  1832. $('td:first',$(this).parent().parent()).text('今天');
  1833. });
  1834. */
  1835.  
  1836. $('.list.t_one').each(function(){
  1837. var poster = $.trim($('.f10.fl', this).text());
  1838. poster = poster [0];
  1839. if($.inArray(poster, blackList)>-1)
  1840. {
  1841. $(this).remove();
  1842. }
  1843. });
  1844. }
  1845. }
  1846.  
  1847.  
  1848. function get_today_thread() {
  1849. //$('#last[href^="post.php"').length
  1850. $('#last[href^="post.php"').parent().prepend('<a href="javascript:void(0);" class="last" id="get_thread"> 選取主題</a>');
  1851. $('#get_thread').click(function() {
  1852. let txt = '';
  1853. if(page == 1)
  1854. {
  1855. txt = `序号\t\tTid\t标题\t作者\t时间\t回復\r\n`;
  1856. }
  1857.  
  1858. $('#tbody tr.tr3').each(function(i,item){
  1859. let $this = $(item);
  1860. let thread = {};
  1861. thread.count_like = 0;
  1862. thread.count_reply = 0;
  1863. thread.title = '';
  1864. thread.tid = 0;
  1865. thread.post_time = '';
  1866. thread.author = '';
  1867.  
  1868. let $td = $this.find('td').eq(1).find('h3');
  1869. thread.title = $td.text();
  1870. thread.tid = $td.find('a').attr('id').replace('t','');
  1871.  
  1872. $td = $this.find('td').eq(0)
  1873. thread.count_like = $td.text().trim().replace('.::','0');
  1874. $td = $this.find('td').eq(3)
  1875. thread.count_reply = $td.text().trim().replace('.::','0');
  1876.  
  1877. $td = $this.find('td').eq(2);
  1878. thread.author = $td.find('a').text();
  1879. thread.post_time = $td.find('span[data-timestamp]').attr('title');
  1880. if(thread.post_time)
  1881. {
  1882. thread.post_time = thread.post_time.replace('今天','').replace('昨天','').replace(' ',' ');
  1883. }
  1884.  
  1885.  
  1886. txt += `${i+1} ${thread.count_like} ${thread.tid} ${thread.title} ${thread.author} ${thread.post_time} ${thread.count_reply}\r\n`;
  1887.  
  1888. //console.log(txt);
  1889. });
  1890.  
  1891.  
  1892. GM_setClipboard(txt,'text');
  1893.  
  1894. message('主体信息取到剪贴板,当前第 {0} 页'.format(page), 5);
  1895. });
  1896. }
  1897.  
  1898. function copy_bets(){
  1899.  
  1900. $('.post_comm').remove();
  1901.  
  1902. let bets_copy = '';
  1903.  
  1904. let reg_date_time = /(?<post_time>\d{1,4}-\d{1,2}-\d{1,2}\s{1,}\d{1,2}:\d{1,2})/
  1905.  
  1906. let limit_time = '';
  1907. if(reg_date_time.test(localTitle))
  1908. {
  1909. limit_time = reg_date_time.exec(localTitle)[1].trim();
  1910. }
  1911. //console.log(limit_time);
  1912.  
  1913. let copy_head = '楼层 ID 下注点数 下注场数 得分 队伍编号 提示 威望 級別 注册(不可用) 评分 Tips By';
  1914. let copy_tample = '{floor} {author} {bet_points} {bet_count} {points} {team} {tips} {v} {group} {reg} {score} {remark} {by}';//'{0} {1} {2}\r\n';
  1915. $.each($("div[id^='cont']:not(#conttpc)"), function(i, bet) {
  1916. var ratio = 0;
  1917. var points = 0;
  1918. var bet_points = 0;
  1919.  
  1920. let points_item = {};
  1921. points_item.author = $('.r_two b:first', $(bet).parent().parent()).text().replace('[樓主]','');
  1922. points_item.floor = $('.tipad .s3', $(bet).parent().parent().parent()).text();
  1923.  
  1924.  
  1925.  
  1926.  
  1927. points_item.post_time = '';
  1928. points_item.bet_points = 0;
  1929. points_item.bet_count = 0;
  1930. points_item.tips = '';
  1931. points_item.points = 0;
  1932. points_item.team = '';
  1933. points_item.v = '';
  1934. points_item.reg = '';
  1935. points_item.score = 0;
  1936. points_item.remark = '';
  1937. points_item.by = '';
  1938.  
  1939. //console.log($(bet).parent().html());
  1940.  
  1941.  
  1942. let tips = $('.tips', $(bet).parent()).text().trim();
  1943. let mp;
  1944. //console.log(tips);
  1945. if(tips)
  1946. {
  1947. if(/本帖最近評分記錄/.test(tips))
  1948. {
  1949. //console.log(tips);
  1950. }
  1951. else
  1952. {
  1953. tips = tips.replaceAll(/\s+|\r+|\n+| +/g, ' ');
  1954. //mp = tips.match(/(?<remark>\S+)(.)By:(?<by>\S+)/);
  1955. if(tips)
  1956. {
  1957. tips = tips.replaceAll(/\s+|\r+|\n+| +/g, ' ');
  1958. if(/本帖最近評分記錄/.test(tips))
  1959. {
  1960. //console.log(tips);
  1961. }
  1962.  
  1963. if(/By:/.test(tips))
  1964. {
  1965. let reg_tmp = /(?<remark>\S+)(.)By:(?<by>\S+)/;
  1966. mp = tips.match(reg_tmp);
  1967. if(mp != null)
  1968. {
  1969. points_item.remark = mp.groups['remark'].trim();
  1970. points_item.by = mp.groups['by'].trim();
  1971. //console.log(tips);
  1972. }
  1973. }
  1974. //console.log(tips);
  1975. }
  1976. }
  1977. }
  1978.  
  1979. tips = $('.tips:last', $(bet).parent().parent().parent()).text().trim();
  1980. //console.log(tips);
  1981. if(tips)
  1982. {
  1983. if(/本帖最近評分記錄/.test(tips))
  1984. {
  1985. tips = tips.replace('威望',' 威望');
  1986. //console.log(tips);
  1987.  
  1988. let reg_tips = /威望:(?<points>(\+|\-)\d{1,})\((?<by>\S+)\)/g;
  1989. mp = tips.match(reg_tips);
  1990. $.each(mp, function(k, m){
  1991. let mc = m.match(/威望:(?<points>(\+|\-)\d{1,})\((?<by>\S+)\)/)
  1992. if(mc != null)
  1993. {
  1994. points_item.score += parseInt(mc.groups['points'].trim());
  1995.  
  1996. points_item.by += points_item.by != '' ? ',' : '';
  1997. points_item.by += mc.groups['by'].trim();
  1998. }
  1999. //$.each(mc, function(kc, mcc){
  2000. //console.log(mcc);
  2001. //points_item.points += parseInt(mcc.groups['points'].trim());
  2002. //points_item.by += mcc.groups['by'].trim();
  2003. //});
  2004. });
  2005.  
  2006. let tips_tmp = tips.replace('本帖最近評分記錄:','');
  2007. tips_tmp = tips_tmp.replace(reg_tips,'').trim();
  2008. if(tips_tmp != '')
  2009. {
  2010. points_item.remark += points_item.remark != '' ? ',' : '';
  2011. points_item.remark += tips_tmp;
  2012. }
  2013. }
  2014. }
  2015.  
  2016. let tipad = $('.tipad', $(bet).parent().parent().parent()).text();
  2017. mp = tipad.match(reg_date_time);
  2018. if(mp != null)
  2019. {
  2020. points_item.post_time = mp.groups['post_time'].trim();
  2021. }
  2022.  
  2023. if(limit_time != '' && points_item.post_time != '')
  2024. {
  2025. //console.log(points_item.post_time + limit_time);
  2026. //console.log('{0} / {1}/ {2}'.format(points_item.post_time, limit_time, points_item.post_time>limit_time));
  2027.  
  2028. if(points_item.post_time > limit_time)
  2029. {
  2030. let date1 = new Date(points_item.post_time);
  2031. let date2 = new Date(limit_time);
  2032. let seconds = date1.getTime() - date2.getTime();
  2033. if(seconds > 5*60*1000)
  2034. {
  2035. points_item.tips += '超时下注';
  2036. }
  2037. }
  2038. }
  2039.  
  2040.  
  2041. let points_tips = $('.points_tips', $(bet));
  2042. if($(points_tips).length > 0)
  2043. {
  2044. points_item.points = $(points_tips).text();
  2045. }
  2046.  
  2047. mp = points_item.floor.match(/(?<floor>\d+)/);
  2048. if(mp != null)
  2049. {
  2050. points_item.floor = parseInt(mp.groups['floor'].trim());
  2051. }
  2052.  
  2053. var bet_html = $(bet).html().replaceAll('>','>\r\n');
  2054. var points_bet=/(下注点数|下註點數|點數|点数)(:|:)\s*(?<points>\d+)/;
  2055.  
  2056. mp = bet_html.match(points_bet);
  2057. if(mp != null)
  2058. {
  2059. bet_points = parseInt(mp.groups['points'].trim());
  2060. points_item.bet_points = bet_points;
  2061. }
  2062.  
  2063.  
  2064. //无下注点数情况下冲刺赛模式
  2065. let key = eval('/'+ G.get('suanfenCCScoreKey') +'/');
  2066.  
  2067. if(key.test(localTitle) && bet_points==0)
  2068. {
  2069. let cc_points = parseInt(G.get('suanfenCCScorePoints'));
  2070.  
  2071. if(!isNaN(cc_points))
  2072. {
  2073. bet_points = cc_points;
  2074. points_item.bet_points = bet_points;
  2075. }
  2076. }
  2077.  
  2078. if(/重新編輯/.test(bet_html))
  2079. {
  2080. points_item.tips += points_item.tips == '' ? '' : '、';
  2081. points_item.tips += '重新編輯';
  2082. }
  2083.  
  2084. bet_html = $(bet).html().replaceAll('\t','').replaceAll('\r','').replaceAll('\n','');
  2085. //bet_html = bet_html.replaceAll('<br>','\r\n').replaceAll('<br/>','\r\n').replaceAll('<br />','\r\n');
  2086. bet_html = bet_html.replace(/<font color="gray">(.*)重新編輯 ]<\/font>/g,'');
  2087. bet_html = bet_html.replaceAll('&nbsp;','');
  2088. bet_html = bet_html.replaceAll(":",":").replaceAll(' :',':');
  2089.  
  2090. if(/编号/.test(bet_html))
  2091. {
  2092. if(!(/编号:/.test(bet_html)))
  2093. {
  2094. //处理编号格式不对问题
  2095. bet_html = bet_html.replace('编号','编号:');
  2096. }
  2097. points_item.team = /编号:([^<]*)/.exec(bet_html)[1].trim();
  2098.  
  2099. //console.log(/队伍编号:(.*)/.exec(bet_html));
  2100. }
  2101. else if (/队伍名字/.test(bet_html))
  2102. {
  2103. points_item.team = /队伍名字:([^<]*)/.exec(bet_html)[1].trim();
  2104. }
  2105.  
  2106. if(/竞猜/.test(bet_html))
  2107. {
  2108. bet_html = bet_html.replace('尾号','').replace('数字','');
  2109. points_item.team = /竞猜:([^<]*)/.exec(bet_html)[1].trim();
  2110. }
  2111.  
  2112.  
  2113. let author_html = $('.r_two',$(bet).parent().parent().parent()).text().trim().replace(/\n/,'');
  2114. author_html = author_html.replace(/^[\r\n\s\f\t\v\o]+/gm, "");
  2115.  
  2116. //console.log(author_html);
  2117.  
  2118. let author_info = {};
  2119. ///級別:(.*)/;
  2120. author_info.name = points_item.author;
  2121.  
  2122.  
  2123. if(/級別:(.*)/.test(author_html))
  2124. {
  2125. author_info.group = /級別:(.*)/.exec(author_html)[1];
  2126. author_info.p = /發帖:(.*)/.exec(author_html)[1];
  2127. author_info.v = /威望:(.*)/.exec(author_html)[1];
  2128. author_info.u = /金錢:(.*)/.exec(author_html)[1];
  2129. author_info.g = /貢獻:(.*)/.exec(author_html)[1];
  2130. author_info.r = /註冊:(.*)/.exec(author_html)[1];
  2131. author_info.c = /認證:(.*)/.test(author_html) ? /認證:(.*)/gs.exec(author_html)[1].trim() : "";
  2132. author_info.c =author_info.c.replaceAll(" ","").replaceAll('\t','').replaceAll('\r','').replaceAll('\n','');
  2133. }
  2134.  
  2135. points_item.v = author_info.v.replace(' 點','');
  2136. points_item.group = author_info.group;
  2137. points_item.reg = author_info.r;
  2138.  
  2139.  
  2140. //超级别验证
  2141. if(bet_points>0)
  2142. {
  2143. if(!check_level(points_item.group, bet_points))
  2144. {
  2145. points_item.tips += points_item.tips == '' ? '' : '、';
  2146. points_item.tips += '超級別下注';
  2147. console.log('{author} {floor} 超級別下注'.format(points_item));
  2148. }
  2149. }
  2150.  
  2151.  
  2152. if(G.get('betsCopyOnlyBets'))
  2153. {
  2154.  
  2155. let copy_tample = '{author}\r\n';
  2156.  
  2157. /*
  2158. 級別:精靈王 ( 12 )
  2159. 發帖:256
  2160. 威望:822 點
  2161. 金錢:200483 USD
  2162. 貢獻:20083 點
  2163. 赞(0) | 資料 短信 推薦 編輯
  2164. */
  2165.  
  2166. //bets_copy += copy_tample.format(points_item);
  2167.  
  2168. bet_html = $(bet).html().replaceAll('\t','').replaceAll('\r','').replaceAll('\n','');
  2169. bet_html = bet_html.replaceAll('<br>','\r\n').replaceAll('<br/>','\r\n').replaceAll('<br />','\r\n');
  2170. bet_html = bet_html.replace(/<div class="points_tips">\S*<\/div>/g,"");
  2171. bet_html = bet_html.replace(/<font color="gray">(.*)重新編輯 ]<\/font>/g,'');
  2172. bet_html = bet_html.replaceAll('&nbsp;','');
  2173. bet_html = bet_html.replaceAll(":",":").replaceAll(' :',':');
  2174.  
  2175.  
  2176. //提取竞猜信息
  2177. if(/世界杯活动正式报名帖/.test(localTitle)) {
  2178. let sign_info ={};
  2179. sign_info.author = points_item.author;
  2180. sign_info.floor = points_item.floor;
  2181.  
  2182. sign_info.v = author_info.v;
  2183. sign_info.group = author_info.group;
  2184. sign_info.reg = author_info.r;
  2185. sign_info.c = author_info.c;
  2186. sign_info.id = '';
  2187. sign_info.team = '';
  2188. sign_info.id2 = '';
  2189. sign_info.p1 = '';
  2190. sign_info.p2 = '';
  2191. sign_info.p3 = '';
  2192. sign_info.p4 = '';
  2193. sign_info.p5 = '';
  2194. //console.log(bet_html);
  2195.  
  2196. //bet_html = bet_html.replaceAll(":",":").replaceAll(' :',':');
  2197. if(/参赛ID:(.*)/.test(bet_html))
  2198. {
  2199. sign_info.id = /参赛ID:(.*)/.exec(bet_html)[1].trim();
  2200. sign_info.team = /参赛队伍名:(.*)/.exec(bet_html)[1].trim();
  2201. }
  2202. else
  2203. {
  2204. console.log(bet_html);
  2205. }
  2206. if(/备用ID:(.*)/.test(bet_html))
  2207. {
  2208. sign_info.id2 = /备用ID:(.*)/.exec(bet_html)[1].trim();
  2209. }
  2210.  
  2211. if(/队员1:(.*)/.test(bet_html))
  2212. {
  2213. if(/队员1:(.*)/.exec(bet_html)[1])
  2214. {
  2215. sign_info.p1 = /队员1:(.*)/.exec(bet_html)[1].trim();
  2216. sign_info.p2 = /队员2:(.*)/.exec(bet_html)[1].trim();
  2217. sign_info.p3 = /队员3:(.*)/.exec(bet_html)[1].trim();
  2218. sign_info.p4 = /队员4:(.*)/.exec(bet_html)[1].trim();
  2219. }
  2220. }
  2221. if(/队员5:(.*)/.test(bet_html))
  2222. {
  2223. sign_info.p5 = /队员5:(.*)/.exec(bet_html)[1].trim();
  2224. }
  2225.  
  2226. if(sign_info.floor<=32)
  2227. {
  2228. bets_copy += '{floor} {team} {author} {id2} {p1} {p2} {p3} {p4} {p5}'.format(sign_info);
  2229. }
  2230. else
  2231. {
  2232. bets_copy += '{floor} {author} {v} {id} {id2} {team} {group}'.format(sign_info);
  2233. }
  2234. }
  2235. else if (/正式报名帖/.test(localTitle) && /冲刺赛/.test(localTitle)){
  2236. let sign_info ={};
  2237. sign_info.author = points_item.author;
  2238. sign_info.floor = points_item.floor;
  2239.  
  2240. sign_info.v = author_info.v.replace(' 點','');
  2241. sign_info.group = author_info.group;
  2242. sign_info.c = author_info.c;
  2243. sign_info.reg = author_info.r;
  2244. sign_info.id = '';
  2245. sign_info.team = '';
  2246. sign_info.id2 = '';
  2247. sign_info.p1 = '';
  2248. sign_info.p2 = '';
  2249. sign_info.p3 = '';
  2250. sign_info.p4 = '';
  2251. sign_info.p5 = '';
  2252. //console.log(bet_html);
  2253.  
  2254. bet_html = bet_html.replaceAll(":",":").replaceAll(' :',':');
  2255. if(/参赛ID:(.*)/.test(bet_html))
  2256. {
  2257. sign_info.id = /参赛ID:(.*)/.exec(bet_html)[1].trim();
  2258. }
  2259. else
  2260. {
  2261. console.log(bet_html);
  2262. }
  2263. if(/备用ID:(.*)/.test(bet_html))
  2264. {
  2265. sign_info.id2 = /备用ID:(.*)/.exec(bet_html)[1].trim();
  2266. }
  2267.  
  2268. bets_copy += '{floor} {author} {id2} {v} {c}'.format(sign_info);
  2269. }
  2270. else
  2271. {
  2272. //console.log(author_info.name + ' ' + points_item.author);
  2273. 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);
  2274. bets_copy += bet_html;
  2275. bets_copy += '\r\n';
  2276. bets_copy = bets_copy.replace(/^[\r\n\s\f\t\v]+/gm, "");
  2277.  
  2278. let tipad = $('.tipad', $(bet).parent().parent().parent()).text().replaceAll('\r','').replaceAll('\n','').replaceAll('\t','');
  2279. bets_copy += tipad;
  2280. }
  2281. }
  2282. else
  2283. {
  2284. let bets_copy_item = '';
  2285. let re_bet= /((下注|站邊)(球|选)\S:|:)(\s*)(?<team>[^<]*)/g;// /(\d+)\.(\S*?)(:|:)(\s*)(?<team>.*)/g;
  2286.  
  2287. if(/竞猜|投票/.test(localTitle))
  2288. {
  2289. re_bet= /(\d+)\.(\S*?)(:|:)(\s*)(?<team>[^<]*)/g;// /(\d+)\.(\S*?)(:|:)(\s*)(?<team>.*)/g;
  2290. }
  2291. var ms = bet_html.match(re_bet);
  2292.  
  2293. $.each(ms, function(k, m){
  2294. //console.log(m + ' ' + m.match(/(:|:)\s*(?<team>.*)/));
  2295. let mc = m.match(/((\S*?)\S:|:)(\s*)(?<team>[^<]*)/);//m.match(/(下注(球|选)\S:|:)(\s*)(?<team>[^<]*)/);//m.match(/\d+\.(\S)(:|:)\s*(?<team>.*)<br/g);
  2296.  
  2297. //console.log(mc);
  2298. if(mc != null)
  2299. {
  2300. var bet_item = mc.groups['team'].trim().replace('<br>','').trim();
  2301. bet_item = bet_item.replace(/^[ |&nbsp;]+$/,'');
  2302.  
  2303. if(bet_item != '') // && !/^[ ]+$/.test(bet_item)
  2304. {
  2305. points_item.bet_count += 1;
  2306. }
  2307. //if(/^\d+$/.test(bet_item))
  2308. //{
  2309. // bet_item = '\''+bet_item
  2310. //}
  2311. bets_copy_item += ' '+ bet_item;
  2312. }
  2313. else
  2314. {
  2315. bets_copy_item += ' ';
  2316. }
  2317.  
  2318. if(i==0)
  2319. {
  2320. copy_head += ' ' + (k+1);
  2321. }
  2322. });
  2323.  
  2324. bets_copy += copy_tample.format(points_item) + bets_copy_item;
  2325. }
  2326.  
  2327. bets_copy += '\r\n';
  2328. })
  2329.  
  2330. if(page == 1 && G.get('betsCopyHead') && !G.get('betsCopyOnlyBets'))
  2331. {
  2332. bets_copy = '{0}\r\n{1}'.format(copy_head,bets_copy);
  2333. }
  2334.  
  2335. //let page = parseInt(getQueryVariable('page'));
  2336. //page = isNaN(page) ? 1 : parseInt(page);
  2337.  
  2338. GM_setClipboard(bets_copy,'text');
  2339.  
  2340. message('下注信息提取到剪贴板,当前第 {0} 页'.format(page), 5);
  2341. }
  2342.  
  2343.  
  2344.  
  2345.  
  2346. //提取算分信息
  2347. function get_game_info()
  2348. {
  2349. var postid = 0;
  2350. var fid = 23;
  2351. var month = '';
  2352. var game_name = $('.t.t2 tr.do_not_catch th:first b:first').text().trim();
  2353.  
  2354. if((/[a-zA-z]+:\/\/[^\s]*\.html/).test(localHref)){
  2355. postid = localHref.substring(localHref.lastIndexOf('/')+1, localHref.lastIndexOf('.'));
  2356. var m = localHref.match(/\/(\d{4})\/(\d{2})\/(\d{6,})\.html/);
  2357.  
  2358. month = m[1];
  2359. fid = m[2];
  2360. }
  2361.  
  2362. if((/read.php\?tid=(\d*)*/).test(localHref)){
  2363. postid = getQueryVariable('tid');
  2364. tid = postid;
  2365.  
  2366. if((/page=(\d*)*/).test(localHref)){
  2367. page = getQueryVariable('page');
  2368. };
  2369. }
  2370.  
  2371. var title = $('#conttpc').prevAll('h4.f16').text();
  2372. var data = [];
  2373. var idx = {};
  2374.  
  2375. var trs = $('#conttpc table tr').not($('#conttpc table tr:has("td[colspan]")'));
  2376. $.each($(trs).eq(0).find('td'), function(i,item) {
  2377.  
  2378. //$(trs).eq(0);
  2379.  
  2380. var tmp_head = $(item).text().trim();
  2381.  
  2382. var key =eval('/'+ G.get('zhiboCodeLM') +'/');
  2383. if(tmp_head.match(key) != null)
  2384. {
  2385. idx.lm = i;
  2386. }
  2387. key =eval('/'+ G.get('zhiboCodeTime') +'/');
  2388. if(tmp_head.match(key) != null)
  2389. {
  2390. idx.time = i;
  2391. }
  2392. key =eval('/'+ G.get('zhiboCodeTa') +'/');
  2393. if(tmp_head.match(key) != null)
  2394. {
  2395. idx.ta = i;
  2396. }
  2397. key =eval('/'+ G.get('zhiboCodePK') +'/');
  2398. if(tmp_head.match(key) != null)
  2399. {
  2400. idx.pk = i;
  2401. }
  2402.  
  2403. key =eval('/'+ G.get('zhiboCodeTb') +'/');
  2404. if(tmp_head.match(key) != null)
  2405. {
  2406. idx.tb = i;
  2407. }
  2408. });
  2409.  
  2410.  
  2411. $.each(trs, function(i,item) {
  2412.  
  2413. var game = {};
  2414. var $td = $('td',item);
  2415. if($td.length<3) return;
  2416. game.time = '';
  2417. game.bf = i == 0 ? '比分' : '比分'+i;
  2418. game.win = '走盘';
  2419. game.half = 0;
  2420.  
  2421. if(idx.time > -1)
  2422. {
  2423. game.time = $td.eq(idx.time).text().trim();
  2424. }
  2425. //game.lm = $td.eq(idx.lm).text().trim();
  2426. game.ta = $td.eq(idx.ta).text().trim();
  2427. game.pk = $td.eq(idx.pk).text().trim();
  2428. game.tb = $td.eq(idx.tb).text().trim();
  2429. game.pi = tid;
  2430.  
  2431. game.tid = '{0}_{1}'.format(postid,i);
  2432. game.bf_a = '';
  2433. game.bf_b = '';
  2434. game.state = '';
  2435. game.checked = '';
  2436. game.half_show = '';
  2437. game.css_a = '';
  2438. game.css_b = '';
  2439.  
  2440. if(game.lm+game.ta == '') return;
  2441.  
  2442. data.push(game);
  2443. });
  2444.  
  2445. var new_data = [];
  2446.  
  2447.  
  2448. var cache_key = 'pf_game_data_' + postid;
  2449. localStorage.setItem(cache_key, JSON.stringify(data));
  2450. get_game_data();
  2451. }
  2452.  
  2453. function get_game_data(){
  2454. if($('#pf_board').length == 0)
  2455. {
  2456. let pf_board_show = GM_getValue('pf_board_show') == 1 ? '' : 'hide';
  2457. let pf_board_show_text = GM_getValue('pf_board_show') == 1 ? '隐藏面板' : '显示面板';
  2458.  
  2459. //console.log(pf_board_show);
  2460.  
  2461. $('body').append(`<div id="pf_board">
  2462. <div class="item_list ${pf_board_show}"></div>
  2463. <div class="tools"><input type="button" id="save_game" value="保存(算分)"> <input type="button" id="hide_tools"
  2464. value="${pf_board_show_text}"> <input type="button" id="clear_pf_data" value="清空数据">
  2465. </div>
  2466. </div>`);
  2467. }
  2468. var game_data = getPingFenData();
  2469.  
  2470. if(game_data == '' || game_data == null || game_data.length == 0)
  2471. {
  2472. GM_setValue('auto_settle_up',0);
  2473. get_game_info();
  2474. }
  2475.  
  2476. game_data = JSON.parse(game_data);
  2477.  
  2478. //console.log(data);
  2479. var htm_tmp = '<div id="id_{pi}_{index}" pi="{pi}" i="{index}" class="item">{index}、<span class="tm"><span class="tm_a {css_a}" i="{index}">{ta}</span> <span class="tm_pk s3 {css_c}" i="{index}">{pk}</span> <span class="tm_b {css_b}" i="{index}">{tb}</span><span class="check_half {half_show}"><input class="check" {checked} type="checkbox">赢半</span>';
  2480. htm_tmp += '<input type="hidden" value="{ta}" name="ta"><input type="hidden" value="{tb}" name="tb"><input type="hidden" value="{pk}" name="pk"><input type="hidden" value="{tid}" name="tid"><input type="hidden" value="{half}" name="half"><input type="hidden" value="{win}" name="win_team">';
  2481. htm_tmp += '</div>'
  2482.  
  2483.  
  2484. var htm_pk_tmp = '<div class="item pk">{0}</div>';
  2485.  
  2486. var htm = '';
  2487. var key =eval('/'+ G.get('zhiboCodeTa') +'/');
  2488. let tmp_i = 0;
  2489. $.each(game_data, function(index, item){
  2490.  
  2491.  
  2492. tmp_i ++;
  2493. if(item.ta.match(key) != null && item.ta.match('胜') == null)
  2494. {
  2495. tmp_i --;
  2496. return
  2497. }
  2498.  
  2499. item.half_show = item.pk.indexOf('/')>-1 ? '' : 'hide';
  2500. item.css_a = (item.win == item.ta ? 'sred' : '');
  2501. item.css_b = (item.win == item.tb ? 'sred' : '');
  2502. item.css_c = (item.win == item.pk ? 'sred' : '');
  2503.  
  2504. item.index = tmp_i;
  2505. htm += htm_tmp.format(item);
  2506. });
  2507.  
  2508. //htm = '<div class="item_list">{0}</div>'.format(htm);
  2509. //htm += '<div class="tools"><input type="button" id="save_game" value="保存(算分)"> <input type="button" id="hide_tools" value="隐藏面板"> <input type="button" id="clear_pf_data" value="清空数据"><!--input type="button" id="rich_code" value="花里胡哨"> <span class="right"><input type="button" id="clear_data" value="清空数据"> <input type="button" id="close_code" value="关闭"--></div>';
  2510.  
  2511. //console.log(htm);
  2512. $('#pf_board .item_list').html(htm).show();
  2513.  
  2514. $('#hide_tools').click(function() {
  2515. pf_board_toggle();
  2516. //$('#pf_board .item_list').addClass('hide');
  2517. });
  2518.  
  2519. $('#clear_pf_data').click(function() {
  2520. setPingFenData([]);
  2521. GM_setValue('auto_settle_up',0);
  2522. get_game_data();
  2523. });
  2524.  
  2525. /*
  2526. $('#pf_board .tm [class^="tm_"]').click(function (){
  2527.  
  2528. let i = $(this).attr('i');
  2529.  
  2530. if(!$(this).hasClass('sred'))
  2531. {
  2532. $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred');
  2533. $(this).addClass('sred');
  2534. $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val($(this).text());
  2535. }
  2536. else
  2537. {
  2538. $('#id_{0}_{1} .tm [class^="tm_"]'.format(tid, i)).removeClass('sred');
  2539. $('#id_{0}_{1} .tm [name=win_team]'.format(tid, i)).val('走盘');
  2540. }
  2541.  
  2542.  
  2543. save_game();
  2544. });
  2545. */
  2546. }
  2547.  
  2548. function save_game()
  2549. {
  2550. win_item = [];
  2551. new_data = [];
  2552. game_data = JSON.parse(getPingFenData());
  2553. var data = {};
  2554. var new_data = [];
  2555. $.each($('#pf_board .item'), function(index, item){
  2556. data = {};
  2557. data.pi = $(item).attr('pi');
  2558. data.index = $(item).attr('i');
  2559. data.ta = $('input[name=ta]', item).val();
  2560. data.tb = $('input[name=tb]', item).val();
  2561. data.pk = $('input[name=pk]', item).val();
  2562. data.state = $('input[name=state]', item).val();
  2563. data.bf_a = $('input[name=bf_a]', item).val();
  2564. data.bf_b = $('input[name=bf_b]', item).val();
  2565. data.win = $('input[name=win_team]', item).val();
  2566. data.tid = $('input[name=tid]', item).val();
  2567. data.checked = $('input:checkbox', item).get(0).checked ? 'checked' : '';
  2568.  
  2569. data.half = data.checked == '' ? 0 : 1;
  2570.  
  2571. var win = {};
  2572. win.idx = index;
  2573. win.team = data.win;
  2574. win.half = data.half;
  2575. win.ratio = 1;
  2576.  
  2577. var m = win.team.match(/\[\S+\]/);
  2578. //console.log(m);
  2579. if(m != null)
  2580. {
  2581. win.ratio = parseFloat(m[0].replace('[','').replace(']','').trim(),0).toFixed(2);
  2582. }
  2583.  
  2584. data.css_a = (data.win == data.ta ? 'sred' : '');
  2585. data.css_b = (data.win == data.tb ? 'sred' : '');
  2586.  
  2587. win_item.push(win);
  2588. //console.log($('input[name=win_team]', item).val());
  2589. new_data.push(data);
  2590. });
  2591.  
  2592. game_data = new_data;
  2593.  
  2594.  
  2595. game_data = new_data;
  2596. //console.log(JSON.stringify(game_data));
  2597. //console.log(JSON.stringify(game_data));
  2598. setPingFenData(game_data);
  2599.  
  2600. settle_up();
  2601. }
  2602.  
  2603.  
  2604. var points_tips = '<div class="points_tips">{0}</div>';
  2605. //保存
  2606. function settle_up(){
  2607.  
  2608. ///删除点评
  2609. $('.post_comm').remove();
  2610. GM_setValue('auto_settle_up',1);
  2611. //console.log(JSON.stringify(win_item));
  2612. let points_list_copy = '';
  2613. let copy_tample = '{floor} {author} {bet_points} {bet_count} {points} {team} {tips}\r\n';//'{0} {1} {2}\r\n';
  2614. $.each($("div[id^='cont']:not(#conttpc)"), function(i, bet) {
  2615. var ratio = 0;
  2616. var points = 0;
  2617. var bet_points = 0;
  2618.  
  2619. var bet_html = $(bet).html().replaceAll('>','>\r\n').replaceAll('球隊','球队');
  2620.  
  2621.  
  2622. var re_bet= /(下注(球|选)\S(:|:))(\s*)(?<team>[^<]*)/g; ///下注(球|选)(\S)(:|:)\s*(?<team>.*?)<br/g;
  2623. var points_bet=/(下注点数|下註點數|點數|点数)(:|:|\s{1})\s*(?<points>\d+)/;
  2624. var mp = bet_html.match(points_bet);
  2625. if(mp!= null)
  2626. {
  2627. bet_points = parseInt(mp.groups['points'].trim());
  2628. }
  2629.  
  2630. //无下注点数情况下冲刺赛模式
  2631. let key = eval('/'+ G.get('suanfenCCScoreKey') +'/');
  2632. if(key.test(localTitle) && bet_points==0)
  2633. {
  2634. let cc_points = parseInt(G.get('suanfenCCScorePoints'));
  2635.  
  2636. if(!isNaN(cc_points))
  2637. {
  2638. bet_points = cc_points;
  2639. }
  2640. }
  2641.  
  2642. //console.log(mp);
  2643.  
  2644. let points_item = {};
  2645. points_item.author = $('.r_two b:first', $(bet).parent().parent()).text().replace('[樓主]','');
  2646. points_item.floor = $('.tipad .s3', $(bet).parent().parent().parent()).text();
  2647. points_item.bet_count = 0;
  2648. points_item.bet_points = bet_points;
  2649. points_item.tips = '';
  2650. points_item.team = '';
  2651.  
  2652. let author_html = $('.r_two',$(bet).parent().parent().parent()).text().trim().replace(/\n/,'');
  2653. author_html = author_html.replace(/^[\r\n\s\f\t\v\o]+/gm, "");
  2654.  
  2655. //console.log(author_html);
  2656.  
  2657. let author_info = {};
  2658. ///級別:(.*)/;
  2659. author_info.name = points_item.author;
  2660.  
  2661. if(/級別:(.*)/.test(author_html))
  2662. {
  2663. author_info.group = /級別:(.*)/.exec(author_html)[1];
  2664. author_info.p = /發帖:(.*)/.exec(author_html)[1];
  2665. author_info.v = /威望:(.*)/.exec(author_html)[1];
  2666. author_info.u = /金錢:(.*)/.exec(author_html)[1];
  2667. author_info.g = /貢獻:(.*)/.exec(author_html)[1];
  2668. author_info.c = /認證:(.*)/.test(author_html) ? /認證:(.*)/gs.exec(author_html)[1].trim() : "";
  2669. author_info.c =author_info.c.replaceAll(" ","").replaceAll('\t','').replaceAll('\r','').replaceAll('\n','');
  2670. }
  2671.  
  2672. points_item.group = author_info.group;
  2673.  
  2674. if(/論壇版主/.test(author_info.group) && !/下注点数/.test(bet_html))
  2675. {
  2676. return;
  2677. }
  2678.  
  2679.  
  2680. //超级别验证
  2681. if(bet_points>0)
  2682. {
  2683. if(!check_level(author_info.group, bet_points))
  2684. {
  2685. points_item.tips += points_item.tips == '' ? '' : '、';
  2686. points_item.tips += '超級別下注';
  2687. console.log('{author} {floor} 超級別下注'.format(points_item));
  2688. }
  2689. }
  2690.  
  2691. if(/重新編輯/.test(bet_html))
  2692. {
  2693. points_item.tips += points_item.tips == '' ? '' : '、';
  2694. points_item.tips += '重新編輯';
  2695. bet_html = bet_html.replace(/<font color="gray">(.*)重新編輯 ]<\/font>/g,'');
  2696. }
  2697.  
  2698. var ms = bet_html.match(re_bet);
  2699.  
  2700. //console.log(ms);
  2701. if(points_item.author=='舞者飞扬')
  2702. {
  2703. console.log(bet_html);
  2704. }
  2705. $.each(ms, function(k, m){
  2706. if(win_item[k] == null)
  2707. {
  2708. //console.log(k);
  2709. return;
  2710. }
  2711. var win = win_item[k];
  2712.  
  2713. //console.log(m);
  2714. var half = win.half > 0 ? 0.5 : 1;
  2715.  
  2716. if(points_item.author=='舞者飞扬')
  2717. {
  2718. console.log(m);
  2719. }
  2720.  
  2721. /*
  2722. var re_bet= /(下注球隊:|:)(\s*)(?<team>[^<]*)/g;// /(\d+)\.(\S*?)(:|:)(\s*)(?<team>.*)/g;
  2723. var ms = bet_html.match(re_bet);
  2724.  
  2725. $.each(ms, function(k, m){
  2726. //console.log(m + ' ' + m.match(/(:|:)\s*(?<team>.*)/));
  2727. let mc = m.match(/(下注球隊:|:)(\s*)(?<team>[^<]*)/);//m.match(/\d+\.(\S)(:|:)\s*(?<team>.*)<br/g);
  2728.  
  2729. //console.log(mc);
  2730. if(mc != null)
  2731. {
  2732. points_item.bet_count += 1;
  2733. var bet_item = mc.groups['team'].trim().replace('<br>','');
  2734. //if(/^\d+$/.test(bet_item))
  2735. //{
  2736. // bet_item = '\''+bet_item
  2737. //}
  2738. bets_copy_item += ' '+ bet_item;
  2739. }
  2740. else
  2741. {
  2742. bets_copy_item += ' ';
  2743. }
  2744. */
  2745.  
  2746. let mc = m.match(/(下注(球|选)(\S)(:|:))(\s*)(?<team>[^<]*)/);
  2747.  
  2748. if(mc != null)
  2749. {
  2750. var bet_item = mc.groups['team'].trim().replace('<br>','');//mc.groups['team'].trim().replaceAll('&nbsp;','').replaceAll(' ','');
  2751.  
  2752. bet_item = bet_item.replace(/^[ |&nbsp;]+$/,'').trim();
  2753.  
  2754. if(bet_item == '') return;
  2755. points_item.bet_count += 1;
  2756.  
  2757. //积分赛制匹配关键字
  2758. var key = eval('/'+ G.get('suanfenScoreKey') +'/');
  2759. if(localTitle.match(key) != null)
  2760. {
  2761. var score_points = {};
  2762. score_points.win = 3;
  2763. score_points.draw = 0;
  2764. score_points.lose = -1;
  2765.  
  2766. $.each(G.get('suanfenScorePoints').split(','), function(i, item){
  2767. if(i==0) score_points.win = parseInt(item);
  2768. if(i==1) score_points.draw = parseInt(item);
  2769. if(i==2) score_points.lose = parseInt(item);
  2770. });
  2771. //console.log(score_points);
  2772. bet_points = (bet_points == 0 ? 1 : bet_points);
  2773. points_item.bet_points = bet_points;
  2774. if(win.team=='走盘')
  2775. {
  2776. if(score_points.draw==0)
  2777. {
  2778. return;
  2779. }
  2780.  
  2781. ratio += score_points.draw * half;
  2782. }
  2783. else if(bet_item==win.team)
  2784. {
  2785. ratio += score_points.win * half;
  2786. }
  2787. else
  2788. {
  2789. ratio += score_points.lose * half;
  2790. }
  2791. }
  2792. else
  2793. {
  2794.  
  2795. if(win.team=='走盘') return;
  2796. if(bet_item==win.team)
  2797. {
  2798. if(/F1|赛马|波胆|菜农斗地主/.test(localTitle))
  2799. {
  2800. ratio += (win.ratio-1) * half;
  2801. }
  2802. else
  2803. {
  2804. ratio += win.ratio * half;
  2805. }
  2806. }
  2807. else
  2808. {
  2809.  
  2810. key = eval('/'+ G.get('suanfenCCScoreKey') +'/');
  2811. if(!key.test(localTitle))
  2812. {
  2813. ratio -= 1 * half;
  2814. }
  2815. }
  2816. }
  2817. }
  2818. });
  2819.  
  2820. points = Math.round(bet_points*ratio);
  2821. //淘汰赛保持赢半小数点
  2822. if(/团体PK/.test(localTitle))
  2823. {
  2824. points = bet_points*ratio;
  2825. }
  2826.  
  2827.  
  2828. if(bet_points == 0 && points == 0)
  2829. {
  2830. points = '下注点数为0';
  2831. }
  2832.  
  2833. var tips = $('.points_tips', bet);
  2834. $(bet).css({position:'relative'});
  2835. if($(tips).length == 0)
  2836. {
  2837. $(bet).append(points_tips.format(points));
  2838. }
  2839. else
  2840. {
  2841. $(tips).text(points);
  2842. }
  2843.  
  2844.  
  2845. //bet_html = bet_html.replaceAll('<br>','\r\n').replaceAll('<br/>','\r\n').replaceAll('<br />','\r\n');
  2846. bet_html = bet_html.replaceAll('&nbsp;','');
  2847. bet_html = bet_html.replaceAll(":",":").replaceAll(' :',':');
  2848.  
  2849. if(/编号/.test(bet_html))
  2850. {
  2851. if(!(/编号:/.test(bet_html)))
  2852. {
  2853. //处理编号格式不对问题
  2854. bet_html = bet_html.replace('编号','编号:');
  2855. }
  2856. points_item.team = /编号:([^<]*)/.exec(bet_html)[1].trim();
  2857.  
  2858. //console.log(/队伍编号:(.*)/.exec(bet_html));
  2859. }
  2860.  
  2861. mp = points_item.floor.match(/(?<floor>\d+)/);
  2862. if(mp != null)
  2863. {
  2864. points_item.floor = parseInt(mp.groups['floor'].trim());
  2865. }
  2866.  
  2867. points_item.points = points;
  2868. points_list_copy += copy_tample.format(points_item);//(points,points,points);
  2869. })
  2870. //111 2 2
  2871. //测试 111 222
  2872. GM_setClipboard(points_list_copy,'text');
  2873. }
  2874.  
  2875. function clearImg()
  2876. {
  2877. var txt = $('#textarea').val();
  2878. txt = txt.replace(/\[url(.*?)\](.*?)\[\/url\](\s{0,2})/gi,'$2\n');
  2879. //txt = txt.replace(/(\r\n){2,}/g,'\r\n');
  2880. $('#textarea').val(txt);
  2881. }
  2882.  
  2883. function personalFix(){
  2884. if (localHref.match(/personal.php/) == null ){
  2885. return;
  2886. }
  2887.  
  2888. $('#main div.t3:eq(1) table td div.t:eq(1) tr.tr3').each(function() {
  2889. var $tr = $(this);
  2890.  
  2891. var $tal = $tr.find('th.tal');
  2892. var $td_reply = $tr.find('td:eq(2)');
  2893. var $td_like = $tr.find('td:eq(3)');
  2894. var $td_time = $tr.find('td:eq(4)');
  2895.  
  2896. var tid = 0;
  2897. var title = '';
  2898.  
  2899. var pattern = /read.php\?tid=(?<tid>\d*).*?>(?<title>.*?)</
  2900.  
  2901. var res = pattern.exec($tal.html());
  2902. if(res.length>2)
  2903. {
  2904. tid = res[1];
  2905. title = res[2];
  2906. }
  2907.  
  2908.  
  2909. if(tid>0)
  2910. {
  2911.  
  2912. var $link = '<a href="/read.php?tid=' + tid + '&toread=5" target="_blank">' + $td_time.html() + '</a>'; //按时间排序
  2913. $td_time.html($link);
  2914.  
  2915. $link = '<a href="/read.php?tid=' + tid + '&toread=1&page=e" target="_blank">' + $td_reply.html() + '</a>'; //最后一页
  2916. $td_reply.html($link);
  2917. }
  2918. var count_like = parseInt($td_like.text());
  2919. if(count_like>0)
  2920. {
  2921. $td_like.html('<a href="/message.php?action=likes&type=id&id=' + tid + '" target="_blank">' + $td_like.html() + '</a>');
  2922. }
  2923.  
  2924. });
  2925.  
  2926. }
  2927.  
  2928. function Funny() {
  2929. let name_list = '好大的风';
  2930.  
  2931. $('body .t').each(function(i, item){
  2932. var tpc_content = $.trim($('.tpc_content', this).text());
  2933. //var tpc_auther_html = $('.tr1 th:first b:first', this);
  2934. var tpc_author = $.trim($('.tr1 th:first b:first', this).text()).replace(/\s\S*/,'');
  2935. var tpc_floor = $.trim($('.tipad .s3', this).text()).replace(/[^0-9]/ig,'');
  2936. var tpc_author_html = $('.tr1 th:first', this);
  2937.  
  2938. //$(tpc_auther_html).html()
  2939. if(eval(`/${name_list}/`).test(tpc_author)){
  2940. //console.log(tpc_author);
  2941. //let author_html = $('.r_two',$(bet).parent().parent().parent()).html();
  2942. //console.log(tpc_author_html);
  2943. ///級別:(.*)/ 論壇版主 ( 5 )
  2944. //
  2945. }
  2946. });
  2947. }
  2948.  
  2949. function judgeTime(date){
  2950. var today = new Date()
  2951. today.setHours(0);
  2952. today.setMinutes(0);
  2953. today.setSeconds(0);
  2954. today.setMilliseconds(0);
  2955. var otime = today.getTime()
  2956. //给出时间 - 今天0点
  2957. var offset= date-otime
  2958. var isToday = offset/1000/60/60
  2959. isToday = parseInt(isToday);
  2960.  
  2961. if(isToday >= 0 && isToday < 24){
  2962. return "今天"
  2963. }else if(isToday < 0 && isToday >= -24){
  2964. return "昨天"
  2965. }else {
  2966. return ""
  2967. }
  2968. }
  2969.  
  2970.  
  2971. ///提示消息,定时关闭,默认秒
  2972. function message(msg, time)
  2973. {
  2974. var msgbox = $('#zhibo_tools_message');
  2975. if($(msgbox).length == 0)
  2976. {
  2977. $('body').append('<div id="zhibo_tools_message"></div>');
  2978. $('#zhibo_tools_message').click(function() { $(this).hide();});
  2979. }
  2980. msgbox = $('#zhibo_tools_message');
  2981.  
  2982. let win_width = $(window).width();
  2983.  
  2984. let left = (win_width - $(msgbox).width())/2;
  2985.  
  2986. $(msgbox).css({left:left}).html(msg).show();
  2987.  
  2988. if(typeof(time) == 'number')
  2989. {
  2990. clearTimeout(st);
  2991. var st = setTimeout(function() {
  2992. $('#zhibo_tools_message').hide();
  2993. }, time*1000);
  2994. }
  2995. }
  2996.  
  2997. function check_limit_time(post_time){
  2998. let tips = '';
  2999.  
  3000. return tips;
  3001. }
  3002.  
  3003. function check_level(group, bet_points){
  3004.  
  3005. //不验证超级别下注类型
  3006. //if(/赛马|賽馬|赛狗|賽狗|串一|串串|F1|波胆|欧赔|對賭|对赌|合體|合体|互怼|大乱斗/.test(localTitle)){
  3007. // return true;
  3008. //}
  3009.  
  3010. if(!(/场次|特别盘/.test(localTitle))){
  3011. return true;
  3012. }
  3013.  
  3014. let item = {};
  3015. item.group = group//.substr(0, 2);
  3016. item.bet_points = bet_points;
  3017. item.limit_points = 0;
  3018.  
  3019. if(/禁止發言/.test(item.group))
  3020. {
  3021. return true;
  3022. }
  3023.  
  3024. switch(true)
  3025. {
  3026. case /天使/.test(item.group):
  3027. item.limit_points = 50;
  3028. break;
  3029. case /光明|風雲/.test(item.group):
  3030. item.limit_points = 40;
  3031. break;
  3032. case /精靈|聖騎|騎士/.test(item.group):
  3033. item.limit_points = 30;
  3034. break;
  3035. default:
  3036. item.limit_points = 0;
  3037. break;
  3038. }
  3039.  
  3040. //console.log(item);
  3041.  
  3042. return (item.bet_points <= item.limit_points);
  3043. }
  3044.  
  3045. function getUrlParam(name, url)
  3046. {
  3047. //window.location.search.substr(1)
  3048. var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
  3049. var r = url.match(reg); //匹配目标参数
  3050. if (r!=null)
  3051. return unescape(r[2]);
  3052.  
  3053. return null; //返回参数值
  3054. }
  3055.  
  3056. function getQueryVariable(variable)
  3057. {
  3058. var query = window.location.search.substring(1);
  3059. var vars = query.split("&");
  3060. for (var i=0;i<vars.length;i++) {
  3061. var pair = vars[i].split("=");
  3062. if(pair[0] == variable){return pair[1];}
  3063. }
  3064. return(false);
  3065. }
  3066.  
  3067. function addStyle(css) {
  3068. var pi = document.createProcessingInstruction(
  3069. 'xml-stylesheet',
  3070. 'type="text/css" href="data:text/css;utf-8,' + encodeURIComponent(css) + '"'
  3071. );
  3072. return document.insertBefore(pi, document.documentElement);
  3073. }
  3074. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址