洛谷关键词屏蔽讨论

屏蔽标题中包含关键词的讨论

目前为 2022-08-14 提交的版本。查看 最新版本

// ==UserScript==
// @name         洛谷关键词屏蔽讨论
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  屏蔽标题中包含关键词的讨论
// @author       You
// @match        https://www.luogu.com.cn
// @match        https://www.luogu.com.cn/discuss/list*
// @icon         https://www.luogu.com.cn/favicon.ico
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
  'use strict';
  const BLOCKLIST = ['求调', '站外题', '小游戏'];
  const HREF = document.location.href;
  if (HREF.indexOf('discuss') === -1) {
    const DISCUSSLIST = document.querySelectorAll('.am-panel-primary');
    for (const DISCUSS of DISCUSSLIST) {
      const TITLE = DISCUSS.children[0].children[1].children[0].innerText;
      for (const KEY of BLOCKLIST) {
        if (TITLE.indexOf(KEY) !== -1) {
          DISCUSS.parentNode.removeChild(DISCUSS);
          break;
        }
      }
    }
  } else {
    const DISCUSSLIST = document.querySelectorAll('.lg-table-row');
    for (const DISCUSS of DISCUSSLIST) {
      const TITLE = DISCUSS.children[1].children[0].innerText;
      for (const KEY of BLOCKLIST) {
        if (TITLE.indexOf(KEY) !== -1) {
          DISCUSS.parentNode.removeChild(DISCUSS);
          break;
        }
      }
    }
  }
})();

QingJ © 2025

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