You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 19, 2023. It is now read-only.
From an email:
I've made a local modification to SearchBox Sync that I think would be useful
in the mainstream
version. I modified the code to _clear_ the search box when switching to a tab
that does not
have search information. The current version you provide leaves the search box
populated with
information not relevant to the active tab. This modification clears that
information out. It's a
relatively minor change to the update method. It can certainly be done much
more cleanly than
this but this was the proof of concept I wrote and it works well enough. The
new version of
update is below:
this.update = function(aUrl) {
if (!this.searchbox) {
return;
}
var empty = true;
var rules = searchboxsync.RuleService.rules;
if (rules != null) {
for (var i = 0; i < rules.length; i++) {
if (rules[i].disabled == true) {
continue;
}
var regex = searchboxsync.RuleService.makeUrlRegex(rules[i]);
if (regex == null) {
continue;
}
var terms = searchboxsync.Util.extractTerms(regex, aUrl);
if (terms && terms != "") {
this.searchbar.removeAttribute("empty");
this.searchbox.value = terms;
var evt = document.createEvent("Events");
evt.initEvent("oninput", true, true);
this.searchbar.dispatchEvent(evt);
empty = false;
break;
}
}
}
if (empty == true)
{
if (this.searchbox.value != "")
{
this.searchbox.value = "";
var evt = document.createEvent("Events");
evt.initEvent("oninput", true, true);
this.searchbar.dispatchEvent(evt);
}
}
}
Original issue reported on code.google.com by legege on 31 Jul 2009 at 2:15
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
legege
on 31 Jul 2009 at 2:15The text was updated successfully, but these errors were encountered: