MAL Custom CSS Override - Working!!!

Replaces the anime/manga lists CSS styles on other users anime/manga lists with your own, or with an style of an user of your choice!

2023-06-11 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

  1. // ==UserScript==
  2. // @name MAL Custom CSS Override - Working!!!
  3. // @namespace MALCSSOverRider
  4. // @description Replaces the anime/manga lists CSS styles on other users anime/manga lists with your own, or with an style of an user of your choice!
  5. // @version 8
  6. // @match https://myanimelist.net/animelist/*
  7. // @match https://myanimelist.net/mangalist/*
  8. // @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://myanimelist.net&size=64
  9. // @grant GM_registerMenuCommand
  10. // @run-at document-end
  11. // @grant GM_setValue
  12. // @grant GM_getValue
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. var BackupedActualUserCustomListStyle = ''; //Create a global variable
  17.  
  18. GM_registerMenuCommand("See this List Style", SeeListStyle); //Adds an option to the menu
  19. GM_registerMenuCommand("Use this List Style!", UseThisListStyle); //Adds an option to the menu
  20.  
  21. const BackupedActualUserListStyle = document.querySelector("style[type*='text/css']").innerText; //Create a global variable to store the user actual list style css codes
  22.  
  23. if (document.querySelector("#advanced-options") !== null) //If the user is on a modern list style
  24. { //Starts the if condition
  25. BackupedActualUserCustomListStyle = document.querySelector("#custom-css").innerText; //Create a global variable to store the user actual custom list style css codes
  26. } //Finishes the if condition
  27.  
  28. function SeeListStyle() //Function to See the List Style
  29. { //Starts the function SeeListStyle
  30. document.querySelector("style[type*='text/css']").innerText = BackupedActualUserListStyle; //Shows the actual user list style
  31.  
  32. if (document.querySelector("#advanced-options") !== null) //If the user is on a modern list style
  33. { //Starts the if condition
  34. document.querySelector("#custom-css").innerText = BackupedActualUserCustomListStyle; //Shows the actual user list custom style
  35. } //Finishes the if condition
  36.  
  37. } //Finishes the function SeeListStyle
  38.  
  39. function UseThisListStyle() //Function to Change the List Style
  40. { //Starts the function UseThisListStyle
  41. SeeListStyle(); //Show the actualy list style
  42. if (document.querySelector("#advanced-options") !== null) //If the user is on a modern list style
  43. { //Starts the if condition
  44. GM_setValue("Default_Style", BackupedActualUserListStyle); //Store the actual style of the script user
  45. GM_setValue("Default_Custom_Style", BackupedActualUserCustomListStyle); //Store the actual custom style of the script user
  46. } //Finishes the if condition
  47. else //If the user is on a modern list style
  48. { //Starts the else condition
  49. GM_setValue("Default_Classic_Style", BackupedActualUserListStyle); //Store the actual style of the script user
  50. } //Finishes the else condition
  51. } //Finishes the function UseThisListStyle
  52.  
  53. if (document.querySelector("#advanced-options") !== null) //If the user is on a classic list style
  54. { //Starts the if condition
  55. document.querySelector("#custom-css").innerText = GM_getValue("Default_Custom_Style"); //Replaces the actual list custom style with the default list style that was chosen to be used to override styles
  56. document.querySelector("style[type*='text/css']").innerText = GM_getValue("Default_Style"); //Replaces the actual list style with the default list style that was chosen to be used to override
  57. } //Finishes the if condition
  58. else //If the user is on a modern list style
  59. { //Starts the else condition styles
  60. document.querySelector("style[type*='text/css']").innerText = GM_getValue("Default_Classic_Style"); //Replaces the actual list style with the default list style that was chosen to be used to override
  61. } //Finishes the else condition
  62. })();