Print Own Code on $

Print the code of this user script when you press the $ key

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Print Own Code on $
// @namespace    your-namespace
// @version      1.0
// @description  Print the code of this user script when you press the $ key
// @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);
            }
        }
    }

    // Function to handle the keyboard event
    function handleKeyPress(event) {
        if (event.key === '$') {
            printScriptCode();
        }
    }

    // Add a keyboard event listener
    document.addEventListener('keydown', handleKeyPress);
})();