m (Undo revision 278296 by PrivateTarkus (talk)) Tag: Undo |
mNo edit summary |
||
Line 1: | Line 1: | ||
/* All JavaScript here will be loaded for users of the Vector skin */ | /* All JavaScript here will be loaded for users of the Vector skin */ | ||
mw.loader.using( 'mediawiki.storage' ).then( function () { | mw.loader.using( 'mediawiki.storage' ).then( function () { | ||
mw.util.addPortletLink( 'p-personal', '#', 'Monochrome mode', 'pt-monochrome-mode', '', 'np', '#pt-watchlist' ); | |||
if ( mw.storage.get( 'client-dark-mode-toggle' ) === '1' ) { | if ( mw.storage.get( 'client-dark-mode-toggle' ) === '1' ) { | ||
mw.util.addPortletLink( 'p-personal', '#', 'Light mode', 'pt-lightmode', '', 'np', '#pt-watchlist' ); | mw.util.addPortletLink( 'p-personal', '#', 'Light mode', 'pt-lightmode', '', 'np', '#pt-watchlist' ); |
Revision as of 23:06, 26 May 2022
/* All JavaScript here will be loaded for users of the Vector skin */
mw.loader.using( 'mediawiki.storage' ).then( function () {
mw.util.addPortletLink( 'p-personal', '#', 'Monochrome mode', 'pt-monochrome-mode', '', 'np', '#pt-watchlist' );
if ( mw.storage.get( 'client-dark-mode-toggle' ) === '1' ) {
mw.util.addPortletLink( 'p-personal', '#', 'Light mode', 'pt-lightmode', '', 'np', '#pt-watchlist' );
} else {
mw.util.addPortletLink( 'p-personal', '#', 'Dark mode', 'pt-darkmode', '', 'np', '#pt-watchlist' );
}
$( function () {
$( '#pt-darkmode' ).on( 'click', function( e ) {
var $html = $( 'html' );
e.preventDefault();
mw.storage.set('client-dark-mode-toggle', '1');
location.reload();
} );
$( '#pt-lightmode' ).on( 'click', function( e ) {
var $html = $( 'html' );
e.preventDefault();
mw.storage.set('client-dark-mode-toggle', '0');
location.reload();
} );
} );
} );