// ==UserScript== // @name 魔怔定型文屏蔽器 // @namespace https://pbb.akioi.ml/ban-shanoa // @version 0.3 // @description 屏蔽某魔怔定型文 / sk // @author tiger0132 // @match https://pbb.akioi.ml/ // @grant unsafeWindow // @grant GM_setValue // @grant GM_getValue // @downloadURL none // ==/UserScript== (function() { 'use strict'; const blockList = ['夏小姐', '夏诺雅', 'シャノア', 'しゃのあ', 'shanoa']; var ignShanoa = GM_getValue('ignShanoa', true); var ignSK = GM_getValue('ignSK', false); var oldFmtFeed = fmtFeed; fmtFeed = feed => { const content = feed.content_markdown; const node = $(oldFmtFeed(feed)); if ((ignShanoa && blockList.some(keyword => content.includes(keyword)))) { node[0].id = `feed-${feed.id}`; node[0].style.opacity = 0.3; node.hide(); return `
隐藏了 ${feed.user.name} 的一条犇犇,点击显示
` + node[0].outerHTML; } if (ignSK && feed.user.name === 'serverkiller') { node[0].id = `feed-${feed.id}`; node[0].style.opacity = 0.3; node.hide(); return `隐藏了 ${feed.user.name} 发送的一条的犇犇,点击显示
` + node[0].outerHTML; } if (ignSK && content.includes('serverkiller')) { node[0].id = `feed-${feed.id}`; node[0].style.opacity = 0.3; node.hide(); return `隐藏了 ${feed.user.name} 的一条包含 serverkiller 的犇犇,点击显示
` + node[0].outerHTML; } return node[0].outerHTML; }; const nodeIgnShanoa = $(``); const nodeIgnSK = $(``); nodeIgnShanoa.checkbox({ onChange: function () { const value = $(this).parent().checkbox('is checked'); console.log(value); GM_setValue('ignShanoa', ignShanoa = value); } }); nodeIgnSK.checkbox({ onChange: function () { const value = $(this).parent().checkbox('is checked'); GM_setValue('ignSK', ignSK = value); } }); if (ignShanoa) nodeIgnShanoa.checkbox('set checked'); if (ignSK) nodeIgnSK.checkbox('set checked'); nodeIgnSK.insertAfter('#ctrlenter-enabled'); nodeIgnShanoa.insertAfter('#ctrlenter-enabled'); })();