Repository: incubator-htrace
Updated Branches:
  refs/heads/master 5bbba1f6c -> c6d90e724


HTRACE-203. htrace-web: pressing enter should dismiss the modal dialog box 
(Colin Patrick McCabe via iwasakims)


Project: http://git-wip-us.apache.org/repos/asf/incubator-htrace/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-htrace/commit/c6d90e72
Tree: http://git-wip-us.apache.org/repos/asf/incubator-htrace/tree/c6d90e72
Diff: http://git-wip-us.apache.org/repos/asf/incubator-htrace/diff/c6d90e72

Branch: refs/heads/master
Commit: c6d90e724ec6900c3e8e1f7c4f198fa456510239
Parents: 5bbba1f
Author: Masatake Iwasaki <[email protected]>
Authored: Wed Jul 8 11:16:52 2015 +0900
Committer: Masatake Iwasaki <[email protected]>
Committed: Wed Jul 8 11:16:52 2015 +0900

----------------------------------------------------------------------
 htrace-webapp/src/main/web/app/modal.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/c6d90e72/htrace-webapp/src/main/web/app/modal.js
----------------------------------------------------------------------
diff --git a/htrace-webapp/src/main/web/app/modal.js 
b/htrace-webapp/src/main/web/app/modal.js
index 91d55fe..aed3fdc 100644
--- a/htrace-webapp/src/main/web/app/modal.js
+++ b/htrace-webapp/src/main/web/app/modal.js
@@ -30,5 +30,13 @@ htrace.showModalWarning = function(title, body) {
 htrace.showModal = function(html) {
   var el = $("#modal");
   el.html(html);
+  // Dismiss the modal dialog box when enter is pressed.
+  $(document).on("keypress", function(e) {
+    if (e.which === 13) {
+      $(document).off('keypress');
+      $('#modal button:first', $(this)).click();
+      return false;
+    }
+  });
   el.modal();
-}
+};

Reply via email to