r97872 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97871‎ | r97872 | r97873 >
Date:00:25, 23 September 2011
Author:preilly
Status:ok
Tags:
Comment:
mft 96528 to 95268
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/javascripts/application.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/javascripts/application.js
@@ -1,5 +1,34 @@
2 -// I don't think this makes sense. Loading this here means that this button
3 -// won't function until the page is loaded. It would probably be an
 2+var search = document.getElementById( 'search' );
 3+var clearSearch = document.getElementById( 'clearsearch' );
 4+
 5+initClearSearchLink();
 6+
 7+function initClearSearchLink() {
 8+ clearSearch.setAttribute( 'title','Clear' );
 9+ clearSearch.addEventListener( 'mousedown', clearSearchBox, true );
 10+ search.addEventListener( 'keyup', _handleClearSearchLink, false );
 11+}
 12+
 13+function _handleClearSearchLink() {
 14+ if ( clearSearch ) {
 15+ if ( search.value.length > 0 ) {
 16+ clearSearch.style.display = 'block';
 17+ } else {
 18+ clearSearch.style.display = 'none';
 19+ }
 20+ }
 21+}
 22+
 23+function clearSearchBox( event ) {
 24+ search.value = '';
 25+ clearSearch.style.display = 'none';
 26+ if ( event ) {
 27+ event.preventDefault();
 28+ }
 29+}
 30+
 31+// I don't think this makes sense. Loading this here means that this button
 32+// won't function until the page is loaded. It would probably be an
433 // improvement to just attach an onclick straight into the html.
534 document.getElementById( 'logo' ).onclick = function() {
635 var n = document.getElementById( 'nav' ).style;
@@ -35,7 +64,7 @@
3665 window.scrollTo( 0, 1 );
3766
3867 // This is a global. I don't know why.
39 -decode = document.getElementById( 'searchField' );
 68+decode = document.getElementById( 'search' );
4069 decode.value = unescape( decode.value );
4170 decode = document.getElementsByTagName( 'title' )[0];
4271 decode.innerHTML = unescape( decode.innerHTML );
@@ -83,4 +112,4 @@
84113 var s = document.getElementById( d[i] + section_id ).style;
85114 s.display = s.display == 'block' ? 'none' : 'block';
86115 }
87 -}
 116+}
\ No newline at end of file

Status & tagging log