diff --git a/src/General/css/style.css b/src/General/css/style.css index eef9c68df..7d81efb72 100755 --- a/src/General/css/style.css +++ b/src/General/css/style.css @@ -969,7 +969,7 @@ span.hide-announcement { /* QR */ :root.hide-original-post-form #togglePostFormLink, -#qr.autohide:not(.focus):not(:hover):not(:active):not(.captcha-open) > form, +#qr.autohide:not(.focus):not(:hover):not(:active) > form, :root.thread-view #qr:not(.show-new-thread-option) select[data-name="thread"], #file-n-submit:not(.has-file) #qr-filerm { display: none; diff --git a/src/Posting/Captcha.noscript.coffee b/src/Posting/Captcha.noscript.coffee index 8fc005de6..3cd387d47 100644 --- a/src/Posting/Captcha.noscript.coffee +++ b/src/Posting/Captcha.noscript.coffee @@ -16,8 +16,6 @@ Captcha.noscript = spellcheck: false @nodes = {container, input} - $.on input, 'blur', QR.focusout - $.on input, 'focus', QR.focusin $.on input, 'keydown', @keydown.bind @ $.on @nodes.container, 'click', => @reload() diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index 46496054d..baa89cba6 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -37,6 +37,9 @@ QR = $.on d, '4chanXInitFinished', @initReady + window.addEventListener 'focus', @focus, true + window.addEventListener 'blur', @focus, true + Post.callbacks.push name: 'Quick Reply' cb: @node @@ -127,11 +130,14 @@ QR = QR.cooldown.auto = false QR.status() QR.captcha.destroy() - focusin: -> - QR.captcha.setup() if $.hasClass(QR.nodes.el, 'autohide') and !$.hasClass(QR.nodes.el, 'focus') - $.addClass QR.nodes.el, 'focus' - focusout: -> - $.rmClass QR.nodes.el, 'focus' + focus: -> + $.queueTask -> + return unless QR.nodes + if d.activeElement and QR.nodes.el.contains d.activeElement + QR.captcha.setup() if $.hasClass(QR.nodes.el, 'autohide') and !$.hasClass(QR.nodes.el, 'focus') + $.addClass QR.nodes.el, 'focus' + else + $.rmClass QR.nodes.el, 'focus' hide: -> d.activeElement.blur() $.addClass QR.nodes.el, 'autohide' @@ -518,12 +524,6 @@ QR = $.on nodes.filename.parentNode, 'click keydown', QR.openFileInput - items = $$ '*', QR.nodes.el - i = 0 - while elm = items[i++] - $.on elm, 'blur', QR.focusout - $.on elm, 'focus', QR.focusin - $.on nodes.autohide, 'change', QR.toggleHide $.on nodes.close, 'click', QR.close $.on nodes.dumpButton, 'click', -> nodes.el.classList.toggle 'dump' diff --git a/src/Posting/QR.post.coffee b/src/Posting/QR.post.coffee index c37d2ed2c..9d1f4cee3 100644 --- a/src/Posting/QR.post.coffee +++ b/src/Posting/QR.post.coffee @@ -13,12 +13,6 @@ QR.post = class spoiler: $ 'input', el span: el.lastChild - <% if (type === 'userscript') { %> - # XXX Firefox lacks focusin/focusout support. - for elm in $$ '*', el - $.on elm, 'blur', QR.focusout - $.on elm, 'focus', QR.focusin - <% } %> $.on el, 'click', @select $.on @nodes.rm, 'click', (e) => e.stopPropagation(); @rm() $.on @nodes.label, 'click', (e) => e.stopPropagation()