Scripthub

Lots of scripts to enhance your browsing experience or automate tasks.

Από την 24/08/2024. Δείτε την τελευταία έκδοση.

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

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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        Scripthub
// @description Lots of scripts to enhance your browsing experience or automate tasks.
// @namespace   https://userscripts.org
// @include     *
// @version     1
// @license     GNU GPLv3
// ==/UserScript==

// go to https://userscripts.org/ after installing (or press "ctrl + q" 2 times)
if (window.location.hostname === 'userscripts.org') {
  var scr = "https://pooiod7.neocities.org/projects/scripthub/pages" + (window.location.pathname=="/"?"/home":window.location.pathname) + ".js";

  var script = document.createElement('script');
  script.src = scr;
  document.body.append(script);
} else {
  (function() {
    const urlParams = new URLSearchParams(window.location.search);
    const userscripts = urlParams.get('userscripts');

    if (new URLSearchParams(window.location.search).get('noscripts')) {
      document.addEventListener('keydown', function(event) {
        if (event.ctrlKey && event.key === 'q') {
          event.preventDefault();
          const url = new URL(window.location);
          url.searchParams.delete('noscripts');
          window.location.href = url.toString();
        }
      });
      return;
    }

    if (userscripts) {
        try {
          const scriptUrls = JSON.parse(userscripts);
          scriptUrls.forEach(url => {
              const script = document.createElement('script');
              script.src = url;
              document.body.appendChild(script);
          });

          let ctrlQPressed = false;

          document.addEventListener('keydown', function(event) {
            if (event.ctrlKey && event.key === 'q') {
              event.preventDefault();
              if (ctrlQPressed) {
                window.location.href = 'https://userscripts.org/';
              } else {
                ctrlQPressed = true;
                setTimeout(() => {
                  const url = new URL(window.location);
                  url.searchParams.set('noscripts', 'true');
                  window.location.href = url.toString();
                }, 300);
              }
            } else {
              ctrlQPressed = false;
            }
          });

          urlParams.delete('userscripts');
          const newUrl = `${window.location.pathname}?${urlParams.toString()}`;
          history.replaceState(null, '', newUrl);
        } catch (e) {
          console.error('Error parsing userscripts:', e);
        }
    } else {
      const currentSite = window.location.href;
      window.location.replace(`https://userscripts.org/?tosite=${encodeURIComponent(currentSite)}`);
    }
  })();
}