您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Select Watching/Reading to auto add the start date, select Completed to auto add the finish date. The script will show 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 on the date and click to reset. This script also adds 6 helpful buttons on the Anime/Manga Edit Page.
当前为
// ==UserScript== // @name Automatically Add Start/Finish Dates For Animes/Mangas + Helpful Buttons // @namespace Add End And Start Dates In 1 Click + Reset Dates/All Buttons, // @version 1.7 // @description Select Watching/Reading to auto add the start date, select Completed to auto add the finish date. The script will show 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 on the date and click to reset. This script also adds 6 helpful buttons on the Anime/Manga Edit Page. // @author hacker09 // @match https://myanimelist.net/ownlist/* // @match https://myanimelist.net/anime/* // @match https://myanimelist.net/anime.php?id=* // @match https://myanimelist.net/manga/* // @match https://myanimelist.net/manga.php?id=* // @run-at document-end // @grant GM_addStyle // ==/UserScript== (function() { 'use strict'; if (window.location.pathname.split('/')[1] === 'ownlist') //Check If The User Is On https://myanimelist.net/ownlist/ ,And If Yes These Codes Will Run { var entrytype = window.location.pathname.split('/')[2]; var $ = window.jQuery; //********************************************************************************************************************************************************************** var ResetBTNStart = document.createElement("a"); ResetBTNStart.innerHTML = "Reset"; document.querySelector("#start_date_insert_today").parentElement.appendChild(ResetBTNStart); ResetBTNStart.setAttribute("id", "resetstart"); ResetBTNStart.setAttribute("style", "cursor: pointer;margin-left: 5px;height: 10px;width: 10px;top: 10px;"); document.getElementById('resetstart').onclick = function (){document.getElementById("add_"+entrytype+"_start_date_year").selectedIndex = -1; document.getElementById("add_"+entrytype+"_start_date_day").selectedIndex = -1; document.getElementById("add_"+entrytype+"_start_date_month").selectedIndex = -1; }; //********************************************************************************************************************************************************************** var ResetBTNEnd = document.createElement("a"); ResetBTNEnd.innerHTML = "Reset"; document.querySelector("#end_date_insert_today").parentElement.appendChild(ResetBTNEnd); ResetBTNEnd.setAttribute("id", "resetend"); ResetBTNEnd.setAttribute("style", "cursor: pointer;margin-left: 5px;height: 10px;width: 10px;top: 10px;"); document.getElementById('resetend').onclick = function (){document.getElementById("add_"+entrytype+"_finish_date_year").selectedIndex = -1; document.getElementById("add_"+entrytype+"_finish_date_day").selectedIndex = -1; document.getElementById("add_"+entrytype+"_finish_date_month").selectedIndex = -1; }; //********************************************************************************************************************************************************************** var AddDates = document.createElement("a"); AddDates.innerHTML = "Add End And Start Dates + Submit"; document.querySelector('.notice_open_public').appendChild(AddDates); AddDates.setAttribute("id", "addalldates"); AddDates.setAttribute("style", "cursor: pointer;margin-left: 5px;height: 10px;width: 10px;top: 10px;"); document.getElementById('addalldates').onclick = function (){document.getElementById("start_date_insert_today").click(); document.getElementById("end_date_insert_today").click(); document.getElementsByClassName("inputButton main_submit")[0].click(); }; //********************************************************************************************************************************************************************** var InsertStart = document.createElement("a"); InsertStart.innerHTML = "Insert + Submit"; function findTheInStartDateTd() { const headers = [...document.querySelectorAll("td")]; return headers.find(td => td.textContent === "Start Date"); } findTheInStartDateTd().nextElementSibling.setAttribute("style", "padding: 14px;"); findTheInStartDateTd().parentElement.appendChild(InsertStart); InsertStart.setAttribute("id", "InsertStart"); InsertStart.setAttribute("style", "cursor: pointer;margin-left: -200px;"); document.getElementById('InsertStart').onclick = function (){document.getElementById("start_date_insert_today").click(); document.getElementsByClassName("inputButton main_submit")[0].click(); }; //********************************************************************************************************************************************************************** var InsertEnd = document.createElement("a"); InsertEnd.innerHTML = "Insert + Submit"; function findTheInFinishDateTd() { const headers = [...document.querySelectorAll("td")]; return headers.find(td => td.textContent === "Finish Date"); } findTheInFinishDateTd().nextElementSibling.setAttribute("style", "padding: 14px;"); findTheInFinishDateTd().parentElement.appendChild(InsertEnd); InsertEnd.setAttribute("id", "InsertEnd"); InsertEnd.setAttribute("style", "cursor: pointer;margin-left: -200px;"); document.getElementById('InsertEnd').onclick = function (){document.getElementById("end_date_insert_today").click(); document.getElementsByClassName("inputButton main_submit")[0].click(); }; //********************************************************************************************************************************************************************** var ResetAlmostAll = document.createElement("a"); ResetAlmostAll.innerHTML = "Reset Almost Everything"; document.querySelector("#advanced-button").parentElement.appendChild(ResetAlmostAll); ResetAlmostAll.setAttribute("id", "resetalmostall"); ResetAlmostAll.setAttribute("style", "cursor: pointer;margin-left: 240px;"); document.getElementById('resetalmostall').onclick = function resetSelectElement() {$('select').prop('selectedIndex', 0); document.getElementById("unknown_end").click(); }; //********************************************************************************************************************************************************************** setTimeout(function(){ //Starts the timeout condition if (document.querySelectorAll("#hide-advanced-button")[0].outerText !== "Hide Advanced ") //Detect if the Show Advanced button is already opened or not,if not then... { //Starts the if condition document.querySelector("#hide-advanced-button").click(); //Click on the Show Advanced button } //Finishes the if condition }, 0); //Finishes the timeout condition } //Finishes the if condition //********************************************************************************************************************************************************************** else { var d = new Date(); //Creates a variable called d that will hold the computer date on the local time zone var day = d.getDate(); //Creates a variable to hold the actual day var month = d.getMonth() + 1; //Creates a variable to hold the actual month var year = d.getFullYear(); //Creates a variable to hold the actual year var entrytype2 = window.location.pathname.split('/')[1]; //Creates a variable to hold the actual entry type var token = document.head.querySelector("[name='csrf_token']").content; //Creates a variable to hold the actual csrf_token var entryid = location.pathname.match(/\d+/)[0]; //Creates a variable to hold the actual entry id 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; //Makes all these variables global if (entrytype2 === 'anime') //If the entry type is anime, get the total episodes number { //Starts the if condition var totaleps = document.querySelector("#curEps").textContent; //Get the actual total episodes value } //Finishes the if condition else //If the entry type is manga { //Starts the else condition var totalVols = document.querySelector("#totalVols").textContent; //Get the actual total manga volumes var totalChaps = document.querySelector("#totalChaps").textContent; //Get the actual total manga chapters } //Finishes the else condition async function getVariables() //Creates a function to get the needed Variables { //Starts the function const response = await fetch('https://myanimelist.net/ownlist/'+entrytype2+'/' + entryid + '/edit'); //Fetch const html = await response.text(); //Gets the fetch response const newDocument = new DOMParser().parseFromString(html, 'text/html'); //Parses the fetch response priority = newDocument.querySelector("#add_"+entrytype2+"_priority").value; //Creates a variable to hold the actual priority value 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 sns_post_type = newDocument.querySelector("#add_"+entrytype2+"_sns_post_type").value; //Creates a variable to hold the actual SNS value start_day = newDocument.querySelector("#add_"+entrytype2+"_start_date_day").value; //Creates a variable to hold the actual start_day value start_month = newDocument.querySelector("#add_"+entrytype2+"_start_date_month").value; //Creates a variable to hold the actual start_month value start_year = newDocument.querySelector("#add_"+entrytype2+"_start_date_year").value; //Creates a variable to hold the actual start_year value finish_day = newDocument.querySelector("#add_"+entrytype2+"_finish_date_day").value; //Creates a variable to hold the actual finish_day value finish_month = newDocument.querySelector("#add_"+entrytype2+"_finish_date_month").value; //Creates a variable to hold the actual finish_month value finish_year = newDocument.querySelector("#add_"+entrytype2+"_finish_date_year").value; //Creates a variable to hold the actual finish_year value current_score = newDocument.querySelector("#add_"+entrytype2+"_score").value; //Creates a variable to hold the actual current_score value anime_tags = newDocument.querySelector("#add_"+entrytype2+"_tags").value; //Creates a variable to hold the actual anime_tags value storage_type = newDocument.querySelector("#add_"+entrytype2+"_storage_type").value; //Creates a variable to hold the actual storage_type value comments = newDocument.querySelector("#add_"+entrytype2+"_comments").value; //Creates a variable to hold the actual comments value status = newDocument.querySelector("#add_"+entrytype2+"_status").value; //Creates a variable to hold the actual status value if(entrytype2 === 'anime') //If the entry type is anime { //Starts the if condition watched_eps = newDocument.querySelector("#add_anime_num_watched_episodes").value; //Creates a variable to hold the actual watched_eps value storage_value = newDocument.querySelector("#add_anime_storage_value").value; //Creates a variable to hold the actual storage_value value rewatched_times = newDocument.querySelector("#add_anime_num_watched_times").value; //Creates a variable to hold the actual rewatched_times value rewatch_value = newDocument.querySelector("#add_anime_rewatch_value").value; //Creates a variable to hold the actual rewatch_value value } //Finishes the if condition else //If the entry type is manga { //Starts the else condition manga_read_chapters = newDocument.querySelector("#add_manga_num_read_chapters").value; //Creates a variable to hold the actual manga_read_chapters value manga_retail = newDocument.querySelector("#add_manga_num_retail_volumes").value; //Creates a variable to hold the actual manga_retail value manga_read_times = newDocument.querySelector("#add_manga_num_read_times").value; //Creates a variable to hold the actual manga_read_times value manga_reread_value = newDocument.querySelector("#add_manga_reread_value").value; //Creates a variable to hold the actual manga_read_times value manga_read_volumes = newDocument.querySelector("#add_manga_num_read_volumes").value; //Creates a variable to hold the actual manga_read_volumes value } //Finishes the else condition } //Finishes the async getvariables function async function DisplayStartedDate() //Creates a function to displat the Started Date { //Starts the async DisplayStartedDate function await getVariables(); //Call and wait the function getVariables if ((start_month !== "") || (start_day !== "") || (start_year !== "")) // If month or date or year is set in the started dates then show the button { //Starts the if condition var ResetStartDate = document.createElement("div"); //Creates the button to reset the start date ResetStartDate.innerHTML = 'Started: Month:'+start_month+' Day:'+start_day+' Year:'+start_year; //Define the button text document.querySelector("#profileRows").append(ResetStartDate); //Append the button below the "add to favorites" button ResetStartDate.setAttribute("id", "ResetStartDate"); //Gives an id to the button if (document.querySelectorAll("#ResetStartDate").length > 1) //If the button already exits { //Starts the if condition document.querySelector("#ResetStartDate").remove(); //Remove the old button } //Finishes the if condition ResetStartDate.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: #1d439b;cursor: pointer;padding: 2px 3px;"); //Set the css for the button when the page loads document.querySelector("#ResetStartDate").onmousemove = function(){ResetStartDate.innerHTML = "Reset Started Date"; ResetStartDate.setAttribute("style", "cursor: pointer;background-color: #1d439b;border-color: #6386d5;border-style: solid;border-width: 0 0 1px;color: #fff;padding: 2px 3px;");}; //Set the css for the button when the mouse is hovering the button document.querySelector("#ResetStartDate").onmouseout = function(){ResetStartDate.innerHTML = 'Started: Month:'+start_month+' Day:'+start_day+' Year:'+start_year; ResetStartDate.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: #1d439b;cursor: pointer;padding: 2px 3px;");}; //Set the css for the button when the mouse is leaves the button document.querySelector("#ResetStartDate").addEventListener("click", ResetStartDateFunc , false); //When the button is cliked call this function } //Finishes the if condition } //Finishes the function DisplayStartedDate DisplayStartedDate(); //Starts the function DisplayStartedDate async function DisplayFinishedDate() //Creates a function to display the Finihed Date { //Starts the async DisplayFinishedDate function await getVariables(); //Call and wait the function getVariables if ((finish_month !== "") || (finish_day !== "") || (finish_year !== "")) // If month or date or year is set in the finished dates then show the button { //Starts the if condition var ResetFinishDate = document.createElement("div"); //Creates the button to reset the finish date ResetFinishDate.innerHTML = 'Finished: Month:'+finish_month+' Day:'+finish_day+' Year:'+finish_year; //Define the button text; //Define the button text document.querySelector("#profileRows").append(ResetFinishDate); //Append the button below the "add to favorites" button ResetFinishDate.setAttribute("id", "ResetFinishDate"); //Gives an id to the button if (document.querySelectorAll("#ResetFinishDate").length > 1) //If the button already exits { //Starts the if condition document.querySelector("#ResetFinishDate").remove(); //Remove the old button } //Finishes the if condition ResetFinishDate.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: #1d439b;cursor: pointer;padding: 2px 3px;"); //Set the css for the button when the page loads document.querySelector("#ResetFinishDate").onmousemove = function(){ResetFinishDate.innerHTML = "Reset Finished Date"; ResetFinishDate.setAttribute("style", "cursor: pointer;background-color: #1d439b;border-color: #6386d5;border-style: solid;border-width: 0 0 1px;color: #fff;padding: 2px 3px;");}; //Set the css for the button when the mouse is hovering the button document.querySelector("#ResetFinishDate").onmouseout = function(){ResetFinishDate.innerHTML = 'Finished: Month:'+finish_month+' Day:'+finish_day+' Year:'+finish_year; ResetFinishDate.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: #1d439b;cursor: pointer;padding: 2px 3px;");}; //Set the css for the button when the mouse is leaves the button document.querySelector("#ResetFinishDate").addEventListener("click", ResetFinishDateFunc , false); //When the button is cliked call this function } //Finishes the if condition } //Finishes the function DisplayFinishedDate DisplayFinishedDate(); //Starts the function DisplayFinishedDate async function DisplayResetAllDates() //Creates a function to Display the Reset All Dates { //Starts the async DisplayResetAllDates function await getVariables(); //Call and wait the function getVariables 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 { //Starts the if condition var ResetAllDatesVar = document.createElement("div"); //Creates the button to reset all dates ResetAllDatesVar.innerHTML = "Reset Started+Finished Dates"; //Define the button text document.querySelector("#profileRows").append(ResetAllDatesVar); //Append the button below the "add to favorites" button ResetAllDatesVar.setAttribute("id", "ResetAllDatesVar"); //Gives an id to the button if (document.querySelectorAll("#ResetAllDatesVar").length > 1) //If the button already exits { //Starts the if condition 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 } //Finishes the if condition ResetAllDatesVar.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: #1d439b;cursor: pointer;padding: 2px 3px;"); //Set the css for the button when the page loads document.querySelector("#ResetAllDatesVar").onmousemove = function(){ResetAllDatesVar.setAttribute("style", "cursor: pointer;background-color: #1d439b;border-color: #6386d5;border-style: solid;border-width: 0 0 1px;color: #fff;padding: 2px 3px;");}; //Set the css for the button when the mouse is hovering the button document.querySelector("#ResetAllDatesVar").onmouseout = function(){ResetAllDatesVar.setAttribute("style", "border-top: #92b0f1 1px solid;border-color: #92b0f1;border-style: solid;border-width: 0 0 1px;color: #1d439b;cursor: pointer;padding: 2px 3px;");}; //Set the css for the button when the mouse is leaves the button document.querySelector("#ResetAllDatesVar").addEventListener("click", ResetAllDates , false); //When the button is cliked call this function } //Finishes the if condition } //Finishes the function DisplayResetAllDates DisplayResetAllDates(); //Starts the function DisplayResetAllDates GM_addStyle(".loading{position: fixed;width: 100%;height: 100%;background-color: rgba(0,0,0,0.9);top: 0;z-index: 1000;background-image: url(https://pa1.narvii.com/6258/61f5cd5c652efec508ff3c6e10798d26ccef6366_hq.gif);background-repeat: no-repeat;background-position: center;}"); //Add the css. Image optionals and backup https://pastebin.com/raw/zrzN2PUe const loadingScreen= document.createElement("div"); //Creates and div element document.body.appendChild(loadingScreen); //Add the loading screen to the html body async function ResetAllDates() //Creates a function to Reset All Dates { //Starts the async ResetAllDates function loadingScreen.classList.add("loading"); //Starts the Loading Screen document.querySelector("#ResetAllDatesVar").textContent = 'Done!'; //Changes the button text await getVariables(); //Call and wait the function getVariables document.querySelector("#ResetStartDate").textContent = 'Done!'; //Changes the button text document.querySelector("#ResetFinishDate").textContent = 'Done!'; //Changes the button text document.querySelector("#ResetAllDatesVar").remove(); //Removes the now needless button document.querySelector("#ResetStartDate").remove(); //Removes the now needless button document.querySelector("#ResetFinishDate").remove(); //Removes the now needless button const response = await fetch("https://myanimelist.net/ownlist/"+entrytype2+"/"+entryid+"/edit", { "headers": { "content-type": "application/x-www-form-urlencoded" }, "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+"", "method": "POST" }); //Finishes the fetch loadingScreen.classList.remove("loading"); //Disable the Loading Screen } //Finishes the async ResetAllDates function async function ResetStartDateFunc() //Creates a function to reset the start dates { //Starts the async ResetStartDateFunc function loadingScreen.classList.add("loading"); //Starts the Loading Screen document.querySelector("#ResetStartDate").textContent = 'Done!'; //Changes the button text if (document.querySelector("#ResetAllDatesVar") !== null) //Check if the button ResetAllDatesVar exists { //Starts the if condition document.querySelectorAll("#ResetAllDatesVar")[0].textContent = 'Done!'; //Changes the button text } //Finishes the if condition await getVariables(); //Call and wait the function getVariables document.querySelector("#ResetStartDate").remove(); //Removes the now needless button if (document.querySelector("#ResetAllDatesVar") !== null) //Check if the button ResetAllDatesVar exists { //Starts the if condition document.querySelector("#ResetAllDatesVar").remove(); //Removes the now needless button } //Finishes the if condition const response = await fetch("https://myanimelist.net/ownlist/"+entrytype2+"/"+entryid+"/edit", { "headers": { "content-type": "application/x-www-form-urlencoded" }, "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+"", "method": "POST" }); //Finishes the fetch await DisplayResetAllDates(); //Call and wait the function DisplayResetAllDates loadingScreen.classList.remove("loading"); //Disable the Loading Screen } //Finishes the async ResetStartDateFunc function async function ResetFinishDateFunc() //Creates a function to reset the finish dates { //Starts the async ResetFinishDateFunc function loadingScreen.classList.add("loading"); //Starts the Loading Screen document.querySelector("#ResetFinishDate").textContent = 'Done!'; //Changes the button text if (document.querySelector("#ResetAllDatesVar") !== null) //Check if the button ResetAllDatesVar exists { //Starts the if condition document.querySelectorAll("#ResetAllDatesVar")[0].textContent = 'Done!'; //Changes the button text } //Finishes the if condition await getVariables(); //Call and wait the function getVariables document.querySelector("#ResetFinishDate").remove(); //Removes the now needless button if (document.querySelector("#ResetAllDatesVar") !== null) //Check if the button ResetAllDatesVar exists { //Starts the if condition document.querySelector("#ResetAllDatesVar").remove(); //Removes the now needless button } //Finishes the if condition const response = await fetch("https://myanimelist.net/ownlist/"+entrytype2+"/"+entryid+"/edit", { "headers": { "content-type": "application/x-www-form-urlencoded" }, "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+"", "method": "POST" }); //Finishes the fetch await DisplayResetAllDates(); //Call and wait the function DisplayResetAllDates loadingScreen.classList.remove("loading"); //Disable the Loading Screen } //Finishes the async ResetFinishDateFunc function async function AddStartDate() //Add The Start Date When Watching Is Selected { //Starts the async function loadingScreen.classList.add("loading"); //Starts the Loading Screen await getVariables(); //Call and wait the function getVariables const response = await fetch("https://myanimelist.net/ownlist/"+entrytype2+"/"+entryid+"/edit", { "headers": { "content-type": "application/x-www-form-urlencoded" }, "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+"", "method": "POST", }); //Set The Anime Start Dates await DisplayStartedDate(); //Call and wait the function DisplayFinishedDate await DisplayResetAllDates(); //Call and wait the function DisplayResetAllDates loadingScreen.classList.remove("loading"); //Disable the Loading Screen } //Finishes the async AddStartDate function async function AddFinishDate() //Add The Finished Date When Completed Is Selected { //Starts the async AddFinishDate function loadingScreen.classList.add("loading"); //Starts the Loading Screen await getVariables(); //Call and wait the function getVariables const response = await fetch("https://myanimelist.net/ownlist/"+entrytype2+"/"+entryid+"/edit", { "headers": { "content-type": "application/x-www-form-urlencoded" }, "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+"", "method": "POST" }); //Finishes the fetch await DisplayFinishedDate(); //Call and wait the function DisplayFinishedDate await DisplayResetAllDates(); //Call and wait the function DisplayResetAllDates loadingScreen.classList.remove("loading"); //Disable the Loading Screen } //Finishes the async AddFinishDate function function SelectedValue() //Creates a function to get the selected value { //Starts the SelectedValue function if (this.value === '2') //Completed Was Selected { //Starts the if condition AddFinishDate(); //Starts the function AddFinishDate } //Finishes the Completed else function else if (this.value === '1') //Watching Was Selected { //Starts the if condition AddStartDate(); //Starts the function set the date } //Finishes the Watching if function else if (this.value === '3') //On-Hold Was Selected { //Starts the else condition console.log('On-Hold Was Selected'); //Just shows a message on the dev console, this allows MAl to run their actual advent listener } //Finishes the On-Hold else function else if (this.value === '4') //Dropped Was Selected { //Starts the else condition console.log('Dropped Was Selected'); //Just shows a message on the dev console, this allows MAl to run their actual advent listener } //Finishes the Dropped else function else //Plan To Watch Was Selected { //Starts the else condition console.log('Plan To Watch Was Selected'); //Just shows a message on the dev console, this allows MAl to run their actual advent listener } //Finishes the Plan To else function } //Finishes the SelectedValue function document.querySelectorAll("#myinfo_status")[1].addEventListener('change', SelectedValue, false); //Adds an advent listener to the status button on the right side of the anime image document.querySelectorAll("#myinfo_status")[0].addEventListener('change', SelectedValue, false); //Adds an advent listener to the status button below the anime image if (entrytype2 === 'anime') //If the script is running on an anime entry { //Starts the if condition function PlusButtonAddFinishedDate() //Adding all episodes auto set entry as completed and auto set finished dates { //Starts the function PlusButtonAddFinishedDate if (document.querySelector("#myinfo_watchedeps").value === document.querySelector("#curEps").textContent) //If the number of add eps is the same as the total then { //Starts the if condition document.querySelectorAll("#myinfo_status")[1].value = '2'; //Set the anime as completed, in a way that the user can see document.querySelectorAll("#myinfo_status")[0].value = '2'; //Set the anime as completed, in a way that the user can see document.querySelectorAll("#myinfo_status")[1].dataset.class = 'completed' //Change the selection box to blue AddFinishDate(); //Call the function AddFinishDate } //Finishes the if condition } //Finishes the function PlusButtonAddFinishedDate function CallPlusButtonAddFinishedDate() //Function to call the function PlusButtonAddFinishedDate after some time { setTimeout(PlusButtonAddFinishedDate, 700); //Call the function PlusButtonAddFinishedDate, after 0.5 secs } //Finishes the function CallPlusButtonAddFinishedDate document.querySelectorAll("i.fa.fa-plus-circle")[0].addEventListener('click', CallPlusButtonAddFinishedDate, false); //Adds an advent listener to the plus button below the anime image document.querySelectorAll("i.fa.fa-plus-circle")[1].addEventListener('click', CallPlusButtonAddFinishedDate, false); //Adds an advent listener to the plus button on the right side of the anime image } //Finishes the if condition } //Finishes the else condition })();