Automatically Add Start/Finish Dates For Animes/Mangas + Helpful Buttons

Selecting Watching/Reading auto adds the start date, and Completed auto adds the finish date. Shows the actual Anime/Manga dates below the Anime/Manga image, that's updated every time you reload or click on Watching/Reading/Completed. Hover the mouse over the dates and click to reset them. This script adds 6 helpful buttons on the Anime/Manga Edit Details Page.

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

您可能也喜欢Anime list total time - MAL

安装此脚本
  1. // ==UserScript==
  2. // @name Automatically Add Start/Finish Dates For Animes/Mangas + Helpful Buttons
  3. // @namespace Add End And Start Dates In 1 Click + Reset Dates/All Buttons,
  4. // @version 44
  5. // @description Selecting Watching/Reading auto adds the start date, and Completed auto adds the finish date. Shows the actual Anime/Manga dates below the Anime/Manga image, that's updated every time you reload or click on Watching/Reading/Completed. Hover the mouse over the dates and click to reset them. This script adds 6 helpful buttons on the Anime/Manga Edit Details Page.
  6. // @author hacker09
  7. // @match https://myanimelist.net/ownlist/*
  8. // @include /^https:\/\/myanimelist\.net\/(anime|manga)(id=)?(\.php\?id=)?\/?\d+\/?(?!.*\/).*(\?q=.*&cat=anime|manga)?$/
  9. // @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://myanimelist.net&size=64
  10. // @run-at document-end
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. if (location.pathname.split('/')[1] === 'ownlist') //Check If The User Is On https://myanimelist.net/ownlist/
  17. {
  18. const $ = window.jQuery; //Defines That The Symbol $ Is A jQuery
  19. const entrytype = location.pathname.split('/')[2]; //Get the entry type
  20. //**********************************************************************************************************************************************************************
  21. document.querySelector("#start_date_insert_today").parentElement.insertAdjacentHTML('beforeend', '<a id="resetstart" style="cursor: pointer;margin-left: 5px;height: 10px;width: 10px;top: 10px;">Reset</a>'); //Adds a reset btn on the page
  22. document.getElementById('resetstart').onclick = function() { //Adds an event listener to the button
  23. document.querySelectorAll("#add_" + entrytype + "_start_date_year,#add_" + entrytype + "_start_date_day,#add_" + entrytype + "_start_date_month").forEach(el => el.selectedIndex = -1); //Reset the start dates
  24. }; //Finishes the event listener
  25. //**********************************************************************************************************************************************************************
  26. document.querySelector("#end_date_insert_today").parentElement.insertAdjacentHTML('beforeend', '<a id="resetend" style="cursor: pointer;margin-left: 5px;height: 10px;width: 10px;top: 10px;">Reset</a>'); //Adds a reset btn on the page
  27. document.getElementById('resetend').onclick = function() { //Adds an event listener to the button
  28. document.querySelectorAll("#add_" + entrytype + "_finish_date_year,#add_" + entrytype + "_finish_date_day,#add_" + entrytype + "_finish_date_month").forEach(el => el.selectedIndex = -1); //Reset the finish dates
  29. }; //Finishes the event listener
  30. //**********************************************************************************************************************************************************************
  31. document.querySelector('.notice_open_public').insertAdjacentHTML('beforeend', '<a id="addalldates" style="cursor: pointer;margin-left: 5px;height: 10px;width: 10px;top: 10px;">Add End And Start Dates + Submit</a>'); //Adds the add all dates btn on the page
  32. document.getElementById('addalldates').onclick = function() { //Adds an event listener to the button
  33. document.querySelectorAll("#start_date_insert_today,#end_date_insert_today").forEach(el => el.click()); //Add dates
  34. document.getElementsByClassName("inputButton main_submit")[0].click(); //Submit
  35. }; //Finishes the event listener
  36. //**********************************************************************************************************************************************************************
  37. [...document.querySelectorAll("td")].find(td => td.textContent === "Start Date").parentElement.insertAdjacentHTML('beforeend', '<a id="InsertStart" style="cursor: pointer;margin-left: -200px; margin-top: -3px; display: block;">Insert + Submit</a>'); //Adds the add start dates btn on the page
  38. document.getElementById('InsertStart').onclick = function() { //Adds an event listener to the button
  39. document.getElementById("start_date_insert_today").click(); //Adds the start date
  40. document.getElementsByClassName("inputButton main_submit")[0].click(); //Submit
  41. }; //Finishes the event listener
  42. //**********************************************************************************************************************************************************************
  43. [...document.querySelectorAll("td")].find(td => td.textContent === "Finish Date").parentElement.insertAdjacentHTML('beforeend', '<a id="InsertEnd" style="cursor: pointer;margin-left: -200px; margin-top: 30px; display: block;">Insert + Submit</a>'); //Adds the add finish dates btn on the page
  44. document.getElementById('InsertEnd').onclick = function() { //Adds an event listener to the button
  45. document.getElementById("end_date_insert_today").click(); //Adds the finish date
  46. document.getElementsByClassName("inputButton main_submit")[0].click(); //Submit
  47. }; //Finishes the event listener
  48. //**********************************************************************************************************************************************************************
  49. document.querySelector("#advanced-button").parentElement.insertAdjacentHTML('beforeend', '<a id="resetalmostall" style="cursor: pointer;margin-left: 240px;">Reset Almost Everything</a>'); //Adds the reset almost all btn on the page
  50. document.getElementById('resetalmostall').onclick = function() { //Adds an event listener to the button
  51. $('select').prop('selectedIndex', 0); //Resets almost all form fields
  52. }; //Finishes the event listener
  53. //**********************************************************************************************************************************************************************
  54. setTimeout(function() { //Starts the timeout condition
  55. if (document.querySelectorAll("#hide-advanced-button")[0].outerText !== "Hide Advanced ") //Detect if the Show Advanced button is already opened or not,if not then...
  56. { //Starts the if condition
  57. document.querySelector("#hide-advanced-button").click(); //Clicks on the Show Advanced button
  58. } //Finishes the if condition
  59. }, 0); //Finishes the settimeout
  60. } //Finishes the if condition
  61. //**********************************************************************************************************************************************************************
  62. else //If the user is on a manga/anime page
  63. { //Starts the else condition
  64. const day = new Date().getDate(); //Creates a variable to hold the actual day
  65. const month = new Date().getMonth() + 1; //Creates a variable to hold the actual month
  66. const year = new Date().getFullYear(); //Creates a variable to hold the actual year
  67. const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; //Creates a variable to hold the month names
  68. const entrytype2 = location.pathname.split('/')[1].match('.php') !== null ? location.pathname.split('/')[1].split('.php')[0] : location.pathname.split('/')[1]; //Creates a variable to hold the actual entry type
  69. const token = document.head.querySelector("[name='csrf_token']").content; //Creates a variable to hold the actual csrf_token
  70. const entryid = location.pathname.match(/\d+/) === null ? location.search.match(/\d+/)[0] : location.pathname.match(/\d+/)[0]; //Creates a variable to hold the actual entry id
  71. var priority, is_asked_to_discuss, sns_post_type, start_month, start_day, start_year, finish_month, finish_day, finish_year, watched_eps, current_score, anime_tags, storage_type, storage_value, rewatched_times, rewatch_value, comments, manga_read_chapters, manga_retail, manga_read_times, manga_reread_value, manga_read_volumes, status, IsEditPageOpened, totaleps, totalVols, totalChaps, AddedToList, color; //Make all these variables global
  72.  
  73. document.querySelector(".dark-mode") !== null ? color = '' : color = '#1d439b'; //Change the btns txt color according to the user theme mode
  74.  
  75. async function ShowButtons() //Creates a function to show the Buttons
  76. { //Starts the function
  77. //Starts the codes to Display the Started Date
  78. if ((start_month !== "") || (start_day !== "") || (start_year !== "")) // If month or date or year is set in the started dates then show the button
  79. { //Starts the if condition
  80. var ShowStartedMonth = monthNames[start_month - 1]; //Suppose the month is set and show it
  81. if (ShowStartedMonth === undefined) // If month is not set in the started dates
  82. { //Starts the if condition
  83. ShowStartedMonth = ''; //Hide the started month
  84. } //Finishes the if condition
  85. const ResetStartDate = document.createElement("div"); //Creates the button to reset the start date
  86. ResetStartDate.innerHTML = 'Started: ' + ShowStartedMonth + ' ' + start_day + ' ' + start_year; //Define the button text
  87. document.querySelector("#profileRows").append(ResetStartDate); //Append the button below the "add to favorites" button
  88. ResetStartDate.setAttribute("id", "ResetStartDate"); //Gives an id to the button
  89. if (document.querySelectorAll("#ResetStartDate").length > 1) //If the button already exits
  90. { //Starts the if condition
  91. document.querySelector("#ResetStartDate").remove(); //Remove the old button
  92. } //Finishes the if condition
  93. ResetStartDate.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: " + color + ";cursor: pointer;padding: 2px 3px;"); //Set the css for the button when the page loads
  94. document.querySelector("#ResetStartDate").onmousemove = function() { //Set the css for the button when the mouse is hovering the button
  95. ResetStartDate.innerHTML = "Reset Started Date"; //Change the element text
  96. ResetStartDate.setAttribute("style", "cursor: pointer;background-color: " + color + ";border-color: #6386d5;border-style: solid;border-width: 0 0 1px;color: #fff;padding: 2px 3px;"); //Make the element look like it's clickable and change the element color
  97. }; //Finishes the css for the button when the mouse is hovering the button
  98. document.querySelector("#ResetStartDate").onmouseout = function() {
  99. ResetStartDate.innerHTML = 'Started: ' + ShowStartedMonth + ' ' + start_day + ' ' + start_year;
  100. ResetStartDate.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: " + color + ";cursor: pointer;padding: 2px 3px;"); //Set the css for the button when the mouse is not hovering the button
  101. }; //Set the css for the button when the mouse is leaves the button
  102. document.querySelector("#ResetStartDate").addEventListener("click", ResetStartDateFunc, false); //When the button is cliked call this function
  103. } //Finishes the if condition
  104.  
  105. //Starts the codes to Display the Finished Date
  106. if ((finish_month !== "") || (finish_day !== "") || (finish_year !== "")) // If month or date or year is set in the finished dates then show the button
  107. { //Starts the if condition
  108. var ShowFinishedMonth = monthNames[finish_month - 1]; //Suppose the month is set and show it
  109. if (ShowFinishedMonth === undefined) // If month is not set in the finished dates
  110. { //Starts the if condition
  111. ShowFinishedMonth = ''; //Hide the finished month
  112. } //Finishes the if condition
  113. const ResetFinishDate = document.createElement("div"); //Creates the button to reset the finish date
  114. ResetFinishDate.innerHTML = 'Finished: ' + ShowFinishedMonth + ' ' + finish_day + ' ' + finish_year; //Define the button text; //Define the button text
  115. document.querySelector("#profileRows").append(ResetFinishDate); //Append the button below the "add to favorites" button
  116. ResetFinishDate.setAttribute("id", "ResetFinishDate"); //Gives an id to the button
  117. if (document.querySelectorAll("#ResetFinishDate").length > 1) //If the button already exits
  118. { //Starts the if condition
  119. document.querySelector("#ResetFinishDate").remove(); //Remove the old button
  120. } //Finishes the if condition
  121. ResetFinishDate.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: " + color + ";cursor: pointer;padding: 2px 3px;"); //Set the css for the button when the page loads
  122. document.querySelector("#ResetFinishDate").onmousemove = function() { //Set the css for the button when the mouse is hovering the button
  123. ResetFinishDate.innerHTML = "Reset Finished Date"; //Change the element text
  124. ResetFinishDate.setAttribute("style", "cursor: pointer;background-color: " + color + ";border-color: #6386d5;border-style: solid;border-width: 0 0 1px;color: #fff;padding: 2px 3px;"); //Make the element look like it's clickable and change the element color
  125. }; //Finishes the css for the button when the mouse is hovering the button
  126. document.querySelector("#ResetFinishDate").onmouseout = function() {
  127. ResetFinishDate.innerHTML = 'Finished: ' + ShowFinishedMonth + ' ' + finish_day + ' ' + finish_year;
  128. ResetFinishDate.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: " + color + ";cursor: pointer;padding: 2px 3px;"); //Set the css for the button when the mouse is leaves the button
  129. }; //Set the css for the button when the mouse is hovering the button
  130. document.querySelector("#ResetFinishDate").addEventListener("click", ResetFinishDateFunc, false); //When the button is cliked call this function
  131. } //Finishes the if condition
  132.  
  133. //Starts the codes to Display the Reset All Dates
  134. if ((finish_month !== "" || finish_day !== "" || finish_year !== "") && (start_month !== "" || start_day !== "" || start_year !== "")) // If month or date or year is set in the started and finished dates then show the button
  135. { //Starts the if condition
  136. const ResetAllDatesVar = document.createElement("div"); //Creates the button to reset all dates
  137. ResetAllDatesVar.innerHTML = "Reset Started+Finished Dates"; //Define the button text
  138. document.querySelector("#profileRows").append(ResetAllDatesVar); //Append the button below the "add to favorites" button
  139. ResetAllDatesVar.setAttribute("id", "ResetAllDatesVar"); //Gives an id to the button
  140. if (document.querySelectorAll("#ResetAllDatesVar").length > 1) //If the button already exits
  141. { //Starts the if condition
  142. document.querySelectorAll("#ResetAllDatesVar")[0].remove(); //Remove the old button.There's no real need to update this button again, but if isn't updated the onmousemove/out won't work
  143. } //Finishes the if condition
  144. ResetAllDatesVar.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: " + color + ";cursor: pointer;padding: 2px 3px;"); //Set the css for the button when the page loads
  145. document.querySelector("#ResetAllDatesVar").onmousemove = function() { //Set the css for the button when the mouse is hovering the button
  146. ResetAllDatesVar.setAttribute("style", "cursor: pointer;background-color: " + color + ";border-color: #6386d5;border-style: solid;border-width: 0 0 1px;color: #fff;padding: 2px 3px;"); //Make the element look like it's clickable and change the element color
  147. }; //Finishes the css for the button when the mouse is hovering the button
  148. document.querySelector("#ResetAllDatesVar").onmouseout = function() { //Set the css for the button when the mouse isn't hovering the button
  149. ResetAllDatesVar.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: " + color + ";cursor: pointer;padding: 2px 3px;"); //Set the css for the button when the mouse is leaves the button
  150. }; //Fnishrd the css for the button when the mouse isn't hovering the button
  151. document.querySelector("#ResetAllDatesVar").addEventListener("click", ResetAllDates, false); //When the button is cliked call this function
  152. } //Finishes the if condition
  153. } //Finishes the async ShowButtons function
  154.  
  155. async function getVariables() //Creates a function to get the needed Variables
  156. { //Starts the function
  157. const response = await fetch('https://myanimelist.net/ownlist/' + entrytype2 + '/' + entryid + '/edit'); //Fetch
  158. const html = await response.text(); //Gets the fetch response
  159. const newDocument = new DOMParser().parseFromString(html, 'text/html'); //Parses the fetch response
  160. priority = newDocument.querySelector("#add_" + entrytype2 + "_priority").value; //Creates a variable to hold the actual priority value
  161. is_asked_to_discuss = newDocument.querySelector("#add_" + entrytype2 + "_is_asked_to_discuss").value; //Creates a variable to hold the actual is_asked_to_discuss value
  162. sns_post_type = newDocument.querySelector("#add_" + entrytype2 + "_sns_post_type").value; //Creates a variable to hold the actual SNS value
  163. start_day = newDocument.querySelector("#add_" + entrytype2 + "_start_date_day").value; //Creates a variable to hold the actual start_day value
  164. start_month = newDocument.querySelector("#add_" + entrytype2 + "_start_date_month").value; //Creates a variable to hold the actual start_month value
  165. start_year = newDocument.querySelector("#add_" + entrytype2 + "_start_date_year").value; //Creates a variable to hold the actual start_year value
  166. finish_day = newDocument.querySelector("#add_" + entrytype2 + "_finish_date_day").value; //Creates a variable to hold the actual finish_day value
  167. finish_month = newDocument.querySelector("#add_" + entrytype2 + "_finish_date_month").value; //Creates a variable to hold the actual finish_month value
  168. finish_year = newDocument.querySelector("#add_" + entrytype2 + "_finish_date_year").value; //Creates a variable to hold the actual finish_year value
  169. current_score = newDocument.querySelector("#add_" + entrytype2 + "_score").value; //Creates a variable to hold the actual current_score value
  170. anime_tags = newDocument.querySelector("#add_" + entrytype2 + "_tags").value; //Creates a variable to hold the actual anime_tags value
  171. storage_type = newDocument.querySelector("#add_" + entrytype2 + "_storage_type").value; //Creates a variable to hold the actual storage_type value
  172. comments = newDocument.querySelector("#add_" + entrytype2 + "_comments").value; //Creates a variable to hold the actual comments value
  173. status = newDocument.querySelector("#add_" + entrytype2 + "_status").value; //Creates a variable to hold the actual status value
  174. if (entrytype2 === 'anime') //If the entry type is anime
  175. { //Starts the if condition
  176. watched_eps = newDocument.querySelector("#add_anime_num_watched_episodes").value; //Creates a variable to hold the actual watched_eps value
  177. storage_value = newDocument.querySelector("#add_anime_storage_value").value; //Creates a variable to hold the actual storage_value value
  178. rewatched_times = newDocument.querySelector("#add_anime_num_watched_times").value; //Creates a variable to hold the actual rewatched_times value
  179. rewatch_value = newDocument.querySelector("#add_anime_rewatch_value").value; //Creates a variable to hold the actual rewatch_value value
  180. totaleps = document.querySelector("#curEps").textContent; //Get the actual total episodes value
  181. } //Finishes the if condition
  182. else //If the entry type is manga
  183. { //Starts the else condition
  184. manga_read_chapters = newDocument.querySelector("#add_manga_num_read_chapters").value; //Creates a variable to hold the actual manga_read_chapters value
  185. manga_retail = newDocument.querySelector("#add_manga_num_retail_volumes").value; //Creates a variable to hold the actual manga_retail value
  186. manga_read_times = newDocument.querySelector("#add_manga_num_read_times").value; //Creates a variable to hold the actual manga_read_times value
  187. manga_reread_value = newDocument.querySelector("#add_manga_reread_value").value; //Creates a variable to hold the actual manga_read_times value
  188. manga_read_volumes = newDocument.querySelector("#add_manga_num_read_volumes").value; //Creates a variable to hold the actual manga_read_volumes value
  189. totalVols = document.querySelector("#totalVols").textContent === '?' ? 0 : document.querySelector("#totalVols").textContent; //Get the actual total manga volumes
  190. totalChaps = document.querySelector("#totalChaps").textContent === '?' ? 0 : document.querySelector("#totalChaps").textContent; //Get the actual total manga chapters
  191. } //Finishes the else condition
  192. } //Finishes the async getvariables function
  193. if (document.querySelector("#myinfo_status.btn-user-status-add-list.js-form-user-status.js-form-user-status-btn.myinfo_addtolist") === null) { //If the anime is on the user list
  194. AddedToList = true;
  195. var TimesExecuted = 0; //Creates a new variable
  196. const increaseby = 1; //Creates a new variable
  197.  
  198. document.addEventListener("mousemove", async function() { //Creates a new function to run when the mouse is hovering the page
  199. TimesExecuted += increaseby; //Sum the amount of times that the page was mouse hovered the page
  200. if (TimesExecuted === 1) { //On the first time that the page is hovered
  201. await getVariables(); //Call and wait the function getVariables
  202. await ShowButtons(); //Call and wait the function ShowButtons to Display the buttons
  203. } // //Finishes the if condition
  204. }); //Finishes the onmousemove event listener
  205. } //Finishes the if condition
  206.  
  207. document.body.insertAdjacentHTML('beforeend', '<div id="loadingScreen" style="display: none;z-index: 200;position: fixed;width: 100%;height: 100%;background-color: #00000054;top: 0;background-image: url(https://pa1.narvii.com/6258/61f5cd5c652efec508ff3c6e10798d26ccef6366_hq.gif);background-repeat: no-repeat;background-position: center;"></div>'); //Add the loading screen to the html body
  208.  
  209. async function ResetAllDates() //Creates a function to Reset All Dates
  210. { //Starts the async ResetAllDates function
  211. document.querySelector("#loadingScreen").style.display = ''; //Shows the Loading Screen
  212. if (IsEditPageOpened === true) //Check if the button edit details was opened
  213. { //Starts the if condition
  214. await getVariables(); //Call and wait the function getVariables
  215. } //Finishes the if condition
  216. document.querySelectorAll("#ResetStartDate,#ResetFinishDate,#ResetAllDatesVar").forEach(el => el.remove()); //Removes the now needless buttons
  217. const response = await fetch("https://myanimelist.net/ownlist/" + entrytype2 + "/" + entryid + "/edit", {
  218. "headers": {
  219. "content-type": "application/x-www-form-urlencoded"
  220. },
  221. "body": "add_manga%5Bnum_read_chapters%5D=" + manga_read_chapters + "&add_manga%5Bnum_retail_volumes%5D=" + manga_retail + "&add_manga%5Bnum_read_times%5D=" + manga_read_times + "&add_manga%5Breread_value%5D=" + manga_reread_value + "&add_manga%5Bnum_read_volumes%5D=" + manga_read_volumes + "&add_" + entrytype2 + "%5Bstatus%5D=" + status + "&add_anime%5Bnum_watched_episodes%5D=" + watched_eps + "&add_" + entrytype2 + "%5Bscore%5D=" + current_score + "&add_" + entrytype2 + "%5Btags%5D=" + anime_tags + "&add_" + entrytype2 + "%5Bpriority%5D=" + priority + "&add_" + entrytype2 + "%5Bstorage_type%5D=" + storage_type + "&add_anime%5Bstorage_value%5D=" + storage_value + "&add_anime%5Bnum_watched_times%5D=" + rewatched_times + "&add_anime%5Brewatch_value%5D=" + rewatch_value + "&add_" + entrytype2 + "%5Bcomments%5D=" + comments + "&add_" + entrytype2 + "%5Bis_asked_to_discuss%5D=" + is_asked_to_discuss + "&add_" + entrytype2 + "%5Bsns_post_type%5D=" + sns_post_type + "&csrf_token=" + token,
  222. "method": "POST"
  223. }); //Finishes the fetch
  224. await getVariables(); //Call and wait the function getVariables to get the new removed Finished/Started Dates variables,if the process was successful
  225. document.querySelector("#loadingScreen").style.display = 'none'; //Hides the Loading Screen
  226. } //Finishes the async ResetAllDates function
  227.  
  228. async function ResetStartDateFunc() //Creates a function to reset the start dates
  229. { //Starts the async ResetStartDateFunc function
  230. document.querySelector("#loadingScreen").style.display = ''; //Shows the Loading Screen
  231. if (IsEditPageOpened === true) //Check if the button edit details was opened
  232. { //Starts the if condition
  233. await getVariables(); //Call and wait the function getVariables
  234. } //Finishes the if condition
  235. document.querySelector("#ResetStartDate").remove(); //Removes the now needless button
  236. if (document.querySelector("#ResetAllDatesVar") !== null) //Check if the button ResetAllDatesVar exists
  237. { //Starts the if condition
  238. document.querySelector("#ResetAllDatesVar").remove(); //Removes the now needless button
  239. } //Finishes the if condition
  240. const response = await fetch("https://myanimelist.net/ownlist/" + entrytype2 + "/" + entryid + "/edit", {
  241. "headers": {
  242. "content-type": "application/x-www-form-urlencoded"
  243. },
  244. "body": "add_manga%5Bnum_read_chapters%5D=" + manga_read_chapters + "&add_manga%5Bnum_retail_volumes%5D=" + manga_retail + "&add_manga%5Bnum_read_times%5D=" + manga_read_times + "&add_manga%5Breread_value%5D=" + manga_reread_value + "&add_manga%5Bnum_read_volumes%5D=" + manga_read_volumes + "&add_" + entrytype2 + "%5Bstatus%5D=" + status + "&add_anime%5Bnum_watched_episodes%5D=" + watched_eps + "&add_" + entrytype2 + "%5Bscore%5D=" + current_score + "&add_" + entrytype2 + "%5Bfinish_date%5D%5Bmonth%5D=" + finish_month + "&add_" + entrytype2 + "%5Bfinish_date%5D%5Bday%5D=" + finish_day + "&add_" + entrytype2 + "%5Bfinish_date%5D%5Byear%5D=" + finish_year + "&add_" + entrytype2 + "%5Btags%5D=" + anime_tags + "&add_" + entrytype2 + "%5Bpriority%5D=" + priority + "&add_" + entrytype2 + "%5Bstorage_type%5D=" + storage_type + "&add_anime%5Bstorage_value%5D=" + storage_value + "&add_anime%5Bnum_watched_times%5D=" + rewatched_times + "&add_anime%5Brewatch_value%5D=" + rewatch_value + "&add_" + entrytype2 + "%5Bcomments%5D=" + comments + "&add_" + entrytype2 + "%5Bis_asked_to_discuss%5D=" + is_asked_to_discuss + "&add_" + entrytype2 + "%5Bsns_post_type%5D=" + sns_post_type + "&csrf_token=" + token,
  245. "method": "POST"
  246. }); //Finishes the fetch
  247. await getVariables(); //Call and wait the function getVariables to get the new removed Started Dates variables,if the process was successful
  248. await ShowButtons(); //Call and wait the function ShowButtons to Display the buttons
  249. document.querySelector("#loadingScreen").style.display = 'none'; //Hides the Loading Screen
  250. } //Finishes the async ResetStartDateFunc function
  251.  
  252. async function ResetFinishDateFunc() //Creates a function to reset the finish dates
  253. { //Starts the async ResetFinishDateFunc function
  254. document.querySelector("#loadingScreen").style.display = ''; //Shows the Loading Screen
  255. if (IsEditPageOpened === true) //Check if the button edit details was opened
  256. { //Starts the if condition
  257. await getVariables(); //Call and wait the function getVariables
  258. } //Finishes the if condition
  259. document.querySelector("#ResetFinishDate").remove(); //Removes the now needless button
  260. if (document.querySelector("#ResetAllDatesVar") !== null) //Check if the button ResetAllDatesVar exists
  261. { //Starts the if condition
  262. document.querySelector("#ResetAllDatesVar").remove(); //Removes the now needless button
  263. } //Finishes the if condition
  264. const response = await fetch("https://myanimelist.net/ownlist/" + entrytype2 + "/" + entryid + "/edit", {
  265. "headers": {
  266. "content-type": "application/x-www-form-urlencoded"
  267. },
  268. "body": "add_manga%5Bnum_read_chapters%5D=" + manga_read_chapters + "&add_manga%5Bnum_retail_volumes%5D=" + manga_retail + "&add_manga%5Bnum_read_times%5D=" + manga_read_times + "&add_manga%5Breread_value%5D=" + manga_reread_value + "&add_manga%5Bnum_read_volumes%5D=" + manga_read_volumes + "&add_" + entrytype2 + "%5Bstatus%5D=" + status + "&add_anime%5Bnum_watched_episodes%5D=" + watched_eps + "&add_" + entrytype2 + "%5Bscore%5D=" + current_score + "&add_" + entrytype2 + "%5Bstart_date%5D%5Bmonth%5D=" + start_month + "&add_" + entrytype2 + "%5Bstart_date%5D%5Bday%5D=" + start_day + "&add_" + entrytype2 + "%5Bstart_date%5D%5Byear%5D=" + start_year + "&add_" + entrytype2 + "%5Btags%5D=" + anime_tags + "&add_" + entrytype2 + "%5Bpriority%5D=" + priority + "&add_" + entrytype2 + "%5Bstorage_type%5D=" + storage_type + "&add_anime%5Bstorage_value%5D=" + storage_value + "&add_anime%5Bnum_watched_times%5D=" + rewatched_times + "&add_anime%5Brewatch_value%5D=" + rewatch_value + "&add_" + entrytype2 + "%5Bcomments%5D=" + comments + "&add_" + entrytype2 + "%5Bis_asked_to_discuss%5D=" + is_asked_to_discuss + "&add_" + entrytype2 + "%5Bsns_post_type%5D=" + sns_post_type + "&csrf_token=" + token,
  269. "method": "POST"
  270. }); //Finishes the fetch
  271. await getVariables(); //Call and wait the function getVariables to get the new removed Finished Dates variables,if the process was successful
  272. await ShowButtons(); //Call and wait the function ShowButtons to Display the buttons
  273. document.querySelector("#loadingScreen").style.display = 'none'; //Hides the Loading Screen
  274. } //Finishes the async ResetFinishDateFunc function
  275.  
  276. async function AddStartDate() //Add The Start Date When Watching Is Selected
  277. { //Starts the async function
  278. document.querySelector("#loadingScreen").style.display = ''; //Shows the Loading Screen
  279. if (IsEditPageOpened === true) //Check if the button edit details was opened
  280. { //Starts the if condition
  281. await getVariables(); //Call and wait the function getVariables
  282. } //Finishes the if condition
  283. if ((start_month === "") && (start_day === "") && (start_year === "")) // If month and date and year is NOT set in the started dates then Add The Start Date
  284. { //Starts the if condition
  285. const response = await fetch("https://myanimelist.net/ownlist/" + entrytype2 + "/" + entryid + "/edit", {
  286. "headers": {
  287. "content-type": "application/x-www-form-urlencoded"
  288. },
  289. "body": "add_manga%5Bnum_read_chapters%5D=" + manga_read_chapters + "&add_manga%5Bnum_retail_volumes%5D=" + manga_retail + "&add_manga%5Bnum_read_times%5D=" + manga_read_times + "&add_manga%5Breread_value%5D=" + manga_reread_value + "&add_manga%5Bnum_read_volumes%5D=" + manga_read_volumes + "&add_" + entrytype2 + "%5Bstatus%5D=1&add_anime%5Bnum_watched_episodes%5D=" + watched_eps + "&add_" + entrytype2 + "%5Bscore%5D=" + current_score + "&add_" + entrytype2 + "%5Bstart_date%5D%5Bmonth%5D=" + month + "&add_" + entrytype2 + "%5Bstart_date%5D%5Bday%5D=" + day + "&add_" + entrytype2 + "%5Bstart_date%5D%5Byear%5D=" + year + "&add_" + entrytype2 + "%5Bfinish_date%5D%5Bmonth%5D=" + finish_month + "&add_" + entrytype2 + "%5Bfinish_date%5D%5Bday%5D=" + finish_day + "&add_" + entrytype2 + "%5Bfinish_date%5D%5Byear%5D=" + finish_year + "&add_" + entrytype2 + "%5Btags%5D=" + anime_tags + "&add_" + entrytype2 + "%5Bpriority%5D=" + priority + "&add_" + entrytype2 + "%5Bstorage_type%5D=" + storage_type + "&add_anime%5Bstorage_value%5D=" + storage_value + "&add_anime%5Bnum_watched_times%5D=" + rewatched_times + "&add_anime%5Brewatch_value%5D=" + rewatch_value + "&add_" + entrytype2 + "%5Bcomments%5D=" + comments + "&add_" + entrytype2 + "%5Bis_asked_to_discuss%5D=" + is_asked_to_discuss + "&add_" + entrytype2 + "%5Bsns_post_type%5D=" + sns_post_type + "&csrf_token=" + token,
  290. "method": "POST",
  291. }); //Set The Anime Start Dates
  292. await getVariables(); //Call and wait the function getVariables to get the new removed Started Dates variables,if the process was successful
  293. await ShowButtons(); //Call and wait the function ShowButtons to Display the Finished Date and Display the Reset All Dates
  294. } //Finishes the if condition
  295. document.querySelector("#loadingScreen").style.display = 'none'; //Hides the Loading Screen
  296. } //Finishes the async AddStartDate function
  297.  
  298. async function AddFinishDate() //Add The Finished Date When Completed Is Selected
  299. { //Starts the async AddFinishDate function
  300. document.querySelector("#loadingScreen").style.display = ''; //Shows the Loading Screen
  301. if (IsEditPageOpened === true) //Check if the button edit details was opened
  302. { //Starts the if condition
  303. await getVariables(); //Call and wait the function getVariables
  304. } //Finishes the if condition
  305. if (finish_month === "" && finish_day === "" && finish_year === "") // If month and date and year is NOT set in the finished dates then Add The Finished Date
  306. { //Starts the if condition
  307.  
  308. if ((start_month === "") && (start_day === "") && (start_year === "")) //If month, date and year isn't set in the started dates, add the start date as well
  309. { //Starts the if condition
  310. start_day = day; //Instead of adding a blank or the actual start day value, add today's day
  311. start_month = month; //Instead of adding a blank or the actual start month value, add today's month
  312. start_year = year; //Instead of adding a blank or the actual start year value, add today's year
  313. } //Finishes the if condition
  314.  
  315. const response = await fetch("https://myanimelist.net/ownlist/" + entrytype2 + "/" + entryid + "/edit", {
  316. "headers": {
  317. "content-type": "application/x-www-form-urlencoded"
  318. },
  319. "body": "add_manga%5Bnum_read_chapters%5D=" + totalChaps + "&add_manga%5Bnum_retail_volumes%5D=" + manga_retail + "&add_manga%5Bnum_read_times%5D=" + manga_read_times + "&add_manga%5Breread_value%5D=" + manga_reread_value + "&add_manga%5Bnum_read_volumes%5D=" + totalVols + "&add_" + entrytype2 + "%5Bstatus%5D=2&add_anime%5Bnum_watched_episodes%5D=" + totaleps + "&add_" + entrytype2 + "%5Bscore%5D=" + current_score + "&add_" + entrytype2 + "%5Bstart_date%5D%5Bmonth%5D=" + start_month + "&add_" + entrytype2 + "%5Bstart_date%5D%5Bday%5D=" + start_day + "&add_" + entrytype2 + "%5Bstart_date%5D%5Byear%5D=" + start_year + "&add_" + entrytype2 + "%5Btags%5D=" + anime_tags + "&add_" + entrytype2 + "%5Bpriority%5D=" + priority + "&add_" + entrytype2 + "%5Bstorage_type%5D=" + storage_type + "&add_anime%5Bstorage_value%5D=" + storage_value + "&add_anime%5Bnum_watched_times%5D=" + rewatched_times + "&add_anime%5Brewatch_value%5D=" + rewatch_value + "&add_" + entrytype2 + "%5Bcomments%5D=" + comments + "&add_" + entrytype2 + "%5Bfinish_date%5D%5Bmonth%5D=" + month + "&add_" + entrytype2 + "%5Bfinish_date%5D%5Bday%5D=" + day + "&add_" + entrytype2 + "%5Bfinish_date%5D%5Byear%5D=" + year + "&add_" + entrytype2 + "%5Bis_asked_to_discuss%5D=" + is_asked_to_discuss + "&add_" + entrytype2 + "%5Bsns_post_type%5D=" + sns_post_type + "&csrf_token=" + token,
  320. "method": "POST"
  321. }); //Finishes the fetch
  322. await getVariables(); //Call and wait the function getVariables to get the new removed Finished Dates variables,if the process was successful
  323. await ShowButtons(); //Call and wait the function ShowButtons to Display the Finished Date and Display the Reset All Dates
  324. } //Finishes the if condition
  325. document.querySelector("#loadingScreen").style.display = 'none'; //Hides the Loading Screen
  326. } //Finishes the async AddFinishDate function
  327.  
  328. function SelectedValue() //Creates a function to get the selected value
  329. { //Starts the SelectedValue function
  330. if (this.value === '2') //Completed Was Selected
  331. { //Starts the if condition
  332. setTimeout(function() {
  333. AddFinishDate();
  334. }, 200); //Starts the function AddFinishDate
  335. } //Finishes the Completed else function
  336. else if (this.value === '1') //Watching Was Selected
  337. { //Starts the if condition
  338. setTimeout(function() {
  339. AddStartDate();
  340. }, 200); //Starts the function AddStartDate
  341. } //Finishes the Watching if function
  342. } //Finishes the SelectedValue function
  343.  
  344. document.querySelectorAll("#myinfo_status").forEach(el => el.onchange = SelectedValue); //Adds an event listener to all of the entry status button
  345.  
  346. if (entrytype2 === 'anime') //If the script is running on an anime entry
  347. { //Starts the if condition
  348. function PlusButtonAddDates() //Adding all episodes auto set entry as completed and auto set finished dates
  349. { //Starts the function PlusButtonAddDates
  350. setTimeout(async function() { //Starts the settimeout function
  351. if (document.querySelector("#myinfo_watchedeps").value === document.querySelector("#curEps").textContent) //If the number of added eps is the same as the total then
  352. { //Starts the if condition
  353. await getVariables(); //Call and wait the function getVariables
  354. await AddFinishDate(); //Call and wait the function AddFinishDate
  355. document.querySelectorAll("#myinfo_status").forEach(el => el.value = '2'); //Set the anime as completed, in a way that the user can see
  356. document.querySelectorAll("#myinfo_status").forEach(el => el.dataset.class = 'completed'); //Change the selection box to blue
  357. } //Finishes the if condition
  358. if (document.querySelector("#myinfo_watchedeps").value === '1' && document.querySelector("#curEps").textContent > '1') //If the number of added eps is = 1 and if the entry has more than 1 eps then
  359. { //Starts the if condition
  360. await getVariables(); //Call and wait the function getVariables
  361. await AddStartDate(); //Call and wait the function AddFinishDate
  362. document.querySelectorAll("#myinfo_status").forEach(el => el.value = '1'); //Set the anime as watching, in a way that the user can see
  363. document.querySelectorAll("#myinfo_status").forEach(el => el.dataset.class = 'watching'); //Change the selection box to green
  364. } //Finishes the if condition
  365. }, 750); //Finishes the settimeout function
  366. } //Finishes the function PlusButtonAddDates
  367.  
  368. document.querySelectorAll("i.fa-solid.fa-circle-plus").forEach(el => el.onclick = PlusButtonAddDates); //Adds an event listener to the plus button
  369.  
  370. if (AddedToList !== true) //If the anime is not on the user list
  371. { //Starts the else condition
  372. document.querySelector("#myinfo_status.btn-user-status-add-list.js-form-user-status.js-form-user-status-btn.myinfo_addtolist").addEventListener("click", async function(e) //When the Add button is clicked
  373. { //Starts the onclick function
  374. e.preventDefault(); //Prevent the default link from being opened
  375. await getVariables(); //Call and wait the function getVariables
  376. setTimeout(function() { //Wait the entry be added to the user list
  377. document.querySelector("#myinfo_status").addEventListener('change', SelectedValue, false); //Adds an event listener to the status button below the anime image
  378. }, 750); //Finishes the settimeout function
  379. }); //Finishes the onclick function
  380. } //Finishes the else condition
  381.  
  382. document.querySelectorAll("#myinfo_watchedeps")[1].addEventListener('change', function() { //Starts the function
  383. watched_eps = this.value; //Update the variable value
  384. }, false); //Adds an advent listener to the watched eps button on the right side of the anime image
  385.  
  386. } //Finishes the if condition
  387. else //If the entry type is manga
  388. { //Starts the else condition
  389. document.querySelectorAll("#myinfo_volumes")[1].addEventListener('change', function() { //Starts the function
  390. manga_read_volumes = this.value; //Update the variable value
  391. }, false); //Adds an event listener to the manga read volumes button on the right side of the anime image
  392. document.querySelectorAll("#myinfo_chapters")[1].addEventListener('change', function() { //Starts the function
  393. manga_read_chapters = this.value; //Update the variable value
  394. }, false); //Adds an event listener to the manga read chapters button on the right side of the anime image
  395. } //Finishes the else condition
  396.  
  397. document.querySelectorAll("#myinfo_score")[1].addEventListener('change', function() { //Starts the function
  398. current_score = this.value; //Update the variable value
  399. }, false); //Adds an event listener to the score button on the right side of the anime image
  400.  
  401. if (AddedToList === true) //If the manga is already added to the the user list
  402. { //Starts the if condition
  403. document.querySelector("input.inputButton.btn-middle.flat.js-anime-update-button,input.inputButton.js-manga-update-button").nextElementSibling.onclick = function() { //Adds an event listener to the button
  404. IsEditPageOpened = true; //Set the variable to true
  405. }; //Finishes the event listener
  406.  
  407. document.querySelector("input.inputButton.btn-middle.flat.js-anime-update-button,input.inputButton.js-manga-update-button").nextElementSibling.oncontextmenu = function() { //Adds an event listener to the button
  408. IsEditPageOpened = true; //Set the variable to true
  409. }; //Finishes the event listener
  410. } //Finishes the if condition
  411.  
  412. } //Finishes the else condition
  413. })();

QingJ © 2025

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