您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
31/03/2023, 5:40:10 am
- // ==UserScript==
- // @name Masiro Block User
- // @namespace Violentmonkey Scripts
- // @license GPL
- // @match *://masiro.me/*
- // @require https://openuserjs.org/src/libs/sizzle/GM_config.js
- // @grant GM_getValue
- // @grant GM_setValue
- // @grant GM.getValue
- // @grant GM.setValue
- // @version 1.0
- // @author Hou Rui
- // @description 31/03/2023, 5:40:10 am
- // ==/UserScript==
- let config = new GM_config({
- 'id': 'MisiroBlockUserConfig',
- 'title': 'Masiro Block User',
- 'fields': {
- 'blockedUsers': {
- 'label': '每行输入一个用户名',
- 'section': ['屏蔽用户列表'],
- 'type': 'textarea',
- }
- },
- 'events': {
- 'init': loadConfig,
- 'save': loadConfig,
- },
- 'css': '#MisiroBlockUserConfig textarea { width: 100%; height: 70%; }'
- })
- function loadConfig() {
- let blockNames = config.get('blockedUsers').split('\n').map(line => line.trim())
- console.log(`Blocked users: ${blockNames}`)
- let contentBlocks = document.querySelectorAll('span.reply_content, div.comment-content')
- for (let block of contentBlocks) {
- let attrs = block.attributes['data-name']
- if (attrs === undefined) {
- return;
- }
- let userName = attrs.value
- if (blockNames.includes(userName)) {
- block.innerHTML = '[已屏蔽]'
- let sibling = block.parentElement.nextElementSibling
- if (sibling === null) {
- return;
- }
- if (sibling.className === 'reply_list') {
- sibling.innerHTML = ''
- }
- }
- }
- }
- let commentButton = document.getElementById('comment-btn')
- let configButton = document.createElement('button')
- configButton.classList.add('btn', 'btn-primary')
- configButton.textContent = '屏蔽设置'
- configButton.style.float = 'right'
- configButton.style.padding = commentButton.style.padding;
- configButton.style.marginRight = commentButton.style.marginRight;
- configButton.style.fontSize = commentButton.style.fontSize;
- configButton.onclick = () => config.open()
- commentButton.parentNode.appendChild(configButton)
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址