User:Ritenerek/js/toggle edit bg.js

// Check if editing if (mw.config.get('wgEditMessage')) { // Load mw.util for addPortletLink mw.loader.using('mediawiki.util', (r) => {       // Add portlet link (who'd have thought!)        var link = r('mediawiki.util').addPortletLink( 'p-tb', '#',           'Toggle background', 'n-toggle-bg', 'Toggle the edit box\'s background', null );       // Remove href so there's no redirection        link.lastChild.attributes.removeNamedItem('href');

let editbox = document.getElementById('wpTextbox1');

$(link).on('click', => {            if (editbox.style.backgroundColor == 'white') {                editbox.style.removeProperty('background');            } else {                editbox.style.background = 'white';            }        }); }).catch(console.error); }