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!

Fra 27.03.2021. Se den seneste versjonen.

  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 1.0.0.3
  6. // @match https://myanimelist.net/animelist/*
  7. // @match https://myanimelist.net/mangalist/*
  8. // @icon https://www.google.com/s2/favicons?domain=myanimelist.net
  9. // @grant GM_registerMenuCommand
  10. // @run-at document-end
  11. // @grant GM_setValue
  12. // @grant GM_getValue
  13. // ==/UserScript==
  14.  
  15. var BackupedActualUserCustomListStyle = document.querySelector("#custom-css").innerText; //Create a global variable to store the user actual custom list style css codes
  16. var BackupedActualUserListStyle = document.querySelector("style[type*='text/css']").innerText; //Create a global variable to store the user actual list style css codes
  17.  
  18. GM_registerMenuCommand("Use this List Style!", ChangeListStyle); //Adds an option to the menu
  19.  
  20. function ChangeListStyle() //Function to Change the List Style
  21. { //Starts the function ChangeListStyle
  22.  
  23. document.querySelector("#custom-css").innerText = BackupedActualUserCustomListStyle; //Shows the actual user list custom style
  24. document.querySelector("style[type*='text/css']").innerText = BackupedActualUserListStyle; //Shows the actual user list style
  25.  
  26. setTimeout(function() {
  27. if (confirm("Press OK if you want to use the Style you're seeing now on any anime and manga lists on MAL.")) //Show the confimation alert box text
  28. { //Starts the if condition
  29. GM_setValue("Default_Custom_Style", BackupedActualUserCustomListStyle); //Store the actual custom style of the script user
  30. GM_setValue("Default_Style", BackupedActualUserListStyle); //Store the actual style of the script user
  31. } //Finishes the if condition
  32. else //If the user pressed cancel
  33. { //Starts the else condition
  34. document.querySelector("#custom-css").innerText = GM_getValue("Default_Custom_Style"); //Shows the default override user list custom style
  35. document.querySelector("style[type*='text/css']").innerText = GM_getValue("Default_Style"); //Shows the default override user list style
  36. } //Finishes the else condition
  37. }, 500); //Shows an alert message
  38. } //Finishes the function ChangeListStyle
  39.  
  40. 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
  41. 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 styles