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:
@@ -245,7 +245,8 @@
|
||||
"dependencies": [
|
||||
"es5-shim",
|
||||
"mediawiki.language",
|
||||
"mediawiki.ui.button"
|
||||
"mediawiki.ui.button",
|
||||
"ext.uls.init"
|
||||
],
|
||||
"messages": [
|
||||
"ext-uls-compact-link-count",
|
||||
|
||||
@@ -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 ) );
|
||||
|
||||
@@ -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 ) );
|
||||
|
||||
Reference in New Issue
Block a user