Earlier evaluation of compactlinks

* Prospectively load ext.uls.init
* Prospectively check if readyState is interactive
Bug: T136463
Change-Id: Ib36ef6a2b9955189acfbe06bd6b498a66014cf06
This commit is contained in:
eranroz
2016-07-16 13:25:04 +03:00
committed by Amire80
parent c8002af92c
commit abaddfaccd
3 changed files with 30 additions and 17 deletions

View File

@@ -245,7 +245,8 @@
"dependencies": [
"es5-shim",
"mediawiki.language",
"mediawiki.ui.button"
"mediawiki.ui.button",
"ext.uls.init"
],
"messages": [
"ext-uls-compact-link-count",

View File

@@ -64,15 +64,13 @@
return;
}
mw.loader.using( 'ext.uls.init' ).done( function () {
// If we're only a bit beyond max, limit to 7 instead of 9.
// FIXME: This assumes the max is 9.
self.compactSize = ( self.listSize <= 12 ) ? 7 : max;
self.compactList = self.getCompactList();
self.hideOriginal();
self.render();
self.listen();
} );
// If we're only a bit beyond max, limit to 7 instead of 9.
// FIXME: This assumes the max is 9.
self.compactSize = ( self.listSize <= 12 ) ? 7 : max;
self.compactList = self.getCompactList();
self.hideOriginal();
self.render();
self.listen();
};
/**
@@ -450,13 +448,20 @@
this.$trigger = $trigger;
};
$( document ).ready( function () {
var compactList;
compactList = new CompactInterlanguageList( $( '#p-lang ul' ), {
function createCompactList() {
var compactList = new CompactInterlanguageList( $( '#p-lang ul' ), {
// Compact the list to this size
max: 9
} );
compactList.init();
} );
}
// Early execute of createCompactList
if ( document.readyState === 'interactive' ) {
createCompactList();
} else {
$( document ).ready( createCompactList );
}
}( jQuery, mediaWiki ) );

View File

@@ -508,9 +508,16 @@
} );
}
$( document ).ready( function () {
function init() {
initInterface();
initTooltip();
initIme();
} );
}
// Early execute of init
if ( document.readyState === 'interactive' ) {
init();
} else {
$( document ).ready( init );
}
}( jQuery, mediaWiki ) );