"Create New Topic" button on mobile version for MAL

Since MAL doesn't have one, i added one.

目前为 2023-05-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name "Create New Topic" button on mobile version for MAL
  3. // @namespace https://myanimelist.net/profile/kyoyatempest
  4. // @version 1.0
  5. // @description Since MAL doesn't have one, i added one.
  6. // @author kyoyacchi
  7. // @match https://myanimelist.net/forum/*
  8. // @grant none
  9. // @run-at document-end
  10. // @icon https://www.google.com/s2/favicons?domain=myanimelist.net&sz=64
  11. // @license none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. try {
  17. let url = window.location.href;
  18. if (!url.includes("?board=")) {
  19. return//to prevent button appearing on some other forum posts.
  20. }
  21. let board_id = url.split("?board=")[1]
  22.  
  23. let buton = document.createElement("a");
  24. buton.id = "create-post";
  25. buton.href = `https://myanimelist.net/forum/?action=post&boardid=${board_id}`
  26. buton.style.color = "#FFFFFF";
  27. buton.style.backgroundColor = "#0000CC";
  28. buton.textContent = "Create New Topic";
  29. buton.style.position = "absolute";
  30. buton.style.left = "12px";
  31. buton.style.border = "1px white";
  32. buton.style.bottom = `${board_id == 4 ? "3293px" : "3330px"}`;//\⁠(⁠°⁠o⁠°⁠)⁠/
  33. buton.style.fontSize = "12px";
  34. buton.style.fontWeight = "bold";
  35. let mb12 = document.querySelectorAll(".mb12");
  36. if (!mb12 || !mb12.length) return;
  37. mb12[2].appendChild(buton)
  38.  
  39. } catch(er) {
  40.  
  41. }
  42. })();