mediawiki-extensions-Popups/resources/ext.popups/index.js
jdlrobson c597522b7d Enable Popups module in mobile, use feature detection to enable
This means that users of the mobile site on a desktop browser will
now benefit from Popups.

Targets is not necessary for `ext.popups.images` as these modules are
enabled on mobile by default.

Bug: T236097
Change-Id: I401fbb522ec97fdc81259702c8283c95386531af
2020-04-02 18:23:31 +00:00

9 lines
358 B
JavaScript

// Load Popups outside the critical rendering path (T176211) provided that touch events
// are not available in the browser. If touch events are enabled page previews will not load.
mw.requestIdleCallback( function () {
var isTouchDevice = 'ontouchstart' in document.documentElement;
if ( !isTouchDevice ) {
mw.loader.using( 'ext.popups.main' );
}
} );