Created script groups, introduce $.uls.data
Gave script groups clear names and sorted them. Documentation in comments. Add tests to check that no script has been left behind. Corrected Lath to Latn (thanks to testing). Rename langdb.js to ext.uls.data.js Add ResourceLoader module ext.uls.data Change-Id: I91fafa94ffd1eaf2d12c954fe3a71064276533f9
This commit is contained in:
committed by
Santhosh Thottingal
parent
b9ee6595d3
commit
03df48a609
@@ -63,7 +63,7 @@
|
||||
},
|
||||
//FIXME This is confusing: languages and source are acturally data for ULS.
|
||||
languages: that.languages,
|
||||
source: langdb,
|
||||
source: $.uls.data,
|
||||
callback: function () {
|
||||
// clear the search field.
|
||||
$( "#languagefilter" ).val( "" );
|
||||
|
||||
26
resources/ext.uls.data.utils.js
Normal file
26
resources/ext.uls.data.utils.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* @author Amir E. Aharoni
|
||||
* Utilities for querying the language db.
|
||||
*/
|
||||
(function ( $ ) {
|
||||
"use strict";
|
||||
|
||||
// Constants
|
||||
var scriptIndex = 0,
|
||||
regionsIndex = 1;
|
||||
|
||||
/*
|
||||
* Returns the script group of a script or 'Other' if it doesn't
|
||||
* belong to any group.
|
||||
*/
|
||||
$.uls.data.groupOfScript = function( script ) {
|
||||
for ( var group in $.uls.data.scriptgroups ) {
|
||||
if ( $.inArray( script, $.uls.data.scriptgroups[group] ) != -1 ) {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
|
||||
return 'Other';
|
||||
}
|
||||
|
||||
} )( jQuery );
|
||||
Reference in New Issue
Block a user