MediaWiki:Gadget-dark-mode-toggle.js: Difference between revisions
Content deleted Content added
requested updates from User:Nardog/dark-mode-toggle.js |
MusikAnimal (talk | contribs) |
||
Line 57:
// We can't use mw.loader as it doesn't work both ways (see talk page)
var scriptPath = mw.util.wikiScript('load');
var
if (
var uri = new mw.Uri(
if (newState) {
uri.query.modules += ',dark-mode';
} else {
if (uri.query.modules === 'ext.gadget.dark-mode') {
// dark-mode is the only module in this link
$gadgetsLink.remove();
return;
}
uri.query.modules = uri.query.modules
.replace('ext.gadget.dark-mode,', 'ext.gadget.') // dark-mode is first in the gadget list
.replace(/,dark-mode(,|$)/, '$1'); // dark-mode is in middle or end of the list
}
} else {
// No gadget-containing styles are enabled
|