mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-22 03:52:52 +00:00
2517c6d32f
Load page previews as quickly as possible. According to performance team it should be beneficial to remove this (See Ibc01f6a82692c7dd3d4a866354ab975af114e7b0 for more information) and it's not a recommendation. its existence in this codebase is leading to misunderstandings elsewhere. Change-Id: If183d9ca07d98c03c957f359c13ca8e2ede7ad58
17 lines
703 B
JavaScript
17 lines
703 B
JavaScript
var types = require( './types.json' );
|
|
// Load Popups when touch events are not available in the browser (e.g. not a mobile device).
|
|
var isTouchDevice = 'ontouchstart' in document.documentElement;
|
|
if ( !isTouchDevice ) {
|
|
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;
|
|
} );
|
|
}
|