mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-15 03:33:45 +00:00
2cf768f7b7
With the parent of this commit (current master) Loading the RevisionSlider JS without it expanded increases the request size by roughly 767KB on first request and 242KB on subsequent requests. The large size of the first request is mainly down the to dependancies of the slider. This lazy loading patch means the RevisionSlider JS only causes an increase of 184 KB per request. If the user has the bar expand by default the main JS will be loaded straight away (and the lazy JS will not be). This patch also means that when only the bar is loaded the pin button to set auto expand will not be shown. This will be added once the RevsionSlider is loaded. Bug: T151668 Change-Id: I054a82e9ea2aa89326464632e744497239f7adba
16 lines
351 B
JavaScript
16 lines
351 B
JavaScript
( function ( mw, $ ) {
|
|
var settings = new mw.libs.revisionSlider.Settings(),
|
|
autoExpand = settings.shouldAutoExpand();
|
|
|
|
if ( autoExpand ) {
|
|
mw.loader.load( 'ext.RevisionSlider.init' );
|
|
} else {
|
|
$( '.mw-revslider-toggle-button' ).click(
|
|
function () {
|
|
mw.loader.load( 'ext.RevisionSlider.init' );
|
|
}
|
|
);
|
|
}
|
|
|
|
}( mediaWiki, jQuery ) );
|