Simplify code by using Object.keys

Guaranteed by es5-shim.

Change-Id: Ifd698dc03fd8e755e95ec6c4856ec3683cc3305d
This commit is contained in:
Niklas Laxström
2016-04-22 12:47:54 +02:00
parent 85f7ebdd4b
commit c99a30bf80
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
*/