MAL Signature Updater

Automatically update your signature!

安装此脚本?
作者推荐脚本

您可能也喜欢Finish Airing Date - MAL

安装此脚本
  1. // ==UserScript==
  2. // @name MAL Signature Updater
  3. // @namespace SignatureUpdater
  4. // @version 1
  5. // @description Automatically update your signature!
  6. // @author hacker09
  7. // @match https://myanimelist.net/forum/?topicid=*
  8. // @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://myanimelist.net&size=64
  9. // @run-at document-end
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. document.querySelectorAll(".mal-post-toolbar > div").forEach(function(el, i) { //ForEach topic
  16. if (document.querySelectorAll(".username")[i].innerText === document.querySelector("a.header-profile-link").innerText) { //If it is the script user topic
  17. el.insertAdjacentHTML('afterbegin', `<button class="mal-btn secondary small outline noborder js-topic-message-report">Update Signature<i class="fa-solid fa-circle-exclamation fa-fw mr4" style=" display: none;"></i></button>`); //Add the update button on the page
  18.  
  19. el.querySelector(`button`).onclick = async function(e) //When the update btn is clicked
  20. { //Starts the function
  21. fetch("https://myanimelist.net/editprofile.php?go=forumoptions") //Get current signature
  22. .then(async response => { //After getting current signature
  23. const html = await response.text(); // Gets the fetch response
  24. const newDocument = new DOMParser().parseFromString(html, 'text/html'); // Parses the fetch response
  25. if (newDocument.querySelector("#sigbox").value.match('malsignature.com') !== null) //If the malsignature.com link exists on the signature
  26. { //Starts the if condition
  27. fetch("https://myanimelist.net/editprofile.php?go=forumoptions", {
  28. "headers": {
  29. "content-type": "application/x-www-form-urlencoded",
  30. },
  31. "body": `signature=${encodeURIComponent(newDocument.querySelector("#sigbox").value.match(/.*style=(\d+)/) !== null ? newDocument.querySelector("#sigbox").value.replace(newDocument.querySelector("#sigbox").value.match(/.*style=(\d+)/)[1], parseInt(newDocument.querySelector("#sigbox").value.match(/.*style=(\d+)/)[1])+1) : newDocument.querySelector("#sigbox").value.match(/username=[^&\[]*/) !== null ? newDocument.querySelector("#sigbox").value.replace(newDocument.querySelector("#sigbox").value.match(/username=[^&\[]*/)[0], newDocument.querySelector("#sigbox").value.match(/username=[^&\[]*/)[0] + '&style=1') : '')}&subsig=Submit&csrf_token=${document.querySelector("[name='csrf_token']").content}`,
  32. "method": "POST"
  33. }); //Finishes the if fetch
  34. } //Finishes the if condition
  35. }); //Finishes the then function
  36. }; //Finishes the function
  37. } //Finishes the if condition
  38. }); //Finishes the forEach loop
  39. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址