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",
|
"scripts": "js/ext.uls.compactlinks.js",
|
||||||
"styles": "css/ext.uls.compactlinks.less",
|
"styles": "css/ext.uls.compactlinks.less",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
"es5-shim",
|
||||||
"jquery.uls.compact",
|
"jquery.uls.compact",
|
||||||
"mediawiki.language",
|
"mediawiki.language",
|
||||||
"mediawiki.ui.button"
|
"mediawiki.ui.button"
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
init: function () {
|
init: function () {
|
||||||
var max = this.options.max;
|
var max = this.options.max;
|
||||||
this.interlanguageList = this.getInterlanguageList();
|
this.interlanguageList = this.getInterlanguageList();
|
||||||
this.listSize = this.getListSize();
|
this.listSize = Object.keys( this.interlanguageList ).length;
|
||||||
|
|
||||||
if ( this.listSize <= max ) {
|
if ( this.listSize <= max ) {
|
||||||
// Not enough languages to compact the list
|
// Not enough languages to compact the list
|
||||||
@@ -319,15 +319,6 @@
|
|||||||
return interlanguageList;
|
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
|
* Hide the original interlanguage list
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user