www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 249e8fa857cc5a13fcf50def24764a12b7dec18a
parent 04bab1f28f11b1225691595f04da4ccc87c5e6b7
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 14 Oct 2009 09:53:50 +0000

Advanced quick search mode was searching after every keypress


Diffstat:
Mchrome/content/zotero/overlay.js | 19++++++++++---------
Mchrome/content/zotero/overlay.xul | 5+----
2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js @@ -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 == ""; diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul @@ -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('&quot;') == -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>