Use lazy loading of regions only where language list is big

This commit is contained in:
Santhosh Thottingal
2012-10-26 10:29:21 +05:30
parent c883c3a774
commit 27b8babfa9

View File

@@ -158,8 +158,15 @@
},
defaultSearch: function () {
var count = getObjectLength ( this.languages );
this.$resultsView.lcd( 'empty' );
this.$regionFilters.first().regionselector( 'show' );
// Use lazy loading only when there are 100+ languages.
if ( count > 100 ) {
this.$regionFilters.first().regionselector( 'show' );
} else{
this.$regionFilters.regionselector( 'show' );
}
},
/**
@@ -332,4 +339,16 @@
$.fn.uls.Constructor = ULS;
// Private utility functions
function getObjectLength ( obj ) {
var k, count = 0;
for ( k in obj ) {
if ( obj.hasOwnProperty( k ) ) {
count++;
}
}
return count;
}
} ( jQuery ) );