2022-07-12 22:48:46 +00:00
|
|
|
var types = require( './types.json' );
|
2020-02-11 07:55:25 +00:00
|
|
|
// 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.
|
2017-10-16 20:09:56 +00:00
|
|
|
mw.requestIdleCallback( function () {
|
2020-02-11 07:55:25 +00:00
|
|
|
var isTouchDevice = 'ontouchstart' in document.documentElement;
|
|
|
|
if ( !isTouchDevice ) {
|
2022-07-12 22:48:46 +00:00
|
|
|
mw.loader.using( types.concat( [ 'ext.popups.main' ] ) ).then( function () {
|
|
|
|
// Load custom popup types
|
|
|
|
types.forEach( function ( moduleName ) {
|
|
|
|
var module = require( moduleName );
|
|
|
|
mw.popups.register( module );
|
|
|
|
} );
|
|
|
|
// For now this API is limited to extensions/skins as we have not had a chance to
|
|
|
|
// consider the implications of gadgets having access to this function and dealing with
|
|
|
|
// challenges such as selector overlap.
|
|
|
|
delete mw.popups.register;
|
|
|
|
} );
|
2020-02-11 07:55:25 +00:00
|
|
|
}
|
2017-10-16 20:09:56 +00:00
|
|
|
} );
|