Scripthub

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

Stan na 24-08-2024. Zobacz najnowsza wersja.

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

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

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        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)}`);
    }
  })();
}