Use require to clarify ext.uls.preferences
ext.uls.preferences only depended on ext.uls.common because of its use of the uls global. This is unnecessary, and made clearer by using require and module.exports to access it. Change-Id: Ied2a1b560d19a18529fd766ced778c912199fa2f
This commit is contained in:
@@ -21,13 +21,14 @@
|
||||
'use strict';
|
||||
|
||||
var mwImeRulesPath, inputSelector, inputPreferences, ulsIMEPreferences, customHelpLink,
|
||||
getULSPreferences = require( 'ext.uls.preferences' ),
|
||||
languageSettingsModules = [ 'ext.uls.displaysettings' ];
|
||||
|
||||
mwImeRulesPath = mw.config.get( 'wgExtensionAssetsPath' ) +
|
||||
'/UniversalLanguageSelector/lib/jquery.ime/';
|
||||
inputSelector = 'input:not([type]), input[type=text], input[type=search], textarea, [contenteditable]';
|
||||
|
||||
inputPreferences = mw.uls.preferences();
|
||||
inputPreferences = getULSPreferences();
|
||||
|
||||
mw.ime = mw.ime || {};
|
||||
|
||||
@@ -74,7 +75,7 @@
|
||||
// we don't want to save isDirty field.
|
||||
this.registry.isDirty = undefined;
|
||||
// get updated copy of preferences
|
||||
inputPreferences = mw.uls.preferences();
|
||||
inputPreferences = getULSPreferences();
|
||||
inputPreferences.set( 'ime', this.registry );
|
||||
inputPreferences.save( callback );
|
||||
// reset the dirty bit
|
||||
|
||||
@@ -145,8 +145,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
mw.uls = mw.uls || {};
|
||||
mw.uls.preferences = function () {
|
||||
module.exports = function () {
|
||||
var data = $( document.body ).data( 'preferences' );
|
||||
|
||||
if ( !data ) {
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
( function () {
|
||||
'use strict';
|
||||
|
||||
var ulsPreferences;
|
||||
var getULSPreferences = require( 'ext.uls.preferences' ),
|
||||
ulsPreferences = getULSPreferences();
|
||||
|
||||
mw.webfonts = mw.webfonts || {};
|
||||
ulsPreferences = mw.uls.preferences();
|
||||
mw.webfonts.preferences = {
|
||||
registry: {
|
||||
fonts: {},
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
save: function ( callback ) {
|
||||
// get updated copy of preferences
|
||||
ulsPreferences = mw.uls.preferences();
|
||||
ulsPreferences = getULSPreferences();
|
||||
ulsPreferences.set( 'webfonts', this.registry );
|
||||
ulsPreferences.save( callback );
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user