屏蔽某魔怔定型文 / sk
当前为
// ==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
// ==/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 `<p style="text-align: center; color: gray; opacity: 0.3; " onclick="$('#feed-${feed.id}').show(); $(this).hide()">隐藏了 ${feed.user.name} 的一条犇犇,点击显示</p>` + node[0].outerHTML;
}
if (ignSK && feed.user.name === 'serverkiller') {
node[0].id = `feed-${feed.id}`;
node[0].style.opacity = 0.3;
node.hide();
return `<p style="text-align: center; color: gray; opacity: 0.3; " onclick="$('#feed-${feed.id}').show(); $(this).hide()">隐藏了 ${feed.user.name} 发送的一条的犇犇,点击显示</p>` + node[0].outerHTML;
}
if (ignSK && content.includes('serverkiller')) {
node[0].id = `feed-${feed.id}`;
node[0].style.opacity = 0.3;
node.hide();
return `<p style="text-align: center; color: gray; opacity: 0.3; " onclick="$('#feed-${feed.id}').show(); $(this).hide()">隐藏了 ${feed.user.name} 的一条包含 serverkiller 的犇犇,点击显示</p>` + node[0].outerHTML;
}
return node[0].outerHTML;
};
const nodeIgnShanoa = $(`<div class="ui toggle checkbox" style="margin-top: 20px; display: block;"><input type="checkbox" tabindex="0" class="hidden"><label>屏蔽夏诺雅</label></div>`);
const nodeIgnSK = $(`<div class="ui toggle checkbox" style="margin-top: 20px; display: block;"><input type="checkbox" tabindex="0" class="hidden"><label>屏蔽 SK</label></div>`);
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');
})();