allow quick-reply to work with image spoilers

This commit is contained in:
Michael Foster 2013-09-15 10:16:33 +10:00
parent 260908025c
commit 91e973fd6e

View File

@ -21,7 +21,7 @@ var show_quick_reply = function(){
#quick-reply {\ #quick-reply {\
position: fixed;\ position: fixed;\
right: 0;\ right: 0;\
top: 10%;\ top: 5%;\
float: right;\ float: right;\
background: #D6DAF0;\ background: #D6DAF0;\
display: block;\ display: block;\
@ -33,6 +33,14 @@ var show_quick_reply = function(){
margin: 0;\ margin: 0;\
width: 100%;\ width: 100%;\
}\ }\
#quick-reply tr td:nth-child(2) {\
white-space: nowrap;\
text-align: right;\
padding-right: 4px;\
}\
#quick-reply tr td:nth-child(2) input[type="submit"] {\
width: 100%;\
}\
#quick-reply th, #quick-reply td {\ #quick-reply th, #quick-reply td {\
margin: 0;\ margin: 0;\
padding: 0;\ padding: 0;\
@ -45,7 +53,6 @@ var show_quick_reply = function(){
#quick-reply input[type="text"] {\ #quick-reply input[type="text"] {\
width: 100%;\ width: 100%;\
padding: 2px;\ padding: 2px;\
margin: 0 0 1px 0;\
font-size: 10pt;\ font-size: 10pt;\
box-sizing: border-box;\ box-sizing: border-box;\
-webkit-box-sizing:border-box;\ -webkit-box-sizing:border-box;\
@ -58,8 +65,11 @@ var show_quick_reply = function(){
-moz-box-sizing: border-box;\ -moz-box-sizing: border-box;\
font-size: 10pt;\ font-size: 10pt;\
}\ }\
#quick-reply input, #quick-reply select, #quick-reply textarea {\
margin: 0 0 1px 0;\
}\
#quick-reply input[type="file"] {\ #quick-reply input[type="file"] {\
padding: 5px 0;\ padding: 5px 2px;\
}\ }\
#quick-reply .nonsense {\ #quick-reply .nonsense {\
display: none;\ display: none;\
@ -81,8 +91,8 @@ var show_quick_reply = function(){
$dummyStuff = $('<div class="nonsense"></div>').appendTo($postForm); $dummyStuff = $('<div class="nonsense"></div>').appendTo($postForm);
$postForm.find('table tr').each(function() { $postForm.find('table tr').each(function() {
var $th = $(this).children('th'); var $th = $(this).children('th:first');
var $td = $(this).children('td'); var $td = $(this).children('td:first');
if ($th.length && $td.length) { if ($th.length && $td.length) {
$td.attr('colspan', 2); $td.attr('colspan', 2);
@ -126,11 +136,26 @@ var show_quick_reply = function(){
}).remove(); }).remove();
$td.find('input[name="file_url"]').removeAttr('id'); $td.find('input[name="file_url"]').removeAttr('id');
} }
if ($(this).find('input[name="spoiler"]').length) {
$td.removeAttr('colspan');
}
} }
// Remove mod controls, because it looks shit. // Remove mod controls, because it looks shit.
if ($td.find('input[type="checkbox"]').length) { if ($td.find('input[type="checkbox"]').length) {
$(this).remove(); var tr = this;
$td.find('input[type="checkbox"]').each(function() {
if ($(this).attr('name') == 'spoiler') {
$td.find('label').remove();
$(this).attr('id', 'q-spoiler-image');
$postForm.find('input[type="file"]').parent()
.removeAttr('colspan')
.after($('<td class="spoiler"></td>').append(this, ' ', $('<label for="q-spoiler-image">').text(_('Spoiler Image'))));
} else {
$(tr).remove();
}
});
} }
} }
}); });