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. - Bug fixes.
<!-- v1.9.14.x --> <!-- 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 ### 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")] *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 { #qr textarea {
resize: both; resize: both;
} }
#qr .captcha-section { #qr .captcha-root {
position: relative; position: relative;
} }
#qr .captcha-container > div > div { #qr .captcha-container > div > div {

View File

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

View File

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

View File

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

View File

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