From f548a03e69422b486ff9cb8bedb631b715ee15bb Mon Sep 17 00:00:00 2001 From: marktaiwan Date: Sun, 25 Jan 2015 17:55:26 +0800 Subject: [PATCH] Add 'esc' keybind to close quick-reply. --- js/quick-reply.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/quick-reply.js b/js/quick-reply.js index 7156b224..eaa152fd 100644 --- a/js/quick-reply.js +++ b/js/quick-reply.js @@ -278,7 +278,13 @@ } }); - $postForm.find('textarea[name="body"]').removeAttr('id').removeAttr('cols').attr('placeholder', _('Comment')); + $postForm.find('textarea[name="body"]').removeAttr('id').removeAttr('cols').attr('placeholder', _('Comment')) + .on('keydown', function (e) { + //close quick reply when esc is prssed + if (e.which === 27) { + $('.close-btn').trigger('click'); + } + }); $postForm.find('textarea:not([name="body"]),input[type="hidden"]:not(.captcha_cookie)').removeAttr('id').appendTo($dummyStuff);