// ==UserScript== // @name Anime-Planet Show New Release // @namespace https://greasyfork.org/en/users/689482-quin15 // @version 0.4.0 // @description Shows an icon for number of new releases for manga and anime // @author Quin15 // @match https://www.anime-planet.com/* // @grant none // @downloadURL none // ==/UserScript== NewReleasePopulate = { populateNewRelease: function(entries, entryDataType) { if (entryDataType == null) { if (document.querySelector('li[data-type="manga"] a')) { if (document.querySelector('li[data-type="anime"] a')) { setTimeout(function(){NewReleasePopulate.populateNewRelease(null, "anime");}, 200); } entryDataType = "manga"; } else { entryDataType = "anime"; }; }; if (entries == null) { entries = document.querySelectorAll('li[data-type="' + entryDataType + '"]'); }; for (var i = 0; i < entries.length; i++) { if (!(entries[i].querySelector('label.NewReleaseLabel'))){ var releasedNo = parseInt(entries[i].dataset.totalEpisodes); var readNo = parseInt(entries[i].dataset.episodes); if (releasedNo != readNo && !(isNaN(readNo))) { var tag = document.createElement("label"); tag.setAttribute("style", "width: 30px; height: 30px; position: absolute; background: " + (($(entries[i].firstElementChild.title).find("li." + ((entryDataType == "manga") ? "iconVol" : "type"))[0].innerText.includes("+") == true) ? "#8DEA43" : "#6F99E4") + "; z-index: 12; border-radius: 15px; margin-left: calc(50% - 20px); top: -10px; line-height: 28px; color: #fff; text-shadow: 0px 0px 3px #000, 0px 0px 3px #000, 0px 0px 3px #000, 0px 0px 3px #000, 0px 0px 3px #000, 0px 0px 3px #000;") tag.setAttribute("class", "NewReleaseLabel") tag.innerText = releasedNo - readNo; entries[i].firstElementChild.appendChild(tag); tag.parentElement.style = "overflow: visible"; tag.parentElement.parentElement.style = "overflow: visible"; }; }; }; } }; $(document).ready(function() { if (document.querySelector('li[data-type="manga"] a') || document.querySelector('li[data-type="anime"] a')) { NewReleasePopulate.populateNewRelease(null, null); }; });