Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name 论坛帖子显示隐藏助手(用户脚本)
- // @namespace https://pastebin.com/8BVBeieH
- // @version 0.0.1
- // @description 适用于 Discuz! 论坛帖子列表页面,基于帖子标题关键词重点显示或隐藏某些帖子。
- // @homepage https://pastebin.com/8BVBeieH
- // @icon https://s.pc.qq.com/tousu/img/20211017/1049266_1634438609.jpg
- // @updateURL https://pastebin.com/raw/8BVBeieH
- // @installURL https://pastebin.com/raw/8BVBeieH
- // @downloadURL https://pastebin.com/raw/8BVBeieH
- // @supportURL https://hostloc.com/space-username-论坛大师.html
- // @author 论坛大师
- // @match http*://*/forum-*-*.html
- // @match http*://*/forum.php?mod=forumdisplay&fid=*
- // @grant none
- // ==/UserScript==
- (() => {
- const allowlist = [
- /免费/i,
- /送/i,
- /漏洞/i,
- /抢/i,
- /踢号/i,
- /T号/i,
- /踢楼/i,
- /T楼/i,
- /传家宝/i,
- /薅羊毛/i,
- /白嫖/i,
- /白女票/i,
- ];
- const blocklist = [
- /新闻联播/i,
- /股票/i,
- /炒股/i,
- /基金/i,
- /期货/i,
- /贷款/i,
- ];
- const POST_LIST = document.getElementById('threadlisttableid').getElementsByClassName('s');
- for (const post of POST_LIST) {
- const POST_TITLE = post.innerHTML;
- for (const allow of allowlist) {
- if (allow.test(POST_TITLE)) {
- const icon = post.parentElement.parentElement.getElementsByClassName('icn')[0];
- icon.style.cursor = 'default';
- icon.innerHTML = '🔴';
- post.innerHTML = POST_TITLE.replace(allow, `<span style="color: red;">${POST_TITLE.match(allow)[0]}</span>`);
- }
- }
- for (const block of blocklist) {
- if (block.test(POST_TITLE)) {
- post.parentElement.parentElement.parentElement.style.display = 'none';
- }
- }
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement