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:
Santhosh Thottingal
2012-08-21 10:05:11 +05:30
parent 86952ff9fd
commit a07dc90ddf

View File

@@ -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 ) ); }( jQuery, mediaWiki ) );