Index: trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js |
— | — | @@ -10,6 +10,7 @@ |
11 | 11 | footer = document.getElementById( 'footer' ), |
12 | 12 | clearSearch = document.getElementById( 'clearsearch' ), |
13 | 13 | focused = false, |
| 14 | + viewportmeta, originalViewport, |
14 | 15 | u = MobileFrontend.utils; |
15 | 16 | |
16 | 17 | apiUrl = MobileFrontend.setting( 'scriptPath' ) + apiUrl; |
— | — | @@ -17,16 +18,19 @@ |
18 | 19 | function hideResults() { |
19 | 20 | results.style.display = 'none'; |
20 | 21 | } |
| 22 | + |
| 23 | + viewportmeta = u( 'meta[name="viewport"]' ) |
| 24 | + if ( viewportmeta ) { |
| 25 | + viewportmeta = viewportmeta[0]; |
| 26 | + originalViewport = viewportmeta.getAttribute( 'content' ); |
| 27 | + } |
| 28 | + // prevent auto-zoom in on clicking search for certain browsers e.g. palm pre and ipad |
21 | 29 | function resetViewPort() { |
22 | | - if ( navigator.userAgent.match( /iPhone/i ) || navigator.userAgent.match( /iPad/i ) ) { |
23 | | - var viewportmeta = u( 'meta[name="viewport"]' ); |
24 | | - if ( viewportmeta ) { |
25 | | - viewportmeta = viewportmeta[0]; |
26 | | - viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0'; |
27 | | - u( document.body ).bind( 'gesturestart', function () { |
28 | | - viewportmeta.content = 'width=device-width, initial-scale=1.0'; |
29 | | - } ); |
30 | | - } |
| 30 | + if ( viewportmeta ) { |
| 31 | + viewportmeta.setAttribute( 'content', 'minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0'); |
| 32 | + u( document.body ).bind( 'gesturestart', function () { |
| 33 | + viewportmeta.setAttribute( 'content', originalViewport ); |
| 34 | + } ); |
31 | 35 | } |
32 | 36 | } |
33 | 37 | |