Advanced quick search mode was searching after every keypress
This commit is contained in:
parent
04bab1f28f
commit
249e8fa857
|
@ -1457,13 +1457,11 @@ var ZoteroPane = new function()
|
|||
if (event.keyCode == event.DOM_VK_ESCAPE) {
|
||||
textbox.value = '';
|
||||
ZoteroPane.setItemsPaneMessage(Zotero.getString('searchInProgress'));
|
||||
setTimeout("document.getElementById('zotero-tb-search').doCommand('cmd_zotero_search'); ZoteroPane.clearItemsPaneMessage();", 1);
|
||||
setTimeout("ZoteroPane.search(); ZoteroPane.clearItemsPaneMessage();", 1);
|
||||
}
|
||||
else if (event.keyCode == event.DOM_VK_RETURN ||
|
||||
event.keyCode == event.DOM_VK_ENTER) {
|
||||
textbox.skipTimeout = true;
|
||||
else if (event.keyCode == event.DOM_VK_RETURN || event.keyCode == event.DOM_VK_ENTER) {
|
||||
ZoteroPane.setItemsPaneMessage(Zotero.getString('searchInProgress'));
|
||||
setTimeout("document.getElementById('zotero-tb-search').doCommand('cmd_zotero_search'); ZoteroPane.clearItemsPaneMessage();", 1);
|
||||
setTimeout("ZoteroPane.search(true); ZoteroPane.clearItemsPaneMessage();", 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1472,9 +1470,8 @@ var ZoteroPane = new function()
|
|||
// This is the new length, except, it seems, when the change is a
|
||||
// result of Undo or Redo
|
||||
if (!textbox.value.length) {
|
||||
textbox.skipTimeout = true;
|
||||
ZoteroPane.setItemsPaneMessage(Zotero.getString('searchInProgress'));
|
||||
setTimeout("document.getElementById('zotero-tb-search').doCommand('cmd_zotero_search'); ZoteroPane.clearItemsPaneMessage();", 1);
|
||||
setTimeout("ZoteroPane.search(); ZoteroPane.clearItemsPaneMessage();", 1);
|
||||
}
|
||||
else if (textbox.value.indexOf('"') != -1) {
|
||||
ZoteroPane.setItemsPaneMessage(Zotero.getString('advancedSearchMode'));
|
||||
|
@ -1482,10 +1479,14 @@ var ZoteroPane = new function()
|
|||
}
|
||||
|
||||
|
||||
function search()
|
||||
function search(runAdvanced)
|
||||
{
|
||||
if (this.itemsView) {
|
||||
var searchVal = document.getElementById('zotero-tb-search').value;
|
||||
var search = document.getElementById('zotero-tb-search');
|
||||
if (!runAdvanced && search.value.indexOf('"') != -1) {
|
||||
return;
|
||||
}
|
||||
var searchVal = search.value;
|
||||
this.itemsView.setFilter('search', searchVal);
|
||||
|
||||
document.getElementById('zotero-tb-search-cancel').hidden = searchVal == "";
|
||||
|
|
|
@ -243,10 +243,7 @@
|
|||
<label id="zotero-tb-search-label" value="&zotero.toolbar.search.label;" control="zotero-tb-search" hidden="true"/>
|
||||
<textbox id="zotero-tb-search" type="search" timeout="250" command="cmd_zotero_search" dir="reverse"
|
||||
onkeypress="ZoteroPane.handleSearchKeypress(this, event)"
|
||||
oninput="ZoteroPane.handleSearchInput(this, event)"
|
||||
testcode="me.value.indexOf('"') == -1"
|
||||
prefire="ZoteroPane.clearItemsPaneMessage()"
|
||||
ontestfail="ZoteroPane.setItemsPaneMessage(Zotero.getString('advancedSearchMode'))">
|
||||
oninput="ZoteroPane.handleSearchInput(this, event)">
|
||||
<toolbarbutton id="zotero-tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/>
|
||||
</textbox>
|
||||
</hbox>
|
||||
|
|
Loading…
Reference in New Issue
Block a user