r105382 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105381‎ | r105382 | r105383 >
Date:23:49, 6 December 2011
Author:preilly
Status:ok (Comments)
Tags:
Comment:
fix placeholder issue
Modified paths:
  • /trunk/extensions/MobileFrontend/javascripts/beta_application.js (modified) (history)
  • /trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/javascripts/beta_application.js
@@ -27,8 +27,9 @@
2828 }
2929
3030 function handleDefaultText() {
31 - if (search.value == placeholder) {
32 - search.value = '';
 31+ var pE = document.getElementById( 'placeholder' );
 32+ if ( pE ) {
 33+ pE.style.display = 'none';
3334 }
3435 }
3536
@@ -38,15 +39,6 @@
3940 clearSearch.style.display = 'block';
4041 } else {
4142 clearSearch.style.display = 'none';
42 - // if ( results ) {
43 - // results.style.display = 'none';
44 - // }
45 - // if ( typeof removeResults == 'function' ) {
46 - // removeResults();
47 - // if ( search ) {
48 - // search.blur();
49 - // }
50 - // }
5143 }
5244 }
5345 }
Index: trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js
@@ -32,7 +32,6 @@
3333 ol.sqLeft = sq.offsetLeft;
3434 ol.sqTop = sq.offsetTop;
3535 sq.style.position = 'absolute';
36 - search.value = placeholder;
3736
3837 if ( !ol.properOffsetWidth ) {
3938 ol.properOffsetWidth = search.offsetLeft + 44;
@@ -63,6 +62,26 @@
6463 sb.style.border = 0 + pixels;
6564 logo.style.visibility = 'hidden';
6665 goButton.style.visibility = 'hidden';
 66+
 67+ var pE = document.getElementById( 'placeholder' );
 68+ if ( !pE ) {
 69+ pT = document.createElement( 'span' );
 70+ var pTT = document.createTextNode(placeholder);
 71+ pT.setAttribute( 'id', 'placeholder' );
 72+ pT.appendChild(pTT);
 73+ sb.insertBefore( pT, sb.firstChild );
 74+ }
 75+ var pE = document.getElementById( 'placeholder' );
 76+ if ( pE ) {
 77+ pE.style.position = 'absolute';
 78+ pE.style.left = ( search.offsetLeft + 5 ) + pixels;
 79+ pE.style.top = ( sq.offsetTop + 12 ) + pixels;
 80+ //pE.style.zIndex = -1;
 81+ pE.style.color = '#666666';
 82+ pE.style.fontSize = 16 + pixels;
 83+ pE.style.display = 'block';
 84+ search.style.backgroundColor = 'transparent';
 85+ }
6786 var removeResults = document.getElementById( 'remove-results' );
6887 if ( !removeResults ) {
6988 rrd = document.createElement( 'a' );
@@ -151,7 +170,6 @@
152171
153172 e.cancelBubble = true;
154173 e.stopPropagation();
155 -
156174 if ( targ.className == "suggestion-result" ||
157175 targ.className == "search-result-item" ||
158176 targ.className == "suggestions-result" ||
@@ -160,6 +178,7 @@
161179 targ.id == 'search' ||
162180 targ.id == 'searchbox' ||
163181 targ.id == 'sq' ||
 182+ targ.id == 'placeholder' ||
164183 targ.id == 'clearsearch' ||
165184 targ.tagName == 'BODY' ) {
166185 if ( targ.id == 'clearsearch' && results ) {

Sign-offs

UserFlagDate
Brion VIBBERtested23:52, 6 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105374detect pasted text in searchpreilly22:52, 6 December 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   23:52, 6 December 2011

Confirmed works with typing and pasting on my android

Status & tagging log