Advanced quick search mode was searching after every keypress
This commit is contained in:
parent
04bab1f28f
commit
249e8fa857
2 changed files with 11 additions and 13 deletions
|
@ -1457,13 +1457,11 @@ var ZoteroPane = new function()
|
||||||
if (event.keyCode == event.DOM_VK_ESCAPE) {
|
if (event.keyCode == event.DOM_VK_ESCAPE) {
|
||||||
textbox.value = '';
|
textbox.value = '';
|
||||||
ZoteroPane.setItemsPaneMessage(Zotero.getString('searchInProgress'));
|
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 ||
|
else if (event.keyCode == event.DOM_VK_RETURN || event.keyCode == event.DOM_VK_ENTER) {
|
||||||
event.keyCode == event.DOM_VK_ENTER) {
|
|
||||||
textbox.skipTimeout = true;
|
|
||||||
ZoteroPane.setItemsPaneMessage(Zotero.getString('searchInProgress'));
|
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
|
// This is the new length, except, it seems, when the change is a
|
||||||
// result of Undo or Redo
|
// result of Undo or Redo
|
||||||
if (!textbox.value.length) {
|
if (!textbox.value.length) {
|
||||||
textbox.skipTimeout = true;
|
|
||||||
ZoteroPane.setItemsPaneMessage(Zotero.getString('searchInProgress'));
|
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) {
|
else if (textbox.value.indexOf('"') != -1) {
|
||||||
ZoteroPane.setItemsPaneMessage(Zotero.getString('advancedSearchMode'));
|
ZoteroPane.setItemsPaneMessage(Zotero.getString('advancedSearchMode'));
|
||||||
|
@ -1482,10 +1479,14 @@ var ZoteroPane = new function()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function search()
|
function search(runAdvanced)
|
||||||
{
|
{
|
||||||
if (this.itemsView) {
|
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);
|
this.itemsView.setFilter('search', searchVal);
|
||||||
|
|
||||||
document.getElementById('zotero-tb-search-cancel').hidden = 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"/>
|
<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"
|
<textbox id="zotero-tb-search" type="search" timeout="250" command="cmd_zotero_search" dir="reverse"
|
||||||
onkeypress="ZoteroPane.handleSearchKeypress(this, event)"
|
onkeypress="ZoteroPane.handleSearchKeypress(this, event)"
|
||||||
oninput="ZoteroPane.handleSearchInput(this, event)"
|
oninput="ZoteroPane.handleSearchInput(this, event)">
|
||||||
testcode="me.value.indexOf('"') == -1"
|
|
||||||
prefire="ZoteroPane.clearItemsPaneMessage()"
|
|
||||||
ontestfail="ZoteroPane.setItemsPaneMessage(Zotero.getString('advancedSearchMode'))">
|
|
||||||
<toolbarbutton id="zotero-tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/>
|
<toolbarbutton id="zotero-tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/>
|
||||||
</textbox>
|
</textbox>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue