r101235 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101234‎ | r101235 | r101236 >
Date:23:47, 28 October 2011
Author:preilly
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/javascripts/opensearch.js (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/views/layout/application.html.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/javascripts/opensearch.js
@@ -14,6 +14,33 @@
1515 var sq = document.getElementById( 'sq' );
1616 var sb = document.getElementById( 'searchbox' );
1717
 18+function hideResults() {
 19+ results.style.display = 'none';
 20+}
 21+
 22+document.onmousedown = function() {
 23+ whichElement(event);
 24+}
 25+results.onmousedown = function() {
 26+ whichElement(event);
 27+}
 28+
 29+function whichElement(e) {
 30+ if (!e) {
 31+ var e = window.event;
 32+ e.target = e.srcElement;
 33+ e.cancelBubble = true;
 34+ } else {
 35+ e.stopPropagation();
 36+ if (e.target.className == "suggestion-result" ||
 37+ e.target.className == "search-result-item" ||
 38+ e.target.className == "sq-val-update" ) {
 39+ } else {
 40+ hideResults();
 41+ }
 42+ }
 43+}
 44+
1845 function updateSearchWidth() {
1946 if ( sq && search && sb && results ) {
2047 var iw = ( document.documentElement.clientWidth ) ? document.documentElement.clientWidth : document.body.clientWidth;
@@ -108,7 +135,7 @@
109136 var section = sections[i];
110137 var rel = i + 1;
111138 section.value = section.value.replace( /^(?:\/\/|[^\/]+)*\//, '/' );
112 - html = html + "<div class=\"suggestions-result\" rel=\"" + rel + "\" title=\"" + section.label + "\"><a href='" + section.value + "'>" + section.label + "</a><a class=\"sq-val-update\" href=\"javascript:sqValUpdate('" + section.label + "');\"> + &nbsp;</a></div>";
 139+ html = html + "<div class=\"suggestions-result\" rel=\"" + rel + "\" title=\"" + section.label + "\"><a class=\"search-result-item\" href='" + section.value + "'>" + section.label + "</a><a class=\"sq-val-update\" href=\"javascript:sqValUpdate('" + section.label + "');\"> + &nbsp;</a></div>";
113140 if ( i < ( sections.length - 1 ) ) {
114141 html = html + '<hr />';
115142 }
Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/views/layout/application.html.php
@@ -18,7 +18,7 @@
1919 $endScriptTag = '"></script>';
2020 $javaScriptPath = $wgExtensionAssetsPath . '/MobileFrontend/javascripts/';
2121
22 -$openSearchScript = ( self::$isBetaGroupMember ) ? $startScriptTag . $javaScriptPath . 'opensearch.js?version=10282011121527' . $endScriptTag : '';
 22+$openSearchScript = ( self::$isBetaGroupMember ) ? $startScriptTag . $javaScriptPath . 'opensearch.js?version=10282011124424' . $endScriptTag : '';
2323
2424 $applicationHtml = <<<EOT
2525 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r101234hide search results on outside clickpreilly23:45, 28 October 2011

Status & tagging log