r103097 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103096‎ | r103097 | r103098 >
Date:00:44, 15 November 2011
Author:preilly
Status:deferred (Comments)
Tags:mobile 
Comment:
hide logo on android application
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)
  • /trunk/extensions/MobileFrontend/views/layout/_search_webkit.html.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -127,6 +127,7 @@
128128 public static $mobileRedirectFormAction;
129129 public static $isBetaGroupMember = false;
130130 public static $hideSearchBox = false;
 131+ public static $hideLogo = false;
131132 public static $languageUrls;
132133
133134 public static $messageKeys = array(
@@ -602,6 +603,9 @@
603604 if ( !empty( $_SERVER['HTTP_APPLICATION_VERSION'] ) &&
604605 strpos( $_SERVER['HTTP_APPLICATION_VERSION'], 'Wikipedia Mobile' ) !== false ) {
605606 self::$hideSearchBox = true;
 607+ if (strpos( $_SERVER['HTTP_APPLICATION_VERSION'], 'Android' ) !== false ) {
 608+ self::$hideLogo = true;
 609+ }
606610 }
607611
608612 $optInCookie = $this->getOptInOutCookie();
Index: trunk/extensions/MobileFrontend/views/layout/_search_webkit.html.php
@@ -10,6 +10,8 @@
1111 $scriptUrl = wfScript();
1212 $searchBoxDisplayNone = ( self::$hideSearchBox ) ? ' style="display: none;" ' : '';
1313
 14+$logoDisplayNone = ( self::$hideLogo ) ? ' style="display: none;" ' : '';
 15+
1416 $openSearchResults = '<div id="results"></div>';
1517
1618 $languageSelection = self::buildLanguageSelection() . '<br/>';
@@ -21,7 +23,7 @@
2224 $searchWebkitHtml = <<<EOD
2325 <div id='header'>
2426 <div id='searchbox'>
25 - <img width="35" height="22" alt='Logo' id='logo' src='{$wgMobileFrontendLogo}' {$logoOnClick} />
 27+ <img width="35" height="22" alt='Logo' id='logo' src='{$wgMobileFrontendLogo}' {$logoOnClick} {$logoDisplayNone} />
2628 <form action='{$scriptUrl}' class='search_bar' method='get' {$searchBoxDisplayNone}>
2729 <input type="hidden" value="Special:Search" name="title" />
2830 <div id="sq" class="divclearable">

Follow-up revisions

RevisionCommit summaryAuthorDate
r1030991.18wmf1: MFT r103097preilly00:46, 15 November 2011
r103102add android logo fixpreilly01:03, 15 November 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   01:29, 13 December 2011

This Application_Version header is hard to work with; it'd be easier if we can use the user-agent for this, which can generally be overridden in web views while adding arbitrary headers doesn't seem very easy.

Of course better might be to use an explicit URL parameter or API.... (long-term)

Status & tagging log