// ==UserScript== // @name Rice's AOTY Add-ons // @namespace https://albumoftheyear.org // @version 0.9.1.5 // @description A few different AOTY extensions I made compiled together. // @author Rice // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js // @require https://openuserjs.org/src/libs/sizzle/GM_config.js // @require https://greasyfork.org/scripts/421384-gm-fetch/code/GM_fetch.js?version=1134973 // @match https://www.albumoftheyear.org/* // @icon https://www.google.com/s2/favicons?sz=64&domain=albumoftheyear.org // @grant GM_getValue // @grant GM.xmlHttpRequest // @grant GM_openInTab // @grant GM_setValue // @grant GM_getValue // @grant GM_xmlhttpRequest // @downloadURL none // ==/UserScript== (function () { function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } GM_config.init({ id: "AOTY-Addons", title: "AOTY Add-ons", fields: { RScoreEnable: { section: [ GM_config.create("Unround Scores"), "Script to show full (unrounded) album/single scores.", ], options: ["On", "Off"], label: "Toggle Score Unrounder", type: "radio", default: "On", }, RScoreRound: { label: "Decimals to show on main album pages.", type: "float", default: 1, }, RScoreFont: { label: "Font size to show on main album pages.", type: "float", default: 39, }, RScoreRound2: { label: "Decimals to show on small album previews.", type: "float", default: 2, }, RScoreFont2: { label: "Font size to show on small album previews.", type: "float", default: 18, }, HScoreEnable: { section: [ GM_config.create("Hide Scores"), "Script to hide album/single ratings", ], options: ["On", "Off"], label: "Toggle Score Hider", type: "radio", default: "Off", }, HScoreDisableIfRated: { options: ["On", "Off"], label: "Show Score If Already Rated", type: "radio", default: "On", }, HScoreHideCriticReviews: { options: ["Hide", "Show"], label: "Hide/Show Critic Reviews", type: "radio", default: "Show", }, HScoreReplacementText: { label: "Score Replacement Text", type: "text", default: "N/A", }, hideTrackScores: { options: ["On", "Off"], label: "Hide Only Track scores", type: "radio", default: "Off", }, THEnable: { section: [ GM_config.create("Best Tracks Highlighter"), "If tracks are above a certain score with a certain amount of ratings they will be bolded.", ], options: ["On", "Off"], label: "Toggle Track Highlighter", type: "radio", default: "On", }, THMinScore: { label: "Minimum score a track must have in order to be bolded.", type: "float", default: 90, }, THMinRatings: { label: "Minimum amount of ratings a track must have in order to be bolded.", type: "float", default: 25, }, RAEnable: { section: [ GM_config.create("Rated Album Shuffle"), "Script to pick a random rated album from you (or anyone's) rated albums page. \nFull guide: \nhttps://pastebin.com/raw/PehxkCSw", ], options: ["On", "Off"], label: "Toggle Rated Album Shuffle", type: "radio", default: "On", }, RAKeyBind: { label: "Enter key code for keybind", type: "float", default: 220, }, AARating: { section: [ GM_config.create("Artist Rating Viewer"), "Script that automatically calculates a user or critics average rating of an artist when viewed.", ], options: ["On", "Off"], label: "Toggle Artist Rating Viewer", type: "radio", default: "On", }, TListSorter: { section: [ GM_config.create("Tracklist Sorter"), "Adds a button to sort a tracklist by the highest rated songs.", ], options: ["On", "Off"], label: "Toggle Tracklist Sorter", type: "radio", default: "On", }, avgTracklist: { section: [ GM_config.create("Tracklist Score Average"), "Adds text to see the average rating of songs on a tracklist and also your personal average ratings.", ], options: ["On", "Off"], label: "Toggle Tracklist Score Average", type: "radio", default: "On", }, ATRound: { label: "Amount of decimals to round by.", type: "float", default: 2, }, quickAddTracks: { section: [ GM_config.create("Quick Track Adder"), 'Adds an option add tracks faster by being able to go to the next section you need to fill out whenever the enter key is pressed instead of manually clicking it.', ], options: ["On", "Off"], label: "Toggle Quick Track Adder", type: "radio", default: "On", }, quickSubmitter: { section: [ GM_config.create("Quick Submitter"), "Adds the ability to click enter instead of manually clicking in different places.", ], options: ["On", "Off"], label: "Toggle Quick Submitter", type: "radio", default: "On", }, multiTagSubmit: { section: [ GM_config.create("Multiple Tag Submitter"), `Allows you to submit multiple tags at once (limit of 5 at a time to prevent spam). How it works is that you enter the tags split up with a comma. For example "jazz rap, cloud rap, neo-soul" then it will submit all 3 as tags. If you cannot fit all the tags then you can edit the maximum tag length to fit them. Disclaimer: this won't allow you to submit tags longer than 35 characters, it will just allow you to fit all the tags you want to add.`, ], options: ["On", "Off"], label: "Multiple Tag Submitter", type: "radio", default: "On", }, maxTagLength: { label: "Edit Maximum Tag Length", type: "float", default: 1000, }, rymUrl: { section: [ GM_config.create("Quick RYM URL"), 'Feature I use to get track times to add from RYM faster. The text here would normally be quite long so here is a link to a pastebin containing all the info: https://pastebin.com/raw/C774Jb4f', ], options: ["On", "Off"], label: "Toggle Quick RYM URL", type: "radio", default: "Off", }, copyUrl: { options: ["On", "Off"], label: "Toggle Automatically Copy RYM URL", type: "radio", default: "Off", }, checkUrl: { options: ["On", "Off"], label: "Toggle Validate RYM URL", type: "radio", default: "Off", }, betterColors: { section: [ GM_config.create("Better Rating Colors"), 'Adds rating colors that more accurately represent the score. This option adds 10 different colors based on the rating while the normal has only 3.', ], options: ["On", "Off"], label: "Toggle Better Rating Colors", type: "radio", default: "Off", }, zeroscolor: { label: "Rating color for score of 1-9", type: "text", default: "#850f0f", }, tenscolor: { label: "Rating color for score of 10-19", type: "text", default: "#a52611", }, twentiescolor: { label: "Rating color for score of 20-29", type: "text", default: "#db4916", }, thirtiescolor: { label: "Rating color for score of 30-39", type: "text", default: "#db5716", }, fourtiescolor: { label: "Rating color for score of 40-49", type: "text", default: "#db8516", }, fiftiescolor: { label: "Rating color for score of 50-59", type: "text", default: "#D6DB7D", }, sixtiescolor: { label: "Rating color for score of 60-69", type: "text", default: "#badd7c", }, seventiescolor: { label: "Rating color for score of 70-79", type: "text", default: "#86E27D", }, eightiescolor: { label: "Rating color for score of 80-89", type: "text", default: "#71c64b", }, ninetiescolor: { label: "Rating color for score of 90-99", type: "text", default: "#52B948", }, hundredcolor: { label: "Rating color for score of 100", type: "text", default: "#0D8C01", }, betterLengths: { section: [ GM_config.create("Better Album Lengths"), 'Adds seconds to the Total Length section on albums.', ], options: ["On", "Off"], label: "Toggle Better Album Lengths", type: "radio", default: "On", }, quickClose: { section: [ GM_config.create("Quick Close Menus"), 'Allows you to just click esc to exit most menus instead of going to manually click it.', ], options: ["On", "Off"], label: "Toggle Quick Close Menus", type: "radio", default: "On", }, RMHEnable: { section: [ GM_config.create("Random Must-Hear Album Selector"), 'Allows you to click a keybind on the must-hear albums section and it will take you to a random album that is a must-hear.', ], options: ["On", "Off"], label: "Toggle Random Must-Hear Album Selector", type: "radio", default: "On", }, RMHBind: { label: "Enter key code for keybind", type: "float", default: 220, }, FREnable: { section: [ GM_config.create("Automatically Set Feed to Reviews"), 'Option to have the user feed set to reviews only be default.', ], options: ["On", "Off"], label: "Toggle Automatically Set Feed to Reviews", type: "radio", default: "Off", }, }, 'events': { 'init': function () { let svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"); svg.setAttribute("width", "20"); svg.setAttribute("height", "20"); svg.innerHTML = ' \ \ \ \ \ \ '; svg.style.postition = "absolute"; svg.style.left = "75%"; svg.style.top = "75%"; svg.style.transform = "translateX(55%) translateY(25%)"; var settingsButton = document.createElement("a"); settingsButton.className = "settingsButton"; settingsButton.style.width = "25px"; settingsButton.style.height = "25px"; settingsButton.style.postition = "absolute"; settingsButton.style.left = "50%"; settingsButton.style.transform = "translateX(-50%)"; settingsButton.style.webkittransform = "translateX(-50%)"; settingsButton.appendChild(svg); settingsButton.onclick = () => { GM_config.open(); let settingsarea = document.querySelector("#AOTY-Addons"); settingsarea.style.width = "530px"; settingsarea.style.height = "540px"; }; setInterval(function () { if (document.getElementsByClassName('settingsButton').length > 1) { for (let i = 0; i < document.getElementsByClassName('settingsButton').length - 1; i++) { document.getElementsByClassName('settingsButton')[i].remove() } } if (document.querySelector("#AOTY-Addons")) { var iframe = document.getElementById("AOTY-Addons"); var innerDoc = iframe.contentDocument || iframe.contentWindow.document; if (innerDoc.getElementById('AOTY-Addons_section_desc_3')) { if (!innerDoc.getElementById('AOTY-Addons_section_desc_3').innerHTML.includes('href="https://pastebin.com/raw/PehxkCSw')) { innerDoc.getElementById('AOTY-Addons_section_desc_3').innerHTML = `Script to pick a random rated album from you (or anyone's) rated albums page.` + `

