r114200 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114199‎ | r114200 | r114201 >
Date:22:16, 19 March 2012
Author:awjrichards
Status:reverted
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/beta_opensearch.js (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/stylesheets/beta_common.css (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/ApplicationTemplate.php (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/SearchTemplate.php (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/tests/js/fixtures.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/tests/js/fixtures.js
@@ -1,3 +1,5 @@
 2+var showText = "show", hideText = "hide";
 3+
24 window.MobileFrontendTests = {
35 cleanFixtures: function() {
46 // note the ZeroRatedMobileAccess extension attaches a banner to the qunit test suite
Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/beta_opensearch.js
@@ -3,18 +3,13 @@
44 MobileFrontend.opensearch = (function() {
55 var apiUrl = '/api.php', timer = -1, typingDelay = 500,
66 numResults = 15, term,
7 - results = document.getElementById( 'results' ),
87 search = document.getElementById( 'search' ),
98 sq = document.getElementById( 'sq' ),
109 sb = document.getElementById( 'searchbox' ),
11 - logo = document.getElementById( 'logo' ),
12 - goButton = document.getElementById( 'goButton' ),
1310 content = document.getElementById( 'content' ),
1411 footer = document.getElementById( 'footer' ),
15 - zeroRatedBanner = document.getElementById( 'zero-rated-banner' ) ||
16 - document.getElementById( 'zero-rated-banner-red' ),
1712 clearSearch = document.getElementById( 'clearsearch' ),
18 - focused = false, ol = {},
 13+ focused = false,
1914 u = MobileFrontend.utils;
2015
2116 if ( scriptPath ) {
@@ -40,8 +35,7 @@
4136 resetViewPort();
4237
4338 search.onfocus = function() {
44 - var pE, pT, pTT, rrd, rrdD,
45 - removeResultsEl;
 39+ var rrd, rrdD;
4640 sb = document.getElementById( 'searchbox' );
4741 sq = document.getElementById( 'sq' );
4842 content = document.getElementById( 'content' );
@@ -51,25 +45,8 @@
5246 if ( !focused ) {
5347 MobileFrontend.utils( document.body ).addClass( 'full-screen-search' );
5448
55 - pE = document.getElementById( 'placeholder' );
56 - if ( !pE ) {
57 - pT = document.createElement( 'span' );
58 - pTT = document.createTextNode(placeholder);
59 - pT.setAttribute( 'id', 'placeholder' );
60 - pT.appendChild(pTT);
61 - sb.insertBefore( pT, sb.firstChild );
62 - }
63 - pE = document.getElementById( 'placeholder' );
64 - if ( pE ) {
65 - pE.style.display = 'block';
66 - }
67 -
68 - if ( pE && search.value !== '' ) {
69 - pE.style.display = 'none';
70 - }
71 -
72 - removeResultsEl = document.getElementById( 'remove-results' );
73 - if ( !removeResultsEl ) {
 49+ rrd = document.getElementById( 'remove-results' );
 50+ if ( !rrd ) {
7451 rrd = document.createElement( 'a' );
7552 rrd.setAttribute( 'href', '#' );
7653 rrd.setAttribute( 'id', 'remove-results' );
@@ -85,12 +62,7 @@
8663
8764 function removeResults() {
8865 MobileFrontend.utils( document.body ).removeClass( 'full-screen-search' );
89 - var removeResultsEl, pE = document.getElementById( 'placeholder' );
9066
91 - if ( pE ) {
92 - pE.style.display = 'none';
93 - }
94 -
9567 if ( focused ) {
9668 focused = false;
9769 }
@@ -182,8 +154,8 @@
183155 }
184156
185157 function htmlEntities( str ) {
186 - var text = document.createTextNode( str );
187 - var el = document.createElement( 'div' );
 158+ var text = document.createTextNode( str ),
 159+ el = document.createElement( 'div' );
188160 el.appendChild( text );
189161 return el.innerHTML;
190162 }
@@ -202,12 +174,12 @@
203175 search.focus();
204176 }
205177 if ( !sections || sections.length < 1 ) {
206 - results.innerHTML = "<div class=\"suggestions-results\" title=\"No Results\">No Results</div>";
 178+ results.innerHTML = '<ul class="suggestions-results" title="No Results"><li class="suggestions-result">No Results</li></div>';
207179 } else {
208180 if( results.firstChild ) {
209181 results.removeChild( results.firstChild );
210182 }
211 - suggestions = document.createElement( 'div' );
 183+ suggestions = document.createElement( 'ul' );
212184 suggestions.className = 'suggestions-results';
213185 results.appendChild( suggestions );
214186 suggestionListener = function() {
@@ -217,7 +189,7 @@
218190
219191 for ( i = 0; i < sections.length; i++ ) {
220192 section = sections[i];
221 - suggestionsResult = document.createElement( 'div' );
 193+ suggestionsResult = document.createElement( 'li' );
222194 link = document.createElement( 'a' );
223195 suggestionsResult.setAttribute( 'title', section.label );
224196 suggestionsResult.className = 'suggestions-result';
@@ -244,17 +216,9 @@
245217 }
246218 }
247219
248 - function handleDefaultText() {
249 - var pE = document.getElementById( 'placeholder' );
250 - if ( pE ) {
251 - pE.style.display = 'none';
252 - }
253 - }
254 -
255220 function initClearSearch() {
256221 var clearSearch = document.getElementById( 'clearsearch' ),
257 - search = document.getElementById( 'search' ),
258 - results = document.getElementById( 'results' );
 222+ search = document.getElementById( 'search' );
259223 function handleClearSearchLink() {
260224 if ( clearSearch ) {
261225 if ( search.value.length > 0 ) {
@@ -278,7 +242,6 @@
279243 }
280244 u( clearSearch ).bind( 'mousedown', clearSearchBox );
281245 u( search ).bind( 'keyup', handleClearSearchLink );
282 - u( search ).bind( 'keydown', handleDefaultText );
283246 u( search ).bind( 'click', onFocusHandler );
284247 }
285248
@@ -288,7 +251,6 @@
289252 document.body.onmousedown = whichElement;
290253 document.body.ontouchstart = whichElement;
291254 results.ontouchstart = whichElement;
292 - search.onpaste = handleDefaultText;
293255 }
294256 init();
295257 initClearSearch();
@@ -301,4 +263,4 @@
302264 removeResults: removeResults
303265 };
304266
305 -}());
\ No newline at end of file
 267+}());
Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/stylesheets/beta_common.css
@@ -1,8 +1,8 @@
22 html,
3 -body {
4 - margin: 0;
5 - padding: 0;
6 - height: 100%;
 3+body {
 4+ margin: 0;
 5+ padding: 0;
 6+ height: 100%;
77 }
88
99 html {
@@ -106,38 +106,16 @@
107107 text-align: center;
108108 }
109109
110 -.suggestions-results {
111 - font-size: 1.4em;
112 - cursor: pointer;
113 - margin: 0;
114 - padding: 0;
115 -}
116 -
117 -.suggestions-results hr {
118 - margin: 0;
119 -}
120 -
121 -.suggestions-result {
122 - color: black;
123 - margin: 0;
124 - line-height: 2.6em;
125 - padding: 0.01em 0.25em;
126 - postion: relative;
127 - border-bottom: solid 1px #999999;
128 -}
129 -
130110 .suggestions-result a {
131111 text-decoration: none;
132112 color: #666;
133113 }
134 -.suggestions-result a:link {
135 - text-decoration: none;
136 - color:#666;
137 -}
 114+
138115 .suggestions-result a:visited {
139116 text-decoration: none;
140117 color:#666;
141118 }
 119+
142120 .suggestions-result a:hover {
143121 text-decoration: none;
144122 color:#666;
@@ -146,9 +124,11 @@
147125 text-decoration: none;
148126 color:#666;
149127 }
 128+
150129 .suggestions-result:hover {
151130 background-color: #ACD1E9;
152131 }
 132+
153133 a.sq-val-update {
154134 font-size: 1.3em;
155135 display: block;
@@ -160,15 +140,15 @@
161141 width: 1.5em;
162142 text-align: center;
163143 }
164 -a.sq-val-update:link {
165 - text-decoration: none;
166 -}
 144+
167145 a.sq-val-update:visited {
168146 text-decoration: none;
169147 }
 148+
170149 a.sq-val-update:hover {
171150 text-decoration: none;
172151 }
 152+
173153 a.sq-val-update:active {
174154 text-decoration: none;
175155 }
@@ -785,11 +765,19 @@
786766 position: relative;
787767 border-bottom: solid 1px #999;
788768 font-size: 1.4em;
 769+ cursor: pointer;
 770+ margin: 0;
789771 }
790772
791773 .full-screen-search .suggestions-result {
792774 line-height: 2.6em;
793775 border: none;
 776+ color: black;
 777+ margin: 0;
 778+ line-height: 2.6em;
 779+ padding: 0.01em 0.25em;
 780+ position: relative;
 781+ border-bottom: solid 1px #999999;
794782 }
795783
796784 .full-screen-search .suggestions-result a:visited {
@@ -841,13 +829,3 @@
842830 .full-screen-search #nav {
843831 display: none !important;
844832 }
845 -
846 -#placeholder {
847 - position: absolute;
848 - left: 38px;
849 - z-index: 2;
850 - top: 0;
851 - color: #666;
852 - font-size: 16px;
853 - padding-top: 10px;
854 -}
Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/ApplicationTemplate.php
@@ -54,14 +54,13 @@
5555 <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$betaPrefix}common.css?version=1331257310' media='all' rel='Stylesheet' type='text/css' />
5656 <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$cssFileName}.css?version=1331257310' media='all' rel='Stylesheet' type='text/css' />
5757 {$filePageStyle}
58 - <meta name="viewport" content="width=device-width, initial-scale=1.0">
 58+ <meta name="viewport" content="max-width=device-width, initial-scale=1.0">
5959 {$appleTouchIconTag}
6060 {$jQueryScript}
6161 <script type='text/javascript'>
6262 //<![CDATA[
6363 var title = "{$this->data['htmlTitle']}";
6464 var scriptPath = "{$this->data['wgScriptPath']}";
65 - var placeholder = "{$this->data['placeholder']}";
6665 var showText = "{$buttonShowText}";
6766 var hideText = "{$buttonHideText}";
6867 //]]>
Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/SearchTemplate.php
@@ -14,6 +14,8 @@
1515 $homeButton = $this->data['messages']['mobile-frontend-home-button'];
1616 $randomButton = $this->data['messages']['mobile-frontend-random-button'];
1717 $clearText = htmlentities( $this->data['messages']['mobile-frontend-clear-search'], ENT_QUOTES );
 18+ $searchValue = $this->data['messages']['mobile-frontend-search-submit'];
 19+ $placeholder = htmlentities( $this->data['messages']['mobile-frontend-placeholder'], ENT_QUOTES );
1820
1921 $scriptUrl = wfScript();
2022 $searchBoxDisplayNone = ( $this->data['hideSearchBox'] ) ? ' style="display: none;" ' : '';
@@ -34,7 +36,7 @@
3537 <form action='{$scriptUrl}' class='search_bar' method='get' {$searchBoxDisplayNone}>
3638 <input type="hidden" value="Special:Search" name="title" />
3739 <div id="sq" class="divclearable">
38 - <input type="search" name="search" id="search" size="22" value="{$searchField}" autocorrect="off" autocomplete="off" autocapitalize="off" maxlength="1024" class="search" />
 40+ <input type="search" name="search" id="search" size="22" value="{$searchField}" autocorrect="off" autocomplete="off" autocapitalize="off" maxlength="1024" class="search" placeholder="{$placeholder}" />
3941 <div class="clearlink" id="clearsearch" title="{$clearText}"></div>
4042 </div>
4143 <button id='goButton' class='goButton' type='submit'></button>
Property changes on: branches/wmf/1.19wmf1/extensions/MobileFrontend
___________________________________________________________________
Modified: svn:mergeinfo
4244 Merged /trunk/extensions/MobileFrontend:r113463,113465-113466,113469-113472

Follow-up revisions

RevisionCommit summaryAuthorDate
r114223Revert r114221,r114216,r114213,r114207,r114206,r114205,r114203,r114202,r11420...awjrichards00:26, 20 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113463use max-width for viewport not width...jdlrobson11:03, 9 March 2012
r113465update fixtures with globalsjdlrobson14:37, 9 March 2012
r113466remove placeholder code in favour of placeholder attribute...jdlrobson14:40, 9 March 2012
r113469search suggestions as list...jdlrobson14:54, 9 March 2012
r113470jslinted beta_opensearch.js...jdlrobson14:59, 9 March 2012
r113471cleanup beta_common.css...jdlrobson15:08, 9 March 2012
r113472css cleanup...jdlrobson15:11, 9 March 2012

Status & tagging log