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:
ccd0 2014-12-08 22:06:33 -08:00
commit 84609c40f3
6 changed files with 41 additions and 23 deletions

View File

@ -48,6 +48,14 @@ Based on v1.9.14.2.
- Bug fixes.
<!-- v1.9.14.x -->
### 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")]
**ccd0**
- Fix some captcha bugs.
- The QR now focuses on the submit button after captcha completion, unless you are dumping and more captchas are needed.
- Fix updater bugs introduced in v1.9.14.0.
### v1.9.14.5
*2014-12-08* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.14.5/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.14.5/builds/4chan-X-noupdate.crx "Chromium version")]

View File

@ -1066,7 +1066,7 @@ input.field.tripped:not(:hover):not(:focus) {
#qr textarea {
resize: both;
}
#qr .captcha-section {
#qr .captcha-root {
position: relative;
}
#qr .captcha-container > div > div {

View File

@ -320,6 +320,7 @@ ThreadUpdater =
ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25
for post in posts
root = post.nodes.root
unless QuoteThreading.insert post
$.add ThreadUpdater.root, post.nodes.root
$.event 'PostsInserted'

View File

@ -8,17 +8,17 @@ QR.captcha =
QR.captcha.sync captchas
$.sync 'captchas', @sync.bind @
section = $.el 'div', className: 'captcha-section'
$.extend section, <%= html(
root = $.el 'div', className: 'captcha-root'
$.extend root, <%= html(
'<div class="captcha-container"></div>' +
'<div class="captcha-counter"><a href="javascript:;"></a></div>'
) %>
container = $ '.captcha-container', section
counter = $ '.captcha-counter > a', section
container = $ '.captcha-container', root
counter = $ '.captcha-counter > a', root
@nodes = {container, counter}
@count()
$.addClass QR.nodes.el, 'has-captcha'
$.after QR.nodes.com.parentNode, section
$.after QR.nodes.com.parentNode, root
new MutationObserver(@afterSetup.bind @).observe container,
childList: true
@ -29,29 +29,37 @@ QR.captcha =
shouldFocus: false
timeouts: {}
postsCount: 0
occupied: ->
{container} = @nodes
(container.firstChild or container.dataset.widgetID) and !@timeouts.destroy
needed: ->
captchaCount = @captchas.length
captchaCount++ if @nodes.container.dataset.widgetID and !@timeouts.destroy
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
captchaCount < postsCount
captchaCount++ if @occupied()
@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
captchaCount < @postsCount
onPostChange: ->
@setup() if @postsCount is 0
toggle: ->
if @nodes.container.dataset.widgetID and !@timeouts.destroy
if @occupied()
@destroy()
else
@shouldFocus = true
@setup true
@setup true, true
setup: (force) ->
setup: (focus, force) ->
return unless @isEnabled and (@needed() or force)
$.addClass QR.nodes.el, 'captcha-open'
@shouldFocus = true if focus
if @timeouts.destroy
clearTimeout @timeouts.destroy
delete @timeouts.destroy
return @reload()
return if @nodes.container.dataset.widgetID
return if @occupied()
$.globalEval '''
(function() {
var container = document.querySelector("#qr .captcha-container");
@ -99,11 +107,11 @@ QR.captcha =
null
save: (e) ->
if @needed()
if QR.cooldown.auto and @needed()
@shouldFocus = true
@reload()
else
@nodes.counter.focus()
QR.nodes.status.focus()
@timeouts.destroy ?= setTimeout @destroy.bind(@), 3 * $.SECOND
$.forceSync 'captchas'
@captchas.push
@ -121,7 +129,7 @@ QR.captcha =
@captchas = @captchas[i..]
@count()
$.set 'captchas', @captchas
@setup()
@setup true
count: ->
@nodes.counter.textContent = "Captchas: #{@captchas.length}"

View File

@ -145,7 +145,7 @@ QR =
el = err
el.removeAttribute 'style'
if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent
QR.captcha.setup()
QR.captcha.setup true
QR.notify el
alert el.textContent if d.hidden
@ -813,7 +813,7 @@ QR =
QR.close()
else
post.rm()
QR.captcha.setup()
QR.captcha.setup true
QR.cooldown.add req.uploadEndTime, threadID, postID

View File

@ -37,7 +37,6 @@ QR.post = class
prev = QR.posts[QR.posts.length - 1]
QR.posts.push @
QR.captcha.setup()
@nodes.spoiler.checked = @spoiler = if prev and Conf['Remember Spoiler']
prev.spoiler
else
@ -70,6 +69,8 @@ QR.post = class
@load() if QR.selected is @ # load persona
@select() if select
@unlock()
# Post count temporarily off by 1 when called from QR.post.rm
$.queueTask -> QR.captcha.setup()
rm: ->
@delete()
@ -132,7 +133,7 @@ QR.post = class
QR.status()
when 'com'
@nodes.span.textContent = @com
QR.captcha.setup()
QR.captcha.onPostChange()
QR.characterCount()
# Disable auto-posting if you're typing in the first post
# during the last 5 seconds of the cooldown.
@ -161,7 +162,7 @@ QR.post = class
@filename = file.name
@filesize = $.bytesToString file.size
@nodes.label.hidden = false if QR.spoiler
QR.captcha.setup()
QR.captcha.onPostChange()
URL.revokeObjectURL @URL
if @ is QR.selected
@showFileData()