Merge "Revert "Add a MediaWiki preference for enabling ULS IME""

This commit is contained in:
jenkins-bot
2013-05-22 07:46:50 +00:00
committed by Gerrit Code Review
4 changed files with 7 additions and 60 deletions

View File

@@ -104,7 +104,6 @@
ULSPreferences = function () {
this.preferenceName = 'uls-preferences';
this.imeEnablePreferenceName = 'uls-ime-enable',
this.username = mw.user.getName();
this.isAnon = mw.user.isAnon();
this.preferences = null;
@@ -116,30 +115,13 @@
* Initialize
*/
init: function () {
var options,
ulsImeEnable = mw.user.options.get( this.imeEnablePreferenceName );
if ( this.isAnon ) {
this.preferences = $.jStorage.get( this.preferenceName );
} else {
options = mw.user.options.get( this.preferenceName );
var options = mw.user.options.get( this.preferenceName );
this.preferences = $.parseJSON( options );
}
this.preferences = this.preferences || {};
if ( this.preferences.ime === undefined ) {
this.preferences.ime = {};
}
if ( ulsImeEnable === undefined ) {
this.preferences.ime.enable = mw.config.get( 'wgULSIMEEnabled' );
} else if ( ulsImeEnable === 1 || ulsImeEnable === '1' ) {
this.preferences.ime.enable = true;
} else {
this.preferences.ime.enable = false;
}
},
/**
@@ -167,9 +149,7 @@
* @param callback
*/
save: function ( callback ) {
var ulsPreferences = this,
successFunction,
failFunction;
var ulsPreferences = this;
callback = callback || $.noop;
if ( this.isAnon ) {
@@ -178,36 +158,16 @@
callback.call( this, true );
} else {
successFunction = function () {
callback.call( this, true );
};
failFunction = function () {
callback.call( this, false );
};
// Logged in user. Use MW APIs to change preferences
saveOptionsWithToken( {
action: 'options',
optionname: ulsPreferences.preferenceName,
optionvalue: $.toJSON( ulsPreferences.preferences )
},
successFunction,
failFunction
);
if ( ulsPreferences.preferences.ime !== undefined &&
ulsPreferences.preferences.ime.enable !== undefined
) {
// Logged in user. Use MW APIs to change preferences
saveOptionsWithToken( {
action: 'options',
optionname: ulsPreferences.imeEnablePreferenceName,
optionvalue: ulsPreferences.preferences.ime.enable ? '1' : ''
},
successFunction,
failFunction
);
}
}, function () {
callback.call( this, true );
}, function () {
callback.call( this, false );
} );
}
}
};