зеркало из https://github.com/mozilla/pjs.git
Bug 281563 Help Viewer search results should be updated with every keystroke (live search) - orginal patch for firefox by steffen.wilberg@web.de on bug 271299
p=me r=neil.parkwaycc.co.uk
This commit is contained in:
Родитель
8eae41cf1a
Коммит
3620f540ab
|
@ -503,14 +503,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;
|
||||
RE[i] = new RegExp(RE[i], "i");
|
||||
// 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;
|
||||
}
|
||||
|
||||
// compile the search string, which has already been split up above, into regexps
|
||||
for (var i=0; i < RE.length; ++i) {
|
||||
RE[i] = new RegExp(RE[i], "i");
|
||||
}
|
||||
emptySearch = true;
|
||||
emptySearch = true;
|
||||
|
||||
// search TOC
|
||||
var resultsDS = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"].createInstance(Components.interfaces.nsIRDFDataSource);
|
||||
var tree = document.getElementById("help-toc-panel");
|
||||
|
@ -545,12 +550,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()) {
|
||||
|
|
|
@ -209,14 +209,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" ref="urn:root"
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
<!-- Left panel -->
|
||||
<!ENTITY glossarytab.label "Glossary">
|
||||
<!ENTITY glossarytab.accesskey "G">
|
||||
<!ENTITY gobtn.label "Search">
|
||||
<!ENTITY indextab.label "Index">
|
||||
<!ENTITY indextab.accesskey "I">
|
||||
<!ENTITY searchtab.label "Search">
|
||||
|
|
Загрузка…
Ссылка в новой задаче