From 31feb93d968a05b9d20347bcf018de2f7715a268 Mon Sep 17 00:00:00 2001
From: Paul van Tilburg
Date: Sun, 12 Sep 2010 12:36:20 +0200
Subject: [PATCH] Added support for the Plus key (shows the add/upload dialog).
---
public/dragreg.js | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/public/dragreg.js b/public/dragreg.js
index 70b44c7..e42229c 100644
--- a/public/dragreg.js
+++ b/public/dragreg.js
@@ -47,6 +47,9 @@ function key_handler(e) {
case 27: /* Escape */
hide_add_dialog();
break;
+ case 187: /* Plus */
+ show_add_dialog();
+ break;
}
}
@@ -54,14 +57,18 @@ function key_handler(e) {
// Shows the upload/add dialog.
function show_add_dialog() {
- $('text').clear();
- $('add_dialog').appear({duration: 0.25});
+ if (!$('add_dialog').visible()) {
+ $('text').clear();
+ $('add_dialog').appear({duration: 0.25});
+ }
}
// Hides and clears the upload/add dialog.
function hide_add_dialog() {
- $('add_dialog').fade({duration: 0.25});
- $('add_form').reset();
+ if ($('add_dialog').visible()) {
+ $('add_dialog').fade({duration: 0.25});
+ $('add_form').reset();
+ }
}
// Returns a Z-index higher with respect to the Z-index of all existing