Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/52053
Change subject: RL: Correctly load modules that belong in the head and headItems
......................................................................
RL: Correctly load modules that belong in the head and headItems
We were not doing this previously
Some extensions add head items that we currently do not surface
Change-Id: Ic8b65b2f602e36f47a492f7660240cd7920e7402
---
M includes/skins/SkinMobile.php
1 file changed, 16 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/53/52053/1
diff --git a/includes/skins/SkinMobile.php b/includes/skins/SkinMobile.php
index e101ed5..04060a7 100644
--- a/includes/skins/SkinMobile.php
+++ b/includes/skins/SkinMobile.php
@@ -263,6 +263,13 @@
)
);
+ // Load modules that have marked themselves for loading
at the top
+ $headLinks[] = Html::inlineScript(
+ ResourceLoader::makeLoaderConditionalScript(
+ Xml::encodeJsCall( 'mw.loader.load',
array( $moduleNames['top'] ) )
+ )
+ );
+
// bottom scripts
$out->addModules( $moduleNames['bottom'] );
// FIXME: EditPage.php adds an inline script that
breaks editing without this - dirty hack
@@ -286,7 +293,15 @@
$headLinks[] = $this->resourceLoaderLink(
$device->moduleName(), 'styles', $target='mobile' );
}
- $tpl->set( 'preamble', implode( "\n", $headLinks ) );
+ $headHtml = implode( "\n", $headLinks );
+ /*
+ FIXME: I'm not too keen on adding getHeadItems here
+ it allows anything to add javascript/css without
checking
+ if it works on mobile. For instance CentralNotice
extension adds a remote geolookupip script
+ */
+ $headHtml .= $out->getHeadItems();
+
+ $tpl->set( 'preamble', $headHtml );
$tpl->set( 'bottomScripts', $bottomScripts );
return $tpl;
}
--
To view, visit https://gerrit.wikimedia.org/r/52053
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic8b65b2f602e36f47a492f7660240cd7920e7402
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits