add ability to close quick reply
This commit is contained in:
parent
d49b145f9a
commit
769dfd95fa
@ -59,6 +59,17 @@ var do_css = function() {
|
|||||||
padding: 2px 0;\
|
padding: 2px 0;\
|
||||||
border: 1px solid #222;\
|
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"] {\
|
#quick-reply input[type="text"] {\
|
||||||
width: 100%;\
|
width: 100%;\
|
||||||
padding: 2px;\
|
padding: 2px;\
|
||||||
@ -187,7 +198,10 @@ var show_quick_reply = function(){
|
|||||||
$postForm.find('textarea:not([name="body"]),input[type="hidden"]').appendTo($dummyStuff);
|
$postForm.find('textarea:not([name="body"]),input[type="hidden"]').appendTo($dummyStuff);
|
||||||
|
|
||||||
$postForm.find('br').remove();
|
$postForm.find('br').remove();
|
||||||
$postForm.find('table').prepend('<tr><th colspan="2">' + _('Quick Reply') + '</th></tr>');
|
$postForm.find('table').prepend('<tr><th colspan="2">\
|
||||||
|
<span class="handle">' + _('Quick Reply') + '</span>\
|
||||||
|
<a class="close-btn" href="javascript:void(0)">X</a>\
|
||||||
|
</th></tr>');
|
||||||
|
|
||||||
$postForm.attr('id', 'quick-reply');
|
$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());
|
$('form[name="post"]:first [name="' + $(this).attr('name') + '"]').val($(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeof $postForm.draggable != undefined) {
|
if (typeof $postForm.draggable != 'undefined') {
|
||||||
if (localStorage.quickReplyPosition) {
|
if (localStorage.quickReplyPosition) {
|
||||||
var offset = JSON.parse(localStorage.quickReplyPosition);
|
var offset = JSON.parse(localStorage.quickReplyPosition);
|
||||||
if (offset.right > $(window).width() - $postForm.width())
|
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.css('right', offset.right).css('top', offset.top);
|
||||||
}
|
}
|
||||||
$postForm.draggable({
|
$postForm.draggable({
|
||||||
handle: 'th',
|
handle: 'th .handle',
|
||||||
containment: 'window',
|
containment: 'window',
|
||||||
distance: 10,
|
distance: 10,
|
||||||
opacity: 0.9,
|
|
||||||
scroll: false,
|
scroll: false,
|
||||||
stop: function() {
|
stop: function() {
|
||||||
var offset = {
|
var offset = {
|
||||||
@ -233,9 +246,13 @@ var show_quick_reply = function(){
|
|||||||
$postForm.css('right', offset.right).css('top', offset.top).css('left', 'auto');
|
$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();
|
$postForm.show();
|
||||||
$(window).trigger('quick-reply');
|
$(window).trigger('quick-reply');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user