r101234 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101233‎ | r101234 | r101235 >
Date:23:45, 28 October 2011
Author:preilly
Status:resolved (Comments)
Tags:
Comment:
hide search results on outside click
Modified paths:
  • /trunk/extensions/MobileFrontend/javascripts/opensearch.js (modified) (history)
  • /trunk/extensions/MobileFrontend/views/layout/application.html.php (modified) (history)

Diff [purge]

Index: trunk/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: trunk/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"

Follow-up revisions

RevisionCommit summaryAuthorDate
r101235mft r101234preilly23:47, 28 October 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   01:49, 13 December 2011

Event issues & XSS issues were cleaned up later.

Status & tagging log