User:Mikevoir/common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
importScript('MediaWiki:Wikimarks.js'); | importScript('MediaWiki:Wikimarks.js'); | ||
if (localStorage.getItem('ciw-theme')===null) {localStorage.setItem('ciw-theme', 'light')} | |||
$('body').addClass('skin-vector-'+localStorage.getItem('ciw-theme')); | |||
$('#p-personal .vector-menu-content-list') | |||
.prepend( | |||
$('<li id="pt-theme" class="mw-list-item active">') | |||
.prepend($('<a class="theme-trigger" href="#"><span>Theme</span></a></li>')) | |||
); | |||
$('#p-personal .vector-menu-content-list').on('click', '#pt-theme, .theme-trigger', function() { | |||
if ( | |||
localStorage.getItem('ciw-theme')===null|| | |||
localStorage.getItem('ciw-theme')==='dark' | |||
) {localStorage.setItem('ciw-theme', 'light')} | |||
else {localStorage.setItem('ciw-theme', 'light')} | |||
$('body').toggleClass('skin-vector-dark skin-vector-light'); | |||
}); |
Revision as of 07:09, 12 July 2024
importScript('MediaWiki:Wikimarks.js');
if (localStorage.getItem('ciw-theme')===null) {localStorage.setItem('ciw-theme', 'light')}
$('body').addClass('skin-vector-'+localStorage.getItem('ciw-theme'));
$('#p-personal .vector-menu-content-list')
.prepend(
$('<li id="pt-theme" class="mw-list-item active">')
.prepend($('<a class="theme-trigger" href="#"><span>Theme</span></a></li>'))
);
$('#p-personal .vector-menu-content-list').on('click', '#pt-theme, .theme-trigger', function() {
if (
localStorage.getItem('ciw-theme')===null||
localStorage.getItem('ciw-theme')==='dark'
) {localStorage.setItem('ciw-theme', 'light')}
else {localStorage.setItem('ciw-theme', 'light')}
$('body').toggleClass('skin-vector-dark skin-vector-light');
});