No Browser Cache for User Scripts

Updates the user script install link on every refresh to avoid browser caching.

// ==UserScript==
// @name         No Browser Cache for User Scripts
// @namespace    https://naeembolchhi.github.io/
// @version      0.4
// @description  Updates the user script install link on every refresh to avoid browser caching.
// @author       NaeemBolchhi
// @license      GPL-3.0-or-later
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAE/5JREFUeJztnQtwXOV5hlfGMaSBkNIB0nRKSsuQTC40bafThBDIdLATSkigIR0SQtt0BuLKdswlkEKIbZImaQPpFAhayUPsCdQBm9Q2wQESAgZTbLDut92VtJJWe9VK2ts5axxs7L/fWbFYkler3XPZ7//Ped+ZZ5jxoPGM93uf/f5zjnZ9PoQ9OU07P1/Qm4kdxEEiQRSINwmhMjkim9eOZ3La0alMITc5nR+aSGZ/OxBOP9oVTN7VFUqs7Ayk3839GiBIQ5PL6edRQX5EjHCXlIupmYIYiUyL3uHUMZLBELG9K5i64eDQ1Jncrw+COJJ8Xr8wXyhupwK8wV1AGZiIZ8R4bEaEJ6ZF33BKkAQMjhD7iJs7A5NncL9mCGI5+Xx+RX72Hf8wd+lkoiyAMsZG0B1KlkVgcIjYSX92CfdriCCmQufgP6dhD3OXTUYWCsBgjOg/sQ3M5TXiKiEE90uKILWFhvwG4hB30WSlkgDKBEbTlSRg0N4VSFzG/doiSNXQgN9GHOUumcxUE4BBaGxqMQmIzmByDx0N/oj7dUaQk0LDvZY4xl0w2VlKAAbBxTcBA524raNDNHG/5ghSSk4vXkvDfYS7XCpQiwAMBsKT1SRg8GLPELYBhDn5vP5+Guwcd7FUoVYBGPQNVbwwOJfprmBqFfcMIB4ODfUB7lKpRD0CGI1OLyUAgzeJjbhTgDQ89O7fzF0o1ahHAKU7A+Gq1wPmsrWvb2I590wgHkmxWDyNBnqKu1CqUa8ADBY8KFSNPQf7E6dyzwbigdAwf5u7TCpiRgBVng+oxPM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AfEAB7IADABwTAHggA8AEBsAcCAHxAAOyBAAAfEAB7/FpegkEA3qSFe/wRv5aUYBCAN/kh9/gjfm1EgkEA3uRb3OOP+LWXJRgE4El0fEEHe/zao/yDADxJq/4J7vFH/No69kEAXuQ4CQCf2sMev/Z+CYYBeI+D3KOPlIMLgaDx4AKgNPFr90owEMBbXMg99kg5LaVjwJsSDAXwBvt9+I4+yeLXdkkwGMATFK7gHndkYVr0j/iwBQCnadG6fW3aKdzjjlSKX3uYfUCAu2nVcO9f2rRp76YXKcE+JMCdtOKXf+SPX7+MXqyj7MMC3MYACeAM7vFGaolxj5Z/YIB70HytOm77KRW/9l8SDA5QnyPEx7nHGak3O0QTvXD3STBAQF1eJy7lHmXESvzarT7cHgT1E/e1Fi7iHl/EjvgLl9ALmpJgqIAa7Pa1FM7mHlvEzvj19/hmjwTHJBgwICczxHW+BzLLuMcVcSotmvHE4M98EAE4QY74pq+tcCb3eCKNSqv+Z/Si306MSzCAoPEcJ56l4+EXfZsLp3OPI8KZFu08X6v2DzQQPyJ+TYwSWR8uHrqB3/lmr/8MEI8Td9Jr/Vl6zfFpPhLk/wEp+G4azgpmawAAAABJRU5ErkJggg==
// @match        https://greasyfork.org/*/scripts/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

// Returns a number string when called
function getString() {
    let date = new Date(),
        inte = date.getFullYear().toString() + date.getMonth().toString().padStart(2,0) + date.getDate().toString().padStart(2,0) + date.getHours().toString().padStart(2,0) + date.getMinutes().toString().padStart(2,0) + date.getSeconds().toString().padStart(2,0);

    return inte;
}

// Updates the download link
function updateLink() {
    let usId = window.location.pathname.replace(/.*scripts\/([0-9]*)\-.*/,'$1');

    try {
        let usJSLink = document.querySelector('#install-area .install-link[href*=".user.js"]');
        usJSLink.setAttribute('href',`https://update.greasyfork.org/scripts/${usId}/${getString()}.user.js`);
    } catch {}

    try {
        let usCSSLink = document.querySelector('#install-area .install-link[href*=".user.css"]');
        usCSSLink.setAttribute('href',`https://update.greasyfork.org/scripts/${usId}/${getString()}.user.css`);
    } catch {}
}

// Initiation
if (!window.location.search.match(/version=/)) {
    updateLink();
}