Search Scripts on GreasyFork/Sleazyfork

Search GleasyFork or Sleasyforks for scripts of the current site

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Search Scripts on GreasyFork/Sleazyfork
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Search GleasyFork or Sleasyforks for scripts of the current site
// @author       You
// @match        *://*/*
// @license MIT
// @grant        GM_openInTab
// @grant        GM_registerMenuCommand
// ==/UserScript==

(function() {
    'use strict';
    
    let domain = window.location.hostname;
    // www.を削除
    if (domain.startsWith('www.')) {
        domain = domain.substring(4);
    }
    
    // GreasyForkで検索
    if (typeof GM_registerMenuCommand !== 'undefined') {
        GM_registerMenuCommand(`Search GreasyFork for ${domain}`, function() {
            const url = `https://greasyfork.org/ja/scripts/by-site/${domain}?filter_locale=0`;
            GM_openInTab(url, false);
        });
        
        // Sleazyforkで検索
        GM_registerMenuCommand(`Search Sleazyfork for ${domain}`, function() {
            const url = `https://sleazyfork.org/ja/scripts/by-site/${domain}?filter_locale=0`;
            GM_openInTab(url, false);
        });
    }
})();