Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/javascripts/opensearch.js |
— | — | @@ -12,14 +12,40 @@ |
13 | 13 | var results = document.getElementById( 'results' ); |
14 | 14 | var search = document.getElementById( 'search' ); |
15 | 15 | var sq = document.getElementById( 'sq' ); |
16 | | -var iw = ( document.documentElement.clientWidth ) ? document.documentElement.clientWidth : document.body.clientWidth; |
17 | | -sq.style.width = ( iw - 110 ) + pixels; |
18 | | -search.style.width = ( iw - 140 ) + pixels;; |
| 16 | +var sb = document.getElementById( 'searchbox' ); |
19 | 17 | |
| 18 | +function updateSearchWidth() { |
| 19 | + if ( sq && search && sb ) { |
| 20 | + var iw = ( document.documentElement.clientWidth ) ? document.documentElement.clientWidth : document.body.clientWidth; |
| 21 | + sb.style.width = ( iw - 30 ) + pixels; |
| 22 | + sq.style.width = ( iw - 110 ) + pixels; |
| 23 | + search.style.width = ( iw - 140 ) + pixels; |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +updateSearchWidth(); |
| 28 | + |
20 | 29 | results.style.width = ( sq.offsetWidth - 2 ) + pixels; |
21 | 30 | results.style.left = sq.offsetLeft + pixels; |
22 | 31 | results.style.top = ( sq.offsetTop + sq.offsetHeight ) + pixels; |
23 | 32 | |
| 33 | +function updateOrientationSearchWidth() { |
| 34 | + switch( window.orientation ) { |
| 35 | + case 0: |
| 36 | + updateSearchWidth(); |
| 37 | + break; |
| 38 | + case 90: |
| 39 | + updateSearchWidth(); |
| 40 | + break; |
| 41 | + case -90: |
| 42 | + updateSearchWidth(); |
| 43 | + break; |
| 44 | + } |
| 45 | +} |
| 46 | + |
| 47 | +// Point to the updateOrientation function when iPhone switches between portrait and landscape modes. |
| 48 | +window.onorientationchange = updateOrientationSearchWidth; |
| 49 | + |
24 | 50 | window.onload = function () { |
25 | 51 | search.addEventListener( 'keyup', |
26 | 52 | function() { |
— | — | @@ -66,6 +92,12 @@ |
67 | 93 | return sections; |
68 | 94 | } |
69 | 95 | |
| 96 | +function sqValUpdate( sqValue ) { |
| 97 | + if ( search ) { |
| 98 | + search.value = sqValue; |
| 99 | + } |
| 100 | +} |
| 101 | + |
70 | 102 | function writeResults( sections ) { |
71 | 103 | results.style.display = 'block'; |
72 | 104 | if ( !sections || sections.length < 1 ) { |
— | — | @@ -76,7 +108,7 @@ |
77 | 109 | var section = sections[i]; |
78 | 110 | var rel = i + 1; |
79 | 111 | section.value = section.value.replace( /^(?:\/\/|[^\/]+)*\//, '/' ); |
80 | | - html = html + "<div class=\"suggestions-result\" rel=\"" + rel + "\" title=\"" + section.label + "\"><a href='" + section.value + "'>" + section.label + "</a></div>"; |
| 112 | + html = html + "<div class=\"suggestions-result\" rel=\"" + rel + "\" title=\"" + section.label + "\"><a href='" + section.value + "'>" + section.label + "</a><a class=\"sq-val-update\" href=\"javascript:sqValUpdate('" + section.label + "');\"> + </a></div>"; |
81 | 113 | if ( i < ( sections.length - 1 ) ) { |
82 | 114 | html = html + '<hr />'; |
83 | 115 | } |
Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/stylesheets/common.css |
— | — | @@ -52,6 +52,28 @@ |
53 | 53 | .suggestions-result:hover { |
54 | 54 | background-color: #ACD1E9; |
55 | 55 | } |
| 56 | +a.sq-val-update { |
| 57 | + font-size: 1.3em; |
| 58 | + font-weight:normal; |
| 59 | + text-decoration: none; |
| 60 | + color: #000000; |
| 61 | +} |
| 62 | +a.sq-val-update:link { |
| 63 | + text-decoration: none; |
| 64 | + color:#000000; |
| 65 | +} |
| 66 | +a.sq-val-update:visited { |
| 67 | + text-decoration: none; |
| 68 | + color:#000000; |
| 69 | +} |
| 70 | +a.sq-val-update:hover { |
| 71 | + text-decoration: none; |
| 72 | + color:#000000; |
| 73 | +} |
| 74 | +a.sq-val-update:active { |
| 75 | + text-decoration: none; |
| 76 | + color:#000000; |
| 77 | +} |
56 | 78 | |
57 | 79 | #results { |
58 | 80 | display: none; |
Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/views/layout/application.html.php |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | <head> |
29 | 29 | <title>{$htmlTitle}</title> |
30 | 30 | <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> |
31 | | - <link href='{$wgExtensionAssetsPath}/MobileFrontend/stylesheets/common.css?version=10282011120815' media='all' rel='Stylesheet' type='text/css' /> |
| 31 | + <link href='{$wgExtensionAssetsPath}/MobileFrontend/stylesheets/common.css?version=10282011122615' media='all' rel='Stylesheet' type='text/css' /> |
32 | 32 | <link href='{$wgExtensionAssetsPath}/MobileFrontend/stylesheets/{$cssFileName}.css?version=10202011120715' media='all' rel='Stylesheet' type='text/css' /> |
33 | 33 | <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /> |
34 | 34 | <meta name = "viewport" content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> |