兔兔兔区+

屏蔽用户|屏蔽帖子|ID统计|帖内搜索|发帖记录直达|快捷举报|楼主标记|只看TA|白色主题夜间主题去广告

  1. // ==UserScript==
  2. // @name 兔兔兔区+
  3. // @namespace https://gf.qytechs.cn/zh-CN/scripts/411262-%E5%85%94%E5%85%94%E5%85%94%E5%8C%BA
  4. // @version 2.1.8
  5. // @description 屏蔽用户|屏蔽帖子|ID统计|帖内搜索|发帖记录直达|快捷举报|楼主标记|只看TA|白色主题夜间主题去广告
  6. // @author chinshry
  7. // @include https://bbs.jjwxc.net/bindex.php*
  8. // @include https://bbs.jjwxc.net/board.php*
  9. // @include https://bbs.jjwxc.net/newpost.php*
  10. // @include https://bbs.jjwxc.net/showmsg.php*
  11. // @include https://bbs.jjwxc.net/search.php*
  12. // @include https://bbs.jjwxc.net/filterword.php*
  13. // @include https://bbs.jjwxc.net/backend/filterReader.php*
  14. // @include https://bbs.jjwxc.net/userinfo.php*
  15. // @include https://bbs.jjwxc.net/postbypolice.php*
  16. // @license GPL-3.0 License
  17. // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js
  18. // ==/UserScript==
  19.  
  20.  
  21. const IS_DARK_MODE = Boolean(Number(localStorage.getItem('themeJJ') == null ? 0 : localStorage.getItem('themeJJ')));
  22. const bgColor = IS_DARK_MODE ? '#1A1A1A' : 'white';
  23. const bgCss = { "background-color": bgColor };
  24. const borderCss = { "border-color": bgColor, "border": "none" };
  25.  
  26. const pathname = window.location.pathname;
  27. const IS_NEWPOST = pathname.indexOf('newpost') >= 0;
  28. const IS_BOARD = IS_NEWPOST || pathname.indexOf('board') >= 0;
  29. const IS_POST = pathname.indexOf('showmsg') >= 0;
  30. const IS_SEARCH = pathname.indexOf('search') >= 0;
  31. const IS_FILTER = pathname.indexOf('filterword') >= 0 || pathname.indexOf('filterReader') >= 0;
  32.  
  33. (function($) {
  34. 'use strict';
  35.  
  36. const BOARD_ID = IS_BOARD || IS_POST || IS_SEARCH ? getPageParams('board') : '';
  37. const POST_ID = IS_POST ? getPageParams('id') : '';
  38. const PAGE = IS_POST ? getPageParams('page') : '';
  39. const BOARD_TYPE = IS_BOARD ? getPageParams('type') : '';
  40.  
  41. var page_count = 0
  42. var id_all = {}
  43. var reply_all = []
  44. var replyStrBody = ''
  45. var dataSortIndex = []
  46.  
  47. console.log("BOARD_ID = " + BOARD_ID);
  48. console.log("POST_ID = " + POST_ID);
  49.  
  50. var Style = {
  51. init() {
  52. if(IS_DARK_MODE){
  53. addGlobalStyle('*', { color: "#B2B2B2" });
  54. }
  55. addGlobalStyle('body', bgCss);
  56. addGlobalStyle('.blockUI.blockMsg', bgCss);
  57. addGlobalStyle('.blockUI.blockMsg', { border: "1px solid #000000" });
  58. addGlobalStyle('tr', bgCss);
  59. addGlobalStyle('td', bgCss);
  60.  
  61. var themeChangeButton = document.createElement("div");
  62. themeChangeButton.className = "themeButton";
  63. themeChangeButton.style.cssText = "width:35px;height:35px;top: 20px;right: 15px;cursor:pointer;border:1px solid #666666;position: fixed;z-index: 10000; font-size: small;line-height: 35px;text-align: center;border-radius: 20px;";
  64. themeChangeButton.style.backgroundColor = 'white';
  65. themeChangeButton.style.color = 'black';
  66. themeChangeButton.textContent = "换肤";
  67. document.getElementsByTagName("body")[0].appendChild(themeChangeButton);
  68. },
  69. removeAD() {
  70. $('.width_300').parent().remove();
  71. },
  72. board() {
  73. Style.removeAD()
  74. const reportNode = document.createElement('script');
  75. reportNode.type = 'text/javascript';
  76. reportNode.src = '/scripts/userreport.js?ver=20200202';
  77. document.head.appendChild(reportNode);
  78. if (IS_NEWPOST){
  79. const blockUItNode = document.createElement('script');
  80. blockUItNode.type = 'text/javascript';
  81. blockUItNode.src = '//static.jjwxc.net/scripts/jquery.blockUI.pack.js';
  82. document.head.appendChild(blockUItNode);
  83. }
  84.  
  85. addGlobalStyle('a:link', { color: IS_DARK_MODE ? '#b2b2b2' :'#161616' });
  86. addGlobalStyle('a:visited', { color: '#808080' });
  87. addGlobalStyle('a:hover', { color: '#bf7326' });
  88.  
  89. addGlobalStyle('a.board-bam:link', { color: '#669900' });
  90. addGlobalStyle('a.board-bam:hover', { color: '#bf7326' });
  91.  
  92. addGlobalStyle('a.board-report:link', { color: '#669900' });
  93. addGlobalStyle('a.board-report:hover', { color: '#bf7326' });
  94. },
  95. search() {
  96. Style.removeAD();
  97. addGlobalStyle('table', { "border-color": bgColor });
  98. },
  99. page() {
  100. addGlobalStyle('.page-reply:link', { color: IS_DARK_MODE ? '#b2b2b2' :'#000000' });
  101. addGlobalStyle('.page-reply:hover', { color: '#bf7326' });
  102. addGlobalStyle('.page-reply:visited', { color: '#808080' });
  103. addGlobalStyle('table', borderCss);
  104. addGlobalStyle('td', borderCss);
  105. for (var i = 1; i < 25; i++) {
  106. changeImgBg(i)
  107. }
  108. $('#imgurl').remove()
  109. $('.ad360_box').remove()
  110. $('.textbook').remove()
  111. },
  112. filter() {
  113. addGlobalStyle('b', { "margin-left": '15px' });
  114. },
  115. idCount(){
  116. var div_side_bar = document.createElement("div");
  117. div_side_bar.id = "countIDButton";
  118. div_side_bar.textContent = 'ID统计'
  119. div_side_bar.style.cssText = 'cursor: pointer;font-size: 12px;line-height: 20px;width: 56px;height: 20px;text-align: center;overflow: hidden;position: fixed;right: 0px;top: 70px;padding: 4px 4px;background-color: white;z-index: 10001;border-radius: 8px 0px 0px 8px;box-shadow: rgba(0, 85, 255, 0.0980392) 0px 0px 20px 0px;border: 1px solid rgb(233, 234, 236);';
  120. div_side_bar.style.color = 'black';
  121. $('#boardname').first().after(div_side_bar);
  122.  
  123. var div_data = document.createElement("div");
  124. div_data.id = 'countIDList'
  125. div_data.style.cssText = 'display: none;position: fixed;height: 85%;width: 350px;right: 0px;top: 140px;z-index: 9999;';
  126. var div_data_inner = document.createElement("div");
  127. div_data_inner.id = 'countIDListInner'
  128. div_data_inner.style.cssText = 'display: block;overflow: hidden;height: inherit;border-radius: 8px;box-shadow: rgba(106, 115, 133, 0.219608) 0px 6px 12px 0px;border: 1px solid black ;background-color: white;overflow: auto; white-space: nowrap;';
  129. var div_data_text = document.createElement("div");
  130. div_data_text.id = 'countIDListText'
  131. div_data_text.style.cssText = 'padding: 10px; box-sizing: border-box;';
  132.  
  133. div_data.append(div_data_inner);
  134. div_data_inner.append(div_data_text);
  135.  
  136. document.body.appendChild(div_data);
  137. },
  138. postSearch(){
  139. var div_side_bar = document.createElement("div");
  140. div_side_bar.id = "postSearchButton";
  141. div_side_bar.textContent = '贴内搜索'
  142. div_side_bar.style.cssText = 'cursor: pointer;font-size: 12px;line-height: 20px;width: 56px;height: 20px;text-align: center;overflow: hidden;position: fixed;right: 0px;top: 105px;padding: 4px 4px;background-color: white;z-index: 10001;border-radius: 8px 0px 0px 8px;box-shadow: rgba(0, 85, 255, 0.0980392) 0px 0px 20px 0px;border: 1px solid rgb(233, 234, 236);';
  143. div_side_bar.style.color = 'black';
  144. $('#boardname').first().after(div_side_bar);
  145.  
  146.  
  147. var div_data = document.createElement("div");
  148. div_data.id = 'postSearchList'
  149. div_data.style.cssText = 'text-align:center; display: none;position: fixed;height: 85%;width: 710px;right: 0px;top: 140px;z-index: 9999;';
  150. var div_data_inner = document.createElement("div");
  151. div_data_inner.id = 'postSearchListInner'
  152. div_data_inner.style.cssText = 'padding: 10px; display: block;overflow: hidden;height: inherit;border-radius: 8px;box-shadow: rgba(106, 115, 133, 0.219608) 0px 6px 12px 0px;border: 1px solid black ;background-color: white;overflow: auto; white-space: nowrap;';
  153. var div_data_text = document.createElement("div");
  154. div_data_text.id = 'postSearchListText'
  155. div_data_text.style.cssText = 'box-sizing: border-box;';
  156.  
  157. var div_data_input = document.createElement("input");
  158. div_data_input.id = 'postSearchInput'
  159. div_data_input.type = 'text'
  160. div_data_input.size = '10'
  161. var div_data_search_btn = document.createElement("input");
  162. div_data_search_btn.id = 'postSearchStart'
  163. div_data_search_btn.type = 'button'
  164. div_data_search_btn.style.cssText = 'margin: 10px 0px 20px 10px;';
  165. div_data_search_btn.value = '搜索'
  166.  
  167. div_data.append(div_data_inner);
  168. div_data_inner.append(div_data_input);
  169. div_data_inner.append(div_data_search_btn);
  170. div_data_inner.append(div_data_text);
  171.  
  172. document.body.appendChild(div_data);
  173. }
  174. }
  175.  
  176. function addGlobalStyle(node, styleParams) {
  177. var styleStr = JSON.stringify(styleParams);
  178. var styleF = styleStr.replace(/"([^"]*)"/g, "$1").replace(/[,]/g, ' !important;').replace('}', ' !important}');
  179. var css = node + styleF;
  180. // console.log(css);
  181. var head = document.getElementsByTagName('head')[0];
  182. if (!head) { return; }
  183. var style = document.createElement('style');
  184. style.type = 'text/css';
  185. style.innerHTML = css;
  186. head.appendChild(style);
  187. }
  188.  
  189. function changeImgBg(imgId) {
  190. var styleStr = JSON.stringify(styleParams)
  191. var styleParams = {
  192. "background-image": "url(img/grzx/" + imgId + ".png)",
  193. "background-size": "100%",
  194. "background-position": "0 0"
  195. }
  196. addGlobalStyle('.image' + imgId, styleParams);
  197. }
  198.  
  199. function getPageParams(key, url) {
  200. var str = '';
  201. if (typeof (url) == "undefined") {
  202. var search = window.location.search;
  203. str = search.substring(1, search.length);
  204. } else {
  205. str = url.split("?")[1];
  206. }
  207. let arr = str.split("&");
  208. let obj = new Object();
  209. for (let i = 0; i < arr.length; i++) {
  210. let tmp_arr = arr[i].split("=");
  211. if (tmp_arr[0] == "keyword") {
  212. obj[tmp_arr[0]] = tmp_arr[1];
  213. } else {
  214. obj[decodeURIComponent(tmp_arr[0])] = decodeURIComponent(tmp_arr[1]);
  215. }
  216. }
  217. return obj[key];
  218. }
  219.  
  220. function initStyle() {
  221. Style.init();
  222. if (IS_BOARD) {
  223. Style.board();
  224. } else if (IS_POST) {
  225. Style.page();
  226. Style.idCount();
  227. Style.postSearch();
  228. } else if (IS_SEARCH) {
  229. Style.search();
  230. } else if (IS_FILTER) {
  231. Style.board();
  232. Style.filter();
  233. } else {
  234. Style.removeAD();
  235. }
  236. }
  237.  
  238. $(function () {
  239. initStyle()
  240. var initNodes = {
  241. board() {
  242. $('#subidform_submit').find('button').eq(0).text("屏蔽设置");
  243. let nodes = $('#msglist').children().children().toArray();
  244.  
  245. if (IS_NEWPOST){
  246. nodes = $('body').find('table').eq(2).children().children().toArray();
  247. }
  248. let blockPosts = localStorage.BlockPosts || '';
  249. let blockUsers = localStorage.BlockUsers || '';
  250. nodes.shift();
  251. for (let node of nodes) {
  252. let reportNode = $(node).find('td').eq(1);
  253. let titleNode = $(node).find('td').eq(3);
  254. let authorNode = $(node).find('td').eq(4);
  255. let title = titleNode[0].innerText;
  256. let url = $(titleNode).children().attr('href');
  257. if (url == undefined) {
  258. url = $(titleNode).children().eq(1).attr('href');
  259. }
  260. let id = getPageParams('id', url);
  261. let authorName = $.trim($(authorNode).text())
  262.  
  263. $(reportNode).children().remove();
  264. $(reportNode).append(`<a class="board-bam" id="${id}" board="${BOARD_ID}" data="${title}" href="javascript:void(0);" style = "font-size:14px">屏蔽</a>`);
  265. $(reportNode).append(`<a class="board-report" href="javascript:;" onclick="userreportshow(${id}, 0, 0, ${BOARD_ID})" style = "font-size:14px">举报</a>`);
  266. $(authorNode).html("");
  267.  
  268. $(authorNode).append(`<a class="board-author" href="https://bbs.jjwxc.net/search.php?act=search&board=${BOARD_ID}&keyword=${authorName}&topic=4" target="_blank">&nbsp${authorName}</font></a>`);
  269.  
  270. if (blockPosts !== '') {
  271. var blockPostsJs = JSON.parse(blockPosts);
  272. if (blockPostsJs.hasOwnProperty(id)) {
  273. $(node).remove();
  274. console.log("已隐藏帖子 " + title);
  275. }
  276. }
  277. if (blockUsers !== '') {
  278. var blockUsersJs = JSON.parse(blockUsers);
  279. if (blockUsersJs.indexOf(authorName) != -1) {
  280. $(node).remove();
  281. console.log("已隐藏 " + authorName + " 发的帖子 " + title);
  282. }
  283. }
  284. }
  285. },
  286. page(start) {
  287. var lzIdenti = $('.authorname').eq(0).find('font').eq(2).text();
  288. console.log("楼主 " + lzIdenti);
  289. let title = $('#msgsubject').text().split("主题:")[1]
  290. let blockUsers = localStorage.BlockUsers || '';
  291.  
  292. $('.authorname').each(function (index, node) {
  293. if (index < start) {
  294. return true;
  295. }
  296.  
  297. var isNormalFloor = start == 0;
  298. console.log("isNormalFloor = " + isNormalFloor);
  299.  
  300. var starNode;
  301. if (isNormalFloor) {
  302. starNode = $(node).find('font').eq(-2);
  303. } else {
  304. starNode = $(node).find('font').eq(-1);
  305. }
  306. $(starNode).text(" " + $(starNode).text().split("来自")[1]);
  307.  
  308. var replyIdNode;
  309. var replyNameNode;
  310. var replyName;
  311.  
  312. if (index == 0) {
  313. var lzAuthornameNode = $('.authorname').eq(0);
  314. replyIdNode = $(node).children().children().eq(2);
  315. $(node).find('a').eq(0).after(`<a class="board-bam" id="${POST_ID}" board="${BOARD_ID}" data="${title}" href="javascript:void(0);" style = "font-size:14px; margin-left:8px">屏蔽该帖</a>`);
  316. replyNameNode = $(replyIdNode).parent().contents()
  317. .filter(function () {
  318. return this.nodeType == Node.TEXT_NODE;
  319. });
  320. } else {
  321. replyIdNode = $(node).children().eq(2);
  322. replyNameNode = $(node).contents()
  323. .filter(function () {
  324. return this.nodeType == Node.TEXT_NODE;
  325. });
  326. }
  327.  
  328. if (index == 0) {
  329. replyName = replyNameNode[0].wholeText.split("|")[0];
  330. replyNameNode[1].replaceData(0, replyNameNode[1].length, replyNameNode[1].wholeText.split("留言")[0]);
  331. $(replyNameNode)[0].remove();
  332. } else if (!isNormalFloor) {
  333. replyName = replyNameNode[2].wholeText.split("|")[0];
  334. replyNameNode[3].replaceData(0, replyNameNode[3].length, replyNameNode[3].wholeText.split("留言")[0]);
  335. $(replyNameNode)[2].remove();
  336. } else {
  337. replyName = replyNameNode[1].wholeText.split("|")[0];
  338. replyNameNode[2].replaceData(0, replyNameNode[2].length, replyNameNode[2].wholeText.split("留言")[0]);
  339. $(replyNameNode)[1].remove();
  340. }
  341.  
  342. var displayName;
  343.  
  344. if ($(replyIdNode).text() == lzIdenti) {
  345. displayName = "[楼主]" + replyName;
  346. $(replyIdNode).prev().after(`<a class="page-reply" id="replyName_${replyName}" href="https://bbs.jjwxc.net/search.php?act=search&board=${BOARD_ID}&keyword=${replyName}&topic=4" target="_blank" style="text-decoration: underline; text-underline-offset: 4px;">${displayName}</a>`);
  347. } else {
  348. displayName = replyName;
  349. $(replyIdNode).prev().after(`<a class="page-reply" id="replyName_${replyName}" href="https://bbs.jjwxc.net/search.php?act=search&board=${BOARD_ID}&keyword=${replyName}&topic=4" target="_blank">${displayName}</a>`);
  350. }
  351.  
  352. if (index == 0) {
  353. // $(".board-bam").after(`<a class="board-bam-user-temp" data="${replyName}" href="javascript:void(0);" style = "font-size:14px; margin-left:8px">隐藏TA</a>`);
  354. // $(".board-bam").after(`<a class="board-bam-user" data="${replyName}" href="javascript:void(0);" style = "font-size:14px; margin-left:8px">屏蔽TA</a>`);
  355. } else {
  356. // $(node).next().prepend(`<a class="board-bam-user-temp" data="${replyName}" href="javascript:void(0);" style = "font-size:14px; margin-left:8px">隐藏TA</a>`);
  357. // $(node).next().prepend(`<a class="board-bam-user" data="${replyName}" href="javascript:void(0);" style = "font-size:14px; margin-left:8px">屏蔽TA</a>`);
  358. var authertParentNode = $(node).parent();
  359. var buttonParentNode;
  360. if (isNormalFloor) {
  361. buttonParentNode = authertParentNode.next();
  362. } else {
  363. buttonParentNode = $(node).parent().clone();
  364. authertParentNode.after(buttonParentNode);
  365. authertParentNode.children().eq(1).remove();
  366. buttonParentNode.children().eq(0).remove();
  367. buttonParentNode.children().eq(0).attr("style", "text-align:right")
  368. }
  369. buttonParentNode.children().eq(0).append(`<a class="board-only-show-user" data="${replyName}" href="javascript:void(0);" style = "font-size:14px; margin-left:0px">只看TA</a>`);
  370. }
  371.  
  372. if (blockUsers !== '') {
  373. var blockUsersJs = JSON.parse(blockUsers);
  374. if (blockUsersJs.indexOf(replyName) != -1) {
  375. $(node).parent().prev().remove();
  376. $(node).parent().prev().remove();
  377. $(node).parent().next().remove();
  378. $(node).parent().remove();
  379. console.log("已屏蔽 " + replyName + " 的楼层 " + index);
  380. }
  381. }
  382. })
  383. page_count = $('.authorname').length
  384. },
  385. filter() {
  386. let oldTab = document.querySelector("body > center > b");
  387. $(oldTab).attr("class", "filter-bam-keyword");
  388. $(oldTab).attr("style", "font-size:20px");
  389. // $(oldTab).after(`<b class="filter-bam-user">屏蔽用户设置</b>`);
  390. $(oldTab).after(`<b class="filter-bam-post">屏蔽帖子设置</b>`);
  391. }
  392. }
  393.  
  394. var Event = {
  395. addBlockPost(node) {
  396. let id = $(node).attr('id')
  397. let title = $(node).attr('data').split("[2]")[0]
  398. let board = $(node).attr('board')
  399. console.log($('#boardtr_' + id).length)
  400. if (IS_NEWPOST){
  401. $(node).parent().parent().parent().parent().parent().parent().remove();
  402. } else {
  403. $('#boardtr_' + id).remove();
  404. }
  405.  
  406. let arr = localStorage.getItem('BlockPosts') ? JSON.parse(localStorage.getItem('BlockPosts')) : {};
  407. arr[id] = [board, title]
  408. localStorage.setItem('BlockPosts', JSON.stringify(arr));
  409. },
  410. onlyShowUser(node) {
  411. let name = $(node).attr('data')
  412. let newNode = $(".page-reply:not(#replyName_" + name + ")");
  413. $(newNode).parent().parent().prev().remove();
  414. $(newNode).parent().parent().prev().remove();
  415. $(newNode).parent().parent().next().remove();
  416. $(newNode).parent().parent().next().remove();
  417. $(newNode).parent().parent().remove();
  418. },
  419. addBlockUserTemp(node) {
  420. let name = $(node).attr('data')
  421. let newNode = $('#replyName_' + name);
  422. $(newNode).parent().parent().prev().remove();
  423. $(newNode).parent().parent().prev().remove();
  424. $(newNode).parent().parent().next().remove();
  425. $(newNode).parent().parent().next().remove();
  426. $(newNode).parent().parent().remove();
  427. },
  428. addBlockUser(node) {
  429. let name = $(node).attr('data')
  430. Event.addBlockUserTemp(node);
  431.  
  432. let arr = localStorage.getItem('BlockUsers') ? JSON.parse(localStorage.getItem('BlockUsers')) : [];
  433. if (arr.indexOf(name) == -1) {
  434. arr.unshift(name)
  435. localStorage.setItem('BlockUsers', JSON.stringify(arr));
  436. }
  437. },
  438. showBlockUser(node) {
  439. $(node).attr("style", "font-size:20px");
  440. $(node).siblings().attr("style", "font-size:16px");
  441. let arr = localStorage.getItem('BlockUsers') ? JSON.parse(localStorage.getItem('BlockUsers')) : [];
  442. console.log(arr);
  443.  
  444. $("table").eq(1).attr("style", "visibility:hidden");
  445. let blockTable = $("table").eq(2).children().toArray()[0]
  446. $(blockTable).parent().next().attr("style", "visibility:hidden");
  447.  
  448. let tips = $(blockTable).parent().next().next().next().find('tr').eq(0)
  449. tips.html(`<td>温馨提示:<br>1、在帖子的楼层中点“屏蔽TA”的用户名会被添加到该列表,刷新仍旧有效。<br>2、而帖子的楼层中点“隐藏TA”只临时隐藏当前贴中该用户的回复楼层,刷新失效。<br>3、列表中的用户,会屏蔽该用户名所发的帖子,并屏蔽帖子中该用户名回复的楼层<br><br></td>`)
  450.  
  451. let blockTrs = $(blockTable).children().toArray()
  452. let tableTab = '<tr align="center" id="filtertablehead">' +
  453. '<td style="font-weight: 700;width: 70%">屏蔽用户名</td>' +
  454. '<td style="font-weight: 700;width: 30%">操作</td>' +
  455. '</tr>'
  456. for (let blockTr of blockTrs) {
  457. blockTr.remove()
  458. }
  459. $(blockTable).append($(tableTab))
  460. if (arr.length != 0) {
  461. let html =''
  462. for(let userName of arr){
  463. html += '<tr align="center" id="' + userName + '">' +
  464. ' <td style="width: 70%"><a href="https://bbs.jjwxc.net/search.php?act=search&board=2&keyword='+ userName + '&topic=4" target="_blank">' + userName + '</a></td>' +
  465. ' <td style="width: 30%"><button class="filter-bam-user-del" data="' + userName + '">解除屏蔽</button></td>' +
  466. '</tr>'
  467. }
  468. $(blockTable).append($(html))
  469. }
  470. },
  471. showBlockPost(node) {
  472. $(node).attr("style", "font-size:20px");
  473. $(node).siblings().attr("style", "font-size:16px");
  474. let arr = localStorage.getItem('BlockPosts') ? JSON.parse(localStorage.getItem('BlockPosts')) : {};
  475. console.log(arr);
  476.  
  477. let tableIndex = 2
  478. if (pathname.indexOf('filterword') >= 0) {
  479. tableIndex = 3
  480. $("table").eq(tableIndex - 2).attr("style", "display:none");
  481. }
  482.  
  483. $("table").eq(tableIndex - 1).attr("style", "display:none");
  484. let blockTable = $("table").eq(tableIndex).children().toArray()[0]
  485. $(blockTable).parent().next().attr("style", "visibility:hidden");
  486. let tips = $(blockTable).parent().next().next().next().find('tr').eq(0)
  487. tips.html(`<td>温馨提示:<br>在主页点击“屏蔽”和帖子首楼点击“屏蔽此贴”的帖子会被添加到该列表,刷新仍旧有效。<br><br></td>`)
  488.  
  489. let blockTrs = $(blockTable).children().toArray()
  490. let tableTab = '<tr align="center" id="filtertablehead">' +
  491. '<td style="font-weight: 700;width: 20%">帖子ID</td>' +
  492. '<td style="font-weight: 700;width: 70%">帖子标题</td>' +
  493. '<td style="font-weight: 700;width: 10%">操作</td>' +
  494. '</tr>'
  495. for (let blockTr of blockTrs) {
  496. blockTr.remove()
  497. }
  498. $(blockTable).append($(tableTab))
  499. if (arr.length != 0) {
  500. let html =''
  501. for(let postId in arr){
  502. let boardId = arr[postId][0]
  503. let postTitle = arr[postId][1]
  504. html = '<tr align="center" id="' + postId + '">' +
  505. '<td style="width: 20%">' + postId + '</td>' +
  506. '<td style="width: 70%"><a href="https://bbs.jjwxc.net/showmsg.php?board=' +boardId + '&id=' + postId + '" target="_blank">' + postTitle + '</a></td>' +
  507. '<td style="width: 10%"><button class="filter-bam-post-del" data="' + postId + '">解除</button></td>' +
  508. '</tr>' + html
  509. }
  510. $(blockTable).append($(html))
  511. }
  512.  
  513. },
  514. delBlockUser(node) {
  515. let name = $(node).attr('data')
  516. let arr = localStorage.getItem('BlockUsers') ? JSON.parse(localStorage.getItem('BlockUsers')) : [];
  517. for(let i=0;i<arr.length;i++){
  518. if(arr[i] == name){
  519. arr.splice(i,1)
  520. localStorage.setItem('BlockUsers', JSON.stringify(arr));
  521. $(node).parent().parent().remove()
  522. }
  523. }
  524. },
  525. delBlockPost(node) {
  526. let postId = $(node).attr('data')
  527. let arr = localStorage.getItem('BlockPosts') ? JSON.parse(localStorage.getItem('BlockPosts')) : {};
  528. delete arr[postId];
  529. localStorage.setItem('BlockPosts', JSON.stringify(arr));
  530. $(node).parent().parent().remove()
  531. },
  532. switchSkin() {
  533. // 0是white 1是black
  534. var oldTheme = Boolean(Number(localStorage.getItem('themeJJ') == null ? 0 : localStorage.getItem('themeJJ')));
  535. var newTheme = Number(!oldTheme);
  536. localStorage.setItem('themeJJ', newTheme);
  537. location.reload();
  538. },
  539. countID() {
  540. // ID统计
  541. if ($("#countIDButton").text() == "ID统计") {
  542. if (dataSortIndex.length != 0){
  543. countIDListFinish()
  544. } else {
  545. getReplyList(0, 1)
  546. }
  547. } else {
  548. $("#countIDList").hide();
  549. $("#countIDButton").text('ID统计');
  550. $("#countIDButton").css('color', 'black');
  551. }
  552. },
  553. postSearch() {
  554. // 帖内搜索
  555. if ($("#postSearchButton").text() == "贴内搜索") {
  556. if (reply_all.length != 0){
  557. getReplyListFinish()
  558. } else {
  559. getReplyList(0, 2)
  560. }
  561. } else {
  562. $("#postSearchList").hide();
  563. $("#postSearchButton").text('贴内搜索');
  564. $("#postSearchButton").css('color', 'black');
  565. }
  566. },
  567. filterPost() {
  568. // 搜索过滤
  569. var searchKey = document.getElementById("postSearchInput").value
  570.  
  571. var content = document.getElementById("postSearchListText")
  572. var values = replyStrBody.split(searchKey);
  573. content.innerHTML = values.join('<span style="background:yellow;">' + searchKey + '</span>');
  574.  
  575. var FloatReplyArr = $('.FloatReplyBody');
  576. var searchResultNum = 0
  577. for(let item of FloatReplyArr){
  578. if(item.innerHTML.search(searchKey) == -1){
  579. $(item).parent().css('visibility', 'collapse')
  580. } else {
  581. $(item).parent().css('visibility', 'visible')
  582. searchResultNum += 1
  583. }
  584. }
  585. var titleStr = `搜索完毕 ${searchResultNum}层提及`
  586. $('#tableTitle').text(titleStr)
  587. },
  588. eventRegister() {
  589. $(document).on('click', '#countIDButton', function () {
  590. Event.countID(this);
  591. })
  592. $(document).on('click', '#postSearchButton', function () {
  593. Event.postSearch(this);
  594. })
  595. $(document).on('click', '#postSearchStart', function () {
  596. Event.filterPost(this);
  597. })
  598. $(document).on('click', '.themeButton', function () {
  599. Event.switchSkin(this);
  600. })
  601. $(document).on('click', '.board-bam', function () {
  602. Event.addBlockPost(this);
  603. })
  604. $(document).on('click', '.board-only-show-user', function () {
  605. Event.onlyShowUser(this);
  606. })
  607. $(document).on('click', '.board-bam-user-temp', function () {
  608. Event.addBlockUserTemp(this);
  609. })
  610. $(document).on('click', '.board-bam-user', function () {
  611. Event.addBlockUser(this);
  612. })
  613. $(document).on('click', '.filter-bam-keyword', function () {
  614. location = 'https://bbs.jjwxc.net/filterword.php'
  615. })
  616. $(document).on('click', '.filter-bam-user', function () {
  617. Event.showBlockUser(this);
  618. })
  619. $(document).on('click', '.filter-bam-post', function () {
  620. Event.showBlockPost(this);
  621. })
  622. $(document).on('click', '.filter-bam-user-del', function () {
  623. Event.delBlockUser(this);
  624. })
  625. $(document).on('click', '.filter-bam-post-del', function () {
  626. Event.delBlockPost(this);
  627. })
  628. }
  629. }
  630.  
  631. function initPages(start) {
  632. if (IS_BOARD) {
  633. initNodes.board()
  634. Event.eventRegister()
  635. } else if (IS_POST) {
  636. initNodes.page(start);
  637. Event.eventRegister()
  638. } else if (IS_FILTER) {
  639. initNodes.filter();
  640. Event.eventRegister()
  641. }
  642. }
  643.  
  644. initPages(page_count);
  645.  
  646. function countIDListFinish() {
  647. var strBody = ''
  648. var floorNum = 0
  649. dataSortIndex.forEach((key, index) =>{
  650. floorNum += id_all[key].num
  651. strBody += `<tr><td style="text-align: center;">NO.${index + 1}</td>
  652. <td style="text-align: center;">${key}</td>
  653. <td style="text-align: center;">${id_all[key].name}</td>
  654. <td style="text-align: center;">${id_all[key].num}</td></tr>`
  655. })
  656. var str =
  657. `<table style="background-color: #999933;">
  658. <caption style="font-size: large;font-weight: bold;">共${dataSortIndex.length}个ID ${floorNum}层楼</caption>` +
  659. `<tr><td style="text-align: center;">序号</td>
  660. <td style="text-align: center;">ID</td>
  661. <td style="text-align: center;">昵称</td>
  662. <td style="text-align: center;">楼层</td></tr>` +
  663. strBody + "</table>";
  664. $("#countIDListText").html(str);
  665.  
  666. $("#countIDList").show();
  667. $("#countIDButton").text('隐藏窗口');
  668. $("#countIDButton").css('color', '#ff8e29');
  669. }
  670.  
  671. function getReplyListFinish() {
  672. var strBody = ''
  673. reply_all.forEach((value) =>{
  674. strBody += `<tr style="vertical-align:top"><td style="text-align:center;">${value.floor}</td>
  675. <td class="FloatReplyBody" style="text-align:center;width: 120px;white-space:pre-line;">${value.author}</td>
  676. <td class="FloatReplyBody" style="text-align:left;white-space: pre-line;word-break: break-word;">${value.replybody}</td></tr>`
  677. })
  678. var str =
  679. `<table style="background-color: #999933;">
  680. <caption id="tableTitle" style="font-size:large;font-weight:bold;">初始化完毕 本帖共${reply_all.length}层楼</caption>` +
  681. `<tr><td style="text-align: center;">楼层</td>
  682. <td style="text-align:center;">昵称</td>
  683. <td style="text-align:center;">回复内容</td></tr>` +
  684. strBody + "</table>";
  685. $("#postSearchListText").html(str);
  686. var tableImgArr = $('#postSearchListText').find('img')
  687. for(let item of tableImgArr){
  688. $(item).css("max-height","150px")
  689. $(item).css("max-width","140px")
  690. }
  691. replyStrBody = $("#postSearchListText").html();
  692.  
  693. $("#postSearchList").show();
  694. $("#postSearchButton").text('隐藏窗口');
  695. $("#postSearchButton").css('color', '#ff8e29');
  696. }
  697.  
  698. function getReplyList(page=0, fun) {
  699. $.ajax({
  700. type: 'POST',
  701. url: "https://bbs.jjwxc.net/frameindex.php?c=showMsg&action=showMoreReply",
  702. headers: {
  703. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
  704. 'Accept': 'application/json'
  705. },
  706. data: {
  707. 'board': BOARD_ID,
  708. 'id': POST_ID,
  709. 'page': page
  710. },
  711. async:true,
  712. success: function (response) {
  713. var result = JSON.parse(response);
  714. console.log("=======getReplyList=======" + (page + 1))
  715. switch (fun) {
  716. case 1: {
  717. countIDList(result, page)
  718. break
  719. }
  720. case 2: {
  721. postSearchList(result, page)
  722. break
  723. }
  724. }
  725. },
  726. error: function (err) {
  727. console.log("错误 " + err);
  728. }
  729. });
  730. }
  731.  
  732. function countIDList(result, page){
  733. $("#countIDButton").text('第' + (page + 1) + '页');
  734. if (result.data.replies.length != 0) {
  735. var dataList = result.data.replies
  736. if(dataList instanceof Object){
  737. Object.keys(dataList).forEach((key) =>{
  738. getOutputList(dataList[key])
  739. })
  740. } else {
  741. dataList.forEach((value) =>{
  742. getOutputList(value)
  743. })
  744. }
  745. getReplyList(page + 1, 1)
  746. } else {
  747. dataSortIndex = Object.keys(id_all).sort(function(a,b){ return id_all[b].num-id_all[a].num;});
  748. countIDListFinish()
  749. }
  750. }
  751.  
  752. function postSearchList(result, page){
  753. $("#postSearchButton").text('第' + (page + 1) + '页');
  754. if (result.data.replies.length != 0) {
  755. var dataList = result.data.replies
  756. if(dataList instanceof Object){
  757. Object.keys(dataList).forEach((key) =>{
  758. reply_all = reply_all.concat(dataList[key])
  759. })
  760. } else {
  761. reply_all = reply_all.concat(dataList)
  762. }
  763. getReplyList(page + 1, 2)
  764. } else {
  765. getReplyListFinish()
  766. }
  767. }
  768.  
  769. function getOutputList(value) {
  770. var id = value.readerIdenti.split(">")[1].split("<")[0];
  771. if (id_all[id] != undefined) {
  772. id_all[id].num = id_all[id].num + 1;
  773. if (id_all[id].name.search("\\*") != -1 && value.author.search("\\*") == -1) {
  774. id_all[id].name = value.author;
  775. }
  776. } else {
  777. id_all[id] = { name: value.author, num: 1 };
  778. }
  779. }
  780.  
  781. $('#showmore_button').click(function() {
  782. setTimeout(function () {
  783. initPages(page_count);
  784. if ($('#showmore_button').length == 0) {
  785. let newPage = Number(PAGE) + 1;
  786. if (isNaN(newPage)) {
  787. newPage = 1;
  788. }
  789. let newPageHref = "?board=" + BOARD_ID +"&id=" + POST_ID + "&page=" + newPage;
  790. $('#pager_top').append(`<a href="${newPageHref}">${newPage + 1}</a>`);
  791. $('#pager_bottom').append(`<a href="${newPageHref}">${newPage + 1}</a>`);
  792. }
  793. },2000)
  794. });
  795.  
  796. })
  797. })(jQuery);

QingJ © 2025

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