Difference between revisions of "MediaWiki:Vector.js"

Jump to navigation Jump to search
174 bytes added ,  12:19, 6 February 2024
no edit summary
(Created page with "→‎All JavaScript here will be loaded for users of the Vector skin: const wikiStorage = window.localStorage; var darkMode = wikiStorage.getItem('darkMode'); if (darkMode == null) { window.localStorage.setItem('darkMode', 0); } var footerLinks = document.getElementById('footer-places'); var modeSwitch = document.createElement('li'); modeSwitch.setAttribute('id', 'footer-places-skin-mode'); modeSwitch.setAttribute('onclick', 'switchSkin()'); function switchSkinShared(...")
 
 
(5 intermediate revisions by one other user not shown)
Line 6: Line 6:
}
}


var footerLinks = document.getElementById('footer-places');
var toolLinksBase = document.getElementById('p-tb');
var modeSwitch = document.createElement('li');
var toolLinks = toolLinksBase.getElementsByClassName('vector-menu-content-list');
modeSwitch.setAttribute('id', 'footer-places-skin-mode');
var modeSwitchBase = document.createElement('li');
var modeSwitch = document.createElement('span');
modeSwitchBase.setAttribute('id', 'skin-mode');
modeSwitch.setAttribute('onclick', 'switchSkin()');
modeSwitch.setAttribute('onclick', 'switchSkin()');


Line 30: Line 32:
wikiStorage.setItem('darkMode', 0 );
wikiStorage.setItem('darkMode', 0 );
}
}
wikiStorage.getItem('darkMode');
darkMode = wikiStorage.getItem('darkMode');
switchSkinShared();
switchSkinShared();
}
}


switchSkinShared();
switchSkinShared();
footerLinks.appendChild(modeSwitch);
modeSwitchBase.appendChild(modeSwitch);
toolLinks[0].appendChild(modeSwitchBase);

Navigation menu