User:Mikevoir/common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
.prepend( | .prepend( | ||
$('<li id="pt-theme" class="mw-list-item active">') | $('<li id="pt-theme" class="mw-list-item active">') | ||
.prepend($('<a class="theme-trigger" href="#"><span>Theme</span></a></li>')) | .prepend($('<a class="theme-trigger theme-trigger-'+localStorage.getItem('ciw-theme')+'" href="#"><span>Theme</span></a></li>')) | ||
); | ); | ||
$('#p-personal .vector-menu-content-list').on('click', '#pt-theme, .theme-trigger', function() { | $('#p-personal .vector-menu-content-list').on('click', '#pt-theme, .theme-trigger', function() { | ||
Line 14: | Line 14: | ||
else {localStorage.setItem('ciw-theme', 'light');} | else {localStorage.setItem('ciw-theme', 'light');} | ||
$('body').toggleClass('skin-vector-dark skin-vector-light'); | $('body').toggleClass('skin-vector-dark skin-vector-light'); | ||
$('#p-personal .vector-menu-content-list .theme-trigger').toggleClass('theme-trigger-dark theme-trigger-light'); | |||
}); | }); |
Revision as of 07:10, 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 theme-trigger-'+localStorage.getItem('ciw-theme')+'" 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');
$('#p-personal .vector-menu-content-list .theme-trigger').toggleClass('theme-trigger-dark theme-trigger-light');
});