Simplify code by using Object.keys
Guaranteed by es5-shim. Change-Id: Ifd698dc03fd8e755e95ec6c4856ec3683cc3305d
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user