No-Cache UserScript Link Loader

Forces the loading of UserScript links without caching to ensure the latest version is always fetched.

Από την 21/05/2023. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         No-Cache UserScript Link Loader
// @namespace    http://tampermonkey.net/
// @version      1.0.1
// @description  Forces the loading of UserScript links without caching to ensure the latest version is always fetched.
// @author       CY Fung
// @match        https://greasyfork.org/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=greasyfork.org
// @grant        none
// @run-at       document-start
// @unwrap
// @allFrames
// @inject-into  page
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';
    let f0 = null;
    /*
    let f0 = () => {
        if (!cid) return;
        if (!document || !document.head) return;
        let meta = document.createElement('meta');
        meta.setAttribute('http-equiv', 'expires');
        meta.setAttribute('content', '0');
        document.head.appendChild(meta);
        clearInterval(cid);
        f0 = null;
    }
    let cid = setInterval(f0, 1);
    */

    const rand4 = () => Math.floor(Math.random() * 8888 + 1000);
    const generateLink = async (href) => {
        let link = document.createElement("link");
        link.rel = "prefetch";
        link.setAttribute('crossorigin', "anonymous");
        link.setAttribute('as', "script");
        link.setAttribute('fetchpriority', 'high');
        link.href = href;
        document.head.appendChild(link);
    }
    const f = () => {
        let p = document.querySelectorAll('a[href*="scripts/"][href$=".user.js"]:not([no-cache-95])');
        for (const s of p) {
            s.setAttribute('no-cache-95', '');
            f0 ? f0() : null;
            let suffix = '?' + rand4() + '#' + rand4();
            let href1 = s.href + suffix;
            let href2 = s.getAttribute('href') + suffix;
            generateLink(href1);
            href1 === href2 || generateLink(href2);
        }
        if (document.readyState === 'complete') return;
        requestAnimationFrame(f);
    };
    requestAnimationFrame(f);





    // Your code here...
})();