diff --git a/CHANGELOG.md b/CHANGELOG.md index ec1bdb969..6fb0d71f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ Sometimes the changelog has notes (not comprehensive) acknowledging people's wor ### v1.11.17 +**v1.11.17.3** *(2015-11-17)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.17.3/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.17.3/builds/4chan-X-noupdate.crx "Chromium version")] +- Minor captcha fixes. + **v1.11.17.2** *(2015-11-15)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.17.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.17.2/builds/4chan-X-noupdate.crx "Chromium version")] - Merge v1.11.16.9: Bring back scrolling prevention when captcha is focused. diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index ce09288ad..5cef05e8f 100644 Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js index a56f315b3..7c1ca83ad 100644 --- a/builds/4chan-X-beta.meta.js +++ b/builds/4chan-X-beta.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X beta -// @version 1.11.17.2 +// @version 1.11.17.3 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js index 8cc9a0cf4..8271329a4 100644 --- a/builds/4chan-X-beta.user.js +++ b/builds/4chan-X-beta.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X beta -// @version 1.11.17.2 +// @version 1.11.17.3 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -433,7 +433,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.17.2', + VERSION: '1.11.17.3', NAMESPACE: '4chan X.', boards: {} }; @@ -7198,9 +7198,6 @@ el = err; el.removeAttribute('style'); } - if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) { - QR.captcha.setup(true); - } notice = new Notice('warning', el); QR.notifications.push(notice); if (!Header.areNotificationsEnabled) { @@ -7715,6 +7712,7 @@ captcha = QR.captcha.getOne(); if (!captcha) { err = 'No valid captcha.'; + QR.captcha.setup(true); } } QR.cleanNotifications(); @@ -7848,12 +7846,12 @@ } else { QR.cooldown.addDelay(post, seconds); } - QR.captcha.setup(d.activeElement === QR.nodes.status); } else { QR.cooldown.auto = false; } QR.status(); QR.error(err); + QR.captcha.setup(true); return; } h1 = $('h1', resDoc); @@ -7897,7 +7895,7 @@ QR.close(); } else { post.rm(); - QR.captcha.setup(d.activeElement === QR.nodes.status); + QR.captcha.setup(true); } QR.cooldown.add(threadID, postID); URL = threadID === postID ? window.location.origin + "/" + g.BOARD + "/thread/" + threadID : g.VIEW === 'index' && lastPostToThread && Conf['Open Post in New Tab'] ? window.location.origin + "/" + g.BOARD + "/thread/" + threadID + "#p" + postID : void 0; @@ -8293,11 +8291,12 @@ onNewPost: function() {}, onPostChange: function() {}, setup: function(focus, force) { + var ref; if (!(this.isEnabled && (force || this.needed()))) { return; } this.create(); - if (focus) { + if (focus && ((ref = d.activeElement) === QR.nodes.status || ref === d.body)) { return this.nodes.input.focus(); } }, @@ -8381,6 +8380,9 @@ response: response, timeout: this.timeout }); + this.captchas.sort(function(a, b) { + return a.timeout - b.timeout; + }); this.count(); this.destroy(); this.setup(false, true); @@ -8446,7 +8448,11 @@ } })(); this.nodes.input.placeholder = placeholder; - return this.nodes.input.alt = count; + this.nodes.input.alt = count; + clearTimeout(this.timer); + if (count) { + return this.timer = setTimeout(this.clear.bind(this), this.captchas[0].timeout - Date.now()); + } }, reload: function(focus) { $.globalEval('if (window.Recaptcha.type === "image") {\n window.Recaptcha.reload();\n} else {\n window.Recaptcha.switch_type("image");\n}\nwindow.Recaptcha.should_focus = false;'); @@ -8538,7 +8544,6 @@ }); } }, - shouldFocus: false, timeouts: {}, postsCount: 0, noscriptURL: function() { @@ -8580,12 +8585,12 @@ } }, setup: function(focus, force) { - var iframe; + var iframe, ref; if (!(this.isEnabled && (this.needed() || force))) { return; } - if (focus && !QR.inBubble()) { - this.shouldFocus = true; + if (focus && ((ref = d.activeElement) === QR.nodes.status || ref === d.body)) { + this.nodes.counter.focus(); } if (this.timeouts.destroy) { clearTimeout(this.timeouts.destroy); @@ -8593,10 +8598,9 @@ return this.reload(); } if (this.nodes.container) { - if (this.shouldFocus && (iframe = $('iframe', this.nodes.container))) { + if (d.activeElement === this.nodes.counter && (iframe = $('iframe', this.nodes.container))) { iframe.focus(); QR.focus(); - delete this.shouldFocus; } return; } @@ -8649,10 +8653,9 @@ QR.nodes.el.style.top = null; QR.nodes.el.style.bottom = '0px'; } - if (this.shouldFocus) { + if (d.activeElement === this.nodes.counter) { iframe.focus(); } - this.shouldFocus = false; return $.global(function() { var f; f = document.querySelector('#qr iframe'); @@ -8712,13 +8715,16 @@ response: token || $('textarea', this.nodes.container).value, timeout: Date.now() + this.lifetime }); + this.captchas.sort(function(a, b) { + return a.timeout - b.timeout; + }); $.set('captchas', this.captchas); this.count(); focus = ((ref = d.activeElement) != null ? ref.nodeName : void 0) === 'IFRAME' && /https?:\/\/www\.google\.com\/recaptcha\//.test(d.activeElement.src); if (this.needed()) { if (focus) { if (QR.cooldown.auto || Conf['Post on Captcha Completion']) { - this.shouldFocus = true; + this.nodes.counter.focus(); } else { QR.nodes.status.focus(); } @@ -8760,7 +8766,7 @@ this.captchas = this.captchas.slice(i); this.count(); $.set('captchas', this.captchas); - return this.setup(d.activeElement === QR.nodes.status); + return this.setup(true); }, count: function() { this.nodes.counter.textContent = "Captchas: " + this.captchas.length; diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index a81120cfe..4f203b3aa 100644 Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js index f6c107356..e57979882 100644 --- a/builds/4chan-X-noupdate.user.js +++ b/builds/4chan-X-noupdate.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.11.17.2 +// @version 1.11.17.3 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -433,7 +433,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.17.2', + VERSION: '1.11.17.3', NAMESPACE: '4chan X.', boards: {} }; @@ -7198,9 +7198,6 @@ el = err; el.removeAttribute('style'); } - if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) { - QR.captcha.setup(true); - } notice = new Notice('warning', el); QR.notifications.push(notice); if (!Header.areNotificationsEnabled) { @@ -7715,6 +7712,7 @@ captcha = QR.captcha.getOne(); if (!captcha) { err = 'No valid captcha.'; + QR.captcha.setup(true); } } QR.cleanNotifications(); @@ -7848,12 +7846,12 @@ } else { QR.cooldown.addDelay(post, seconds); } - QR.captcha.setup(d.activeElement === QR.nodes.status); } else { QR.cooldown.auto = false; } QR.status(); QR.error(err); + QR.captcha.setup(true); return; } h1 = $('h1', resDoc); @@ -7897,7 +7895,7 @@ QR.close(); } else { post.rm(); - QR.captcha.setup(d.activeElement === QR.nodes.status); + QR.captcha.setup(true); } QR.cooldown.add(threadID, postID); URL = threadID === postID ? window.location.origin + "/" + g.BOARD + "/thread/" + threadID : g.VIEW === 'index' && lastPostToThread && Conf['Open Post in New Tab'] ? window.location.origin + "/" + g.BOARD + "/thread/" + threadID + "#p" + postID : void 0; @@ -8293,11 +8291,12 @@ onNewPost: function() {}, onPostChange: function() {}, setup: function(focus, force) { + var ref; if (!(this.isEnabled && (force || this.needed()))) { return; } this.create(); - if (focus) { + if (focus && ((ref = d.activeElement) === QR.nodes.status || ref === d.body)) { return this.nodes.input.focus(); } }, @@ -8381,6 +8380,9 @@ response: response, timeout: this.timeout }); + this.captchas.sort(function(a, b) { + return a.timeout - b.timeout; + }); this.count(); this.destroy(); this.setup(false, true); @@ -8446,7 +8448,11 @@ } })(); this.nodes.input.placeholder = placeholder; - return this.nodes.input.alt = count; + this.nodes.input.alt = count; + clearTimeout(this.timer); + if (count) { + return this.timer = setTimeout(this.clear.bind(this), this.captchas[0].timeout - Date.now()); + } }, reload: function(focus) { $.globalEval('if (window.Recaptcha.type === "image") {\n window.Recaptcha.reload();\n} else {\n window.Recaptcha.switch_type("image");\n}\nwindow.Recaptcha.should_focus = false;'); @@ -8538,7 +8544,6 @@ }); } }, - shouldFocus: false, timeouts: {}, postsCount: 0, noscriptURL: function() { @@ -8580,12 +8585,12 @@ } }, setup: function(focus, force) { - var iframe; + var iframe, ref; if (!(this.isEnabled && (this.needed() || force))) { return; } - if (focus && !QR.inBubble()) { - this.shouldFocus = true; + if (focus && ((ref = d.activeElement) === QR.nodes.status || ref === d.body)) { + this.nodes.counter.focus(); } if (this.timeouts.destroy) { clearTimeout(this.timeouts.destroy); @@ -8593,10 +8598,9 @@ return this.reload(); } if (this.nodes.container) { - if (this.shouldFocus && (iframe = $('iframe', this.nodes.container))) { + if (d.activeElement === this.nodes.counter && (iframe = $('iframe', this.nodes.container))) { iframe.focus(); QR.focus(); - delete this.shouldFocus; } return; } @@ -8649,10 +8653,9 @@ QR.nodes.el.style.top = null; QR.nodes.el.style.bottom = '0px'; } - if (this.shouldFocus) { + if (d.activeElement === this.nodes.counter) { iframe.focus(); } - this.shouldFocus = false; return $.global(function() { var f; f = document.querySelector('#qr iframe'); @@ -8712,13 +8715,16 @@ response: token || $('textarea', this.nodes.container).value, timeout: Date.now() + this.lifetime }); + this.captchas.sort(function(a, b) { + return a.timeout - b.timeout; + }); $.set('captchas', this.captchas); this.count(); focus = ((ref = d.activeElement) != null ? ref.nodeName : void 0) === 'IFRAME' && /https?:\/\/www\.google\.com\/recaptcha\//.test(d.activeElement.src); if (this.needed()) { if (focus) { if (QR.cooldown.auto || Conf['Post on Captcha Completion']) { - this.shouldFocus = true; + this.nodes.counter.focus(); } else { QR.nodes.status.focus(); } @@ -8760,7 +8766,7 @@ this.captchas = this.captchas.slice(i); this.count(); $.set('captchas', this.captchas); - return this.setup(d.activeElement === QR.nodes.status); + return this.setup(true); }, count: function() { this.nodes.counter.textContent = "Captchas: " + this.captchas.length; diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index e5a0b6c21..6e4d92a7a 100644 Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index fc73983f3..09148fb97 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.11.17.2 +// @version 1.11.17.3 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index f069f53fc..fb75b04c9 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.11.17.2 +// @version 1.11.17.3 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -433,7 +433,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.17.2', + VERSION: '1.11.17.3', NAMESPACE: '4chan X.', boards: {} }; @@ -7198,9 +7198,6 @@ el = err; el.removeAttribute('style'); } - if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) { - QR.captcha.setup(true); - } notice = new Notice('warning', el); QR.notifications.push(notice); if (!Header.areNotificationsEnabled) { @@ -7715,6 +7712,7 @@ captcha = QR.captcha.getOne(); if (!captcha) { err = 'No valid captcha.'; + QR.captcha.setup(true); } } QR.cleanNotifications(); @@ -7848,12 +7846,12 @@ } else { QR.cooldown.addDelay(post, seconds); } - QR.captcha.setup(d.activeElement === QR.nodes.status); } else { QR.cooldown.auto = false; } QR.status(); QR.error(err); + QR.captcha.setup(true); return; } h1 = $('h1', resDoc); @@ -7897,7 +7895,7 @@ QR.close(); } else { post.rm(); - QR.captcha.setup(d.activeElement === QR.nodes.status); + QR.captcha.setup(true); } QR.cooldown.add(threadID, postID); URL = threadID === postID ? window.location.origin + "/" + g.BOARD + "/thread/" + threadID : g.VIEW === 'index' && lastPostToThread && Conf['Open Post in New Tab'] ? window.location.origin + "/" + g.BOARD + "/thread/" + threadID + "#p" + postID : void 0; @@ -8293,11 +8291,12 @@ onNewPost: function() {}, onPostChange: function() {}, setup: function(focus, force) { + var ref; if (!(this.isEnabled && (force || this.needed()))) { return; } this.create(); - if (focus) { + if (focus && ((ref = d.activeElement) === QR.nodes.status || ref === d.body)) { return this.nodes.input.focus(); } }, @@ -8381,6 +8380,9 @@ response: response, timeout: this.timeout }); + this.captchas.sort(function(a, b) { + return a.timeout - b.timeout; + }); this.count(); this.destroy(); this.setup(false, true); @@ -8446,7 +8448,11 @@ } })(); this.nodes.input.placeholder = placeholder; - return this.nodes.input.alt = count; + this.nodes.input.alt = count; + clearTimeout(this.timer); + if (count) { + return this.timer = setTimeout(this.clear.bind(this), this.captchas[0].timeout - Date.now()); + } }, reload: function(focus) { $.globalEval('if (window.Recaptcha.type === "image") {\n window.Recaptcha.reload();\n} else {\n window.Recaptcha.switch_type("image");\n}\nwindow.Recaptcha.should_focus = false;'); @@ -8538,7 +8544,6 @@ }); } }, - shouldFocus: false, timeouts: {}, postsCount: 0, noscriptURL: function() { @@ -8580,12 +8585,12 @@ } }, setup: function(focus, force) { - var iframe; + var iframe, ref; if (!(this.isEnabled && (this.needed() || force))) { return; } - if (focus && !QR.inBubble()) { - this.shouldFocus = true; + if (focus && ((ref = d.activeElement) === QR.nodes.status || ref === d.body)) { + this.nodes.counter.focus(); } if (this.timeouts.destroy) { clearTimeout(this.timeouts.destroy); @@ -8593,10 +8598,9 @@ return this.reload(); } if (this.nodes.container) { - if (this.shouldFocus && (iframe = $('iframe', this.nodes.container))) { + if (d.activeElement === this.nodes.counter && (iframe = $('iframe', this.nodes.container))) { iframe.focus(); QR.focus(); - delete this.shouldFocus; } return; } @@ -8649,10 +8653,9 @@ QR.nodes.el.style.top = null; QR.nodes.el.style.bottom = '0px'; } - if (this.shouldFocus) { + if (d.activeElement === this.nodes.counter) { iframe.focus(); } - this.shouldFocus = false; return $.global(function() { var f; f = document.querySelector('#qr iframe'); @@ -8712,13 +8715,16 @@ response: token || $('textarea', this.nodes.container).value, timeout: Date.now() + this.lifetime }); + this.captchas.sort(function(a, b) { + return a.timeout - b.timeout; + }); $.set('captchas', this.captchas); this.count(); focus = ((ref = d.activeElement) != null ? ref.nodeName : void 0) === 'IFRAME' && /https?:\/\/www\.google\.com\/recaptcha\//.test(d.activeElement.src); if (this.needed()) { if (focus) { if (QR.cooldown.auto || Conf['Post on Captcha Completion']) { - this.shouldFocus = true; + this.nodes.counter.focus(); } else { QR.nodes.status.focus(); } @@ -8760,7 +8766,7 @@ this.captchas = this.captchas.slice(i); this.count(); $.set('captchas', this.captchas); - return this.setup(d.activeElement === QR.nodes.status); + return this.setup(true); }, count: function() { this.nodes.counter.textContent = "Captchas: " + this.captchas.length; diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index ced1415f2..93d93d320 100644 Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml index 48a3c6f68..31d9815ec 100644 --- a/builds/updates-beta.xml +++ b/builds/updates-beta.xml @@ -1,7 +1,7 @@ - + diff --git a/builds/updates.xml b/builds/updates.xml index f1a1ba6c5..9a7c8d10e 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/version.json b/version.json index fa176f3cd..b0d162ca1 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { - "version": "1.11.17.2", - "date": "2015-11-16T07:50:49.812Z" + "version": "1.11.17.3", + "date": "2015-11-18T06:28:00.317Z" }