aboutsummaryrefslogtreecommitdiff
path: root/juick-www
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www')
-rw-r--r--juick-www/src/main/static/scripts.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js
index 244c83c6..a2f25d07 100644
--- a/juick-www/src/main/static/scripts.js
+++ b/juick-www/src/main/static/scripts.js
@@ -273,13 +273,19 @@ function updateRepliesCounter() {
/******************************************************************************/
function postformListener(formEl, ev) {
- var form = formEl.closest('form');
if (ev.ctrlKey && (ev.keyCode == 10 || ev.keyCode == 13)) {
+ let form = formEl.closest('form');
if (!form.onsubmit || form.onsubmit()) {
form.submit();
}
}
}
+function closeDialogListener(ev) {
+ ev = ev || window.event;
+ if (ev.keyCode == 27) {
+ closeDialog();
+ }
+}
function newMessage() {
if (document.querySelector('#newmessage textarea').value.length == 0) {
@@ -516,6 +522,7 @@ function openDialog(html) {
</div>
</div>`;
document.querySelector('body').insertAdjacentHTML('afterbegin', dialogHtml);
+ document.addEventListener('keydown', closeDialogListener);
document.querySelector('#dialogb').addEventListener('click', closeDialog);
document.querySelector('#dialogc').addEventListener('click', closeDialog);
}