r113470 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113469‎ | r113470 | r113471 >
Date:14:59, 9 March 2012
Author:jdlrobson
Status:ok
Tags:
Comment:
jslinted beta_opensearch.js

add new line at end
remove unused variables
remove left over redundant placeholder code
Modified paths:
  • /trunk/extensions/MobileFrontend/javascripts/beta_opensearch.js (modified) (history)

Diff [purge]

Index: trunk/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 rrd, rrdD,
45 - removeResultsEl;
 39+ var rrd, rrdD;
4640 sb = document.getElementById( 'searchbox' );
4741 sq = document.getElementById( 'sq' );
4842 content = document.getElementById( 'content' );
@@ -51,8 +45,8 @@
5246 if ( !focused ) {
5347 MobileFrontend.utils( document.body ).addClass( 'full-screen-search' );
5448
55 - removeResultsEl = document.getElementById( 'remove-results' );
56 - if ( !removeResultsEl ) {
 49+ rrd = document.getElementById( 'remove-results' );
 50+ if ( !rrd ) {
5751 rrd = document.createElement( 'a' );
5852 rrd.setAttribute( 'href', '#' );
5953 rrd.setAttribute( 'id', 'remove-results' );
@@ -68,12 +62,7 @@
6963
7064 function removeResults() {
7165 MobileFrontend.utils( document.body ).removeClass( 'full-screen-search' );
72 - var removeResultsEl, pE = document.getElementById( 'placeholder' );
7366
74 - if ( pE ) {
75 - pE.style.display = 'none';
76 - }
77 -
7867 if ( focused ) {
7968 focused = false;
8069 }
@@ -165,8 +154,8 @@
166155 }
167156
168157 function htmlEntities( str ) {
169 - var text = document.createTextNode( str );
170 - var el = document.createElement( 'div' );
 158+ var text = document.createTextNode( str ),
 159+ el = document.createElement( 'div' );
171160 el.appendChild( text );
172161 return el.innerHTML;
173162 }
@@ -229,8 +218,7 @@
230219
231220 function initClearSearch() {
232221 var clearSearch = document.getElementById( 'clearsearch' ),
233 - search = document.getElementById( 'search' ),
234 - results = document.getElementById( 'results' );
 222+ search = document.getElementById( 'search' );
235223 function handleClearSearchLink() {
236224 if ( clearSearch ) {
237225 if ( search.value.length > 0 ) {
@@ -275,4 +263,4 @@
276264 removeResults: removeResults
277265 };
278266
279 -}());
\ No newline at end of file
 267+}());

Follow-up revisions

RevisionCommit summaryAuthorDate
r114200r113463, r113465, r113466, r113469, r113470, r113471, r113472awjrichards22:16, 19 March 2012

Status & tagging log