diff --git a/4chan_x.user.js b/4chan_x.user.js index 62385a572..a2d5ea868 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1230,15 +1230,15 @@ qr = { init: function() { var iframe; + g.callbacks.push(qr.node); + $.bind(window, 'message', qr.message); + $.bind($('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode); + qr.captcha = []; iframe = $.el('iframe', { name: 'iframe', hidden: true }); $.append(d.body, iframe); - g.callbacks.push(qr.node); - $.bind(window, 'message', qr.message); - $.bind($('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode); - qr.captcha = []; return $('#recaptcha_response_field').id = ''; }, attach: function() { @@ -1263,12 +1263,10 @@ }, autohide: { set: function() { - var _ref; - return (_ref = $('#autohide:not(:checked)', qr.el)) != null ? _ref.click() : void 0; + return $('#autohide').checked = true; }, unset: function() { - var _ref; - return (_ref = $('#autohide:checked', qr.el)) != null ? _ref.click() : void 0; + return $('#autohide').checked = false; } }, captchaNode: function(e) { @@ -1290,13 +1288,6 @@ } }, cb: { - autohide: function(e) { - if (this.checked) { - return $.addClass(qr.el, 'auto'); - } else { - return $.removeClass(qr.el, 'auto'); - } - }, quote: function(e) { e.preventDefault(); return qr.quote(this); @@ -1313,7 +1304,7 @@ THREAD_ID = g.THREAD_ID || $.x('ancestor::div[@class="thread"]/div', link).id; spoiler = $('.postarea label') ? '' : ''; challenge = $('#recaptcha_challenge_field').value; - html = "
Quick Reply X
" + spoiler + "
0
attach another file
"; + html = " X
Quick Reply
" + spoiler + "
0
attach another file
"; qr.el = ui.dialog('qr', { top: '0px', left: '0px' @@ -1323,8 +1314,7 @@ $.bind($('input[name=name]', qr.el), 'mousedown', function(e) { return e.stopPropagation(); }); - $.bind($('#autohide', qr.el), 'click', qr.cb.autohide); - $.bind($('a[name=close]', qr.el), 'click', qr.close); + $.bind($('#close', qr.el), 'click', qr.close); $.bind($('form', qr.el), 'submit', qr.submit); $.bind($('a[name=attach]', qr.el), 'click', qr.attach); $.bind($('img', qr.el), 'click', Recaptcha.reload); @@ -3002,7 +2992,10 @@ width: 100%;\ height: 120px;\ }\ - #qr.auto:not(:hover) > form {\ + #qr #close, #qr #autohide {\ + float: right;\ + }\ + #qr:not(:hover) > #autohide:checked ~ form {\ height: 0;\ overflow: hidden;\ }\ diff --git a/script.coffee b/script.coffee index 211fb83cd..1d0c32546 100644 --- a/script.coffee +++ b/script.coffee @@ -1000,9 +1000,9 @@ qr = autohide: set: -> - $('#autohide:not(:checked)', qr.el)?.click() + $('#autohide').checked = true unset: -> - $('#autohide:checked', qr.el)?.click() + $('#autohide').checked = false captchaNode: (e) -> return unless qr.el @@ -1017,12 +1017,6 @@ qr = qr.push.call this cb: - autohide: (e) -> - if @checked - $.addClass qr.el, 'auto' - else - $.removeClass qr.el, 'auto' - quote: (e) -> e.preventDefault() qr.quote @ @@ -1039,11 +1033,11 @@ qr = spoiler = if $('.postarea label') then '' else '' challenge = $('#recaptcha_challenge_field').value html = " + X +
Quick Reply - - X
@@ -1065,8 +1059,7 @@ qr = $('textarea', qr.el).value = $('textarea').value $.bind $('input[name=name]', qr.el), 'mousedown', (e) -> e.stopPropagation() - $.bind $('#autohide', qr.el), 'click', qr.cb.autohide - $.bind $('a[name=close]', qr.el), 'click', qr.close + $.bind $('#close', qr.el), 'click', qr.close $.bind $('form', qr.el), 'submit', qr.submit $.bind $('a[name=attach]', qr.el), 'click', qr.attach $.bind $('img', qr.el), 'click', Recaptcha.reload @@ -2392,7 +2385,10 @@ main = width: 100%; height: 120px; } - #qr.auto:not(:hover) > form { + #qr #close, #qr #autohide { + float: right; + } + #qr:not(:hover) > #autohide:checked ~ form { height: 0; overflow: hidden; }