r106304 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106303‎ | r106304 | r106305 >
Date:02:15, 15 December 2011
Author:preilly
Status:deferred
Tags:mobile 
Comment:
reset viewport on iPhone iPad for search
Modified paths:
  • /trunk/extensions/MobileFrontend/ApplicationTemplate.php (modified) (history)
  • /trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/ApplicationTemplate.php
@@ -24,7 +24,7 @@
2525 $endScriptTag = '"></script>';
2626 $javaScriptPath = $this->data['wgExtensionAssetsPath'] . '/MobileFrontend/javascripts/';
2727
28 - $openSearchScript = $startScriptTag . $javaScriptPath . $betaPrefix . 'opensearch.js?version=12142011126437' . $endScriptTag;
 28+ $openSearchScript = $startScriptTag . $javaScriptPath . $betaPrefix . 'opensearch.js?version=12142011129437' . $endScriptTag;
2929 $jQueryScript = ( $this->data['device']['supports_jquery'] ) ? $startScriptTag . $javaScriptPath . 'jquery-1.7.1.min.js' . $endScriptTag : '';
3030 $filePageScript = ( $this->data['isFilePage'] ) ? $startScriptTag . $javaScriptPath . 'filepage.js' . $endScriptTag : '';
3131
Index: trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js
@@ -22,10 +22,26 @@
2323 function hideResults() {
2424 results.style.display = 'none';
2525 }
 26+function resetViewPort() {
 27+ if ( navigator.userAgent.match( /iPhone/i ) || navigator.userAgent.match( /iPad/i ) ) {
 28+ var viewportmeta = document.querySelector( 'meta[name="viewport"]' );
 29+ if ( viewportmeta ) {
 30+ viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0';
 31+ document.body.addEventListener( 'gesturestart', function () {
 32+ viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6';
 33+ }, false );
 34+ }
 35+ }
 36+}
2637
 38+resetViewPort();
 39+
2740 var focused = false;
2841 var ol = new Object();
2942 search.onfocus = function() {
 43+
 44+ resetViewPort();
 45+
3046 if ( !focused ) {
3147 content.style.display = 'none';
3248 footer.style.display = 'none';

Follow-up revisions

RevisionCommit summaryAuthorDate
r1063051.18wmf1: MFT r106304preilly02:16, 15 December 2011

Status & tagging log