Full guide: ` + `https://pastebin.com/raw/PehxkCSw` } } if (innerDoc.getElementById('AOTY-Addons_section_desc_10')) { if (!innerDoc.getElementById('AOTY-Addons_section_desc_10').textContent.includes('href="https://pastebin.com/raw/C774Jb4f')) { innerDoc.getElementById('AOTY-Addons_section_desc_10').innerHTML = `Feature I use to get track times to add from RYM faster.` + `

Full guide: ` + `https://pastebin.com/raw/C774Jb4f` } } if (innerDoc.getElementsByClassName("saveclose_buttons")[0]) { innerDoc.getElementById("AOTY-Addons_saveBtn").addEventListener( "click", function () { location.reload(); }, false ); } } }, 200); let topbar = document.querySelectorAll("#content")[1]; topbar.appendChild(settingsButton); let onuserpage = "False"; let onalbum = "False"; let oncharts = "False"; let onartist = "False"; let url = document.URL; if (url.startsWith("https://www.albumoftheyear.org/user/")) { onuserpage = "True"; } if (url.startsWith("https://www.albumoftheyear.org/album/") && !url.includes('/comments/') && !url.includes('/user-reviews/') && !url.includes('/similar/') && !url.includes('corrections.php') && !url.includes('/user-lists/')) { onalbum = "True"; } if (url.startsWith("https://www.albumoftheyear.org/artist/")) { onartist = "True"; } if (url.startsWith("https://www.albumoftheyear.org/ratings/")) { oncharts = "True"; } var styleElem = document.head.appendChild(document.createElement("style")); let ratingcolorsred = document.getElementsByClassName("red"); let ratingcolorsyellow = document.getElementsByClassName("yellow"); let ratingcolorsgreen = document.getElementsByClassName("green"); let ratings = ""; let HSreplacetext = GM_config.get("HScoreReplacementText"); let HSenabled = GM_config.get("HScoreEnable"); let RSenabled = GM_config.get("RScoreEnable"); let RSFontSize1 = GM_config.get("RScoreFont") let RSFontSize2 = GM_config.get("RScoreFont2") let RSRound1 = GM_config.get("RScoreRound") let RSRound2 = GM_config.get("RScoreRound2") let ifrated = GM_config.get("HScoreDisableIfRated"); let criticreviews = GM_config.get("HScoreHideCriticReviews"); let TBEnabled = GM_config.get("THEnable") let TBMinScore = GM_config.get("THMinScore") let TBMinRatings = GM_config.get("THMinRatings") let RAEnabled = GM_config.get("RAEnable") let AARating = GM_config.get("AARating") let RAKeyBind = GM_config.get("RAKeyBind") let TListSorter = GM_config.get("TListSorter") let avgTracklist = GM_config.get('avgTracklist') let ATRound = GM_config.get('ATRound') let quickSubmitter = GM_config.get('quickSubmitter') let quickAddTracks = GM_config.get('quickAddTracks') let rymUrl = GM_config.get('rymUrl') let copyUrl = GM_config.get('copyUrl') let zero = GM_config.get('zeroscolor') let tens = GM_config.get('tenscolor') let twenties = GM_config.get('twentiescolor') let thirties = GM_config.get('thirtiescolor') let fourties = GM_config.get('fourtiescolor') let fifties = GM_config.get('fiftiescolor') let sixties = GM_config.get('sixtiescolor') let seventies = GM_config.get('seventiescolor') let eighties = GM_config.get('eightiescolor') let nineties = GM_config.get('ninetiescolor') let hundredcolor = GM_config.get('hundredcolor') let betterColors = GM_config.get('betterColors') let betterLengths = GM_config.get('betterLengths') let checkUrl = GM_config.get('checkUrl') let hideTrackScores = GM_config.get('hideTrackScores') let multiTagSubmit = GM_config.get('multiTagSubmit') let maxTagLength = GM_config.get('maxTagLength') let quickClose = GM_config.get('quickClose') let RMHEnable = GM_config.get('RMHEnable') let RMHBind = GM_config.get('RMHBind') let FREnable = GM_config.get('FREnable') if (TBEnabled == "On" && HSenabled == "Off" && hideTrackScores == "Off") { if (url.startsWith("https://www.albumoftheyear.org/album/")) { if (document.getElementsByClassName("trackRating").length > 0) { let tracklist = document.getElementsByClassName("trackRating"); for (let i = 0; tracklist.length > i; i++) { let ratingcount; let rating; if (tracklist[i].children[0]) { rating = tracklist[i].children[0].textContent; ratingcount = tracklist[i].children[0].getAttribute("title").split("Ratings")[0]; } if (rating >= TBMinScore && ratingcount >= TBMinRatings) { let track; if (document.getElementsByClassName("trackTitle")[i].children[0].className != 'featuredArtists') { track = document.getElementsByClassName("trackTitle")[i].children[0]; } if (document.getElementsByClassName("trackTitle")[i].children[0].className == 'featuredArtists') { track = document.getElementsByClassName("trackTitle")[i].children[1]; } track.style.fontWeight = "bold"; } } } } } if (document.getElementsByClassName("ratingBlock yourOwn")[0] && ifrated == "On") { onuserpage = "True"; } if (onuserpage == "False" && HSenabled == "On") { if (oncharts == "True") { styleElem.innerHTML = ".albumListCover.mustHear::before {border-right: 0px solid rgba(98,188,250,.85);}"; ratings = document.getElementsByClassName("scoreValue"); } if (oncharts == "False") { styleElem.innerHTML = ".image.mustHear::before {border-right: 0px solid rgba(98,188,250,.85);}"; ratings = document.getElementsByClassName("rating"); } let musthear2 = document.getElementsByClassName("fas fa-star"); for (let i = 0; i < 200; i++) { if (ratingcolorsred[1 + i] && ratingcolorsred[1 + i].parentElement.parentElement.classList.length !== 2) { ratingcolorsred[1 + i].classList.replace("red", "white"); } if (ratingcolorsyellow[1 + i] && ratingcolorsyellow[1 + i].parentElement.parentElement.classList.length !== 2) { ratingcolorsyellow[1 + i].classList.replace("yellow", "white"); } if (ratingcolorsgreen[1 + i] && ratingcolorsgreen[1 + i].parentElement.parentElement.classList.length !== 2) { ratingcolorsgreen[1 + i].classList.replace("green", "white"); } if (ratings[i]) { if (ratings[i].parentElement.classList.length !== 2) { ratings[i].textContent = HSreplacetext; } } for (let i = 0; i < musthear2.length; i++) { if (musthear2[i]) { musthear2[i].remove(); } } if (onartist == "True") { let artistcriticscore = document.getElementsByClassName("artistCriticScore"); if (artistcriticscore.length >= 1) { artistcriticscore[0].children[0].textContent = HSreplacetext; } let artistuserscore = document.getElementsByClassName("artistUserScore"); if (artistuserscore.length >= 1) { artistuserscore[0].textContent = HSreplacetext; } let bestsongsratings = document.getElementsByClassName("trackRating noPadding"); if (bestsongsratings) { for (let i = 0; i < bestsongsratings.length; i++) { bestsongsratings[i].textContent = HSreplacetext; } } } if (onalbum == "True") { let musthearbutton = document.getElementsByClassName("mustHearButton"); if (musthearbutton) { for (let i = 0; i < musthearbutton.length; i++) { musthearbutton[i].remove(); } } if (criticreviews == "Hide") { let criticreviewcontainer = document.getElementById("critics"); if (criticreviewcontainer) { criticreviewcontainer.remove(); } } if (criticreviews == "Show") { let criticboxratings = document.getElementsByClassName("albumReviewRow"); for (let i = 0; i < criticboxratings.length; i++) { criticboxratings[i].children[1].children[0].children[0].textContent = HSreplacetext; } } let criticratings = document.getElementsByClassName("albumCriticScore"); criticratings[0].children[0].textContent = HSreplacetext; let userratings = document.getElementsByClassName("albumUserScore"); userratings[0].children[0].textContent = HSreplacetext; let likecount = document.getElementsByClassName("text"); if (likecount) { if (likecount.length == 3) { likecount[2].remove(); } } let albumrankings = document.getElementsByClassName("text gray"); if (albumrankings) { for (let i = 0; i < albumrankings.length; i++) { albumrankings[i].remove(); } } let trackratings = document.getElementsByClassName("trackRating"); if (trackratings) { for (let i = 0; i < trackratings.length; i++) { trackratings[i].remove(); } } } } } if (hideTrackScores == "On" && onalbum == "True") { let ratedornot = "False" if (ifrated == "On" && document.getElementsByClassName("ratingBlock yourOwn")[0]) { ratedornot = "True" } if (ratedornot == "False") { setInterval(() => { let trackratings = document.getElementsByClassName("trackRating"); if (trackratings) { for (let i = 0; i < trackratings.length; i++) { if (!trackratings[i].children[0].id.includes("track_")) trackratings[i].remove(); } } }, 10); } } function round(value, decimals) { return Number(Math.round(value + "e" + decimals) + "e-" + decimals); } if (RSenabled == "On" && HSenabled == "Off") { if (url.startsWith('https://www.albumoftheyear.org/songs/top-100/')) { let truescore = document.getElementsByClassName("trackListTable large")[0].children[0]; for (let i = 0; i < truescore.children.length; i++) { let score = truescore.children[i].children[3].children[0]; score.textContent = round(score.getAttribute("title"), RSRound2); } } if (url.startsWith("https://www.albumoftheyear.org/album/")) { if (document.getElementsByClassName("albumCriticScore")[0]) { if (document.getElementsByClassName("albumCriticScore")[0].children[0].children[0] && document.getElementsByClassName("albumCriticScore")[0].children[0].children[0].textContent !== "NR") { let criticscore = document.getElementsByClassName("albumCriticScore")[0].children[0].children[0]; let unrounded = criticscore.getAttribute('title') document.getElementsByClassName('albumCriticScore')[0].style.color = '#FFF' if (round(unrounded, RSRound1) > 100) { criticscore.textContent = 100; } else { criticscore.textContent = round(unrounded, RSRound1); document.getElementsByClassName("albumCriticScore")[0].style.fontSize = `${RSFontSize1}px`; } } } if (document.getElementsByClassName("albumUserScore")[0]) { if (document.getElementsByClassName("albumUserScore")[0].textContent !== "NR") { let userscore = document.getElementsByClassName("albumUserScore")[0].children[0]; let unrounded2 = userscore.getAttribute("title"); userscore.textContent = round(unrounded2, RSRound1); document.getElementsByClassName("albumUserScore")[0].style.fontSize = `${RSFontSize1}px`; document.getElementsByClassName('albumCriticScore')[0].style.color = '#FFF' } } } if (url.startsWith("https://www.albumoftheyear.org/artist/") && url.endsWith('/best-songs/')) { let truescore = document.getElementsByClassName("trackListTable large")[0].children[0]; for (let i = 0; i < truescore.children.length; i++) { let score = truescore.children[i].children[3].children[0]; score.textContent = round(score.getAttribute("title"), RSRound2); } } if (url.startsWith("https://www.albumoftheyear.org/ratings/")) { let roundedscore = document.getElementsByClassName("scoreValue"); let truescore = document.getElementsByClassName("scoreValueContainer"); let check = document.getElementsByClassName("scoreHeader"); for (let i = 0; i < truescore.length; i++) { if (check[i].textContent !== "Critic Score" && check[i].textContent !== "Score") { roundedscore[i].textContent = round(truescore[i].getAttribute("title"), RSRound2); roundedscore[i].style.fontSize = `${RSFontSize2}px`; } } } } if (RMHEnable == "On") { if (url.includes('https://www.albumoftheyear.org/must-hear') || (url.includes('https://www.albumoftheyear.org/must-hear') && url.includes('/1/'))) { setInterval(() => { if (GM_getValue('onrandompage') == true && (document.getElementsByClassName('headline')[0].textContent == `Must Hear Albums - Page ${GM_getValue('pagenumber')}` || (document.getElementsByClassName('headline')[0].textContent == "Must Hear Albums") && GM_getValue('pagenumber') == 1)) { let randomalbumnumber = Math.floor(Math.random() * document.getElementsByClassName("albumTitle").length + 1); GM_setValue('onrandompage', false) window.location.href = "https://www.albumoftheyear.org" + document.getElementsByClassName("albumTitle")[randomalbumnumber].parentNode.getAttribute("href"); } }, 500); function doc_keyUp(e) { switch (e.keyCode) { case RMHBind: GM_setValue('onrandompage', false) let url = window.location.href; let pagenumbers = document.getElementsByClassName("pageSelectSmall")[document.getElementsByClassName("pageSelectSmall").length - 1].textContent; let randompage = Math.floor(Math.random() * pagenumbers) + 1; if (GM_getValue('onrandompage') == false) { GM_setValue('pagenumber', randompage) } GM_setValue('onrandompage', true) if (url.includes('both') || url.includes('users')) { window.location.href = 'https://www.albumoftheyear.org' + '/must-hear/' + url.split('/must-hear/')[1].split('/')[0] + "/" + `${randompage}/`; } if (!url.includes('both') && !url.includes('users')) { window.location.href = 'https://www.albumoftheyear.org' + '/must-hear' + "/" + `${randompage}/`; } } } document.addEventListener("keyup", doc_keyUp, false); } } if (RAEnabled == "On") { if (url.includes('https://www.albumoftheyear.org/user/') && url.includes('/ratings')) { function doc_keyUp(e) { switch (e.keyCode) { case RAKeyBind: let url = window.location.href; GM_setValue("first", false); if (url.endsWith("/ratings/1/") || url.endsWith("/ratings/")) { GM_setValue("first", true); } if (GM_getValue("first") == true) { let pagenumbers = document.getElementsByClassName("pageSelectSmall")[document.getElementsByClassName("pageSelectSmall").length - 1].textContent; let randompage = Math.floor(Math.random() * pagenumbers) + 1; if (randompage == 1) { randompage++; } window.location.href = url.split(/ratings/)[0] + `ratings/${randompage}/`; } if (GM_getValue("first") == false) { let randomalbumnumber = Math.floor(Math.random() * document.getElementsByClassName("artistTitle").length + 1); window.location.href = "https://www.albumoftheyear.org" + document.getElementsByClassName("artistTitle")[randomalbumnumber].parentNode.parentNode.children[2].getAttribute("href"); } } } document.addEventListener("keyup", doc_keyUp, false); } } function color(score) { if (score >= 0 && score < 10) { return zero } if (score >= 10 && score < 20) { return tens } if (score >= 20 && score < 30) { return twenties } if (score >= 30 && score < 40) { return thirties } if (score >= 40 && score < 50) { return fourties } if (score >= 50 && score < 60) { return fifties } if (score >= 60 && score < 70) { return sixties } if (score >= 70 && score < 80) { return seventies } if (score >= 80 && score < 90) { return eighties } if (score >= 90 && score < 99.5) { return nineties } if (score >= 99.5) { return hundredcolor } } if (betterLengths == "On") { function updateLength() { if (document.getElementsByClassName('length')[0]) { if (onalbum == "True" || url.startsWith('https://www.albumoftheyear.org/song/')) { if (!url.includes('corrections.php')) { let length = 0 if (document.getElementsByClassName('length').length > 0) { for (let i = 0; i < document.getElementsByClassName('length').length; i++) { if (document.getElementsByClassName('length')[i].textContent) { let ii = 0 if (document.getElementsByClassName('length')[i].textContent.split(':').length == 3) { ii += 1 length += Number(document.getElementsByClassName('length')[i].textContent.split(':')[0]) * 3600 } length += Number(document.getElementsByClassName('length')[i].textContent.split(':')[0 + ii]) * 60 length += Number(document.getElementsByClassName('length')[i].textContent.split(':')[1 + ii]) } } } let originallength = length const hours = Math.floor(length / 3600) if (hours >= 1) { length -= hours * 3600 } let minutes = Math.floor(length / 60); const seconds = length - (minutes * 60); let rightelem; let addtracklist = 'True' if (document.getElementsByClassName('testing')[0]) { rightelem = 'testing' } if (!document.getElementsByClassName('testing')[0]) { rightelem = "totalLength" } let timestring = `Total Length: ` if (hours == 0 && minutes == 0 && seconds == 0) { addtracklist = "False" } if (originallength >= 3600) { if (hours > 1) { timestring += `${hours} hours` } if (hours == 1) { timestring += `${hours} hour` } } if (minutes > 0) { if (timestring.includes(`${hours} hour`)) { timestring += `, ${minutes} minutes` } if (!timestring.includes(`${hours} hour`)) { timestring += `${minutes} minutes` } if (minutes == 1) { timestring = timestring.replace('minutes', 'minute') } } if (seconds > 0) { if (minutes > 0) { timestring += `, ${seconds} seconds` } if (minutes == 0) { if (hours >= 1) { timestring += `, ${seconds} seconds` } if (!hours >= 1) { timestring += `${seconds} seconds` } } if (seconds == 1) { timestring = timestring.replace('seconds', 'second') } } if (addtracklist == "True") { document.getElementsByClassName(rightelem)[0].innerHTML = document.getElementsByClassName(rightelem)[0].innerHTML.split('Total Length:')[0] + timestring + '
' } } } } } updateLength() } if (AARating == "On") { let ok = false let total = 0 let thingtest; let albsrated = 0 const Observe = (sel, opt, cb) => { const Obs = new MutationObserver((m) => [...m].forEach(cb)); document.querySelectorAll(sel).forEach(el => Obs.observe(el, opt)); }; if (document.querySelector("#graybg > span > div.footer > div.overlay")) { thingtest = "#graybg > span > div.footer > div.overlay" } if (document.querySelector("#graybg > div.footer > div.overlay")) { thingtest = "#graybg > div.footer > div.overlay" } Observe(thingtest, { attributesList: ["style"], attributeOldValue: true, }, (m) => { if (m.target.getAttribute(m.attributeName) == "display: block;") { ok = true } }); setInterval(() => { if (url.includes('album') && !url.includes('/list/') && !url.includes('/critic-lists/')) { if (ok == true && document.getElementsByClassName("albumInfo").length > 0) { for (let i = 0; document.getElementsByClassName("albumInfo").length * 2 > i; i++) { if (document.getElementsByClassName("tableRating")[i] && document.getElementsByClassName("tableRating")[i].children[0]) { if (document.getElementsByClassName("tableRating")[i].children[0].className == "green-font" || document.getElementsByClassName("tableRating")[i].children[0].className == "yellow-font" || document.getElementsByClassName("tableRating")[i].children[0].className == "red-font") { total += Number(document.getElementsByClassName("tableRating")[i].children[0].textContent) albsrated++ } } } let artistratings = document.getElementsByClassName("subHeadline artistRatings")[0] let avgscore = round((total / albsrated), ATRound) let colorr; if (betterColors == "Off") { if (avgscore >= 69.5) { colorr = "#85ce73" } if (avgscore < 69.5 && avgscore >= 49.5) { colorr = "#f0e68c" } if (avgscore < 49.5) { colorr = "#d76666" } } if (betterColors == "On") { colorr = color(avgscore) } artistratings.innerHTML += `
Average Artist Rating: ${round((total / albsrated), ATRound)}
` if (betterColors == "On") { updateColors() } total = 0 albsrated = 0 ok = false } } }, 100); } if (TListSorter == "On" && !url.includes('corrections.php')) { if (onalbum == "True" || url.startsWith('https://www.albumoftheyear.org/song/')) { let elemtolookfor; let secheading1; if (url.startsWith('https://www.albumoftheyear.org/song/')) { for (let i = 0; document.getElementsByClassName('sectionHeading')[i] && !document.getElementsByClassName('sectionHeading')[i].textContent.includes("Community's Top Songs"); i++) { if (document.getElementsByClassName('sectionHeading')[i + 1]) { if (document.getElementsByClassName('sectionHeading')[i + 1].textContent.includes("Community's Top Songs")) { secheading1 = i + 1 } } } if (Number.isInteger(secheading1)) { if (document.getElementsByClassName('sectionHeading')[secheading1].parentNode) { if (document.getElementsByClassName('trackListTable')[1]) { document.getElementsByClassName('trackListTable')[1].className = 'trackTable' document.getElementsByClassName('trackTable')[0].style.width = "100%" document.getElementsByClassName('trackTable')[0].style.borderSpacing = '0' document.getElementsByClassName('trackTable')[0].style.borderColor = '#36393f' } for (let i = 0; i < document.getElementsByClassName('sectionHeading')[secheading1].parentNode.children[1].children[0].children.length; i++) { document.getElementsByClassName('sectionHeading')[secheading1].parentNode.children[1].children[0].children[i].children[2].className = "thing" var styles = ` body.dark .ratingRowContainer, body.dark .albumReviewRow, body.dark .rightBox .row, body.dark .albumListRow, body.dark .listItem, body.dark .mediaContainer, body.dark .profileStatContainer, body.dark .profileStatContainer.first, body.dark .artistTopBox.info, body.dark table.discussion td, body.dark table.discussion, body.dark .albumHeader, body.dark .rightBox .moreButton, body.dark .largeButton, body.dark .albumButton, body.dark .albumTopBox.info, body.dark .button, body.dark .commentTextBox, body.dark .prevAlbumReview, body.dark .nextAlbumReview, body.dark .newsListContainerSmall, body.dark .albumListLinks div, body.dark .reviewTextBox, body.dark .feedAlbumRow, body.dark .userListRow, body.dark .ratingTextBox, body.dark .notificationRow, body.dark .commentRow, body.dark .upd, body.dark .listSummaryRow, body.dark .listSelect, body.dark #newListForm textarea, body.dark #newListForm input[type=text], body.dark #newListForm .checkmark, body.dark #editListForm .checkmark, body.dark #listEdit table, body.dark #listEdit td, body.dark #editListForm textarea, body.dark #editListForm input[type=text], body.dark #editListEntry textarea, body.dark #editListEntry input[type=text], body.dark .dotDropMenu, body.dark .editUserEntry input, body.dark .editUserEntry select, body.dark table.existing td, body.dark table.existing th, body.dark .addCoverBox, body.dark input[type=submit].link, body.dark .editUserEntry textarea, body.dark .textBox, body.dark .textLine, body.dark .userReviewBlock.full, body.dark .listRow, body.dark .overlaySearchBox, body.dark .donorList, body.dark table.listRows, body.dark .menuDropSelected ul, body.dark .tagRow, body.dark .overlayTextarea, body.dark .trackTable td, body.dark .ratingDistribution, body.dark .overlay select, body.dark .inlineRelated, body.dark .artistList .photo, body.dark .artistList .name { border-color: #36393f; } .trackTable .thing { vertical-align: middle; font-weight: 700; text-align: center; } .trackTable td {vertical-align: top;padding: 5px 7px 5px 0;border-bottom: 1px solid #e2e2e2;} .trackTable .songAlbum { vertical-align: middle; padding-left: 5px; } ` var styleSheet = document.createElement("style") styleSheet.innerText = styles document.head.appendChild(styleSheet) document.getElementsByClassName('sectionHeading')[secheading1].parentNode.children[1].children[0].children[i].children[2].style.paddingRight = '0' } document.getElementsByClassName('trackRating noPadding')[0].style.cssText } } elemtolookfor = document.getElementsByClassName('trackList')[0].children[0].children[0] } if (onalbum == "True") { elemtolookfor = document.getElementById('tracklist').children[0].children[0] } if (TListSorter == "On" && hideTrackScores == "Off" && HSenabled == "Off") { function unselectable(classname) { if (elemtolookfor.innerHTML) { if (document.getElementsByClassName(classname)[0]) { document.getElementsByClassName(classname)[0].style.MozUserSelect = "-moz-none" document.getElementsByClassName(classname)[0].style.webkitUserSelect = "none" document.getElementsByClassName(classname)[0].style.UserSelect = "none" } } } if (document.getElementsByClassName('trackRating').length > 0) { let initialinhtml; let secheading; const disclength = document.getElementsByClassName('discNumber').length if (onalbum == "True") { initialinhtml = document.getElementById('tracklist').children[0].children[0].innerHTML document.getElementById('tracklist').children[0].children[0].innerHTML += `
[Sort by highest rated]
` unselectable("sorttracklist") } if (url.startsWith('https://www.albumoftheyear.org/song/')) { for (let i = 0; document.getElementsByClassName('sectionHeading')[i] && !document.getElementsByClassName('sectionHeading')[i].textContent.includes("Track ListRate Tracks"); i++) { if (document.getElementsByClassName('sectionHeading')[i + 1]) { if (document.getElementsByClassName('sectionHeading')[i + 1].textContent.includes("Track ListRate Tracks")) { secheading = i + 1 } } } initialinhtml = document.getElementsByClassName('sectionHeading')[secheading].innerHTML document.getElementsByClassName('sectionHeading')[secheading].insertAdjacentHTML('beforeEnd', `
[Sort by highest rated]
`) } const ogtracklist = document.getElementsByClassName('trackList')[0].innerHTML unselectable("sorttracklist") setInterval(() => { let sorttracklist = document.getElementsByClassName('sorttracklist')[0] if (sorttracklist) { sorttracklist.onclick = () => { function sortscores(oddeven) { let evenorodd; if (oddeven == "Odd") { evenorodd = function (x) { return x & 1; } }; if (oddeven == "Even") { evenorodd = function (x) { return !(x & 1); }; } let arr1 = [] let arr2 = [] let rateabletrackcount = 0 for (let i = 0; i < document.getElementsByClassName('trackRating').length; i++) { if (!document.getElementsByClassName('trackRating')[i].children[0]) { rateabletrackcount++ } if (document.getElementsByClassName('trackRating')[i].children[0]) { let clsnme = document.getElementsByClassName('trackRating')[i].children[0].getAttribute('class') if (clsnme == "green-font" || clsnme == "red-font" || clsnme == "yellow-font" || document.getElementsByClassName('trackRating')[i].children[0].textContent == "NR") { rateabletrackcount++ } } } if (rateabletrackcount == document.getElementsByClassName('trackRating').length) { for (let i = 0; i < document.getElementsByClassName('trackRating').length; i++) { if (document.getElementsByClassName('trackRating')[i].children[0] && onalbum == "True") { arr1.push(document.getElementsByClassName('trackRating')[i].children[0].textContent) } if (!document.getElementsByClassName('trackRating')[i].children[0]) { arr1.push(-1) } if (document.getElementsByClassName('trackRating')[i].children[0] && evenorodd(i) && url.startsWith('https://www.albumoftheyear.org/song/') && document.getElementsByClassName('trackRating')[i].children[0].textContent != "NR") { arr1.push(document.getElementsByClassName('trackRating')[i].children[0].textContent) } if (document.getElementsByClassName('trackRating')[i].children[0] && evenorodd(i) && url.startsWith('https://www.albumoftheyear.org/song/') && document.getElementsByClassName('trackRating')[i].children[0].textContent == "NR") { arr1.push(-1) } } const deepCopy = [...arr1].map((e, i) => [e, i]).sort(function (a, b) { return b[0] - a[0] }); for (let [e, i] of deepCopy) { arr2.push(i); }; let arr = arr2; let disclength = document.getElementsByClassName('discNumber').length if (disclength > 0) { for (let i = 0; i < disclength; i++) { document.getElementsByClassName('discNumber')[0].remove() } } let tracklistslength = document.getElementsByClassName('trackListTable').length if (tracklistslength > 1) { for (let i = 1; i < tracklistslength + 1; i++) { if (document.getElementsByClassName('trackListTable')[1]) { document.getElementsByClassName('trackListTable')[0].children[0].innerHTML += document.getElementsByClassName('trackListTable')[1].innerHTML document.getElementsByClassName('trackListTable')[1].remove() } } } let wrapper = document.getElementsByClassName("trackListTable"); let items; if (evenorodd(2)) { if (!wrapper[0].children[0].children[2] || (wrapper[0].children[0].children[2] && !wrapper[0].children[0].children[2].textContent.includes('User Score'))) { // && !wrapper[0].children[0].children[2].textContent.includes('User Score') items = wrapper[0].children[0].children; } if (wrapper[0].children[0].children[2] && wrapper[0].children[0].children[2].textContent.includes('User Score')) { items = wrapper[0].children; } } if (evenorodd(1)) { items = wrapper[0].children; } let items3 = wrapper[0].children let elements = document.createDocumentFragment(); let onsongornot; if (url.startsWith('https://www.albumoftheyear.org/song/')) { elements.appendChild(items[0].cloneNode(true)) onsongornot = 1 } if (onalbum == "True") { onsongornot = 0 } arr.forEach(function (idx) { if (items[onsongornot].getAttribute('class') !== 'trackNumber') { if (url.startsWith('https://www.albumoftheyear.org/song/')) { elements.appendChild(items[idx + 1].cloneNode(true)); } if (onalbum == "True" && !url.startsWith('https://www.albumoftheyear.org/song/')) { elements.appendChild(items[idx].cloneNode(true)); } } if (items[onsongornot].getAttribute('class') == 'trackNumber') { if (url.startsWith('https://www.albumoftheyear.org/song/')) { elements.appendChild(items3[idx + 1].cloneNode(true)); } if (onalbum == "True") { elements.appendChild(items3[idx].cloneNode(true)); } } }); wrapper[0].innerHTML = null; wrapper[0].appendChild(elements); } if (onalbum == "True") { if (!document.getElementsByClassName('sorttracklist')[0]) { elemtolookfor.innerHTML = initialinhtml + `
[Sort by track number]
` } if (document.getElementsByClassName('sorttracklist')[0]) { document.getElementsByClassName('sorttracklist')[0].parentNode.innerHTML = initialinhtml + `
[Sort by track number]` } unselectable("sorttracklist2") } if (url.startsWith('https://www.albumoftheyear.org/song/')) { if (document.getElementsByClassName('sorttracklist')[0]) { document.getElementsByClassName('sorttracklist')[0].parentNode.insertAdjacentHTML('beforeEnd', ` [Sort by your highest rated]`) document.getElementsByClassName('sorttracklist')[0].remove() if (document.getElementsByClassName('sectionHeading')[secheading].children.length > 4) { document.getElementsByClassName('sectionHeading')[secheading].children[3].remove() } } setInterval(() => { if (document.getElementsByClassName('sorttracklist3')[0]) { document.getElementsByClassName('sorttracklist3')[0].onclick = () => { sortscores("Odd") if (document.getElementsByClassName('sorttracklist3')[0]) { document.getElementsByClassName('sorttracklist3')[0].parentNode.insertAdjacentHTML('beforeEnd', ` [Sort by track number]`) document.getElementsByClassName('sorttracklist3')[0].remove() unselectable("sorttracklist2") } } } }, 100); unselectable("sorttracklist3") } } sortscores("Even") } } let unsorttracklist = document.getElementsByClassName('sorttracklist2')[0] if (unsorttracklist) { unsorttracklist.onclick = () => { let arr3 = [] let arr4 = [] for (let i = 0; i < document.getElementsByClassName("trackListTable")[0].children.length; i++) { if (document.getElementsByClassName("trackListTable")[0].children[i].children[0].textContent.includes('.')) { arr3.push((document.getElementsByClassName("trackListTable")[0].children[i].children[0].textContent.split('.')[0] * 1000) + document.getElementsByClassName("trackListTable")[0].children[i].children[0].textContent.split('.')[1]) } if (!document.getElementsByClassName("trackListTable")[0].children[i].children[0].textContent.includes('.')) { arr3.push(document.getElementsByClassName("trackListTable")[0].children[i].children[0].textContent) } } let elements2 = document.createDocumentFragment(); const deepCopy2 = [...arr3].map((e, i) => [e, i]).sort(function (a, b) { return b[0] - a[0] }); for (let [e, i] of deepCopy2) { arr4.push(i); }; let wrapper2 = document.getElementsByClassName("trackListTable"); let items2 = wrapper2[0].children; arr4.reverse().forEach(function (idx) { elements2.appendChild(items2[idx].cloneNode(true)); }); if (disclength == 0) { wrapper2[0].innerHTML = null; wrapper2[0].appendChild(elements2); } if (disclength > 0) { document.getElementsByClassName('trackList')[0].innerHTML = ogtracklist if (avgTracklist == "On") { getAvgTracklist() updateColors() updateLength() } } if (document.getElementsByClassName('sorttracklist2')[0]) { document.getElementsByClassName('sorttracklist2')[0].parentNode.insertAdjacentHTML('beforeEnd', `
[Sort by highest rated]
`) document.getElementsByClassName('sorttracklist2')[0].remove() if (url.startsWith('https://www.albumoftheyear.org/song')) { if (document.getElementsByClassName('sectionHeading')[secheading].children.length > 4) { document.getElementsByClassName('sectionHeading')[secheading].children[3].remove() } } if (onalbum == "True") { if (document.getElementById('tracklist').children[0].children[0].children.length > 3) { document.getElementById('tracklist').children[0].children[0].children[1].remove() } } unselectable("sorttracklist") } } } }, 100); } } } } if (avgTracklist == "On" && !url.includes('corrections.php') && hideTrackScores == "Off" && HSenabled == "Off") { function getAvgTracklist() { if (url.includes('https://www.albumoftheyear.org/song/') || url.includes('https://www.albumoftheyear.org/album/')) { if (!url.includes('/user-reviews/')) { let allscores = 0 let ratedtrackcount = 0 let yourratedtrackcount = 0 let youravgrating = 0 let color2; let color3; if (document.getElementsByClassName('trackTitle') && url.startsWith("https://www.albumoftheyear.org/song/")) { if (document.getElementsByClassName('trackTitle')) { for (let i = 0; i < document.getElementsByClassName('trackTitle').length; i++) { let checkifrating = document.getElementsByClassName('trackTitle')[i].parentNode.children[2].children[0].className let checkifrating2 = document.getElementsByClassName('trackTitle')[i].parentNode.children[3].children[0].className if (checkifrating == "green-font" || checkifrating == "red-font" || checkifrating == "yellow-font") { allscores += Number(document.getElementsByClassName('trackTitle')[i].parentNode.children[2].children[0].textContent) ratedtrackcount++ } if (checkifrating2 == "green-font" || checkifrating2 == "red-font" || checkifrating2 == "yellow-font") { youravgrating += Number(document.getElementsByClassName('trackTitle')[i].parentNode.children[3].children[0].textContent) yourratedtrackcount++ } } let addedelm; if (!document.getElementsByClassName('totalLength')[0]) { if (document.getElementsByClassName('trackList')) { let totalLengthChild = document.createElement('div') totalLengthChild.innerHTML = `
` document.getElementsByClassName('trackList')[0].appendChild(totalLengthChild) addedelm = true; } } let tracklength = document.createElement('span') tracklength.className = 'testing' let averagerating = round(allscores / ratedtrackcount, ATRound) let youraveragerating = round(youravgrating / yourratedtrackcount, ATRound) if (youraveragerating >= 69.5) { color3 = "#85ce73" } if (youraveragerating < 69.5 && youraveragerating >= 49.5) { color3 = "#f0e68c" } if (youraveragerating < 49.5) { color3 = "#d76666" } if (averagerating >= 69.5) { color2 = "#85ce73" } if (averagerating < 69.5 && averagerating >= 49.5) { color2 = "#f0e68c" } if (averagerating < 49.5) { color2 = "#d76666" } let tracklengthtxt; if (ratedtrackcount !== 0 && yourratedtrackcount !== 0) { if (addedelm !== true) { tracklengthtxt = document.getElementsByClassName('totalLength')[0].textContent tracklength.innerHTML = `Your Average Rating: ${youraveragerating}
Average Rating: ${averagerating}
${tracklengthtxt}` } if (addedelm == true) { tracklength.innerHTML = `Your Average Rating: ${youraveragerating}
Average Rating: ${averagerating}
` } } if (ratedtrackcount !== 0 && yourratedtrackcount == 0) { if (addedelm !== true) { tracklengthtxt = document.getElementsByClassName('totalLength')[0].textContent tracklength.innerHTML = `Your Average Rating: N/A
Average Rating: ${averagerating}
${tracklengthtxt}` } if (addedelm == true) { tracklength.innerHTML = `Your Average Rating: N/A
Average Rating: ${averagerating}
` } } if (ratedtrackcount == 0) { if (addedelm !== true) { tracklengthtxt = document.getElementsByClassName('totalLength')[0].textContent tracklength.innerHTML = `Your Average Rating: N/A
Average Rating: N/A
${tracklengthtxt}` } if (addedelm == true) { tracklength.innerHTML = `Your Average Rating: N/A
Average Rating: N/A
` } } document.getElementsByClassName('totalLength')[0].innerHTML = '' document.getElementsByClassName('totalLength')[0].append(tracklength) } } if (document.getElementsByClassName('trackTitle') && onalbum == "True" && HSenabled == "Off") { for (let i = 0; i < document.getElementsByClassName('trackTitle').length; i++) { if (document.getElementsByClassName('trackRating')[i].children[0]) { ratedtrackcount++ allscores += Number(document.getElementsByClassName('trackRating')[i].children[0].textContent) } } let addedelm; if (!document.getElementsByClassName('totalLength')[0]) { if (document.getElementsByClassName('trackList')) { let totalLengthChild = document.createElement('div') totalLengthChild.innerHTML = `
` document.getElementsByClassName('trackList')[0].appendChild(totalLengthChild) addedelm = true } } let tracklength = document.createElement('span') tracklength.className = 'testing' let averagerating = round(allscores / ratedtrackcount, ATRound) if (averagerating >= 69.5) { color2 = "#85ce73" } if (averagerating < 69.5 && averagerating >= 49.5) { color2 = "#f0e68c" } if (averagerating < 49.5) { color2 = "#d76666" } let tracklengthtxt; if (ratedtrackcount !== 0) { tracklengthtxt = document.getElementsByClassName('totalLength')[0].textContent tracklength.innerHTML = `Average Rating: ${averagerating}
${tracklengthtxt}
` document.getElementsByClassName('totalLength')[0].innerHTML = '' document.getElementsByClassName('totalLength')[0].append(tracklength) } if (addedelm == true) { document.getElementsByClassName('totalLength')[0].innerHTML = document.getElementsByClassName('totalLength')[0].innerHTML.replaceAll('
', '').replaceAll('
', '') } } } } } getAvgTracklist() } if (quickClose == "On") { function closeMenu(e) { switch (e.keyCode) { case 27: if (document.getElementsByClassName('overlayClose').length > 0) { document.getElementsByClassName('overlayClose')[0].click() } } } document.addEventListener('keyup', closeMenu, false); } if (quickSubmitter == "On") { if (onalbum == "True") { function enterGenre(e) { //switch (e.keyCode) { if (e.keyCode == 13) { if (document.getElementById('suggestGenre')) { if (document.getElementById(`genre`).value) { if (document.getElementsByClassName('ui-menu-item-wrapper').length == 1) { document.getElementById(`genre`).value = document.getElementsByClassName('ui-menu-item-wrapper')[0].textContent } if (document.getElementsByClassName('addAlbumGenre')[0].children[0]) { document.getElementsByClassName('addAlbumGenre')[0].children[0].click() if (document.getElementById('ui-id-3')) { for (let x = 0; x < document.getElementById('ui-id-3').children.length; x++) { document.getElementById('ui-id-3').children[x].remove() } document.getElementById('ui-id-3').style = 'hidden' } } } } } if (e.keyCode == 27) { if (document.getElementById('suggestGenre')) { document.getElementsByClassName('overlayClose')[0].click() } } } } document.addEventListener('keyup', enterGenre, false) //} if (onalbum == "True") { function enterScore(e) { switch (e.keyCode) { case 13: if (document.getElementById('value')) { if (document.getElementById('value').value && !document.getElementsByClassName('ratingBlock yourOwn')[0]) { document.getElementById('rate').click() } } } } document.addEventListener('keyup', enterScore, false); } if ((url.startsWith('https://www.albumoftheyear.org/artist/') && !url.includes('/best-songs/') && !url.includes('/comments')) || onalbum == "True") { if (multiTagSubmit == "On") { document.getElementById('addTag').children[0].setAttribute('maxlength', maxTagLength) setInterval(() => { if (document.getElementById('ui-id-2')) { if (document.getElementById('ui-id-2').children[0]) { if (document.getElementById('ui-id-2').children[0].children[0]) { if (document.getElementById('ui-id-2').children[0].children[0].textContent.includes('Only letters and digits are permitted...')) { if (document.getElementById('tag').value.includes(',')) { for (let x = 0; x < document.getElementById('ui-id-2').children.length; x++) { document.getElementById('ui-id-2').children[x].remove() } document.getElementById('ui-id-2').style = 'hidden' } } } } } }, 100); } function enterTag(e) { switch (e.keyCode) { case 13: if (document.getElementsByClassName("tagTextBox ui-autocomplete-input") && document.getElementById('tag').value) { if (!document.getElementById('tag').value.includes(',')) { if (document.getElementById('tagMessage1')) { document.getElementById('tagMessage1').setAttribute('id', 'tagMessage') } document.getElementById('addTag').children[1].click() } if (multiTagSubmit == "On") { if (document.getElementById('tag').value.includes(',')) { let tagsplit = document.getElementById('tag').value.split(',') if (tagsplit.length <= 15) { let listTagsAdded = '' if (document.getElementById('tagMessage')) { document.getElementById('tagMessage').setAttribute('id', 'tagMessage1') } for (let x = 0; x < tagsplit.length; x++) { var tagEl = document.createElement('tagtext') tagEl.innerHTML = `` tagEl.style = ` document.getElementById('tag').value = tagsplit[x] document.getElementById('addTag').children[1].click() --fa-style-family-brands: "Font Awesome 6 Brands"; --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands"; --fa-style-family-duotone: "Font Awesome 6 Duotone"; --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone"; --fa-font-light: normal 300 1em/1 "Font Awesome 6 Pro"; --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Pro"; --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Pro"; --fa-style-family-classic: "Font Awesome 6 Pro"; --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Pro"; --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 6 Sharp"; --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 6 Sharp"; --fa-style-family-sharp: "Font Awesome 6 Sharp"; --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 6 Sharp"; font-family: open sans,sans-serif; -webkit-text-size-adjust: 100%; text-align: left; font-size: 11px; ` if (document.getElementById('tagMessage1')) { if (tagsplit[x].replace(' ', '').length > 1 && tagsplit[x].replace(' ', '').length < 35) { if (x + 2 == tagsplit.length) { listTagsAdded += `${tagsplit[x]}` + ', and ' + tagsplit[x + 1] } if (x + 2 != tagsplit.length && x + 1 != tagsplit.length) { listTagsAdded += `${tagsplit[x]}` + ', ' } document.getElementById('tag').value = tagsplit[x] document.getElementById('addTag').children[1].click() tagEl.style.color = 'green' document.getElementById('tagMessage1').appendChild(tagEl) document.getElementById('tagMessage1').children[0].textContent = `${listTagsAdded.replace(`, `, `, `)} entered as tags` } if (tagsplit[x].replace(' ', '').length == 1 || tagsplit[x].replace(' ', '').length > 35) { tagEl.style.color = 'red' document.getElementById('tagMessage1').appendChild(tagEl) document.getElementById('tagMessage1').children[0].textContent = 'Tag must be more than 1 character and no more than 35' } } } } } } if (document.getElementById('ui-id-2')) { for (let x = 0; x < document.getElementById('ui-id-2').children.length; x++) { document.getElementById('ui-id-2').children[x].remove() } document.getElementById('ui-id-2').style = 'hidden' } } } } document.addEventListener('keyup', enterTag, false); } } if (quickAddTracks == "On" && url.includes('https://www.albumoftheyear.org/album/corrections.php?')) { function enterTracks(e) { let currenttrack; switch (e.keyCode) { case 13: for (let i = 1; document.getElementById(`trackName_${i}`); i++) { currenttrack = i } if (document.activeElement.className !== "textBox") { if (document.getElementById(`trackName_${currenttrack}`)) { if (!document.getElementById(`trackName_${currenttrack}`).value && !document.getElementById(`minutes_${currenttrack}`).value && !document.getElementById(`seconds_${currenttrack}`).value) { document.getElementById(`trackName_${currenttrack}`).select() } if (document.getElementById(`trackName_${currenttrack}`).value && !document.getElementById(`minutes_${currenttrack}`).value && !document.getElementById(`seconds_${currenttrack}`).value) { document.getElementById(`minutes_${currenttrack}`).select() } if (document.getElementById(`trackName_${currenttrack}`).value && document.getElementById(`minutes_${currenttrack}`).value && !document.getElementById(`seconds_${currenttrack}`).value) { document.getElementById(`seconds_${currenttrack}`).select() } if (document.getElementById(`trackName_${currenttrack}`).value && document.getElementById(`minutes_${currenttrack}`).value && document.getElementById(`seconds_${currenttrack}`).value) { document.getElementById(`row_${currenttrack}`).children[4].children[0].children[0].click() document.getElementById(`row_${currenttrack}`).children[4].children[0].children[0].remove() } } } } } document.addEventListener('keyup', enterTracks, false); } if (rymUrl == "On" && url.includes('https://www.albumoftheyear.org/album/corrections.php?')) { const removeAccents = str => str.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); String.prototype.htmlProtect = function () { var replace_map; replace_map = { ' ': '-', ' ': '-', "'": '', '?': '', '//': '', '/': '-', ':': '', '&': '', '--': '-', '.': '', '!': '', '+': '', ',': '', ':': '', '(': '', ')': '', '>': '', '#': '_' }; return this.replace(/[ '?///:&--.!+,:()>#]/g, function (match) { return replace_map[match]; }); }; if (document.getElementsByClassName('headline')[3] && document.getElementsByClassName('headline')[3].textContent == "Add Tracks") { let albandart = document.getElementsByClassName('headline')[0].textContent.split(" - ") let artist = albandart[0].toLowerCase().replaceAll('&', "and") let album = albandart[1].toLowerCase() let e = document.getElementById("type") let format = e.options[e.selectedIndex].text if (format == "LP") { format = "album" } let link = `https://rateyourmusic.com/release/${format.toLowerCase()}/${encodeURIComponent((removeAccents(artist.htmlProtect())))}/${encodeURIComponent(removeAccents(album.htmlProtect())).replaceAll('----', '-').replaceAll('---', '-').replaceAll('--', '-')}/` if (checkUrl == "On") { GM_fetch(link) .then(function (response) { return response.text() }).then(function (body) { var el = document.createElement('html'); el.innerHTML = body if (!el.getElementsByClassName('page_error_content').length > 0) { let rymlink = document.createElement("a"); rymlink.innerHTML = `Add Tracks` document.getElementsByClassName('headline')[3].textContent = '' document.getElementsByClassName('headline')[3].appendChild(rymlink) if (copyUrl == "On") { navigator.clipboard.writeText(link) } } if (el.getElementsByClassName('page_error_content').length > 0) { let rymlink = document.createElement("a"); rymlink.innerHTML = `Add Tracks (No RYM URL Found)` document.getElementsByClassName('headline')[3].textContent = '' document.getElementsByClassName('headline')[3].appendChild(rymlink) } }) } if (checkUrl == "Off") { let rymlink = document.createElement("a"); rymlink.innerHTML = `Add Tracks` document.getElementsByClassName('headline')[3].textContent = '' document.getElementsByClassName('headline')[3].appendChild(rymlink) if (copyUrl == "On") { navigator.clipboard.writeText(link) } } } } if (betterColors == "On") { function updateColors() { if (url.startsWith('https://www.albumoftheyear.org/user/') || url.includes('/user-reviews/') || url.startsWith('https://www.albumoftheyear.org/song/') || url.startsWith('https://www.albumoftheyear.org/user/')) { for (let i = 0; i < document.getElementsByClassName('distBar').length; i++) { let currentcolor; let ii = 0 if (i == 0 && url.startsWith('https://www.albumoftheyear.org/user/')) { currentcolor = hundredcolor } if (!url.startsWith('https://www.albumoftheyear.org/user/')) { ii = 1 } if (i == 1 - ii) { currentcolor = nineties } if (i == 2 - ii) { currentcolor = eighties } if (i == 3 - ii) { currentcolor = seventies } if (i == 4 - ii) { currentcolor = sixties } if (i == 5 - ii) { currentcolor = fifties } if (i == 6 - ii) { currentcolor = fourties } if (i == 7 - ii) { currentcolor = thirties } if (i == 8 - ii) { currentcolor = twenties } if (i == 9 - ii) { currentcolor = tens } if (i == 10 - ii) { currentcolor = zero } document.getElementsByClassName('distBar')[i].style.backgroundColor = currentcolor } } if (document.getElementsByClassName('testing').length > 0) { if (document.getElementsByClassName('testing')[0].children[1].textContent !== "N/A") { let score = document.getElementsByClassName('testing')[0].children[1].textContent document.getElementsByClassName('testing')[0].children[1].style.color = color(score) } if (document.getElementsByClassName('testing')[0].children[4]) { if (document.getElementsByClassName('testing')[0].children[4].textContent !== "N/A") { let score = document.getElementsByClassName('testing')[0].children[4].textContent document.getElementsByClassName('testing')[0].children[4].style.color = color(score) } } } if (document.getElementsByClassName('trackRating').length > 0) { for (let i = 0; i < document.getElementsByClassName('trackRating').length; i++) { if (document.getElementsByClassName('trackRating')[i].children[0]) { let score = document.getElementsByClassName('trackRating')[i].children[0].textContent document.getElementsByClassName('trackRating')[i].children[0].style.color = color(score) } } } setInterval(() => { if (document.getElementsByClassName('ratingBar').length > 0) { for (let i = 0; i < document.getElementsByClassName('ratingBar').length; i++) { let score = document.getElementsByClassName('ratingBar')[i].children[0].getAttribute('style').replaceAll('width:', '').replaceAll('%;', '') document.getElementsByClassName('ratingBar')[i].children[0].style.backgroundColor = color(score) } } }, 200); if (document.getElementsByClassName('albumReviewRatingBar').length > 0) { for (let i = 0; i < document.getElementsByClassName('albumReviewRatingBar').length; i++) { let score = document.getElementsByClassName('albumReviewRatingBar')[i].children[0].getAttribute('style').replaceAll('width:', '').replaceAll('%;', '') document.getElementsByClassName('albumReviewRatingBar')[i].children[0].style.backgroundColor = color(score) } } if (url.startsWith('https://www.albumoftheyear.org/user/') || onalbum == "True") { if (document.getElementsByClassName('green-font').length > 0) { for (let i = 0; i < document.getElementsByClassName('green-font').length; i++) { document.getElementsByClassName('green-font')[i].style.color = color(document.getElementsByClassName('green-font')[i].textContent) } } if (document.getElementsByClassName('yellow-font').length > 0) { for (let i = 0; i < document.getElementsByClassName('yellow-font').length; i++) { document.getElementsByClassName('yellow-font')[i].style.color = color(document.getElementsByClassName('yellow-font')[i].textContent) } } if (document.getElementsByClassName('red-font').length > 0) { for (let i = 0; i < document.getElementsByClassName('red-font').length; i++) { document.getElementsByClassName('red-font')[i].style.color = color(document.getElementsByClassName('red-font')[i].textContent) } } } } updateColors() } if (FREnable == "On" && url == 'https://www.albumoftheyear.org/feed/') { window.location.href = 'https://www.albumoftheyear.org/feed/?q=reviews' } }, }, css: "#AOTY-Addons { height: 200px; width: 500px }", }); })();