User:MetalManeMc/vector.js: Difference between revisions

Jump to navigation Jump to search
Undo revision 147274 by MetalManeMc (talk)
(Undo revision 130971 by MetalManeMc (talk))
Tag: Undo
(Undo revision 147274 by MetalManeMc (talk))
Tag: Undo
 
(9 intermediate revisions by the same user not shown)
Line 14: Line 14:
);
);
$(portletLink).find('a').click(function(e) {
$(portletLink).find('a').click(function(e) {
e.preventDefault();
e.preventDefault();
console.error(mw.user.options.get('theme'));
if (mw.user.options.get('theme')==='dark-grey') {
if (mw.user.options.get('theme')==='dark-grey') {
var params = {
var params = {
action: 'options',
action: 'options',
change: 'theme=light',
change: 'theme=light',
format: 'json'
format: 'json'
};
},
$('body').addClass('theme-light')
api = new mw.Api();
$('body').removeClass('theme-dark-grey')
mw.loader.using(['theme.dark-grey']).then(function() {
}
  $('body').addClass('theme-light')
else {
  $('body').removeClass('theme-dark-grey')
var params = {
});
action: 'options',
}
change: 'theme=dark-grey',
else {
format: 'json'
var params = {
};
action: 'options',
        mw.loader.using(['ext.darkvector']).then(function() {
change: 'theme=dark-grey',
        $('body').addClass('theme-dark-grey');
format: 'json'
        $('body').removeClass('theme-light');
},
        });
api = new mw.Api();
}
}
new mw.Api().postWithToken( 'csrf', params ).done( function ( data ) {});
api.postWithToken( 'csrf', params ).done( function ( data ) {});
});
});

Navigation menu