Highlight Updates in History

Highlights Updates in history tab of Nexus Mods

安裝腳本?
作者推薦腳本

您可能也會喜歡 Grab Mods Requiring Links

安裝腳本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Highlight Updates in History
// @namespace    http://tampermonkey.net/
// @version      2024-03-26
// @description  Highlights Updates in history tab of Nexus Mods
// @author       TragicNet
// @match        https://www.nexusmods.com/users/myaccount?tab=download+history
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nexusmods.com
// @grant       GM_addStyle
// ==/UserScript==

function updateDateColors(newColor, oldColor) {
    let tableRows = document.querySelectorAll('tbody > tr');
    tableRows.forEach((row) => {
        let dlDate = new Date(row.querySelector('td:nth-child(2)').innerHTML);
        let updateDate = new Date(row.querySelector('td:nth-child(5)').innerHTML);
        if(dlDate > updateDate) {
            row.querySelector('td:nth-child(2)').style.color = newColor;

        } else {
            row.querySelector('td:nth-child(2)').style.color = oldColor;
        }
    })
}


window.addEventListener('load', (event) => {
    // Select the node that will be observed for mutations
    const targetNode = document.getElementById("tab-my-download-history");

    // Options for the observer (which mutations to observe)
    const config = { childList: true, subtree: true };

    // Callback function to execute when mutations are observed
    const callback = (mutationList, observer) => {
        updateDateColors('cyan', 'red');
    };

    // Create an observer instance linked to the callback function
    const observer = new MutationObserver(callback);

    // Start observing the target node for configured mutations
    observer.observe(targetNode, config);
});