User:Polygnotus/Scripts/WikiTypoInterface.js

This is an old revision of this page, as edited by Polygnotus (talk | contribs) at 12:42, 25 August 2024. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Hide menu bar, header, and adjust layout
(function() {
    function addCustomCSS() {
        var style = document.createElement('style');
        style.textContent = `
             #mw-head, #mw-page-base, /* Top header */
            #mw-panel /* Left sidebar menu */
            {
                display: none !important;
            }
            
            /* Adjust the content area to take full width and height */
            body {
                padding-top: 0 !important;
            }
            
            .mw-body {
                margin-left: 0 !important;
                padding-top: 0 !important;
            }
            
            /* Ensure the content starts from the top of the page */
            #content {
                margin-top: 0 !important;
            }
            
            /* Adjust the position of the content */
            #bodyContent {
                margin-top: 1em;
            }
        `;
        document.head.appendChild(style);
    }

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