aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/webui/static
diff options
context:
space:
mode:
Diffstat (limited to 'fg21sim/webui/static')
-rw-r--r--fg21sim/webui/static/js/login.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/fg21sim/webui/static/js/login.js b/fg21sim/webui/static/js/login.js
new file mode 100644
index 0000000..301de73
--- /dev/null
+++ b/fg21sim/webui/static/js/login.js
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2016 Weitian LI <liweitianux@live.com>
+ * MIT license
+ *
+ * JavaScript codes for the Web UI of "fg21sim"
+ */
+
+"use strict";
+
+
+$(document).ready(function () {
+ /**
+ * Submit the login form on "Enter" key
+ * Credit: https://stackoverflow.com/a/12518467/4856091
+ */
+ $("form#login input").keypress(function (e) {
+ if (e.which === 13) {
+ // "Enter" key pressed
+ $(e.target).closest("form").submit();
+ return false;
+ }
+ });
+});