Make the preferences singleton
Renamed $.fn.uls.preferences to mw.uls.preferences since this is not a jquery function, but a singleton object per page. Change-Id: Ie6c37fb321685e927fa5197fa8a53f41bff656ef
This commit is contained in:
@@ -108,6 +108,18 @@
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.uls.preferences = ULSPreferences;
|
||||
mw.uls = mw.uls || {};
|
||||
mw.uls.preferences = function( option ) {
|
||||
var data = $( 'body' ).data( "preferences" ),
|
||||
options = typeof option === "object" && option;
|
||||
|
||||
if ( !data ) {
|
||||
$( 'body' ).data( "preferences", ( data = new ULSPreferences( options ) ) );
|
||||
}
|
||||
if ( typeof option === "string" ) {
|
||||
data.get(option);
|
||||
}
|
||||
return data;
|
||||
};
|
||||
|
||||
}( jQuery, mediaWiki ) );
|
||||
|
||||
Reference in New Issue
Block a user