Greasy Fork is available in English.

Better Buttons To Edit Anime/Manga Information

The script removes the actual "Edit Anime/Manga Information" drop down menu, and replaces that with Better Buttons To edit the Anime/Manga information.

Instalar este script¿?
Script recomendado por el autor

Puede que también te guste Watch Order & Adaptations Finder.

Instalar este script
  1. // ==UserScript==
  2. // @name Better Buttons To Edit Anime/Manga Information
  3. // @namespace Better Buttons To Edit Anime Information
  4. // @version 14
  5. // @description The script removes the actual "Edit Anime/Manga Information" drop down menu, and replaces that with Better Buttons To edit the Anime/Manga information.
  6. // @author hacker09
  7. // @include /^https:\/\/myanimelist\.net\/((anime|manga)(id=)?(\.php\?id=)?)(\/)?([\d]+)/
  8. // @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://myanimelist.net&size=64
  9. // @run-at document-end
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (async function() {
  14. var MarginLeft = -7; //Creates a new variable
  15. const $ = window.jQuery; //Defines That The Symbol $ Is A jQuery
  16. const id = location.pathname.match(/\d+/)[0]; //Get the entry id
  17. var type, remove, sourceortype, airingdatesorpubdates, ratingorchapvol; //Create new variables
  18. const CSSPart = 'height: 10px; width: 10px; background-size: cover; display: inline-block; transform: scale(1.8); vertical-align: top; margin-top: -10px;'; //Store parts of the CSS codes
  19.  
  20. location.pathname.split('/')[1] === 'anime' ? (type = 'aid', remove = 'anime', sourceortype = 'source', airingdatesorpubdates = 'airingdates', ratingorchapvol = 'rating') : (type = 'mid', remove = 'manga', sourceortype = 'type', airingdatesorpubdates = 'pubdates', ratingorchapvol = 'chapvol'); //Set up the variables
  21.  
  22. document.getElementsByClassName('js-' + remove + '-edit-info-button')[0].remove(); //Remove the default Edit Anime/Manga Information Button
  23.  
  24. const BroadCastButton = '<a href="/dbchanges.php?aid=' + id + '&t=broadcast" target="_blank" title="Edit Anime BroadCast" class="BetterBTN" id="BroadCastButton" style="margin-left: 420px; ' + CSSPart + ` background-image: url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/Qtr7ckM.png' : 'https://i.imgur.com/1TA8f0M.png'});"></a>`; //Create a BTN const
  25. const ProducersButton = '<a href="/dbchanges.php?aid=' + id + '&t=producers" target="_blank" title="Edit Anime Producers" class="BetterBTN" id="ProducersButton" style="margin-left: 400px; ' + CSSPart + ` background-image: url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/tncXsk9.png' : 'https://i.imgur.com/X8b0lhp.png'});"></a>`; //Create a BTN const
  26. const RatingButton = '<a href="/dbchanges.php?' + type + "=" + id + "&t=" + ratingorchapvol + '" target="_blank" title="Edit Anime Rating" class="BetterBTN" id="RatingButton" style="margin-left: 380px; ' + CSSPart + ` background-image: url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/Kf803n2.png' : 'https://i.imgur.com/ouIcJ0L.png'});"></a>`; //Create a BTN const
  27. const RelationsButton = '<a href="/dbchanges.php?' + type + "=" + id + '&t=relations" target="_blank" title="Edit Anime Relations" class="BetterBTN" id="RelationsButton" style="margin-left: 357px; ' + CSSPart + ` background-image: url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/ErLd0nD.png' : 'https://i.imgur.com/7tWTGSx.png'});"></a>`; //Create a BTN const
  28. const SourceButton = '<a href="/dbchanges.php?' + type + "=" + id + "&t=" + sourceortype + '" target="_blank" title="Edit Anime Source" class="BetterBTN" id="SourceButton" style="margin-left: 335px; ' + CSSPart + ` background-image: url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/Ha6bhYe.png' : 'https://i.imgur.com/wv414uC.png'});"></a>`; //Create a BTN const
  29. const AiringDatesButton = '<a href="/dbchanges.php?' + type + "=" + id + "&t=" + airingdatesorpubdates + '" target="_blank" title="Edit Anime Airing Dates" class="BetterBTN" id="AiringDatesButton" style="margin-left: 313px; ' + CSSPart + ` background-image: url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/8KJdVd9.png' : 'https://i.imgur.com/9j8Jkyc.png'});"></a>`; //Create a BTN const
  30. const BackgroundButton = '<a href= "/dbchanges.php?' + type + "=" + id + '&t=background" target="_blank" title="Edit Anime Background" class="BetterBTN" id="BackgroundButton" style="margin-left: 290px; ' + CSSPart + ` background-image: url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/TA49IXP.png' : 'https://i.imgur.com/nglIeUs.png'});"></a>`; //Create a BTN const
  31. const AlternativeTitlesButton = '<a href="/dbchanges.php?' + type + "=" + id + '&t=alternative_titles" target="_blank" title="Edit Anime Alternative Titles" class="BetterBTN" id="AlternativeTitlesButton" style="margin-left: 270px; ' + CSSPart + ` background-image: url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/dKTM3vZ.png' : 'https://i.imgur.com/YDcRsLh.png'});"></a>`; //Create a BTN const
  32. const SynopsisButton = '<a href="/dbchanges.php?' + type + "=" + id + '&t=synopsis" target="_blank" title="Edit Anime Synopsis" class="BetterBTN" id="SynopsisButton" style="margin-left: 250px; ' + CSSPart + ` background-image: url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/JnL17QZ.png' : 'https://i.imgur.com/G41CHJZ.png'});"></a>`; //Create a BTN const
  33. const PictureButton = '<a href="/dbchanges.php?' + type + "=" + id + '&t=pic" target="_blank" title="Edit Anime Picture" class="BetterBTN" id="PictureButton" style="margin-left: 228px; ' + CSSPart + ` background-image: url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/dorhKZG.png' : 'https://i.imgur.com/fzxCO0C.png'});"></a>`; //Create a BTN const
  34. const DurationButton = '<a href="/dbchanges.php?aid=' + id + '&t=duration" target="_blank" title="Edit Anime Duration" class="BetterBTN" id="DurationButton" style="margin-left: 205px; ' + CSSPart + ` margin-top: -9px; background-image: url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/s0bc70x.png' : 'https://i.imgur.com/U9qigWi.png'});"></a>`; //Create a BTN const
  35.  
  36. const Infoh2Elem = [...[...document.querySelectorAll("h2")].find(h2 => h2.textContent === "Information").parentNode.querySelectorAll("h2")].find(info => info.outerHTML.includes("Information")); //Save the information div element
  37. Infoh2Elem.insertAdjacentHTML("afterbegin", '<br>'); //Add a space before the Information h2 header
  38.  
  39. const BTNsArray = [BroadCastButton, ProducersButton, RatingButton, RelationsButton, SourceButton, AiringDatesButton, BackgroundButton, AlternativeTitlesButton, SynopsisButton, PictureButton, DurationButton]; //Creates an array of BTNs
  40. BTNsArray.forEach(function(BTNs) { //ForEach button in the array
  41. document.querySelector('.header-right').parentElement.insertAdjacentHTML("beforeend", BTNs); //Add the BTNs on the page
  42. Infoh2Elem.insertAdjacentHTML("afterbegin", BTNs); //Add the BTNs on the page
  43. }); //Finishes the ForEach function
  44.  
  45. if (type === 'mid') //If the user is on a manga entry
  46. { //Starts the if condition
  47. MarginLeft = 5; //Centralize the icons
  48. document.querySelectorAll("#SourceButton").forEach(BTN => BTN.setAttribute("title", "Edit Manga Type")); //Change txt on mouse hover
  49. document.querySelectorAll("#PictureButton").forEach(BTN => BTN.setAttribute("title", "Edit Manga Picture")); //Change txt on mouse hover
  50. document.querySelectorAll("#SynopsisButton").forEach(BTN => BTN.setAttribute("title", "Edit Manga Synopsis")); //Change txt on mouse hover
  51. document.querySelectorAll("#RelationsButton").forEach(BTN => BTN.setAttribute("title", "Edit Manga Relations")); //Change txt on mouse hover
  52. document.querySelectorAll("#BackgroundButton").forEach(BTN => BTN.setAttribute("title", "Edit Manga Background")); //Change txt on mouse hover
  53. document.querySelectorAll("#AiringDatesButton").forEach(BTN => BTN.setAttribute("title", "Edit Manga Publishing Dates")); //Change txt on mouse hover
  54. document.querySelectorAll("#RatingButton").forEach(BTN => BTN.setAttribute("title", "Edit Manga Chapters/Volumes")); //Change txt on mouse hover
  55. document.querySelectorAll("#RatingButton").forEach(BTN => BTN.style.backgroundImage = `url(${document.querySelector(".dark-mode") !== null ? 'https://i.imgur.com/UoGgWiw.png' : 'https://i.imgur.com/py5QNtd.png'}`); //Change rating BTN IMG
  56. document.querySelectorAll("#AlternativeTitlesButton").forEach(BTN => BTN.setAttribute("title", "Edit Manga Alternative Titles")); //Change txt on mouse hover
  57. document.querySelectorAll("#BroadCastButton,#ProducersButton,#DurationButton").forEach(BTN => BTN.setAttribute("style", "display: none !important;")); //Hide BTNs
  58. } //Finishes the if condition
  59.  
  60. document.querySelectorAll(".BetterBTN").forEach(function(BTNs, i) { //ForEach Information BTNs
  61. if (i > 10) { //Only for the Information BTNs
  62. BTNs.style.marginLeft = MarginLeft + 'px'; //Gradualy increase the left margin
  63. BTNs.style.display = 'block'; //Change the display mode
  64. MarginLeft += 22; //Increase the left margin
  65. } //Finishes the if condition
  66. }); //Finishes the ForEach loop
  67.  
  68. function Format(el, href) { //Creates a function to add the link elements
  69. if ($(el).length > 0) { //If the element exists
  70. if ($(el).parent().html().match(/span>\s+?None\sfound,/)) //If the element is none found
  71. { //Starts the if condition
  72. $(el).parent().html($(el).parent().html().replace(/span>\s+?None\sfound,[\s\S]+?$/, 'span> Unknown')); //Add a none found span element
  73. } //Finishes the if condition
  74. var text = $('span', $(el).parent()).first().text().replace(/:$/, ''); //Save the element text to an array
  75. $(el).empty().append(`<a href="${href}" target="_blank">${text}</a>`).append(':'); //Add a link to the element and the text for the element
  76. } //Finishes the if condition
  77. } //Finishes the Format function
  78.  
  79. if ($('#addtolist ~ h2:contains(Alternative Titles)').length > 0) { //If the Alternative Titles element exists
  80. $('#addtolist ~ h2:contains(Alternative Titles)').prepend('<a href="/dbchanges.php?' + location.href.split('/')[3] + 'id=' + id + '&t=alternative_titles" class="floatRightHeader" target="_blank">Edit</a>'); //Add an edit button next to it
  81. } //Finishes the if condition
  82. if (type === 'aid') { //If the entry is an anime
  83. Format('span.dark_text:contains(Aired:)', '/dbchanges.php?aid=' + id + '&t=airingdates'); //Call the Format function
  84. Format('span.dark_text:contains(Broadcast:)', '/dbchanges.php?aid=' + id + '&t=broadcast'); //Call the Format function
  85. Format('span.dark_text:contains(Producers:)', '/dbchanges.php?aid=' + id + '&t=producers'); //Call the Format function
  86. Format('span.dark_text:contains(Licensors:)', '/dbchanges.php?aid=' + id + '&t=producers'); //Call the Format function
  87. Format('span.dark_text:contains(Studios:)', '/dbchanges.php?aid=' + id + '&t=producers'); //Call the Format function
  88. Format('span.dark_text:contains(Source:)', '/dbchanges.php?aid=' + id + '&t=source'); //Call the Format function
  89. Format('span.dark_text:contains(Duration:)', '/dbchanges.php?aid=' + id + '&t=duration'); //Call the Format function
  90. Format('span.dark_text:contains(Rating:)', '/dbchanges.php?aid=' + id + '&t=rating'); //Call the Format function
  91. } else { //If the entry is manga
  92. Format('span.dark_text:contains(Type:)', '/dbchanges.php?mid=' + id + '&t=type'); //Call the Format function
  93. Format('span.dark_text:contains(Volumes:)', '/dbchanges.php?mid=' + id + '&t=chapvol'); //Call the Format function
  94. Format('span.dark_text:contains(Chapters:)', '/dbchanges.php?mid=' + id + '&t=chapvol'); //Call the Format function
  95. Format('span.dark_text:contains(Published:)', '/dbchanges.php?mid=' + id + '&t=pubdates'); //Call the Format function
  96. } //Finishes the else condition
  97. })();