Greasy Fork is available in English.

Print Own Code

Print the code of this user script

À partir de 2023-10-27. Voir la dernière version.

// ==UserScript==
// @name         Print Own Code
// @namespace    your-namespace
// @version      1.0
// @description  Print the code of this user script
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to print the script code
    function printScriptCode() {
        const scriptElements = document.querySelectorAll('script');
        for (const script of scriptElements) {
            if (script.src === '' && script.textContent.includes('// ==UserScript==')) {
                console.log(script.textContent);
            }
        }
    }

    // Call the function to print the script code
    printScriptCode();
})();