AniList MultiTitle Display

Adds the non-primary titles to the title display.

  1. // ==UserScript==
  2. // @name AniList MultiTitle Display
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Adds the non-primary titles to the title display.
  6. // @author Bane
  7. // @match https://anilist.co/anime/*
  8. // @match https://anilist.co/manga/*
  9. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
  10. // @require http://code.jquery.com/jquery-3.4.1.min.js
  11. // @require https://gf.qytechs.cn/scripts/6250-waitforkeyelements/code/waitForKeyElements.js?version=23756
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. /* globals jQuery, $, waitForKeyElements */
  16.  
  17. function GetTitles(jnode)
  18. {
  19. console.log("Getting AniTitles!");
  20.  
  21. //The already existing title
  22. var aniTitle = document.querySelector("#app > div.page-content > div > div.header-wrap > div.header > div.container > div.content > h1")
  23. aniTitle.innerHTML = aniTitle.innerText; //Replace the HTML with the innerText cuz it's neater
  24.  
  25. var oldTitle = aniTitle.innerText; //Store the user preference
  26. var oldTitle2 = aniTitle.innerHTML; //Double store because weirdness in some titles, discovered thanks to https://anilist.co/anime/97634/
  27. aniTitle.innerHTML += "</br></br>" //Add line breaks to separate the preference from the others
  28.  
  29. //var sets = jnode;
  30. var sets = document.getElementsByClassName("data-set"); //Searched all the data values on the sidebar
  31.  
  32. var title = ""; //Creates empty title string for later
  33.  
  34. //The types we are looking to add
  35. var types = ["Romaji", "English", "Native", "Synonyms"];
  36.  
  37. SetTitles();
  38.  
  39. function SetTitles()
  40. {
  41. for(var i = 0; i < sets.length; i++)
  42. {
  43. //Get the type we are looking at in the loop
  44. var typeCheck = sets[i].getElementsByClassName("type")[0].innerText;
  45.  
  46. //If the type is in our wanted types...
  47. if(types.indexOf(typeCheck) > -1)
  48. {
  49. //...continue and add it to the title.
  50. console.log("Right Ani type found");
  51. AddTitle(i);
  52. }
  53. }
  54. }
  55.  
  56. function AddTitle(i)
  57. {
  58. title = sets[i].getElementsByClassName("value")[0].innerHTML; //Get the text from the value.
  59. title = title.replace(/ +/g, " "); //Removes double spaces (for some reason there's a few, such as at https://anilist.co/anime/98448/)
  60.  
  61. if(!(title == oldTitle || title == oldTitle2)) //If the title is NOT the same as the user preference one...
  62. {
  63. //...add it.
  64. aniTitle.innerHTML += title + "</br>";
  65. }
  66. }
  67. }
  68.  
  69. waitForKeyElements("div.sidebar", GetTitles);

QingJ © 2025

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