890
pakeitimų
SNėra keitimo santraukos |
SNėra keitimo santraukos |
||
| 18 eilutė: | 18 eilutė: | ||
init: function () { | init: function () { | ||
$.cookie(THEME_COOKIE, isUsingDarkmode ? 'dark' : 'light', {expires: 365, path: '/'}); | $.cookie(THEME_COOKIE, isUsingDarkmode ? 'dark' : 'light', {expires: 365, path: '/'}); | ||
console.log('test1') | |||
portletLink = mw.util.addPortletLink( | portletLink = mw.util.addPortletLink( | ||
| 31 eilutė: | 33 eilutė: | ||
$(portletLink).find('a').click(function(e) { | $(portletLink).find('a').click(function(e) { | ||
e.preventDefault(); | e.preventDefault(); | ||
console.log('test2') | |||
isUsingDarkmode = !isUsingDarkmode; | isUsingDarkmode = !isUsingDarkmode; | ||
| 37 eilutė: | 41 eilutė: | ||
if (isUsingDarkmode === true) { | if (isUsingDarkmode === true) { | ||
console.log('test3') | |||
mw.loader.using(['wgl.theme.dark']).then(function() { | mw.loader.using(['wgl.theme.dark']).then(function() { | ||
$('body').addClass('wgl-theme-dark') | $('body').addClass('wgl-theme-dark') | ||
| 43 eilutė: | 48 eilutė: | ||
}); | }); | ||
} else { | } else { | ||
console.log('test4') | |||
$('body').addClass('wgl-theme-light') | $('body').addClass('wgl-theme-light') | ||
$('body').removeClass('wgl-theme-dark') | $('body').removeClass('wgl-theme-dark') | ||
mw.hook('wgl.themeChanged').fire('light') | mw.hook('wgl.themeChanged').fire('light') | ||
} | } | ||
console.log('test5') | |||
}); | }); | ||
} | } | ||