jenkins-bot has submitted this change and it was merged.
Change subject: Kill use of MobileFormatter on special pages
......................................................................
Kill use of MobileFormatter on special pages
* Stop adding #section_0 to special pages
* Re-instore search special page styling
* Stop scrubbing search elements - instead hide in css
Change-Id: I78881cd2b264ea1b3c6475238f3a3c25bce8b93f
---
M includes/MobileFrontend.body.php
M includes/MobileFrontend.hooks.php
M includes/formatters/MobileFormatter.php
M less/specials/search.less
M stylesheets/specials/search.css
5 files changed, 26 insertions(+), 5 deletions(-)
Approvals:
MaxSem: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/MobileFrontend.body.php b/includes/MobileFrontend.body.php
index 38e50c3..1c07bf8 100644
--- a/includes/MobileFrontend.body.php
+++ b/includes/MobileFrontend.body.php
@@ -25,8 +25,10 @@
wfRunHooks( 'MobileFrontendBeforeDOM', array( $context,
$formatter ) );
wfProfileIn( __METHOD__ . '-filter' );
+ $specialPage = $out->getTitle()->isSpecialPage();
if ( $context->getContentTransformations() ) {
- $formatter->filterContent();
+ // Remove images if they're disabled from special
pages, but don't transform otherwise
+ $formatter->filterContent( /* remove defaults */
!$specialPage );
}
wfProfileOut( __METHOD__ . '-filter' );
diff --git a/includes/MobileFrontend.hooks.php
b/includes/MobileFrontend.hooks.php
index 2be5bbc..0794455 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -313,12 +313,22 @@
public static function onSpecialPageBeforeExecute( SpecialPage
$special, $subpage ) {
global $wgMFForceSecureLogin;
$mobileContext = MobileContext::singleton();
- if ( $special->getName() != 'Userlogin' ||
!$mobileContext->shouldDisplayMobileView() ) {
+ $isMobileView = $mobileContext->shouldDisplayMobileView();
+ if ( $special->getName() != 'Userlogin' || !$isMobileView ) {
// no further processing necessary
return true;
}
$out = $special->getContext()->getOutput();
+ if ( $special->getName() === 'Search' ) {
+ $out->addModuleStyles( 'mobile.search.styles' );
+ }
+
+ // go no further if we're not dealing with the login page
+ if ( $special->getName() != 'Userlogin' ) {
+ return true;
+ }
+
$out->addModuleStyles( 'mobile.userlogin.styles' );
// make sure we're on https if we're supposed to be and
currently aren't.
diff --git a/includes/formatters/MobileFormatter.php
b/includes/formatters/MobileFormatter.php
index d44b17d..e6e77db 100644
--- a/includes/formatters/MobileFormatter.php
+++ b/includes/formatters/MobileFormatter.php
@@ -17,9 +17,7 @@
private $defaultItemsToRemove = array(
'.toc',
- '#search', // remove search form element from Special:Search
'div.magnify',
- '.mw-search-createlink',
'.nomobile',
);
@@ -50,6 +48,7 @@
$title = $context->getTitle();
$isMainPage = $title->isMainPage();
$isFilePage = $title->inNamespace( NS_FILE );
+ $isSpecialPage = $title->isSpecialPage();
$html = self::wrapHTML( $html );
if ( $context->getContentFormat() === 'WML' ) {
@@ -57,7 +56,7 @@
$formatter = new MobileFormatterWML( $html, $title,
$wmlContext );
} else {
$formatter = new MobileFormatterHTML( $html, $title );
- $formatter->enableExpandableSections( !$isMainPage );
+ $formatter->enableExpandableSections( !$isMainPage &&
!$isSpecialPage );
}
if ( $context->isBetaGroupMember() ) {
diff --git a/less/specials/search.less b/less/specials/search.less
index 13fdffc..b9f4ef9 100644
--- a/less/specials/search.less
+++ b/less/specials/search.less
@@ -19,3 +19,9 @@
}
}
}
+
+.mw-search-createlink,
+// FIXME: Revisit when search input is not in a table
+#search {
+ display: none;
+}
diff --git a/stylesheets/specials/search.css b/stylesheets/specials/search.css
index e0b3048..46f5a88 100644
--- a/stylesheets/specials/search.css
+++ b/stylesheets/specials/search.css
@@ -19,3 +19,7 @@
width: 100%;
margin-left: 12px;
}
+.mw-search-createlink,
+#search {
+ display: none;
+}
--
To view, visit https://gerrit.wikimedia.org/r/76270
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I78881cd2b264ea1b3c6475238f3a3c25bce8b93f
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits