Rename variables for better comprehension

Change-Id: Ifa8da084a93e85201564bae3aa71b0c3c899894b
This commit is contained in:
Niharika Kohli
2014-03-21 08:36:46 +00:00
parent 938fc6768f
commit 1031c11521

View File

@@ -196,19 +196,27 @@
function manageInterlaguageList() { function manageInterlaguageList() {
var $numOfLangCurrently = $( '.interlanguage-link' ).length, var $numOfLangCurrently = $( '.interlanguage-link' ).length,
currentLangs = getInterlanguageList(), currentLangs = getInterlanguageList(),
numLanguages = 9, longListLength = 9,
minLanguages = 7, maxLanguageCheck = 12,
shortListLength = 7,
i, i,
finalList; // Final list of languages to be displayed on page finalList; // Final list of languages to be displayed on page
if ( $numOfLangCurrently > 9) { // If the total number of languages are between 9(longListLength) and 12(inclusive) then
// we show only 7 (shortListLength) languages (to avoid displaying "2/3 more languages")
// Else, we show 9 languages. Please note that as per the current design of the system, this
// does not always hold true. The language list might exceed 9. This will be fixed as we refine
// the algo for the languages being shown.
if ( $numOfLangCurrently > longListLength ) {
hideLanguages(); hideLanguages();
if ( $numOfLangCurrently > 9 && $numOfLangCurrently <= 12 ) { if ( $numOfLangCurrently > longListLength && $numOfLangCurrently <= maxLanguageCheck ) {
finalList = displayLanguages( minLanguages ); finalList = displayLanguages( shortListLength );
} else { } else {
finalList = displayLanguages( numLanguages ); finalList = displayLanguages( longListLength );
} }
// Output all the languages we have in the finalList to the page
for ( i in finalList ) { for ( i in finalList ) {
addLanguage( $.uls.data.getAutonym( finalList[i] ), currentLangs[ finalList[i] ] ); addLanguage( $.uls.data.getAutonym( finalList[i] ), currentLangs[ finalList[i] ] );
} }