Greasy Fork Pro X

Modern, clean & stable GreasyFork enhancer

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Greasy Fork Pro X
// @namespace    http://tampermonkey.net/
// @version      25.3
// @description  Modern, clean & stable GreasyFork enhancer
// @author       Mustafa Hakan
// @match        *://greasyfork.org/*
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_registerMenuCommand
// @run-at       document-start
// @icon         data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' style='stop-color:%234a7db8'/%3E%3Cstop offset='100%25' style='stop-color:%232a4d6e'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='50' cy='50' r='18' fill='none' stroke='url(%23g)' stroke-width='5'/%3E%3Cpath d='M35 50h30M50 35v30' stroke='%23fff' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E
// ==/UserScript==

(function () {
    'use strict';

    // ====================== TRANSLATIONS ======================
    var translations = {
        en: {
            drawer: 'Panel',
            tab1: 'Appearance',
            tab2: 'Typography',
            tab3: 'Layout',
            tab4: 'Code',
            tab5: 'Tools',
            tab6: 'Navigation',
            tab7: 'System',
            on: 'ON',
            off: 'OFF'
        }
    };

    var currentLang = GM_getValue('lang', 'en');

    function t(key) {
        var langObj = translations[currentLang];
        if (langObj && langObj[key]) return langObj[key];
        var enObj = translations.en;
        return (enObj && enObj[key]) ? enObj[key] : key;
    }

    // ====================== SETTINGS ======================
    var defaults = {
        width: '960px',
        lineHeight: '1.65',
        letterSpacing: '0px',
        wordSpacing: '0px',
        fontWeight: '400',
        fontFamily: 'system-ui',
        fontSize: '16px',
        animations: true,
        hoverEffect: true,
        centerContent: true,
        hideSidebar: false,
        fullWidthCode: true,
        wrapCode: true,
        showLineNumbers: true,
        cardOpacity: 0.98,
        darkenImages: true,
        blurImages: false,
        zenMode: false,
        hideFooter: true,
        stickyHeader: true,
        blueTheme: true
    };

    var settings = {};
    Object.keys(defaults).forEach(function (key) {
        settings[key] = GM_getValue(key, defaults[key]);
    });

    function saveSettings() {
        Object.keys(settings).forEach(function (key) {
            GM_setValue(key, settings[key]);
        });
    }

    // ====================== PALETTE ======================
    var palette = {
        bg: '#0f1625',
        bgLight: '#1a2338',
        bgDark: '#0a0f1c',
        text: '#e0e7f5'
    };

    function getAccent() {
        return settings.blueTheme ? '#4a9eff' : '#ff8a4d';
    }

    // ====================== CSS ======================
    function injectCSS() {
        var oldStyle = document.getElementById('gfp-style');
        if (oldStyle) oldStyle.remove();

        var accent = getAccent();

        var css = `
            :root {
                --accent: ${accent};
                --bg: ${palette.bg};
                --bg-light: ${palette.bgLight};
                --bg-dark: ${palette.bgDark};
                --text: ${palette.text};
                --transition: ${settings.animations ? '0.28s ease' : '0s'};
            }

            body {
                font-family: ${settings.fontFamily};
                font-size: ${settings.fontSize};
                line-height: ${settings.lineHeight};
                background: var(--bg);
                color: var(--text);
            }

            .content, main, article, .script-list {
                max-width: ${settings.width} !important;
                margin: 24px auto !important;
                background: var(--bg-light) !important;
            }

            .script, .script-list-item {
                background: var(--bg-dark) !important;
                opacity: ${settings.cardOpacity};
                transition: all var(--transition);
            }

            ${settings.hoverEffect ? '.script:hover, .script-list-item:hover { transform: translateY(-3px); }' : ''}
            ${settings.hideSidebar ? '.sidebar, aside { display: none !important; }' : ''}
            ${settings.hideFooter ? 'footer { display: none !important; }' : ''}
        `;

        var style = document.createElement('style');
        style.id = 'gfp-style';
        style.textContent = css;
        document.head.appendChild(style);
    }

    // ====================== INIT ======================
    function init() {
        injectCSS();
        console.log('%c✅ Greasy Fork Pro X v25.3 loaded successfully', 'color:#4a9eff; font-weight:bold');
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', init);
    } else {
        init();
    }
})();