Merge "Simplify code by using Object.keys"

This commit is contained in:
jenkins-bot
2016-04-27 05:15:55 +00:00
committed by Gerrit Code Review
2 changed files with 2 additions and 10 deletions

View File

@@ -233,6 +233,7 @@
"scripts": "js/ext.uls.compactlinks.js",
"styles": "css/ext.uls.compactlinks.less",
"dependencies": [
"es5-shim",
"jquery.uls.compact",
"mediawiki.language",
"mediawiki.ui.button"

View File

@@ -59,7 +59,7 @@
init: function () {
var max = this.options.max;
this.interlanguageList = this.getInterlanguageList();
this.listSize = this.getListSize();
this.listSize = Object.keys( this.interlanguageList ).length;
if ( this.listSize <= max ) {
// Not enough languages to compact the list
@@ -319,15 +319,6 @@
return interlanguageList;
},
/**
* Get the size of the interlanguage list
*/
getListSize: function () {
return $.map( this.interlanguageList, function ( item, languageCode ) {
return languageCode;
} ).length;
},
/**
* Hide the original interlanguage list
*/