From: Robert Stojnić Date: Mon, 4 May 2009 21:07:18 +0000 (+0000) Subject: Fix annoying bug with mwsuggest that makes it shown suggestions after search box... X-Git-Tag: 1.31.0-rc.0~41879 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=58607bec93b59d85e8727d9779d73d8267e59c8b;p=lhc%2Fweb%2Fwiklou.git Fix annoying bug with mwsuggest that makes it shown suggestions after search box has lost focus (which it shouldn't). Introduce additional attribute that tells the suggestion container that it should stay hidden. --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index fc6424ee02..bd71fc5599 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1477,7 +1477,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '217'; +$wgStyleVersion = '218'; # Server-side caching: diff --git a/skins/common/mwsuggest.js b/skins/common/mwsuggest.js index 061a645149..503c739246 100644 --- a/skins/common/mwsuggest.js +++ b/skins/common/mwsuggest.js @@ -78,6 +78,7 @@ function os_Results(name, formname){ this.containerRow = 0; // height of result field in the container this.containerTotal = 0; // total height of the container will all results this.visible = false; // if container is visible + this.stayHidden = false; // don't try to show if lost focus } /** Hide results div */ @@ -93,6 +94,8 @@ function os_hideResults(r){ function os_showResults(r){ if(os_is_stopped) return; + if(r.stayHidden) + return os_fitContainer(r); var c = document.getElementById(r.container); r.selected = -1; @@ -442,6 +445,7 @@ function os_delayedFetch(){ /** Init timed update via os_delayedUpdate() */ function os_fetchResults(r, query, timeout){ if(query == ""){ + r.query = ""; os_hideResults(r); return; } else if(query == r.query) @@ -622,13 +626,19 @@ function os_eventBlur(e){ var r = os_map[targ.id]; if(r == null) return; // not our event - if(!os_mouse_pressed) + if(!os_mouse_pressed){ os_hideResults(r); + r.stayHidden = true + } } /** Event: focus (catch only when stopped) */ function os_eventFocus(e){ - // nothing happens here? + var targ = os_getTarget(e); + var r = os_map[targ.id]; + if(r == null) + return; // not our event + r.stayHidden = false }