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": [
|
"dependencies": [
|
||||||
"es5-shim",
|
"es5-shim",
|
||||||
"mediawiki.language",
|
"mediawiki.language",
|
||||||
"mediawiki.ui.button"
|
"mediawiki.ui.button",
|
||||||
|
"ext.uls.init"
|
||||||
],
|
],
|
||||||
"messages": [
|
"messages": [
|
||||||
"ext-uls-compact-link-count",
|
"ext-uls-compact-link-count",
|
||||||
|
|||||||
@@ -64,15 +64,13 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mw.loader.using( 'ext.uls.init' ).done( function () {
|
// If we're only a bit beyond max, limit to 7 instead of 9.
|
||||||
// If we're only a bit beyond max, limit to 7 instead of 9.
|
// FIXME: This assumes the max is 9.
|
||||||
// FIXME: This assumes the max is 9.
|
self.compactSize = ( self.listSize <= 12 ) ? 7 : max;
|
||||||
self.compactSize = ( self.listSize <= 12 ) ? 7 : max;
|
self.compactList = self.getCompactList();
|
||||||
self.compactList = self.getCompactList();
|
self.hideOriginal();
|
||||||
self.hideOriginal();
|
self.render();
|
||||||
self.render();
|
self.listen();
|
||||||
self.listen();
|
|
||||||
} );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -450,13 +448,20 @@
|
|||||||
this.$trigger = $trigger;
|
this.$trigger = $trigger;
|
||||||
};
|
};
|
||||||
|
|
||||||
$( document ).ready( function () {
|
function createCompactList() {
|
||||||
var compactList;
|
var compactList = new CompactInterlanguageList( $( '#p-lang ul' ), {
|
||||||
|
|
||||||
compactList = new CompactInterlanguageList( $( '#p-lang ul' ), {
|
|
||||||
// Compact the list to this size
|
// Compact the list to this size
|
||||||
max: 9
|
max: 9
|
||||||
} );
|
} );
|
||||||
compactList.init();
|
compactList.init();
|
||||||
} );
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Early execute of createCompactList
|
||||||
|
if ( document.readyState === 'interactive' ) {
|
||||||
|
createCompactList();
|
||||||
|
} else {
|
||||||
|
$( document ).ready( createCompactList );
|
||||||
|
}
|
||||||
|
|
||||||
}( jQuery, mediaWiki ) );
|
}( jQuery, mediaWiki ) );
|
||||||
|
|||||||
@@ -508,9 +508,16 @@
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
$( document ).ready( function () {
|
function init() {
|
||||||
initInterface();
|
initInterface();
|
||||||
initTooltip();
|
initTooltip();
|
||||||
initIme();
|
initIme();
|
||||||
} );
|
}
|
||||||
|
|
||||||
|
// Early execute of init
|
||||||
|
if ( document.readyState === 'interactive' ) {
|
||||||
|
init();
|
||||||
|
} else {
|
||||||
|
$( document ).ready( init );
|
||||||
|
}
|
||||||
}( jQuery, mediaWiki ) );
|
}( jQuery, mediaWiki ) );
|
||||||
|
|||||||
Reference in New Issue
Block a user