From 769dfd95fabb52e3bf664d5c30bf8f609bc5f1dd Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 16 Sep 2013 03:20:11 +1000 Subject: [PATCH] add ability to close quick reply --- js/quick-reply.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/js/quick-reply.js b/js/quick-reply.js index 7cfc9ac3..61832ea7 100644 --- a/js/quick-reply.js +++ b/js/quick-reply.js @@ -59,6 +59,17 @@ var do_css = function() { padding: 2px 0;\ border: 1px solid #222;\ }\ + #quick-reply th .handle {\ + float: left;\ + position: absolute;\ + left: 0;\ + right: 30px;\ + display: inline-block;\ + }\ + #quick-reply th .close-btn {\ + float: right;\ + padding: 0 5px;\ + }\ #quick-reply input[type="text"] {\ width: 100%;\ padding: 2px;\ @@ -187,7 +198,10 @@ var show_quick_reply = function(){ $postForm.find('textarea:not([name="body"]),input[type="hidden"]').appendTo($dummyStuff); $postForm.find('br').remove(); - $postForm.find('table').prepend('' + _('Quick Reply') + ''); + $postForm.find('table').prepend('\ + ' + _('Quick Reply') + '\ + X\ + '); $postForm.attr('id', 'quick-reply'); @@ -208,7 +222,7 @@ var show_quick_reply = function(){ $('form[name="post"]:first [name="' + $(this).attr('name') + '"]').val($(this).val()); }); - if (typeof $postForm.draggable != undefined) { + if (typeof $postForm.draggable != 'undefined') { if (localStorage.quickReplyPosition) { var offset = JSON.parse(localStorage.quickReplyPosition); if (offset.right > $(window).width() - $postForm.width()) @@ -218,10 +232,9 @@ var show_quick_reply = function(){ $postForm.css('right', offset.right).css('top', offset.top); } $postForm.draggable({ - handle: 'th', + handle: 'th .handle', containment: 'window', distance: 10, - opacity: 0.9, scroll: false, stop: function() { var offset = { @@ -233,8 +246,12 @@ var show_quick_reply = function(){ $postForm.css('right', offset.right).css('top', offset.top).css('left', 'auto'); } }); - $postForm.find('th').css('cursor', 'move'); + $postForm.find('th .handle').css('cursor', 'move'); } + + $postForm.find('th .close-btn').click(function() { + $postForm.remove(); + }); $postForm.show(); $(window).trigger('quick-reply');