Series Highlighter - MAL

Highlights entries that already exist on your MAL lists

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

您可能也喜欢Hide Entry Score

安装此脚本
  1. // ==UserScript==
  2. // @name Series Highlighter - MAL
  3. // @namespace MALHighlither
  4. // @version 30
  5. // @description Highlights entries that already exist on your MAL lists
  6. // @author hacker09
  7. // @match https://myanimelist.net/
  8. // @match https://myanimelist.net/watch/*
  9. // @match https://myanimelist.net/stacks/*
  10. // @match https://myanimelist.net/search/all*
  11. // @include /^https?:\/\/myanimelist\.net\/(animelist|mangalist)/
  12. // @include /^https?:\/\/myanimelist\.net\/top(anime|manga)\.php/
  13. // @include /^https?:\/\/myanimelist\.net\/(anime|manga)\.php\?.*\S=/
  14. // @include /^https?:\/\/myanimelist\.net\/(anime|manga)\/\d+\/[^\/]+\/userrecs/
  15. // @include /^https?:\/\/myanimelist\.net\/(character|people)(\.php\?id=|\/)\d+/
  16. // @include /^https?:\/\/myanimelist\.net\/(addtolist|recommendations|reviews|shared)\.php/
  17. // @include /^https?:\/\/myanimelist\.net\/(anime|manga)\/(season|genre|producer|magazine)/
  18. // @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://myanimelist.net&size=64
  19. // @require https://update.gf.qytechs.cn/scripts/519092/arrivejs%20%28Latest%29.js
  20. // @run-at document-end
  21. // @grant GM_setValue
  22. // @grant GM_getValue
  23. // ==/UserScript==
  24.  
  25. (function() {
  26. 'use strict';
  27. const $ = jQuery; //Defines That The Symbol $ Is A jQuery
  28. const url = location.pathname; //Create a new global variable to detect the URL
  29.  
  30. document.head.insertAdjacentHTML('beforeend', '<style>.ranking-list td {background: none !important;}</style>'); //On topanime/manga and shared.php pages remove the default background
  31.  
  32. if (url.match('shared.php') !== null || (url.match(/animelist|mangalist/) !== null && document.body.innerHTML.match(/sharedanime.php|sharedmanga.php/) !== null)) { //If the url is the shared page or If the user is on any animelist or mangalist and if it's not the user own anime/manga list
  33. document.head.insertAdjacentHTML('beforeend', '<style>td {background: none !important;}</style>'); //Remove the default background color on rows on classic lists and on rows that both users gave the exact same score for the row entry on the shared.php page
  34. } //Finishes the if condition
  35.  
  36. if (GM_getValue("Dropped") === undefined) { //If the variable doesn't exist yet define the variables
  37. GM_setValue('On-Hold', 'rgb(255 216 82 / 30%)'); //Set the On-Hold Color
  38. GM_setValue('PTW/PTR', 'rgb(144 144 144 / 30%)'); //Set the PTW/PTR Color
  39. GM_setValue('Dropped', 'rgb(255 142 144 / 30%)'); //Set the Dropped Color
  40. GM_setValue('addtolist', 'rgb(85 253 207 / 30%)'); //Set the addtolist Color
  41. GM_setValue('Completed', 'rgb(155 184 253 / 30%)'); //Set the Completed Color
  42. GM_setValue('Watching/Reading', 'rgb(67 232 93 / 30%)'); //Set the Watching/Reading Color
  43. GM_setValue('AnimeList/MangaList', 'rgb(85 253 207 / 30%)'); //Set the Watching/Reading Color
  44. } //Finishes the if condition
  45.  
  46. if (url.match('addtolist.php') !== null) //If the user is on the addtolist page
  47. { //Starts the if condition
  48. document.querySelector("button.inputButton").addEventListener("click", function() { //When the search button is clicked
  49. setTimeout(function() { //Starts the settimeout function
  50. $('tr:contains("Edit")').css('background-color', GM_getValue('addtolist'))[0]; //Add the same background color to all entries that's on the user list
  51. }, 2000); //Starts the HighLight function after 2 secs
  52. }); //Finishes the settimeout function
  53.  
  54. document.querySelector("#maSearchText").addEventListener("keyup", function(e) { //When the user press Enter on the search box
  55. if (e.keyCode === 13) { //If the enter key was pressed
  56. setTimeout(function() { //Starts the settimeout function
  57. $('tr:contains("Edit")').css('background-color', GM_getValue('addtolist'))[0]; //Add the same background color to all entries that's on the user list
  58. }, 2000); //Starts the HighLight function after 2 secs
  59. } //Finishes the if condition
  60. }); //Finishes the settimeout function
  61. } //Finishes the if condition
  62.  
  63. if (document.querySelectorAll('a.Lightbox_AddEdit:not(.button_add)').length !== 0 && url.match('addtolist.php') === null && document.querySelectorAll('.page-common .bgColor1').length !== 0) { //If the page has animes that are on the user list and if the url isn't the addtolist page and if the element '.page-common .bgColor1/2' exists
  64. document.head.insertAdjacentHTML('beforeend', '<style>.page-common .bgColor1, .page-common .bgColor2 {background: unset !important;}</style>'); //Remove the default background
  65. } //Finishes the if condition
  66.  
  67. async function HighLight() //Creates a new function function
  68. { //Starts the function
  69.  
  70. if (url.match(/animelist|mangalist/) !== null && document.body.innerHTML.match(/sharedanime.php|sharedmanga.php/) !== null) { //If the user is on any animelist or mangalist and if it's not the user own anime/manga list
  71. $('tr:contains("Edit")').css('background-color', GM_getValue('AnimeList/MangaList'))[0]; //Add the same background color to all entries that's on the user list
  72. return; //Stop the script execution
  73. } //Finishes the if condition
  74.  
  75. if (document.querySelectorAll('a.Lightbox_AddEdit:not(.button_add)').length !== 0) { //If the page has animes that are on the user list
  76. var OnUserLists = document.querySelectorAll('a.Lightbox_AddEdit:not(.button_add)').length === 0 ? document.querySelectorAll('.Lightbox_AddEdit.btn-addEdit-large:not(.button_add)') : document.querySelectorAll('a.Lightbox_AddEdit:not(.button_add)'); //Add all animes on the user list total number to a variable
  77.  
  78. if (url.match('shared.php') !== null) { //If the URL is the shared page
  79. OnUserLists = document.querySelector("table").querySelectorAll('a.Lightbox_AddEdit:not(.button_add)'); //Add all shared animes on the user list total number to a variable
  80. } //Finishes the if condition
  81.  
  82. } //Finishes the if condition
  83.  
  84. if (OnUserLists !== undefined) //If there's at least 1 anime on the user list on the current page
  85. { //Starts the if condition
  86. for (var i = OnUserLists.length; i--;) { //Starts the for condition
  87. var Elements = OnUserLists[i].parentElement.parentElement.parentElement; //If the current opened page is the season or userrecs page, or if it's the people page and the user also has MALSync installed
  88.  
  89. if (url.match('stacks') !== null && document.querySelector(".on").className === 'tile on') { //If the URL is the stacks page and the tile is active
  90. Elements = OnUserLists[i].parentElement.parentElement; //Change the Elements variable
  91. OnUserLists[i].style.fontSize = 'unset'; //Make the description text fit the add btn box
  92. } //Finishes the if condition
  93.  
  94. if (url.match('/people|anime.php/') !== null && OnUserLists[i].parentElement.parentElement.tagName === 'TR') { //If the current opened page is the people page or the anime.php and if the 2 parentElement is a TR element
  95. var ParentElement = true; //Define the variable as false because the user doesn't have MALSync installed
  96. } //Finishes the if condition
  97.  
  98. if (location.href === 'https://myanimelist.net/' || url.match(/\/search\/all|reviews.php|recommendations.php|topanime.php|topmanga.php|shared.php|manga.php|\/watch|\/character|\/genre|\/producer|\/magazine/) !== null && document.querySelector("div.js-categories-seasonal.js-block-list.tile.mt16") === null || ParentElement === true) { //If the current page is one of these pages, and If the genre/producer/magazine page it's not on the block list view mode, or if it's the people page and the user doesn't have MALSync installed
  99. Elements = OnUserLists[i].parentElement.parentElement; //Store the correct element to a variable to change its background color later
  100. } //Finishes the if condition
  101.  
  102. if (Elements.outerHTML.match(/Completed|s="2"/gi) !== null) //If the link element title/classname/data-status "is" completed
  103. { //Starts the if condition
  104. Elements.style.backgroundColor = GM_getValue('Completed'); //Change the element background color
  105. OnUserLists[i].innerText = 'CMPL'; //Change the text from edit to CMPL
  106. OnUserLists[i].style.backgroundColor = '#26448f'; //Change the edit button background color
  107. OnUserLists[i].style.color = 'white'; //Change the edit button text color
  108. } //Finishes the if condition
  109.  
  110. if (Elements.innerHTML.match(/Plan to Watch$|Plan to Read$|plantowatch|plantoread|s="6"/gi) !== null) //If the link element title/classname/data-status "is" PTW/PTR
  111. { //Starts the if condition
  112. Elements.style.backgroundColor = GM_getValue('PTW/PTR'); //Change the element background color
  113. OnUserLists[i].innerText = 'PLAN'; //Change the text from edit to PLAN
  114. OnUserLists[i].style.backgroundColor = '#c3c3c3'; //Change the edit button background color
  115. OnUserLists[i].style.color = 'white'; //Change the edit button text color
  116. } //Finishes the if condition
  117.  
  118. if (OnUserLists[i].outerHTML.match(/Watching|Reading|s="1"/gi) !== null) //If the link element title/classname/data-status "is" watching/reading
  119. { //Starts the if condition
  120. Elements.style.backgroundColor = GM_getValue('Watching/Reading'); //Change the element background color
  121. OnUserLists[i].innerText = OnUserLists[i].outerHTML.match(/Reading/gi) !== null ? 'CR' : 'CW'; //Change the text from edit to the actual entry status
  122. OnUserLists[i].style.backgroundColor = '#2db039'; //Change the edit button background color
  123. OnUserLists[i].style.color = 'white'; //Change the edit button text color
  124. } //Finishes the if condition
  125.  
  126. if (OnUserLists[i].outerHTML.match(/Dropped|s="4"/gi) !== null) //If the link element title/classname/data-status "is" dropped
  127. { //Starts the if condition
  128. Elements.style.backgroundColor = GM_getValue('Dropped'); //Change the element background color
  129. OnUserLists[i].innerText = 'DROP'; //Change the text from edit to DROP
  130. OnUserLists[i].style.backgroundColor = '#a12f31'; //Change the edit button background color
  131. OnUserLists[i].style.color = 'white'; //Change the edit button text color
  132. } //Finishes the if condition
  133.  
  134. if (OnUserLists[i].outerHTML.match(/On-Hold|s="3"/gi) !== null) //If the link element title/classname/data-status "is" on-hold
  135. { //Starts the if condition
  136. Elements.style.backgroundColor = GM_getValue('On-Hold'); //Change the element background color
  137. OnUserLists[i].innerText = 'HOLD'; //Change the text from edit to HOLD
  138. OnUserLists[i].style.backgroundColor = '#f1c83e'; //Change the edit button background color
  139. OnUserLists[i].style.color = 'white'; //Change the edit button text color
  140. } //Finishes the if condition
  141. } //Finishes the for condition
  142. } //Finishes the if condition
  143. } //Finishes the function HighLight
  144.  
  145. window.onscroll = function() { //If the next result page is auto-loaded and added to the document body (If the user uses anything like the Endless MAL Script)
  146. if (window.scrollY * 1.2 >= document.querySelector('body').offsetHeight - window.innerHeight) { //When the bottom is almost reached
  147. setTimeout(function() { //Starts the settimeout function
  148. HighLight(); //Starts the HighLight function
  149. }, 1500); //Starts the HighLight function after 1.5 secs
  150. } //Finishes the if condition
  151. }; //Finishes the onscroll event listener
  152.  
  153. window.onload = setTimeout(function() { //Starts the settimeout function when the page finishes loading
  154. HighLight(); //Starts the HighLight function
  155. }, 500); //Finishes the onscroll event listener and SFinishes the onscroll event listener and tarts the HighLight function after half sec
  156. })();

QingJ © 2025

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