diff --git a/extension.json b/extension.json index c7655387..c0479d0e 100644 --- a/extension.json +++ b/extension.json @@ -245,7 +245,8 @@ "dependencies": [ "es5-shim", "mediawiki.language", - "mediawiki.ui.button" + "mediawiki.ui.button", + "ext.uls.init" ], "messages": [ "ext-uls-compact-link-count", diff --git a/resources/js/ext.uls.compactlinks.js b/resources/js/ext.uls.compactlinks.js index abb827f3..23c52436 100644 --- a/resources/js/ext.uls.compactlinks.js +++ b/resources/js/ext.uls.compactlinks.js @@ -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 ) ); diff --git a/resources/js/ext.uls.interface.js b/resources/js/ext.uls.interface.js index 53d64a2b..8fe644b5 100644 --- a/resources/js/ext.uls.interface.js +++ b/resources/js/ext.uls.interface.js @@ -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 ) );