r99823 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99822‎ | r99823 | r99824 >
Date:22:16, 14 October 2011
Author:preilly
Status:old
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.17wmf1/extensions/MobileFrontend/MobileFrontend.php (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/MobileFrontend/javascripts/application.min.js (added) (history)
  • /branches/wmf/1.17wmf1/extensions/MobileFrontend/views/layout/_search_webkit.html.php (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/MobileFrontend/views/layout/application.html.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/extensions/MobileFrontend/javascripts/application.min.js
@@ -0,0 +1 @@
 2+var search=document.getElementById('search');var clearSearch=document.getElementById('clearsearch');initClearSearchLink();function initClearSearchLink(){clearSearch.setAttribute('title','Clear');clearSearch.addEventListener('mousedown',clearSearchBox,true);search.addEventListener('keyup',_handleClearSearchLink,false)}function _handleClearSearchLink(){if(clearSearch){if(search.value.length>0){clearSearch.style.display='block'}else{clearSearch.style.display='none'}}}function clearSearchBox(a){search.value='';clearSearch.style.display='none';if(a){a.preventDefault()}}document.getElementById('logo').onclick=function(){var n=document.getElementById('nav').style;n.display=n.display=='block'?'none':'block'};for(var h=document.getElementsByTagName('h2'),i=0;i<h.length;i++){if(h[i].className=='section_heading'){h[i].onclick=function(){var a=parseInt(this.id.replace(/section_(\d+)/,'$1'));wm_toggle_section(a)}}};for(var a=document.getElementsByTagName('a'),i=0;i<a.length;i++){a[i].onclick=function(){if(this.hash.indexOf('#')==0){wm_reveal_for_hash(this.hash)}}};if(document.location.hash.indexOf('#')==0){wm_reveal_for_hash(document.location.hash)}updateOrientation();window.scrollTo(0,1);function updateOrientation(){switch(window.orientation){case 0:document.body.setAttribute('class','portrait');break;case 90:case-90:document.body.setAttribute('class','landscape')}}window.onorientationchange=updateOrientation;function wm_reveal_for_hash(a){var b=document.getElementById(a.substr(1));if(b){for(var p=b.parentNode;p&&p.className!='content_block'&&p.className!='section_heading';){p=p.parentNode}if(p&&p.style.display!='block'){var c=parseInt(p.id.split('_')[1]);wm_toggle_section(c)}}}function wm_toggle_section(a){var b=document.getElementById('section_'+a),bb=b.getElementsByTagName('button');for(var i=0;i<=1;i++){var s=bb[i].style;s.display=s.display=='none'||(i&&!s.display)?'inline-block':'none'}for(var i=0,d=['content_','anchor_'];i<=1;i++){var s=document.getElementById(d[i]+a).style;s.display=s.display=='block'?'none':'block'}}
\ No newline at end of file
Property changes on: branches/wmf/1.17wmf1/extensions/MobileFrontend/javascripts/application.min.js
___________________________________________________________________
Added: svn:eol-style
13 + native
Index: branches/wmf/1.17wmf1/extensions/MobileFrontend/MobileFrontend.php
@@ -128,6 +128,7 @@
129129 public static $leaveFeedbackURL;
130130 public static $mobileRedirectFormAction;
131131 public static $isBetaGroupMember = false;
 132+ public static $hideSearchBox = false;
132133
133134 public static $messageKeys = array(
134135 'mobile-frontend-show-button',
@@ -556,6 +557,12 @@
557558
558559 private function checkUserStatus() {
559560 wfProfileIn( __METHOD__ );
 561+
 562+ if ( !empty( $_SERVER['HTTP_APPLICATION_VERSION'] ) &&
 563+ strpos( $_SERVER['HTTP_APPLICATION_VERSION'], 'Wikipedia Mobile' ) !== false ) {
 564+ self::$hideSearchBox = true;
 565+ }
 566+
560567 $optInCookie = $this->getOptInOutCookie();
561568 if ( !empty( $optInCookie ) &&
562569 $optInCookie == 1 ) {
@@ -1082,6 +1089,9 @@
10831090 if ( self::$isMainPage ) {
10841091 $contentHtml = $this->DOMParseMainPage( $contentHtml );
10851092 }
 1093+
 1094+ $title = htmlspecialchars( self::$title->getText() );
 1095+ $htmlTitle = htmlspecialchars( self::$htmlTitle );
10861096
10871097 if ( strlen( $contentHtml ) > 4000 && $this->contentFormat == 'XHTML'
10881098 && self::$device['supports_javascript'] === true
Index: branches/wmf/1.17wmf1/extensions/MobileFrontend/views/layout/_search_webkit.html.php
@@ -8,12 +8,13 @@
99 $randomButton = self::$messages['mobile-frontend-random-button'];
1010
1111 $scriptUrl = wfScript();
 12+$searchBoxDisplayNone = ( self::$hideSearchBox ) ? ' style="display: none;" ' : '';
1213
1314 $searchWebkitHtml = <<<EOD
1415 <div id='header'>
1516 <div id='searchbox'>
1617 <img width="35" height="22" alt='Logo' id='logo' src='{$wgMobileFrontendLogo}' />
17 - <form action='{$scriptUrl}' class='search_bar' method='get'>
 18+ <form action='{$scriptUrl}' class='search_bar' method='get' {$searchBoxDisplayNone}>
1819 <input type="hidden" value="Special:Search" name="title" />
1920 <div id="sq" class="divclearable">
2021 <input type="text" name="search" id="search" size="22" value="{$searchField}" />
Index: branches/wmf/1.17wmf1/extensions/MobileFrontend/views/layout/application.html.php
@@ -22,10 +22,11 @@
2323 <head>
2424 <title>{$htmlTitle}</title>
2525 <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
 26+ <link href='{$wgExtensionAssetsPath}/MobileFrontend/stylesheets/common.css' media='all' rel='Stylesheet' type='text/css' />
2627 <link href='{$wgExtensionAssetsPath}/MobileFrontend/stylesheets/{$cssFileName}.css' media='all' rel='Stylesheet' type='text/css' />
2728 <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
28 - <meta name = "viewport" content = "width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
29 - ${appleTouchIconTag}
 29+ <meta name = "viewport" content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0," />
 30+ {$appleTouchIconTag}
3031 <script type='text/javascript'>
3132 //<![CDATA[
3233 var title = "{$htmlTitle}";
@@ -42,7 +43,7 @@
4344 {$contentHtml}
4445 </div>
4546 {$footerHtml}
46 - <script type="text/javascript" language="javascript" src="{$wgExtensionAssetsPath}/MobileFrontend/javascripts/application.js?version=20110920T172820Z"></script>
 47+ <script type="text/javascript" language="javascript" src="{$wgExtensionAssetsPath}/MobileFrontend/javascripts/application.min.js?version=20111014T172820Z"></script>
4748 </body>
4849 </html>
4950 EOT;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r99819fix for bug 31710 - ios app show both native and mobile web search input fieldspreilly22:01, 14 October 2011
r99822add back title for htmlpreilly22:14, 14 October 2011

Status & tagging log