Fix QR hiding issue.
We should now be able to tell when the QR is focused even when within the captcha <iframe>. No longer need to hold open QR when there is a captcha.
This commit is contained in:
parent
a9e7240547
commit
dd7dbf80f4
@ -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;
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user