Created
July 18, 2020 20:57
-
-
Save AliceDTRH/2694b3ff74fe164d93deb47454affcfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Mark outdated plugins | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.nexusmods.com/*/mods/categories/* | |
// @match https://www.nexusmods.com/*/mods/* | |
// @match https://www.nexusmods.com/*/search/* | |
// @grant none | |
// @require https://cdnjs.cloudflare.com/ajax/libs/arrive/2.4.1/arrive.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.arrive(".mod-tile", function(e) {highlightSearchDates(e);}); | |
document.addEventListener("DOMContentLoaded", function(){ | |
if(document.body.classList.contains("modpage")) { | |
console.debug("Mod page, disabling self."); | |
document.unbindArrive(); | |
}}); | |
let count = 0; | |
function highlightSearchDates(e) { | |
$(e).find('.meta > div.date').not('.aliceproc').each(function(i, e){ | |
count++; | |
let data = e.lastChild; | |
let year = data.wholeText.split(" ").splice(-1); | |
if(year < (new Date()).getFullYear() - 7) {$(e).css("color", "rgb(65, 0, 0)").css("font-weight:bold;");} else if(year < (new Date()).getFullYear() - 5) { | |
$(e).css("color", "rgb(210, 105, 30)"); | |
} else if(year < (new Date()).getFullYear() - 3) { | |
$(e).css("color", "rgb(75, 107, 47)"); | |
} | |
else { | |
$(e).css("color", "rgb(143,188,143)"); | |
} | |
$(e).addClass("aliceproc"); | |
console.debug("Updated "+count+" mod-items :)"); | |
}); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment