Merge branch 'Stable' into Beta
Conflicts: LICENSE builds/4chan-X-beta.crx builds/4chan-X-beta.meta.js builds/4chan-X-beta.user.js builds/4chan-X-noupdate.crx builds/4chan-X-noupdate.user.js builds/4chan-X.crx builds/4chan-X.meta.js builds/4chan-X.user.js builds/4chan-X.zip builds/updates-beta.xml builds/updates.xml package.json
This commit is contained in:
commit
f53937af2f
@ -58,6 +58,13 @@ Based on v1.9.14.2.
|
|||||||
- Bug fixes.
|
- Bug fixes.
|
||||||
|
|
||||||
<!-- v1.9.14.x -->
|
<!-- v1.9.14.x -->
|
||||||
|
### v1.9.14.7
|
||||||
|
*2014-12-09* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.14.7/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.14.7/builds/4chan-X-noupdate.crx "Chromium version")]
|
||||||
|
|
||||||
|
**ccd0**
|
||||||
|
- Fix more captcha bugs.
|
||||||
|
- No longer open the original post form automatically when `Hide Original Post Form` is unchecked, as it interferes with the original form's captcha loading.
|
||||||
|
|
||||||
### v1.9.14.6
|
### v1.9.14.6
|
||||||
*2014-12-08* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.14.6/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.14.6/builds/4chan-X-noupdate.crx "Chromium version")]
|
*2014-12-08* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.14.6/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.14.6/builds/4chan-X-noupdate.crx "Chromium version")]
|
||||||
|
|
||||||
|
|||||||
@ -958,7 +958,6 @@ span.hide-announcement {
|
|||||||
|
|
||||||
/* QR */
|
/* QR */
|
||||||
:root.hide-original-post-form #togglePostFormLink,
|
:root.hide-original-post-form #togglePostFormLink,
|
||||||
:root:not(.catalog) #togglePostFormLink,
|
|
||||||
#qr.autohide:not(.focus):not(:hover):not(:active):not(.captcha-open) > form,
|
#qr.autohide:not(.focus):not(:hover):not(:active):not(.captcha-open) > form,
|
||||||
:root.thread-view #qr:not(.show-new-thread-option) select[data-name="thread"],
|
:root.thread-view #qr:not(.show-new-thread-option) select[data-name="thread"],
|
||||||
#file-n-submit:not(.has-file) #qr-filerm {
|
#file-n-submit:not(.has-file) #qr-filerm {
|
||||||
@ -967,9 +966,6 @@ span.hide-announcement {
|
|||||||
:root.hide-original-post-form #postForm {
|
:root.hide-original-post-form #postForm {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
:root:not(.hide-original-post-form):not(.catalog) #postForm {
|
|
||||||
display: table;
|
|
||||||
}
|
|
||||||
#qr select,
|
#qr select,
|
||||||
#dump-button,
|
#dump-button,
|
||||||
#url-button,
|
#url-button,
|
||||||
|
|||||||
@ -10,34 +10,24 @@ QR.captcha =
|
|||||||
|
|
||||||
root = $.el 'div', className: 'captcha-root'
|
root = $.el 'div', className: 'captcha-root'
|
||||||
$.extend root, <%= html(
|
$.extend root, <%= html(
|
||||||
'<div class="captcha-container"></div>' +
|
|
||||||
'<div class="captcha-counter"><a href="javascript:;"></a></div>'
|
'<div class="captcha-counter"><a href="javascript:;"></a></div>'
|
||||||
) %>
|
) %>
|
||||||
container = $ '.captcha-container', root
|
|
||||||
counter = $ '.captcha-counter > a', root
|
counter = $ '.captcha-counter > a', root
|
||||||
@nodes = {container, counter}
|
@nodes = {root, counter}
|
||||||
@count()
|
@count()
|
||||||
$.addClass QR.nodes.el, 'has-captcha'
|
$.addClass QR.nodes.el, 'has-captcha'
|
||||||
$.after QR.nodes.com.parentNode, root
|
$.after QR.nodes.com.parentNode, root
|
||||||
|
|
||||||
new MutationObserver(@afterSetup.bind @).observe container,
|
|
||||||
childList: true
|
|
||||||
subtree: true
|
|
||||||
|
|
||||||
$.on counter, 'click', @toggle.bind @
|
$.on counter, 'click', @toggle.bind @
|
||||||
$.on window, 'captcha:success', @save.bind @
|
$.on window, 'captcha:success', => @save false
|
||||||
|
|
||||||
shouldFocus: false
|
shouldFocus: false
|
||||||
timeouts: {}
|
timeouts: {}
|
||||||
postsCount: 0
|
postsCount: 0
|
||||||
|
|
||||||
occupied: ->
|
|
||||||
{container} = @nodes
|
|
||||||
(container.firstChild or container.dataset.widgetID) and !@timeouts.destroy
|
|
||||||
|
|
||||||
needed: ->
|
needed: ->
|
||||||
captchaCount = @captchas.length
|
captchaCount = @captchas.length
|
||||||
captchaCount++ if @occupied()
|
captchaCount++ if @nodes.container and !@timeouts.destroy
|
||||||
@postsCount = QR.posts.length
|
@postsCount = QR.posts.length
|
||||||
@postsCount = 0 if @postsCount is 1 and !Conf['Auto-load captcha'] and !QR.posts[0].com and !QR.posts[0].file
|
@postsCount = 0 if @postsCount is 1 and !Conf['Auto-load captcha'] and !QR.posts[0].com and !QR.posts[0].file
|
||||||
captchaCount < @postsCount
|
captchaCount < @postsCount
|
||||||
@ -46,7 +36,7 @@ QR.captcha =
|
|||||||
@setup() if @postsCount is 0
|
@setup() if @postsCount is 0
|
||||||
|
|
||||||
toggle: ->
|
toggle: ->
|
||||||
if @occupied()
|
if @nodes.container and !@timeouts.destroy
|
||||||
@destroy()
|
@destroy()
|
||||||
else
|
else
|
||||||
@setup true, true
|
@setup true, true
|
||||||
@ -59,7 +49,15 @@ QR.captcha =
|
|||||||
clearTimeout @timeouts.destroy
|
clearTimeout @timeouts.destroy
|
||||||
delete @timeouts.destroy
|
delete @timeouts.destroy
|
||||||
return @reload()
|
return @reload()
|
||||||
return if @occupied()
|
|
||||||
|
return if @nodes.container
|
||||||
|
|
||||||
|
@nodes.container = $.el 'div', className: 'captcha-container'
|
||||||
|
$.prepend @nodes.root, @nodes.container
|
||||||
|
new MutationObserver(@afterSetup.bind @).observe @nodes.container,
|
||||||
|
childList: true
|
||||||
|
subtree: true
|
||||||
|
|
||||||
$.globalEval '''
|
$.globalEval '''
|
||||||
(function() {
|
(function() {
|
||||||
var container = document.querySelector("#qr .captcha-container");
|
var container = document.querySelector("#qr .captcha-container");
|
||||||
@ -76,21 +74,27 @@ QR.captcha =
|
|||||||
afterSetup: (mutations) ->
|
afterSetup: (mutations) ->
|
||||||
for mutation in mutations
|
for mutation in mutations
|
||||||
for node in mutation.addedNodes
|
for node in mutation.addedNodes
|
||||||
iframe = node if node.nodeName is 'IFRAME'
|
@setupIFrame node if node.nodeName is 'IFRAME'
|
||||||
return unless iframe
|
@setupTextArea node if node.nodeName is 'TEXTAREA'
|
||||||
|
return
|
||||||
|
|
||||||
|
setupIFrame: (iframe) ->
|
||||||
|
@setupTime = Date.now()
|
||||||
if QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight
|
if QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight
|
||||||
QR.nodes.el.style.top = null
|
QR.nodes.el.style.top = null
|
||||||
QR.nodes.el.style.bottom = '0px'
|
QR.nodes.el.style.bottom = '0px'
|
||||||
iframe.focus() if @shouldFocus
|
iframe.focus() if @shouldFocus
|
||||||
@shouldFocus = false
|
@shouldFocus = false
|
||||||
|
|
||||||
|
setupTextArea: (textarea) ->
|
||||||
|
$.one textarea, 'input', => @save true
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
return unless @isEnabled
|
return unless @isEnabled
|
||||||
delete @timeouts.destroy
|
delete @timeouts.destroy
|
||||||
$.rmClass QR.nodes.el, 'captcha-open'
|
$.rmClass QR.nodes.el, 'captcha-open'
|
||||||
$.rmAll @nodes.container
|
$.rm @nodes.container if @nodes.container
|
||||||
# XXX https://github.com/greasemonkey/greasemonkey/issues/1571
|
delete @nodes.container
|
||||||
@nodes.container.removeAttribute 'data-widget-i-d'
|
|
||||||
|
|
||||||
sync: (captchas) ->
|
sync: (captchas) ->
|
||||||
@captchas = captchas
|
@captchas = captchas
|
||||||
@ -106,17 +110,20 @@ QR.captcha =
|
|||||||
else
|
else
|
||||||
null
|
null
|
||||||
|
|
||||||
save: (e) ->
|
save: (pasted) ->
|
||||||
|
response = $('textarea', @nodes.container).value
|
||||||
|
timeout = (if pasted then @setupTime else Date.now()) + 2 * $.MINUTE
|
||||||
if QR.cooldown.auto and @needed()
|
if QR.cooldown.auto and @needed()
|
||||||
@shouldFocus = true
|
@shouldFocus = true
|
||||||
@reload()
|
@reload()
|
||||||
else
|
else
|
||||||
QR.nodes.status.focus()
|
QR.nodes.status.focus()
|
||||||
@timeouts.destroy ?= setTimeout @destroy.bind(@), 3 * $.SECOND
|
if pasted
|
||||||
|
@destroy()
|
||||||
|
else
|
||||||
|
@timeouts.destroy ?= setTimeout @destroy.bind(@), 3 * $.SECOND
|
||||||
$.forceSync 'captchas'
|
$.forceSync 'captchas'
|
||||||
@captchas.push
|
@captchas.push {response, timeout}
|
||||||
response: e.detail
|
|
||||||
timeout: Date.now() + 2 * $.MINUTE
|
|
||||||
@count()
|
@count()
|
||||||
$.set 'captchas', @captchas
|
$.set 'captchas', @captchas
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user