Userscript Utilities

Adds functionality to interact with Greasy Fork and Chrome Web Store.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Userscript Utilities
// @namespace    https://github.com/AmeLooksSus
// @version      1.0
// @description  Adds functionality to interact with Greasy Fork and Chrome Web Store.
// @icon         https://i.imgur.com/LXyAydx.png
// @author       AmeLooksSus
// @match        *://*/*
// @grant        GM_registerMenuCommand
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    // Choose the filter for Greasy Fork: updated, created, total_installs, ratings, or name.
    var filter = "updated";
    // To enable CSS filtering, uncomment the line below and optionally specify "all" to view both javascript and css. Remember to add "+ language" before the semicolon(;) in line 27
    // var language = "css";

    if (typeof GM_registerMenuCommand === 'function') {
        GM_registerMenuCommand('Greasy Fork: ' + filter, function() {
        // Get the base domain of the website
        var hostname = window.location.hostname;
        // Remove subdomains like www from the hostname
        var baseDomain = hostname.replace(/^[^.]+\./, '');
        // Create the modified link for Greasy Fork
        var modifiedLink = 'https://greasyfork.org/en/scripts/by-site/' + baseDomain + '?sort=' + filter;
        // Open the modified link in a new tab
        window.open(modifiedLink, '_blank');
    });
      GM_registerMenuCommand('Extensions', function() {
        // Get the base domain of the website
        var baseDomain = window.location.hostname.match(/([^.]+)\.\w{2,3}(?:\.\w{2})?$/)[1];
        // Create the modified link for Chrome Web Store extensions
        var modifiedLink = 'https://chromewebstore.google.com/search/' + baseDomain + '?itemTypes=EXTENSION';
        // Open the modified link in a new tab
        window.open(modifiedLink, '_blank');
    });
      GM_registerMenuCommand('Themes', function() {
        // Get the base domain of the website
        var baseDomain = window.location.hostname.match(/([^.]+)\.\w{2,3}(?:\.\w{2})?$/)[1];
        // Create the modified link for Chrome Web Store themes
        var modifiedLink = 'https://chromewebstore.google.com/search/' + baseDomain + '?itemTypes=THEME';
        // Open the modified link in a new tab
        window.open(modifiedLink, '_blank');
    });
      GM_registerMenuCommand('Both', function() {
        // Get the base domain of the website
        var baseDomain = window.location.hostname.match(/([^.]+)\.\w{2,3}(?:\.\w{2})?$/)[1];
        // Create the modified link for Chrome Web Store both extensions and themes
        var modifiedLink = 'https://chromewebstore.google.com/search/' + baseDomain + '?itemTypes=EXTENSION%2CTHEME';
        // Open the modified link in a new tab
        window.open(modifiedLink, '_blank');
    });
    }
})();