From 3743c179e1ef14ee6f95962304cc8c69115470b6 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 21 Jun 2022 01:23:22 -0400 Subject: [PATCH] Add missing commonDialog.js from dictionary manager Currently provides close-on-Esc functionality --- chrome/content/zotero/commonDialog.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 chrome/content/zotero/commonDialog.js diff --git a/chrome/content/zotero/commonDialog.js b/chrome/content/zotero/commonDialog.js new file mode 100644 index 0000000000..26f0a59637 --- /dev/null +++ b/chrome/content/zotero/commonDialog.js @@ -0,0 +1,14 @@ +window.addEventListener('keypress', function (event) { + if (event.key == 'Escape') { + try { + let elem = document.querySelector('button[dlgtype="cancel"]'); + if (!elem) { + elem = document.getElementById('cancel-button'); + } + elem.click(); + } + catch (e) { + window.close(); + } + } +}); \ No newline at end of file