Greasy Fork is available in English.

Params Class

URL params utility class

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greasyfork.org/scripts/476650/1259545/Params%20Class.js

// ==UserScript==
// @name         Params Class
// @version      1.0.0
// @description  URL params utility class
// @author       Paweł Malak (pawemala) LCJ2
// @license      MIT
// ==/UserScript==

class Params {
  /**
   * Check if parameter exists in the URL search parameters
   * @param {string} key name of sought parameter
   * @returns {string | null} value of parameter if it exists, or null if it doesn't
   */
  static getParameter(key) {
    const searchParams = new URLSearchParams(window.location.search);

    if (!searchParams.has(key)) {
      return null;
    }

    return searchParams.get(key);
  }
}