您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Really ignore ignored users
当前为
- // ==UserScript==
- // @name Rllmukzen Threadshitter
- // @description Really ignore ignored users
- // @namespace https://github.com/insin/greasemonkey/
- // @version 2
- // @match https://www.rllmukforum.com/index.php*
- // ==/UserScript==
- function addStyle(css) {
- let $style = document.createElement('style')
- $style.appendChild(document.createTextNode(css))
- document.querySelector('head').appendChild($style)
- }
- function TopicPage() {
- // Hide "You've chosen to ignore content by <ignored user>"
- addStyle(`
- .ipsComment_ignored {
- display: none;
- }
- `)
- function processPage() {
- // Hide comments which quote ignored users
- let ignoredUserIds = JSON.parse(localStorage.ignoredUserIds || '[]')
- let quotes = document.querySelectorAll('[data-ipsquote-userid]')
- document.querySelectorAll('[data-ipsquote-userid]').forEach(el => {
- if (!ignoredUserIds.includes(el.dataset.ipsquoteUserid)) return
- let comment = el.closest('article.ipsComment')
- if (comment.style.display == 'none') return
- comment.style.display = 'none'
- })
- }
- // Process initial posts
- processPage()
- // Watch for posts being replaced when paging
- new MutationObserver(mutations =>
- mutations.forEach(mutation => {
- if (mutation.oldValue == 'true') {
- processPage()
- }
- })
- ).observe(document.querySelector('div.cTopic'), {
- attributes: true,
- attributeFilter: ['animating'],
- attributeOldValue: true,
- })
- }
- function IgnoredUsersPage() {
- // Sync ignored user ids
- localStorage.ignoredUserIds = JSON.stringify(
- Array.from(document.querySelectorAll('[data-ignoreuserid]')).map(el => el.dataset.ignoreuserid)
- )
- }
- let page
- if (location.href.includes('index.php?/topic/')) {
- page = TopicPage
- } else if (location.href.includes('index.php?/ignore/')) {
- page = IgnoredUsersPage
- }
- if (page) {
- page()
- }