17,097
edits
No edit summary |
(Add Dark mode link to Wiki tools menu) |
||
Line 559: | Line 559: | ||
$("#personal-inner").append('<button onClick="toggleDarkMode();" style="margin:.5rem!important;">Toggle Dark Mode</button>'); | $("#personal-inner").append('<button onClick="toggleDarkMode();" style="margin:.5rem!important;">Toggle Dark Mode</button>'); | ||
}); | }); | ||
// Add dark mode link to "Wiki tools" menu | |||
$.when(mw.loader.using(['mediawiki.util']), $.ready).then( function() { | |||
var darkModeLink = mw.util.addPortletLink('p-tb', '#', 'Toggle Dark Mode'); | |||
$(darkModeLink).on('click', function(e) { | |||
e.preventDefault(); | |||
toggleDarkMode(); | |||
}) | |||
} ); | |||