mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-24 07:34:11 +00:00
Remove ResourceLoaderRegisterModules hook handler
We should endeavour to define Resource Loader modules in one place, extension.json. Adding them to the output, however... Changes: * Remove ResourceLoaderRegisterModules hook handler. * Move all dependencies, messages, templates, and styles into "empty" RL module definitions in extension.json so that they don't have to be looked up later. Change-Id: I7ec963e3296de8f411e90079ab13b97c6eba4916
This commit is contained in:
parent
046d12f51b
commit
3bf0f8ab8b
|
@ -52,79 +52,6 @@ class PopupsHooks {
|
|||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ResourceLoader $rl
|
||||
* @return bool
|
||||
*/
|
||||
public static function onResourceLoaderRegisterModules( ResourceLoader $rl ) {
|
||||
$moduleDependencies = array(
|
||||
'mediawiki.jqueryMsg',
|
||||
'mediawiki.ui.button',
|
||||
'mediawiki.ui.icon',
|
||||
'moment',
|
||||
'jquery.hidpi',
|
||||
'ext.popups.targets.desktopTarget',
|
||||
'ext.popups.images',
|
||||
);
|
||||
|
||||
// Create a schema module and add it as a dependency of `ext.popups.desktop`.
|
||||
$schemaPopups = [
|
||||
'remoteExtPath' => 'Popups',
|
||||
'localBasePath' => __DIR__,
|
||||
'targets' => [ 'desktop' ],
|
||||
];
|
||||
|
||||
if ( class_exists( 'EventLogging' ) ) {
|
||||
$schemaPopups += [
|
||||
'dependencies' => [
|
||||
'schema.Popups',
|
||||
'ext.popups.schemaPopups.utils',
|
||||
],
|
||||
'scripts' => [
|
||||
'resources/ext.popups.schemaPopups/ext.popups.schemaPopups.js',
|
||||
]
|
||||
];
|
||||
}
|
||||
$rl->register('ext.popups.schemaPopups', $schemaPopups );
|
||||
$moduleDependencies[] = 'ext.popups.schemaPopups';
|
||||
|
||||
$rl->register( "ext.popups.desktop", array(
|
||||
'scripts' => array(
|
||||
'resources/ext.popups.desktop/ext.popups.renderer.article.js',
|
||||
'resources/ext.popups.desktop/ext.popups.settings.js',
|
||||
),
|
||||
'templates' => array(
|
||||
'popup.mustache' => 'resources/ext.popups.desktop/popup.mustache',
|
||||
'settings.mustache' => 'resources/ext.popups.desktop/settings.mustache',
|
||||
),
|
||||
'styles' => array(
|
||||
'resources/ext.popups.desktop/ext.popups.animation.less',
|
||||
'resources/ext.popups.desktop/ext.popups.settings.less',
|
||||
),
|
||||
'dependencies' => $moduleDependencies,
|
||||
'messages' => array(
|
||||
'popups-last-edited',
|
||||
"popups-settings-title",
|
||||
"popups-settings-description",
|
||||
"popups-settings-option-simple",
|
||||
"popups-settings-option-simple-description",
|
||||
"popups-settings-option-advanced",
|
||||
"popups-settings-option-advanced-description",
|
||||
"popups-settings-option-off",
|
||||
"popups-settings-save",
|
||||
"popups-settings-cancel",
|
||||
"popups-settings-enable",
|
||||
"popups-settings-help",
|
||||
"popups-settings-help-ok",
|
||||
"popups-send-feedback",
|
||||
),
|
||||
'remoteExtPath' => 'Popups',
|
||||
'localBasePath' => __DIR__,
|
||||
) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin) {
|
||||
// Enable only if the user has turned it on in Beta Preferences, or BetaFeatures is not installed.
|
||||
// Will only be loaded if PageImages & TextExtracts extensions are installed.
|
||||
|
@ -156,7 +83,7 @@ class PopupsHooks {
|
|||
}
|
||||
}
|
||||
|
||||
$out->addModules( array( 'ext.popups.desktop' ) );
|
||||
$out->addModules( array( 'ext.popups' ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
"ResourceLoaderTestModules": [
|
||||
"PopupsHooks::onResourceLoaderTestModules"
|
||||
],
|
||||
"ResourceLoaderRegisterModules": [
|
||||
"PopupsHooks::onResourceLoaderRegisterModules"
|
||||
],
|
||||
"ResourceLoaderGetConfigVars": [
|
||||
"PopupsHooks::onResourceLoaderGetConfigVars"
|
||||
],
|
||||
|
@ -52,38 +49,6 @@
|
|||
"PopupsExperiment": false
|
||||
},
|
||||
"ResourceModules": {
|
||||
"ext.popups.core": {
|
||||
"scripts": [
|
||||
"resources/ext.popups.core/ext.popups.core.js"
|
||||
],
|
||||
"dependencies": [
|
||||
"mediawiki.api",
|
||||
"mediawiki.Title",
|
||||
"mediawiki.Uri",
|
||||
"mediawiki.RegExp",
|
||||
"mediawiki.storage",
|
||||
"mediawiki.user",
|
||||
"mediawiki.experiments"
|
||||
],
|
||||
"targets": [
|
||||
"desktop"
|
||||
],
|
||||
"styles": [
|
||||
"resources/ext.popups.core/ext.popups.core.less"
|
||||
]
|
||||
},
|
||||
"ext.popups.targets.desktopTarget": {
|
||||
"scripts": [
|
||||
"resources/ext.popups.targets.desktopTarget/desktopTarget.js"
|
||||
],
|
||||
"dependencies": [
|
||||
"mediawiki.storage",
|
||||
"jquery.client",
|
||||
"ext.popups.core",
|
||||
"ext.popups.renderer.desktopRenderer"
|
||||
],
|
||||
"targets": [ "desktop" ]
|
||||
},
|
||||
"ext.popups.images": {
|
||||
"selector": ".mw-ui-icon-{name}:before",
|
||||
"class": "ResourceLoaderImageModule",
|
||||
|
@ -92,27 +57,37 @@
|
|||
"popups-close": "resources/ext.popups.images/close.svg"
|
||||
}
|
||||
},
|
||||
"ext.popups.renderer.desktopRenderer": {
|
||||
"scripts": [
|
||||
"resources/ext.popups.renderer.desktopRenderer/desktopRenderer.js"
|
||||
"ext.popups": {
|
||||
"templates": {
|
||||
"popup.mustache": "resources/ext.popups.desktop/popup.mustache",
|
||||
"settings.mustache": "resources/ext.popups.desktop/settings.mustache"
|
||||
},
|
||||
"styles": [
|
||||
"resources/ext.popups.desktop/ext.popups.animation.less",
|
||||
"resources/ext.popups.desktop/ext.popups.settings.less"
|
||||
],
|
||||
"messages": [
|
||||
"popups-last-edited",
|
||||
"popups-settings-title",
|
||||
"popups-settings-description",
|
||||
"popups-settings-option-simple",
|
||||
"popups-settings-option-simple-description",
|
||||
"popups-settings-option-advanced",
|
||||
"popups-settings-option-advanced-description",
|
||||
"popups-settings-option-off",
|
||||
"popups-settings-save",
|
||||
"popups-settings-cancel",
|
||||
"popups-settings-enable",
|
||||
"popups-settings-help",
|
||||
"popups-settings-help-ok",
|
||||
"popups-send-feedback"
|
||||
],
|
||||
"dependencies": [
|
||||
"ext.popups.core"
|
||||
]
|
||||
},
|
||||
"ext.popups.schemaPopups.utils": {
|
||||
"scripts": [
|
||||
"resources/ext.popups.schemaPopups.utils/ext.popups.schemaPopups.utils.js"
|
||||
],
|
||||
"dependencies": [
|
||||
"mediawiki.experiments",
|
||||
"mediawiki.Title",
|
||||
"mediawiki.user",
|
||||
"ext.popups.core",
|
||||
"ext.popups.renderer.desktopRenderer"
|
||||
],
|
||||
"targets": [
|
||||
"desktop"
|
||||
"mediawiki.jqueryMsg",
|
||||
"mediawiki.ui.button",
|
||||
"mediawiki.ui.icon",
|
||||
"moment",
|
||||
"jquery.hidpi"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue