www

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

commit 617646f0a26ddc653734608fa19a86da38501102
parent 09e07df2942ca452e94928b105d2483e16c7bd84
Author: Simon Kornblith <simon@simonster.com>
Date:   Sun, 24 Jul 2011 17:49:16 +0000

Cancel should close lookup panel


Diffstat:
Mchrome/content/zotero/lookup.js | 13+++++++++++++
Mchrome/content/zotero/zoteroPane.xul | 2+-
2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/lookup.js b/chrome/content/zotero/lookup.js @@ -92,6 +92,19 @@ const Zotero_Lookup = new function () { } /** + * Handles a key press + */ + this.onKeyPress = function(event) { + var keyCode = event.keyCode; + if(keyCode === 13 || keyCode === 14) { + Zotero_Lookup.accept(); + } else if(keyCode == event.DOM_VK_ESCAPE) { + document.getElementById("zotero-lookup-panel").hidePopup(); + } + return true; + } + + /** * Focuses the field */ this.onShowing = function() { diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul @@ -145,7 +145,7 @@ onpopuphidden="Zotero_Lookup.onHidden()" noautohide="true"> <vbox> <description>&zotero.lookup.description;</description> - <textbox id="zotero-lookup-textbox" style="margin: 2px 0 2px 0" onkeypress="if([13, 14].indexOf(event.keyCode) !== -1) { Zotero_Lookup.accept(); } return true;" flex="1"/> + <textbox id="zotero-lookup-textbox" style="margin: 2px 0 2px 0" onkeypress="return Zotero_Lookup.onKeyPress(event)" flex="1"/> <hbox> <toolbarbutton class="zotero-small-progress-indicator" id="zotero-lookup-progress"/> <spacer flex="1"/>