Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/171171
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, 106 insertions(+), 101 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/71/171171/1 diff --git a/includes/Resources.php b/includes/Resources.php index 33136eb..9dfc26d 100644 --- a/includes/Resources.php +++ b/includes/Resources.php @@ -129,40 +129,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', @@ -463,19 +429,6 @@ ), ), - 'mobile.beta' => $wgMFResourceFileModuleBoilerplate + array( - 'dependencies' => array( - 'mobile.stable', - 'mobile.overlays', - 'mobile.wikigrok', - 'mobile.preferredLanguages', - 'mobile.stable.common', - 'mobile.loggingSchemas', - 'mobile.templates', - ), - 'position' => 'bottom', - ), - 'mobile.search' => $wgMFResourceFileModuleBoilerplate + array( 'class' => 'ResourceLoaderParsedMessageModule', 'dependencies' => array( @@ -572,12 +525,6 @@ ), ), - 'mobile.alpha' => $wgMFResourceFileModuleBoilerplate + array( - 'dependencies' => array( - 'mobile.beta', - ), - ), - 'mobile.wikigrok' => $wgMFResourceFileModuleBoilerplate + array( 'dependencies' => array( 'mobile.startup', @@ -586,6 +533,18 @@ ), 'scripts' => array( 'javascripts/modules/wikigrok/wikigrok.js', + ), + ), + + 'mobile.toggling' => $wgMFResourceFileModuleBoilerplate + array( + 'dependencies' => array( + 'mobile.startup', + ), + 'styles' => array( + 'less/modules/toggle.less', + ), + 'scripts' => array( + 'javascripts/modules/toggling/toggle.js', ), ), @@ -727,18 +686,6 @@ ), ), - 'mobile.toggling' => $wgMFResourceFileModuleBoilerplate + array( - 'dependencies' => array( - 'mobile.startup', - ), - 'styles' => array( - 'less/modules/toggle.less', - ), - 'scripts' => array( - 'javascripts/modules/toggling/toggle.js', - ), - ), - 'mobile.contentOverlays' => $wgMFResourceFileModuleBoilerplate + array( 'dependencies' => array( 'mobile.overlays', @@ -801,29 +748,6 @@ 'mobile-frontend-watchlist-removed', 'mobile-frontend-watchlist-cta', 'mobile-frontend-watchlist-please-wait', - ), - ), - - 'mobile.stable' => $wgMFResourceFileModuleBoilerplate + array( - 'dependencies' => array( - 'mobile.startup', - 'mobile.user', - 'mobile.stable.common', - 'mediawiki.util', - 'mobile.stable.styles', - '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', ), ), @@ -959,6 +883,7 @@ // See https://www.mediawiki.org/wiki/Extension:MobileFrontend/WikiGrok 'mobile.wikigrok.dialog' => $wgMFResourceFileModuleBoilerplate + array( 'dependencies' => array( + 'mobile.overlays', 'mobile.alpha', ), 'templates' => array( @@ -1181,9 +1106,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.stable.styles', + '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.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 f6a389b..edf779c 100644 --- a/includes/skins/SkinMinerva.php +++ b/includes/skins/SkinMinerva.php @@ -861,7 +861,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() { @@ -870,19 +871,10 @@ $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'; + $modules['stable'] = 'mobile.stable'; - if ( $this->isAllowedPageAction( 'watch' ) ) { - $modules['watch'] = array(); - } - $modules['search'] = array( 'mobile.search' ); - $modules['issues'] = array( 'mobile.issues' ); if ( $this->isAllowedPageAction( 'edit' ) ) { $modules['editor'] = array( 'mobile.editor' ); } @@ -893,6 +885,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: newchange Gerrit-Change-Id: I48d75893be973451e16ca0b593ac828b8e118eb3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits