зеркало из https://github.com/mozilla/pjs.git
Bug 271299: Help Viewer search results should be updated with every keystroke (live search). r=jan
This commit is contained in:
Родитель
e6e1eca2d1
Коммит
ac44cfa4a2
|
@ -620,15 +620,19 @@ function doFind() {
|
|||
// clear any previous results.
|
||||
clearDatabases(searchTree.database);
|
||||
|
||||
// split search string into separate terms and compile into regexp's
|
||||
RE = findText.value.split(/\s+/);
|
||||
for (var i=0; i < RE.length; ++i) {
|
||||
if (RE[i] == "")
|
||||
continue;
|
||||
// if the search string is empty or contains only whitespace, purge the results tree and return
|
||||
RE = findText.value.match(/\S+/g);
|
||||
if (!RE) {
|
||||
searchTree.builder.rebuild();
|
||||
return;
|
||||
}
|
||||
|
||||
RE[i] = new RegExp(RE[i], "i");
|
||||
// compile the search string, which has already been split up above, into regexp's
|
||||
for (var i=0; i < RE.length; ++i) {
|
||||
RE[i] = new RegExp(RE[i], "i");
|
||||
}
|
||||
emptySearch = true;
|
||||
|
||||
// search TOC
|
||||
var resultsDS = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"]
|
||||
.createInstance(Components.interfaces.nsIRDFDataSource);
|
||||
|
@ -661,12 +665,6 @@ function doFind() {
|
|||
searchTree.builder.rebuild();
|
||||
}
|
||||
|
||||
function doEnabling() {
|
||||
var findButton = document.getElementById("findButton");
|
||||
var findTextbox = document.getElementById("findText");
|
||||
findButton.disabled = !findTextbox.value;
|
||||
}
|
||||
|
||||
function clearDatabases(compositeDataSource) {
|
||||
var enumDS = compositeDataSource.GetDataSources()
|
||||
while (enumDS.hasMoreElements()) {
|
||||
|
|
|
@ -315,16 +315,8 @@
|
|||
accesskey="&searchtab.accesskey;"/>
|
||||
|
||||
<vbox id="help-search-panel" hidden="true" flex="1">
|
||||
<hbox align="center">
|
||||
<textbox id="findText" flex="1" oninput="doEnabling();"
|
||||
onkeypress="if ((event.keyCode
|
||||
== KeyEvent.DOM_VK_ENTER) || (event.keyCode
|
||||
== KeyEvent.DOM_VK_RETURN))
|
||||
doFind();"/>
|
||||
<button id="findButton" default="true" disabled="true"
|
||||
label="&gobtn.label;" oncommand="doFind()"
|
||||
flex="0"/>
|
||||
</hbox>
|
||||
<textbox id="findText" type="timed" timeout="500"
|
||||
oncommand="doFind();"/>
|
||||
<tree id="help-search-tree" class="focusring"
|
||||
flex="1" hidecolumnpicker="true"
|
||||
datasources="rdf:null"
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
<!ENTITY glossarytab.label "Glossary">
|
||||
<!ENTITY glossarytab.accesskey "G">
|
||||
<!ENTITY glossname.label "Name">
|
||||
<!ENTITY gobtn.label "Search">
|
||||
<!ENTITY name.label "Item">
|
||||
|
||||
<!ENTITY textZoomReduceCmd.commandkey "-">
|
||||
|
|
Загрузка…
Ссылка в новой задаче