MediaWiki:MaximizeAce.js

/* MaximizeAce by Sophiedp */ /* NOTE: Please don't move css to its own css page, I have a reason for having it like this */ (function {   //Double load protection and only run when editing    if (window.MaximizeAceLoaded || mw.config.get('wgAction') !== 'edit') {        return;    }    window.MaximizeAceLoaded = true;

function init { //ATTENTION: THIS MUST BE DONE IN ORDER OTHERWISE ISSUES WILL HAPPEN\

//100% page width and move rail all the way to the right mw.util.addCSS(           ':root {\                --rail-right: 0;\            }\            html {\                overflow: hidden;\            }\            #WikiaPage {\                border: none;\                width: 100%;\            }\            .EditPageEditor {\                margin-bottom: 0;\            }\            .EditPageEditorWrapper {\                padding-left: 0 !important;\                padding-right: 0 !important;\            }\            .EditPageHeader > h1 {\                overflow: unset;\            }'        );

//expand the editor if not already expanded document.querySelector('.editpage-sourcewidemode-off .editpage-widemode-trigger').click;

//remove toolbar document.body.classList.remove('wikia-bar-visible'); document.getElementById('WikiaBar').remove; window.dispatchEvent(new Event('resize'));

//import FixAceWidemode importArticle({           type: 'style',            article: 'u:dev:MediaWiki:FixAceWidemode.css'        })[0].onload = function { window.dispatchEvent(new Event('resize')); };   }    if (document.body.classList.contains('codeeditor')) { //Wait for editor to load var interval = setInterval(function {            if (!document.querySelector('.editpage-widemode-trigger')) {                return;            }            clearInterval(interval);

//Remove extra two lines ace.edit('editarea').setValue(ace.edit('editarea').getValue.replace(/\n{2}$/, ''), -1);

init; }, 100);   } else {        mw.hook('dev.codeeditor.session').then(init);    } });