您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Brings back the original MAL quotes button! Now you can copy in a single click original BBCodes and image URLs!
当前为
// ==UserScript== // @name Quotes - MAL // @namespace Quote // @version 1 // @description Brings back the original MAL quotes button! Now you can copy in a single click original BBCodes and image URLs! // @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== (function() { 'use strict'; function Function() { //Starts the Function setTimeout(() => { //Starts the setTimeout function document.querySelectorAll(".mal-post-toolbar > div, .toolbar.left").forEach(function(el, i) { //ForEach topic var counter = i; //Create a new variable document.querySelector(".mal-post-toolbar > div") === null ? counter = i + 1 : counter = i; //If the page is on the conversation view if ((document.querySelectorAll(".username, .item.name")[counter].innerText !== document.querySelector("a.header-profile-link").innerText) && document.querySelectorAll(".mal-post-toolbar > div, .toolbar.left")[i].innerHTML.match("Quote") === null) { //If it is not the script user topic and the current message does not have the quote button el.insertAdjacentHTML('afterbegin', `<button title="Quote ${document.querySelectorAll(".username, .item.name")[counter].innerText}" class="mal-btn secondary small outline noborder js-topic-message-report"><i class="fa-solid fa-reply fa-fw mr4"></i>Quote</button>`); //Add the quote button on the page el.querySelector(`button`).onclick = async function() //When the quote btn is clicked { //Starts the onclick function document.querySelector(".js-reply-start.pressed") === null ? document.querySelectorAll(".js-reply-start")[1].click() : ''; //If the reply btn closed, open it document.querySelectorAll(".postnum > a, .item.name")[document.querySelectorAll(".postnum > a, .item.name").length - 1].scrollIntoView(); //Scroll the page to the bottom const response = await (await fetch('https://myanimelist.net/includes/quotetext.php', { "headers": { "content-type": "application/x-www-form-urlencoded" }, "body": `msgid=${document.querySelector(".postnum") !== null ? document.querySelectorAll(".postnum > a")[i].href.match(/\d+/g)[1] : document.querySelectorAll("[class='message']")[i].dataset.id}&csrf token=${document.head.querySelector("[name='csrf_token']").content}`, "method": "POST" })).text(); //Finishes the fetch setTimeout(() => { //Paste the quoted content on the bottom new reply btn document.querySelectorAll(".sourceMode > textarea")[1].value += `[quote=${document.querySelectorAll(".username, .item.name")[counter].innerText} message=${document.querySelector(".postnum") !== null ? document.querySelectorAll(".postnum > a")[i].href.match(/\d+/g)[1] : document.querySelectorAll("[class='message']")[i].dataset.id}}]` + new DOMParser().parseFromString(response, "text/html").documentElement.textContent + '[/quote]'; //Paste the text and BBCode content from the topic reply the user wants to quote }, 500); //Finishes the click event listener and setTimeout function }; //Finishes the onclick function } //Finishes the if condition }) //Finishes the forEach loop }, 500); //Finishes the setTimeout function } //FInishes the Function Function(); //Run the script when the page is loaded document.querySelectorAll(".js-thread-childs").forEach(function(el) { //ForEach reply child el.onclick = function() { //When the reply child btn is clicked Function(); //Run the script again }; //Finishes the onclick function }) //Finishes the forEach loop })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址