您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Block any user on any forum topic with a single click!
当前为
- // ==UserScript==
- // @name User Blocker - MAL
- // @namespace Blocker
- // @version 3
- // @description Block any user on any forum topic with a single click!
- // @author hacker09
- // @match https://myanimelist.net/forum/?topicid=*
- // @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://myanimelist.net&size=64
- // @run-at document-end
- // @grant none
- // ==/UserScript==
- (async function() {
- 'use strict';
- document.querySelectorAll(".mal-post-toolbar > div").forEach(function(el, i) { //ForEach topic
- if (document.querySelectorAll(".username")[i].innerText !== document.querySelector("a.header-profile-link").innerText) { //If it is not the script user topic
- el.insertAdjacentHTML('afterbegin', `<button title="Block ${document.querySelectorAll(".username")[i].innerText}" class="mal-btn secondary small outline noborder js-topic-message-report"><i class="fa-solid fa-circle-exclamation fa-fw mr4"></i>Block</button>`); //Add the block button on the page
- el.querySelector(`button`).onclick = async function(e) //When the block btn is clicked
- { //Starts the function
- fetch("https://myanimelist.net/forum/settings/ignored_users", { //Fetch
- "headers": {
- "content-type": "application/x-www-form-urlencoded; charset=UTF-8"
- },
- "body": `name=${document.querySelectorAll(".username")[i].innerText}&csrf_token=${document.head.querySelector("[name='csrf_token']").content}`,
- "method": "POST"
- });
- location.reload(); //Reloads the page
- }; //Finishes the function
- } //Finishes the if condition
- }); //Finishes the forEach loop
- })();