MCPcopy Create free account
hub / github.com/XIU2/UserScript / blockKeywords

Function blockKeywords

Hostloc-Enhanced.user.js:306–317  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

304 };
305 // 屏蔽关键词(帖子标题)
306 function blockKeywords() {
307 if (!menu_value('menu_customBlockKeywords') || menu_value('menu_customBlockKeywords').length < 1) return
308 document.querySelectorAll('[id^="normalthread_"]').forEach(function (item) { // 遍历所有帖子标题
309 menu_value('menu_customBlockKeywords').forEach(function (item1) { // 遍历关键词
310 let itemName = item.querySelector('a.s.xst'); // 寻找帖子标题
311 if (itemName && itemName.textContent.toLowerCase().indexOf(item1.toLowerCase()) > -1) {
312 console.log(`屏蔽关键词:[${item1}]`, `,帖子标题:[${itemName.textContent}]`);
313 item.hidden = true; // 删除帖子
314 }
315 })
316 })
317 }
318 // 监听插入事件(有新的回复主题,点击查看)
319 function blockDOMNodeInserted() {
320 let block = e => {

Callers 3

blockFunction · 0.70
pageLoadingFunction · 0.70

Calls 1

menu_valueFunction · 0.70

Tested by

no test coverage detected