FreeSQL Optimizer (Pure Performance)

Streamlined UI and optimized Monaco Editor performance for FreeSQL.com, featuring an intelligent, eye-friendly Dark Mode.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

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

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

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

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         FreeSQL Optimizer (Pure Performance)
// @namespace    freesql-clean
// @version      1.1
// @description  Streamlined UI and optimized Monaco Editor performance for FreeSQL.com, featuring an intelligent, eye-friendly Dark Mode.
// @author       SLIYARLI
// @license      MIT
// @match        https://freesql.com/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    /**
     * 1. UI & Visual Styling
     * Injects CSS to hide bulky UI elements and applies the custom Dark Mode filter.
     */
    const injectStyles = () => {
        const style = document.createElement("style");
        style.textContent = `
            /* Hide unnecessary Oracle UI components to maximize vertical space */
            header.app-Header, #footer, #teconsent,
            oj-message-banner, .oj-c-messagebanner {
                display: none !important;
            }

            /* Global filter-based Dark Mode */
            html {
                filter: invert(85%) hue-rotate(180deg) !important;
                background: #111 !important;
            }

            /* Re-invert media elements and icons to preserve original colors */
            img, svg, video, canvas, .oj-ux-ico-*, [class*="oj-ux-ico-"] {
                filter: invert(100%) hue-rotate(180deg) !important;
            }
        `;
        (document.head || document.documentElement).appendChild(style);
    };
    injectStyles();

    /**
     * 2. Monaco Editor Configuration
     * Lightweight settings focused on performance and fixing cursor alignment (drift).
     */
    const editorConfig = {
        fontSize: 17,
        lineHeight: 18,
        fontFamily: "Hack, Menlo, Monaco, 'Courier New', monospace",
        minimap: { enabled: false },
        smoothScrolling: false,
        cursorBlinking: "solid",
        renderWhitespace: "none",
        renderIndentGuides: false,
        semanticHighlighting: false,
        scrollBeyondLastLine: false,
        wordWrap: "on",
        renderLineHighlight: "none",
        contextmenu: false,
        scrollbar: { 
            verticalScrollbarSize: 10, 
            horizontalScrollbarSize: 10 
        }
    };

    /**
     * Applies configuration to all active Monaco Editor instances.
     */
    function applyEditorSettings() {
        if (window.monaco?.editor) {
            const editors = window.monaco.editor.getEditors?.();
            if (editors?.length > 0) {
                editors.forEach(ed => ed.updateOptions(editorConfig));
                return true;
            }
        }
        return false;
    }

    /**
     * 3. DOM Observer
     * Efficiently handles dynamic UI changes and applies settings as elements load.
     */
    const observer = new MutationObserver(() => {
        applyEditorSettings();
        
        // Remove UI elements if they are re-rendered by the SPA
        const elementsToRemove = document.querySelectorAll('header.app-Header, #footer, #teconsent');
        elementsToRemove.forEach(el => el.remove());
    });

    observer.observe(document.documentElement, { 
        childList: true, 
        subtree: true 
    });

    /**
     * 4. Lifecycle Management
     * Periodic checks for the first 5 seconds to ensure late-loading editors are captured.
     */
    let initializationCheck = setInterval(() => {
        if (applyEditorSettings()) clearInterval(initializationCheck);
    }, 1000);

    setTimeout(() => clearInterval(initializationCheck), 5000);

})();