Do not load jquery.jStorage for logged in users

Change-Id: Ibe77962cecd6aa8504aa60d5d2b8d17a56e1319f
This commit is contained in:
Niklas Laxström
2013-11-01 11:16:24 +00:00
parent caa2852aa9
commit 5884337c9f
3 changed files with 18 additions and 7 deletions

View File

@@ -115,13 +115,14 @@
* Initialize
*/
init: function () {
var options;
if ( this.isAnon ) {
this.preferences = $.jStorage.get( this.preferenceName );
this.preferences = $.jStorage.get( this.preferenceName ) || {};
} else {
var options = mw.user.options.get( this.preferenceName );
this.preferences = $.parseJSON( options );
options = mw.user.options.get( this.preferenceName );
this.preferences = $.parseJSON( options ) || {};
}
this.preferences = this.preferences || {};
},
/**
@@ -157,7 +158,6 @@
$.jStorage.set( this.preferenceName, this.preferences );
callback.call( this, true );
} else {
// Logged in user. Use MW APIs to change preferences
saveOptionsWithToken( {
action: 'options',