jenkins-bot has submitted this change and it was merged.
Change subject: Separate the entry point modules
......................................................................
Separate the entry point modules
Certain modules are used to setup features/routes (e.g. bind
to certain hash fragments) or to progressively enhance the page.
This splits those out to make it clearer and cleans up their dependencies
in the process (if a parent has a dependency it doesn't need to be restated)
Change-Id: I48d75893be973451e16ca0b593ac828b8e118eb3
---
M includes/Resources.php
M includes/skins/SkinMinerva.php
2 files changed, 99 insertions(+), 86 deletions(-)
Approvals:
Jhernandez: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Resources.php b/includes/Resources.php
index 272be02..6409e0d 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -123,40 +123,6 @@
),
),
- 'tablet.scripts' => $wgMFResourceFileModuleBoilerplate + array(
- 'dependencies' => array(
- 'mobile.toc',
- ),
- ),
-
- // Important: This module is loaded on both mobile and desktop skin
- 'mobile.head' => $wgMFResourceFileModuleBoilerplate + array(
- 'dependencies' => array(
- 'mediawiki.language',
- 'mediawiki.jqueryMsg',
- 'mobile.templates',
- 'ext.mantle.modules',
- 'ext.mantle.oo',
- ),
- 'scripts' => array(
- 'javascripts/modes.js',
- 'javascripts/mainmenu.js',
- 'javascripts/modules/lastEdited/time.js',
- 'javascripts/modules/lastEdited/lastEdited.js',
- ),
- 'messages' => array(
- // lastEdited.js
- 'mobile-frontend-last-modified-with-user-seconds',
- 'mobile-frontend-last-modified-with-user-minutes',
- 'mobile-frontend-last-modified-with-user-hours',
- 'mobile-frontend-last-modified-with-user-days',
- 'mobile-frontend-last-modified-with-user-months',
- 'mobile-frontend-last-modified-with-user-years',
- 'mobile-frontend-last-modified-with-user-just-now',
- ),
- 'position' => 'top',
- ),
-
'mobile.ajax' => $wgMFResourceFileModuleBoilerplate + array(
'templates' => array(
'spinner.hogan' => 'templates/spinner.hogan',
@@ -469,20 +435,6 @@
),
),
- 'mobile.beta' => $wgMFResourceFileModuleBoilerplate + array(
- 'dependencies' => array(
- 'mobile.stable',
- 'mobile.overlays',
- 'mobile.references.beta',
- 'mobile.wikigrok',
- 'mobile.preferredLanguages',
- 'mobile.stable.common',
- 'mobile.loggingSchemas',
- 'mobile.templates',
- ),
- 'position' => 'bottom',
- ),
-
'mobile.search' => $wgMFResourceFileModuleBoilerplate + array(
'class' => 'ResourceLoaderParsedMessageModule',
'dependencies' => array(
@@ -577,12 +529,6 @@
// mediaViewer.js
'mobile-frontend-media-details',
'mobile-frontend-media-license-link',
- ),
- ),
-
- 'mobile.alpha' => $wgMFResourceFileModuleBoilerplate + array(
- 'dependencies' => array(
- 'mobile.beta',
),
),
@@ -845,28 +791,6 @@
),
),
- 'mobile.stable' => $wgMFResourceFileModuleBoilerplate + array(
- 'dependencies' => array(
- 'mobile.startup',
- 'mobile.user',
- 'mobile.stable.common',
- 'mediawiki.util',
- 'mobile.templates',
- 'mobile.references',
- 'mediawiki.language',
- 'mobile.loggingSchemas',
- 'mobile.watchstar',
- 'mobile.pagelist.scripts',
- ),
- 'scripts' => array(
- 'javascripts/externals/micro.autosize.js',
- 'javascripts/modules/uploads/init.js',
- 'javascripts/modules/mainmenutweaks.js',
- 'javascripts/modules/mediaViewer/init.js',
- 'javascripts/modules/languages/languages.js',
- ),
- ),
-
'mobile.languages' => $wgMFResourceFileModuleBoilerplate + array(
'class' => 'ResourceLoaderParsedMessageModule',
'dependencies' => array(
@@ -1000,6 +924,7 @@
// See https://www.mediawiki.org/wiki/Extension:MobileFrontend/WikiGrok
'mobile.wikigrok.dialog' => $wgMFResourceFileModuleBoilerplate + array(
'dependencies' => array(
+ 'mobile.overlays',
'mobile.alpha',
),
'templates' => array(
@@ -1223,9 +1148,96 @@
),
);
+// These modules are the gateways to all other modules and will ensure the
other modules get loaded
+// on the page.
+$wgMinervaBootstrapModules = array(
+ // Important: This module is loaded on both mobile and desktop skin
+ // This JavaScript is loaded at the top of the page so be cautious what
you put in it.
+ 'mobile.head' => $wgMFResourceFileModuleBoilerplate + array(
+ 'dependencies' => array(
+ 'mediawiki.language',
+ 'mediawiki.jqueryMsg',
+ 'mobile.templates',
+ 'ext.mantle.modules',
+ 'ext.mantle.oo',
+ ),
+ 'scripts' => array(
+ 'javascripts/modes.js',
+ 'javascripts/mainmenu.js',
+ 'javascripts/modules/lastEdited/time.js',
+ 'javascripts/modules/lastEdited/lastEdited.js',
+ ),
+ 'messages' => array(
+ // lastEdited.js
+ 'mobile-frontend-last-modified-with-user-seconds',
+ 'mobile-frontend-last-modified-with-user-minutes',
+ 'mobile-frontend-last-modified-with-user-hours',
+ 'mobile-frontend-last-modified-with-user-days',
+ 'mobile-frontend-last-modified-with-user-months',
+ 'mobile-frontend-last-modified-with-user-years',
+ 'mobile-frontend-last-modified-with-user-just-now',
+ ),
+ 'position' => 'top',
+ ),
+
+ // By mode.
+ 'mobile.stable' => $wgMFResourceFileModuleBoilerplate + array(
+ 'dependencies' => array(
+ 'mobile.startup',
+ 'mobile.loggingSchemas',
+ // FIXME: Review the modules that follow. Ensure they
are in the correct module definition.
+ 'mobile.user',
+ 'mobile.stable.common',
+ 'mediawiki.util',
+ 'mobile.templates',
+ 'mediawiki.language',
+ 'mobile.pagelist.scripts',
+ // Feature modules that should be loaded in stable.
+ // These modules should only setup routes/events or
+ // load code under certain conditions.
+ 'mobile.watchstar',
+ 'mobile.site',
+ 'mobile.issues',
+ 'mobile.search',
+ 'mobile.references',
+ ),
+ 'scripts' => array(
+ 'javascripts/externals/micro.autosize.js',
+ 'javascripts/modules/uploads/init.js',
+ 'javascripts/modules/mainmenutweaks.js',
+ 'javascripts/modules/mediaViewer/init.js',
+ 'javascripts/modules/languages/languages.js',
+ ),
+ ),
+ 'mobile.beta' => $wgMFResourceFileModuleBoilerplate + array(
+ 'dependencies' => array(
+ 'mobile.stable',
+ // Feature modules that should be loaded in beta should
be listed below here.
+ // These modules should only setup routes/events or
+ // load code under certain conditions.
+ 'mobile.wikigrok',
+ 'mobile.preferredLanguages',
+ 'mobile.references.beta',
+ ),
+ ),
+ 'mobile.alpha' => $wgMFResourceFileModuleBoilerplate + array(
+ 'dependencies' => array(
+ 'mobile.beta',
+ // Feature modules that should be loaded in alpha
should be listed below here.
+ ),
+ ),
+ 'tablet.scripts' => $wgMFResourceFileModuleBoilerplate + array(
+ 'dependencies' => array(
+ // Feature modules that should be loaded on tablets
should be listed below here.
+ 'mobile.toc',
+ ),
+ ),
+);
+
$wgResourceModules = array_merge( $wgResourceModules,
$wgMobileSpecialPageModules );
$wgResourceModules = array_merge( $wgResourceModules,
$wgMinervaSpecialPageModules );
$wgResourceModules = array_merge( $wgResourceModules, $wgMinervaStyleModules );
+$wgResourceModules = array_merge( $wgResourceModules,
$wgMinervaBootstrapModules );
// Module customizations
$wgResourceModuleSkinStyles['minerva'] = $wgMFResourceBoilerplate + array(
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 4d806a7..5300a83 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -877,7 +877,8 @@
}
/**
- * Returns the javascript modules to load.
+ * Returns the javascript entry modules to load. Only modules that need
to
+ * be overriden or added conditionally should be placed here.
* @return array
*/
public function getDefaultModules() {
@@ -886,19 +887,18 @@
$modules['content'] = array();
$modules['legacy'] = array();
- $modules['mobile'] = array(
- 'mobile.head',
- 'mobile.startup',
- 'mobile.site',
- // FIXME: separate mobile.stable into more meaningful
groupings
- 'mobile.stable',
- );
+ // Add minerva specific modules
+ $modules['head'] = 'mobile.head';
+ // Define all the modules that should load on the mobile site
and their dependencies.
+ // Do not add mobules here.
+ $modules['stable'] = 'mobile.stable';
if ( $this->isAllowedPageAction( 'watch' ) ) {
+ // Prevent the desktop watchstar from ever leaking into
mobile view.
+ // FIXME: Let's set this to a module so it's more
explicit
$modules['watch'] = array();
}
- $modules['search'] = array( 'mobile.search' );
- $modules['issues'] = array( 'mobile.issues' );
+
if ( $this->isAllowedPageAction( 'edit' ) ) {
$modules['editor'] = array( 'mobile.editor' );
}
@@ -909,6 +909,7 @@
$modules['toggling'] = array( 'mobile.toggling' );
$modules['eventlogging'] = array(
'mobile.loggingSchemas' );
}
+
// FIXME: Upstream?
wfRunHooks( 'SkinMinervaDefaultModules', array( $this,
&$modules ) );
return $modules;
--
To view, visit https://gerrit.wikimedia.org/r/171171
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I48d75893be973451e16ca0b593ac828b8e118eb3
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: Phuedx <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits