https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113466
Revision: 113466 Author: jdlrobson Date: 2012-03-09 14:40:48 +0000 (Fri, 09 Mar 2012) Log Message: ----------- remove placeholder code in favour of placeholder attribute for browsers that don't support this attribute it would make more sense to provide a generic solution if this is in fact needed see http://www.quirksmode.org/html5/inputs_mobile.html#t13 Modified Paths: -------------- trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php trunk/extensions/MobileFrontend/templates/SearchTemplate.php Modified: trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js =================================================================== --- trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js 2012-03-09 14:37:45 UTC (rev 113465) +++ trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js 2012-03-09 14:40:48 UTC (rev 113466) @@ -40,7 +40,7 @@ resetViewPort(); search.onfocus = function() { - var pE, pT, pTT, rrd, rrdD, + var rrd, rrdD, removeResultsEl; sb = document.getElementById( 'searchbox' ); sq = document.getElementById( 'sq' ); @@ -51,23 +51,6 @@ if ( !focused ) { MobileFrontend.utils( document.body ).addClass( 'full-screen-search' ); - pE = document.getElementById( 'placeholder' ); - if ( !pE ) { - pT = document.createElement( 'span' ); - pTT = document.createTextNode(placeholder); - pT.setAttribute( 'id', 'placeholder' ); - pT.appendChild(pTT); - sb.insertBefore( pT, sb.firstChild ); - } - pE = document.getElementById( 'placeholder' ); - if ( pE ) { - pE.style.display = 'block'; - } - - if ( pE && search.value !== '' ) { - pE.style.display = 'none'; - } - removeResultsEl = document.getElementById( 'remove-results' ); if ( !removeResultsEl ) { rrd = document.createElement( 'a' ); @@ -244,13 +227,6 @@ } } - function handleDefaultText() { - var pE = document.getElementById( 'placeholder' ); - if ( pE ) { - pE.style.display = 'none'; - } - } - function initClearSearch() { var clearSearch = document.getElementById( 'clearsearch' ), search = document.getElementById( 'search' ), @@ -278,7 +254,6 @@ } u( clearSearch ).bind( 'mousedown', clearSearchBox ); u( search ).bind( 'keyup', handleClearSearchLink ); - u( search ).bind( 'keydown', handleDefaultText ); u( search ).bind( 'click', onFocusHandler ); } @@ -288,7 +263,6 @@ document.body.onmousedown = whichElement; document.body.ontouchstart = whichElement; results.ontouchstart = whichElement; - search.onpaste = handleDefaultText; } init(); initClearSearch(); Modified: trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php =================================================================== --- trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php 2012-03-09 14:37:45 UTC (rev 113465) +++ trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php 2012-03-09 14:40:48 UTC (rev 113466) @@ -61,7 +61,6 @@ //<![CDATA[ var title = "{$this->data['htmlTitle']}"; var scriptPath = "{$this->data['wgScriptPath']}"; - var placeholder = "{$this->data['placeholder']}"; var showText = "{$buttonShowText}"; var hideText = "{$buttonHideText}"; //]]> Modified: trunk/extensions/MobileFrontend/templates/SearchTemplate.php =================================================================== --- trunk/extensions/MobileFrontend/templates/SearchTemplate.php 2012-03-09 14:37:45 UTC (rev 113465) +++ trunk/extensions/MobileFrontend/templates/SearchTemplate.php 2012-03-09 14:40:48 UTC (rev 113466) @@ -14,6 +14,8 @@ $homeButton = $this->data['messages']['mobile-frontend-home-button']; $randomButton = $this->data['messages']['mobile-frontend-random-button']; $clearText = htmlentities( $this->data['messages']['mobile-frontend-clear-search'], ENT_QUOTES ); + $searchValue = $this->data['messages']['mobile-frontend-search-submit']; + $placeholder = htmlentities( $this->data['messages']['mobile-frontend-placeholder'], ENT_QUOTES ); $scriptUrl = wfScript(); $searchBoxDisplayNone = ( $this->data['hideSearchBox'] ) ? ' style="display: none;" ' : ''; @@ -34,7 +36,7 @@ <form action='{$scriptUrl}' class='search_bar' method='get' {$searchBoxDisplayNone}> <input type="hidden" value="Special:Search" name="title" /> <div id="sq" class="divclearable"> - <input type="search" name="search" id="search" size="22" value="{$searchField}" autocorrect="off" autocomplete="off" autocapitalize="off" maxlength="1024" class="search" /> + <input type="search" name="search" id="search" size="22" value="{$searchField}" autocorrect="off" autocomplete="off" autocapitalize="off" maxlength="1024" class="search" placeholder="{$placeholder}" /> <div class="clearlink" id="clearsearch" title="{$clearText}"></div> </div> <button id='goButton' class='goButton' type='submit'></button> _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs