diff --git a/CHANGELOG.md b/CHANGELOG.md index 793887858..e94f9e516 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Sometimes the changelog has notes (not comprehensive) acknowledging people's wor ### v1.11.13 +**v1.11.13.5** *(2015-10-21)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.13.5/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.13.5/builds/4chan-X-noupdate.crx "Chromium version")] +- Merge v1.11.12.9: Workarounds for Google's latest captcha bugs. +- Merge v1.11.12.9: Ignore `Force Noscript Captcha` if Recaptcha v1 is selected. +- Show spoiler checkbox as an "S" unless hovered, checked, or focused. +- Minor bugfixes. + **v1.11.13.4** *(2015-10-20)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.13.4/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.13.4/builds/4chan-X-noupdate.crx "Chromium version")] - Add TeX preview button to Quick Reply on /sci/. diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 5429ee8f3..509e0fe88 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 c23a72ba7..dba5f7b83 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.13.4 +// @version 1.11.13.5 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -22,8 +22,6 @@ // @include https://www.google.com/recaptcha/api2/frame?*&k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @include http://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @include https://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* -// @include http://www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* -// @include https://www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js index 8b4383e45..77d481240 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.13.4 +// @version 1.11.13.5 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -23,8 +23,6 @@ // @include https://www.google.com/recaptcha/api2/frame?*&k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @include http://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @include https://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* -// @include http://www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* -// @include https://www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue @@ -244,7 +242,7 @@ 'Hide Original Post Form': [true, 'Hide the normal post form.', 1], 'Cooldown': [true, 'Indicate the remaining time before posting again.', 1], 'Posting Success Notifications': [true, 'Show notifications on successful post creation or file uploading.', 1], - 'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha in the QR even if Javascript is enabled.', 1], + 'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha in the QR even if Javascript is enabled (Recaptcha v2 only).', 1], 'Auto-load captcha': [false, 'Automatically load the captcha in the QR even if your post is empty.', 1], 'Post on Captcha Completion': [false, 'Submit the post immediately when the captcha is completed.', 1], 'Bottom QR Link': [true, 'Places a link on the bottom of threads to open the QR.', 1], @@ -415,7 +413,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.13.4', + VERSION: '1.11.13.5', NAMESPACE: '4chan X.', boards: {} }; @@ -6866,7 +6864,7 @@ 'webm': 'video/webm' }, init: function() { - var noscript, sc, version; + var sc, version; if (!Conf['Quick Reply']) { return; } @@ -6875,7 +6873,7 @@ if (g.VIEW === 'archive') { return; } - version = Conf['Use Recaptcha v1'] ? (noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled'), noscript ? 'noscript' : 'v1') : 'v2'; + version = Conf['Use Recaptcha v1'] ? 'v1' : 'v2'; this.captcha = Captcha[version]; $.on(d, '4chanXInitFinished', this.initReady); Post.callbacks.push({ @@ -7424,7 +7422,7 @@ var dialog, event, i, items, m, match_max, match_min, name, node, nodes, ref, rules, save, scriptData, setNode; QR.nodes = nodes = { el: dialog = UI.dialog('qr', 'top: 50px; right: 0px;', { - innerHTML: "
" + innerHTML: " " }) }; setNode = function(name, query) { @@ -7489,8 +7487,6 @@ QR.spoiler = !!$('.postForm input[name=spoiler]'); if (QR.spoiler) { $.addClass(QR.nodes.el, 'has-spoiler'); - } else { - nodes.spoiler.parentElement.hidden = true; } if (g.BOARD.ID === 'jp' && Conf['sjisPreview']) { $.addClass(QR.nodes.el, 'sjis-preview'); @@ -7884,7 +7880,8 @@ childList: true, subtree: true }); - return $.on(d, 'keydown', this.keybinds.bind(this)); + $.on(d, 'keydown', this.keybinds.bind(this)); + return window.focus(); }, initNoscript: function() { this.noscript = true; @@ -8007,334 +8004,6 @@ } }; - Captcha.noscript = { - lifetime: 30 * $.MINUTE, - init: function() { - var container, input; - if (d.cookie.indexOf('pass_enabled=1') >= 0) { - return; - } - if (!(this.isEnabled = !!$('#g-recaptcha, #captchaContainerAlt'))) { - return; - } - container = $.el('div', { - className: 'captcha-img', - title: 'Reload reCAPTCHA' - }); - input = $.el('input', { - className: 'captcha-input field', - title: 'Verification', - autocomplete: 'off', - spellcheck: false - }); - this.nodes = { - container: container, - input: input - }; - $.on(input, 'keydown', this.keydown.bind(this)); - $.on(this.nodes.container, 'click', (function(_this) { - return function() { - _this.reload(); - return _this.nodes.input.focus(); - }; - })(this)); - this.conn = new Connection(null, location.protocol + "//www.google.com", { - challenge: this.load.bind(this), - token: this.save.bind(this), - error: this.error.bind(this) - }); - $.addClass(QR.nodes.el, 'has-captcha', 'captcha-v1', 'noscript-captcha'); - $.after(QR.nodes.com.parentNode, [container, input]); - this.captchas = []; - $.get('captchas', [], function(arg) { - var captchas; - captchas = arg.captchas; - QR.captcha.sync(captchas); - return QR.captcha.clear(); - }); - $.sync('captchas', this.sync); - this.beforeSetup(); - return this.setup(); - }, - initFrame: function() { - var cb, conn, img, ref, ref1; - conn = new Connection(window.parent, location.protocol + "//boards.4chan.org", { - response: function(response) { - $.id('recaptcha_response_field').value = response; - return HTMLFormElement.prototype.submit.call($('form')); - } - }); - if (location.hash === '#response') { - conn.send({ - token: (ref = $('textarea')) != null ? ref.value : void 0, - error: (ref1 = $('.recaptcha_input_area')) != null ? ref1.textContent.replace(/:$/, '') : void 0 - }); - } - if (!(img = $('img'))) { - return; - } - $('form').action = '#response'; - cb = function() { - var canvas; - canvas = $.el('canvas'); - canvas.width = img.width; - canvas.height = img.height; - canvas.getContext('2d').drawImage(img, 0, 0); - return conn.send({ - challenge: canvas.toDataURL() - }); - }; - if (img.complete) { - return cb(); - } else { - return $.on(img, 'load', cb); - } - }, - timers: {}, - iframeURL: function() { - var lang, url; - url = '//www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc'; - if (lang = Conf['captchaLanguage'].trim()) { - url += "&hl=" + (encodeURIComponent(lang)); - } - return url; - }, - cb: { - focus: function() { - return QR.captcha.setup(false, true); - } - }, - beforeSetup: function() { - var container, input, ref; - ref = this.nodes, container = ref.container, input = ref.input; - container.hidden = true; - input.value = ''; - input.placeholder = 'Focus to load reCAPTCHA'; - this.count(); - return $.on(input, 'focus click', this.cb.focus); - }, - needed: function() { - var captchaCount, postsCount; - captchaCount = this.captchas.length; - if (QR.req) { - captchaCount++; - } - postsCount = QR.posts.length; - if (postsCount === 1 && !Conf['Auto-load captcha'] && !QR.posts[0].com && !QR.posts[0].file) { - postsCount = 0; - } - return captchaCount < postsCount; - }, - onNewPost: function() {}, - onPostChange: function() {}, - setup: function(focus, force) { - if (!(this.isEnabled && (this.needed() || force))) { - return; - } - if (!this.nodes.iframe) { - this.nodes.iframe = $.el('iframe', { - id: 'qr-captcha-iframe', - src: this.iframeURL() - }); - $.add(QR.nodes.el, this.nodes.iframe); - this.conn.target = this.nodes.iframe; - } else if (!this.occupied || force) { - this.nodes.iframe.src = this.iframeURL(); - } - this.occupied = true; - if (focus) { - return this.nodes.input.focus(); - } - }, - afterSetup: function() { - var container, input, ref; - ref = this.nodes, container = ref.container, input = ref.input; - container.hidden = false; - input.placeholder = 'Verification'; - this.count(); - $.off(input, 'focus click', this.cb.focus); - if (QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight) { - QR.nodes.el.style.top = ''; - return QR.nodes.el.style.bottom = '0px'; - } - }, - destroy: function() { - if (!this.isEnabled) { - return; - } - $.rm(this.nodes.img); - delete this.nodes.img; - $.rm(this.nodes.iframe); - delete this.nodes.iframe; - delete this.occupied; - return this.beforeSetup(); - }, - sync: function(captchas) { - if (captchas == null) { - captchas = []; - } - QR.captcha.captchas = captchas; - return QR.captcha.count(); - }, - getOne: function() { - var captcha; - this.clear(); - if (captcha = this.captchas.shift()) { - this.count(); - $.set('captchas', this.captchas); - return captcha; - } else if (/\S/.test(this.nodes.input.value)) { - return (function(_this) { - return function(cb) { - _this.submitCB = cb; - return _this.sendResponse(); - }; - })(this); - } else { - return null; - } - }, - sendResponse: function() { - var response; - response = this.nodes.input.value; - if (/\S/.test(response)) { - return this.conn.send({ - response: response - }); - } - }, - save: function(token) { - var captcha; - delete this.occupied; - this.nodes.input.value = ''; - captcha = { - challenge: token, - response: 'manual_challenge', - timeout: this.timeout - }; - if (this.submitCB) { - this.submitCB(captcha); - delete this.submitCB; - if (this.needed()) { - return this.reload(); - } else { - return this.destroy(); - } - } else { - $.forceSync('captchas'); - this.captchas.push(captcha); - this.count(); - $.set('captchas', this.captchas); - return this.reload(); - } - }, - error: function(message) { - this.occupied = true; - this.nodes.input.value = ''; - if (this.submitCB) { - this.submitCB(); - delete this.submitCB; - } - return QR.error("Captcha Error: " + message); - }, - clear: function() { - var captcha, i, k, len1, now, ref; - if (!this.captchas.length) { - return; - } - $.forceSync('captchas'); - now = Date.now(); - ref = this.captchas; - for (i = k = 0, len1 = ref.length; k < len1; i = ++k) { - captcha = ref[i]; - if (captcha.timeout > now) { - break; - } - } - if (!i) { - return; - } - this.captchas = this.captchas.slice(i); - this.count(); - return $.set('captchas', this.captchas); - }, - load: function(src) { - var container, img, input, ref; - ref = this.nodes, container = ref.container, input = ref.input, img = ref.img; - this.occupied = true; - this.timeout = Date.now() + this.lifetime; - if (!img) { - img = this.nodes.img = new Image(); - $.one(img, 'load', this.afterSetup.bind(this)); - $.on(img, 'load', function() { - return this.hidden = false; - }); - $.add(container, img); - } - img.src = src; - input.value = ''; - this.clear(); - clearTimeout(this.timers.expire); - return this.timers.expire = setTimeout(this.expire.bind(this), this.lifetime); - }, - count: function() { - var count, placeholder; - count = this.captchas ? this.captchas.length : 0; - placeholder = this.nodes.input.placeholder.replace(/\ \(.*\)$/, ''); - placeholder += (function() { - switch (count) { - case 0: - if (placeholder === 'Verification') { - return ' (Shift + Enter to cache)'; - } else { - return ''; - } - break; - case 1: - return ' (1 cached captcha)'; - default: - return " (" + count + " cached captchas)"; - } - })(); - this.nodes.input.placeholder = placeholder; - this.nodes.input.alt = count; - clearTimeout(this.timers.clear); - if (this.captchas.length) { - return this.timers.clear = setTimeout(this.clear.bind(this), this.captchas[0].timeout - Date.now()); - } - }, - expire: function() { - if (!this.nodes.iframe) { - return; - } - if (!d.hidden && (this.needed() || d.activeElement === this.nodes.input)) { - return this.reload(); - } else { - return this.destroy(); - } - }, - reload: function() { - var ref; - this.nodes.iframe.src = this.iframeURL(); - this.occupied = true; - return (ref = this.nodes.img) != null ? ref.hidden = true : void 0; - }, - keydown: function(e) { - if (e.keyCode === 8 && !this.nodes.input.value) { - if (this.nodes.iframe) { - this.reload(); - } else { - this.setup(); - } - } else if (e.keyCode === 13 && e.shiftKey) { - this.sendResponse(); - } else { - return; - } - return e.preventDefault(); - } - }; - Captcha.replace = { init: function() { var jsEnabled; @@ -9322,20 +8991,19 @@ QR.post = (function() { function _Class(select) { this.select = bind(this.select, this); - var el, event, k, len1, prev, ref; + var el, event, k, label, len1, len2, prev, q, ref, ref1; el = $.el('a', { className: 'qr-preview', draggable: true, href: 'javascript:;' }); $.extend(el, { - innerHTML: "" + innerHTML: "" }); this.nodes = { el: el, rm: el.firstChild, - label: $('label', el), - spoiler: $('input', el), + spoiler: $('.qr-preview-spoiler input', el), span: el.lastChild }; $.on(el, 'click', this.select); @@ -9345,9 +9013,6 @@ return _this.rm(); }; })(this)); - $.on(this.nodes.label, 'click', function(e) { - return e.stopPropagation(); - }); $.on(this.nodes.spoiler, 'change', (function(_this) { return function(e) { _this.spoiler = e.target.checked; @@ -9356,10 +9021,17 @@ } }; })(this)); - $.add(QR.nodes.dumpList, el); - ref = ['dragStart', 'dragEnter', 'dragLeave', 'dragOver', 'dragEnd', 'drop']; + ref = $$('label', el); for (k = 0, len1 = ref.length; k < len1; k++) { - event = ref[k]; + label = ref[k]; + $.on(label, 'click', function(e) { + return e.stopPropagation(); + }); + } + $.add(QR.nodes.dumpList, el); + ref1 = ['dragStart', 'dragEnter', 'dragLeave', 'dragOver', 'dragEnd', 'drop']; + for (q = 0, len2 = ref1.length; q < len2; q++) { + event = ref1[q]; $.on(el, event.toLowerCase(), this[event]); } this.thread = g.VIEW === 'thread' ? g.THREADID : 'new'; @@ -9433,7 +9105,7 @@ _Class.prototype.select = function() { var rectEl, rectList; if (QR.selected) { - QR.selected.nodes.el.id = null; + QR.selected.nodes.el.removeAttribute('id'); QR.selected.forceSave(); } QR.selected = this; @@ -9591,9 +9263,7 @@ } this.filesize = $.bytesToString(this.file.size); this.checkSize(); - if (QR.spoiler) { - this.nodes.label.hidden = false; - } + $.addClass(this.nodes.el, 'has-file'); QR.captcha.onPostChange(); URL.revokeObjectURL(this.URL); this.saveFilename(); @@ -9727,12 +9397,10 @@ delete this.file; delete this.filename; delete this.filesize; - this.nodes.el.title = null; - QR.nodes.filename.title = ''; + this.nodes.el.removeAttribute('title'); + QR.nodes.filename.removeAttribute('title'); this.nodes.el.style.backgroundImage = null; - if (QR.spoiler) { - this.nodes.label.hidden = true; - } + $.rmClass(this.nodes.el, 'has-file'); this.showFileData(); this.updateFlashURL(); URL.revokeObjectURL(this.URL); @@ -9762,11 +9430,11 @@ if (this.file) { this.updateFilename(); QR.nodes.filename.value = this.filename; - QR.nodes.spoiler.checked = this.spoiler; - return $.addClass(QR.nodes.fileSubmit, 'has-file'); + $.addClass(QR.nodes.fileSubmit, 'has-file'); } else { - return $.rmClass(QR.nodes.fileSubmit, 'has-file'); + $.rmClass(QR.nodes.fileSubmit, 'has-file'); } + return QR.nodes.spoiler.checked = this.spoiler; }; _Class.prototype.updateFlashURL = function() { @@ -16311,9 +15979,6 @@ Report = { css: ":root:not(.js-enabled) #captchaContainerAlt {\n" + " height: auto;\n" + -"}\n" + -"noscript > iframe, #recaptcha_challenge_field {\n" + -" width: 500px;\n" + "}", init: function() { var match; @@ -17256,12 +16921,6 @@ } window['4chan X antidup'] = true; if (location.hostname === 'www.google.com') { - if (location.pathname === '/recaptcha/api/noscript') { - $.ready(function() { - return Captcha.noscript.initFrame(); - }); - return; - } if (location.pathname === '/recaptcha/api/fallback') { $.ready(function() { return Captcha.v2.initFrame(); @@ -18477,6 +18136,10 @@ "#captchaContainerAlt td:nth-child(2) {\n" + " display: table-cell !important;\n" + "}\n" + +"/* Disable obnoxious captcha fade-in. */\n" + +"body > div:last-of-type {\n" + +" transition: none !important;\n" + +"}\n" + "/* Anti-autoplay */\n" + "audio.controls-added {\n" + " display: block;\n" + @@ -19785,7 +19448,8 @@ " margin: 0;\n" + " margin-right: 3px;\n" + "}\n" + -"#qr.has-spoiler #file-n-submit:not(.has-file) #qr-spoiler-label,\n" + +"#qr:not(.has-spoiler) #qr-spoiler-label,\n" + +"#file-n-submit:not(.has-file) #qr-spoiler-label,\n" + ".has-file #paste-area,\n" + ".has-file #url-button,\n" + "#file-n-submit:not(.custom-cooldown) #custom-cooldown-button {\n" + @@ -19798,20 +19462,18 @@ " margin: 0;\n" + "}\n" + ".checkbox-letter {\n" + -" pointer-events: none;\n" + -" position: absolute;\n" + -" top: 2px;\n" + -" left: 0;\n" + -" right: 0;\n" + -" text-align: center;\n" + -" font-size: 11px;\n" + " font-weight: bold;\n" + -" color: rgba(0,0,0,.6);\n" + "}\n" + +"#qr-filename-container label:not(:hover) > input[type=\"checkbox\"]:not(:focus):not(:checked),\n" + +"#qr-filename-container label:hover > .checkbox-letter,\n" + +"input[type=\"checkbox\"]:focus ~ .checkbox-letter,\n" + "input[type=\"checkbox\"]:checked ~ .checkbox-letter {\n" + -" display: none;\n" + +" /* not displayed but still focusable */\n" + +" position: absolute;\n" + +" opacity: 0;\n" + +" pointer-events: none;\n" + "}\n" + -"#paste-area, #url-button, #custom-cooldown-button, #dump-button {\n" + +".checkbox-letter, #paste-area, #url-button, #custom-cooldown-button, #dump-button {\n" + " opacity: 0.6;\n" + "}\n" + "#paste-area {\n" + @@ -19906,6 +19568,10 @@ ".remove:hover::after {\n" + " content: \" Remove\";\n" + "}\n" + +".qr-preview:not(.has-file) label,\n" + +"#qr:not(.has-spoiler) .qr-preview-spoiler {\n" + +" display: none;\n" + +"}\n" + ".qr-preview > label {\n" + " background: rgba(0,0,0,.5);\n" + " color: #fff;\n" + diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 9d000d91d..e3956bf10 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 78ecc07e3..8f324e4ec 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.13.4 +// @version 1.11.13.5 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -23,8 +23,6 @@ // @include https://www.google.com/recaptcha/api2/frame?*&k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @include http://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @include https://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* -// @include http://www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* -// @include https://www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue @@ -244,7 +242,7 @@ 'Hide Original Post Form': [true, 'Hide the normal post form.', 1], 'Cooldown': [true, 'Indicate the remaining time before posting again.', 1], 'Posting Success Notifications': [true, 'Show notifications on successful post creation or file uploading.', 1], - 'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha in the QR even if Javascript is enabled.', 1], + 'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha in the QR even if Javascript is enabled (Recaptcha v2 only).', 1], 'Auto-load captcha': [false, 'Automatically load the captcha in the QR even if your post is empty.', 1], 'Post on Captcha Completion': [false, 'Submit the post immediately when the captcha is completed.', 1], 'Bottom QR Link': [true, 'Places a link on the bottom of threads to open the QR.', 1], @@ -415,7 +413,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.13.4', + VERSION: '1.11.13.5', NAMESPACE: '4chan X.', boards: {} }; @@ -6866,7 +6864,7 @@ 'webm': 'video/webm' }, init: function() { - var noscript, sc, version; + var sc, version; if (!Conf['Quick Reply']) { return; } @@ -6875,7 +6873,7 @@ if (g.VIEW === 'archive') { return; } - version = Conf['Use Recaptcha v1'] ? (noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled'), noscript ? 'noscript' : 'v1') : 'v2'; + version = Conf['Use Recaptcha v1'] ? 'v1' : 'v2'; this.captcha = Captcha[version]; $.on(d, '4chanXInitFinished', this.initReady); Post.callbacks.push({ @@ -7424,7 +7422,7 @@ var dialog, event, i, items, m, match_max, match_min, name, node, nodes, ref, rules, save, scriptData, setNode; QR.nodes = nodes = { el: dialog = UI.dialog('qr', 'top: 50px; right: 0px;', { - innerHTML: " " + innerHTML: " " }) }; setNode = function(name, query) { @@ -7489,8 +7487,6 @@ QR.spoiler = !!$('.postForm input[name=spoiler]'); if (QR.spoiler) { $.addClass(QR.nodes.el, 'has-spoiler'); - } else { - nodes.spoiler.parentElement.hidden = true; } if (g.BOARD.ID === 'jp' && Conf['sjisPreview']) { $.addClass(QR.nodes.el, 'sjis-preview'); @@ -7884,7 +7880,8 @@ childList: true, subtree: true }); - return $.on(d, 'keydown', this.keybinds.bind(this)); + $.on(d, 'keydown', this.keybinds.bind(this)); + return window.focus(); }, initNoscript: function() { this.noscript = true; @@ -8007,334 +8004,6 @@ } }; - Captcha.noscript = { - lifetime: 30 * $.MINUTE, - init: function() { - var container, input; - if (d.cookie.indexOf('pass_enabled=1') >= 0) { - return; - } - if (!(this.isEnabled = !!$('#g-recaptcha, #captchaContainerAlt'))) { - return; - } - container = $.el('div', { - className: 'captcha-img', - title: 'Reload reCAPTCHA' - }); - input = $.el('input', { - className: 'captcha-input field', - title: 'Verification', - autocomplete: 'off', - spellcheck: false - }); - this.nodes = { - container: container, - input: input - }; - $.on(input, 'keydown', this.keydown.bind(this)); - $.on(this.nodes.container, 'click', (function(_this) { - return function() { - _this.reload(); - return _this.nodes.input.focus(); - }; - })(this)); - this.conn = new Connection(null, location.protocol + "//www.google.com", { - challenge: this.load.bind(this), - token: this.save.bind(this), - error: this.error.bind(this) - }); - $.addClass(QR.nodes.el, 'has-captcha', 'captcha-v1', 'noscript-captcha'); - $.after(QR.nodes.com.parentNode, [container, input]); - this.captchas = []; - $.get('captchas', [], function(arg) { - var captchas; - captchas = arg.captchas; - QR.captcha.sync(captchas); - return QR.captcha.clear(); - }); - $.sync('captchas', this.sync); - this.beforeSetup(); - return this.setup(); - }, - initFrame: function() { - var cb, conn, img, ref, ref1; - conn = new Connection(window.parent, location.protocol + "//boards.4chan.org", { - response: function(response) { - $.id('recaptcha_response_field').value = response; - return HTMLFormElement.prototype.submit.call($('form')); - } - }); - if (location.hash === '#response') { - conn.send({ - token: (ref = $('textarea')) != null ? ref.value : void 0, - error: (ref1 = $('.recaptcha_input_area')) != null ? ref1.textContent.replace(/:$/, '') : void 0 - }); - } - if (!(img = $('img'))) { - return; - } - $('form').action = '#response'; - cb = function() { - var canvas; - canvas = $.el('canvas'); - canvas.width = img.width; - canvas.height = img.height; - canvas.getContext('2d').drawImage(img, 0, 0); - return conn.send({ - challenge: canvas.toDataURL() - }); - }; - if (img.complete) { - return cb(); - } else { - return $.on(img, 'load', cb); - } - }, - timers: {}, - iframeURL: function() { - var lang, url; - url = '//www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc'; - if (lang = Conf['captchaLanguage'].trim()) { - url += "&hl=" + (encodeURIComponent(lang)); - } - return url; - }, - cb: { - focus: function() { - return QR.captcha.setup(false, true); - } - }, - beforeSetup: function() { - var container, input, ref; - ref = this.nodes, container = ref.container, input = ref.input; - container.hidden = true; - input.value = ''; - input.placeholder = 'Focus to load reCAPTCHA'; - this.count(); - return $.on(input, 'focus click', this.cb.focus); - }, - needed: function() { - var captchaCount, postsCount; - captchaCount = this.captchas.length; - if (QR.req) { - captchaCount++; - } - postsCount = QR.posts.length; - if (postsCount === 1 && !Conf['Auto-load captcha'] && !QR.posts[0].com && !QR.posts[0].file) { - postsCount = 0; - } - return captchaCount < postsCount; - }, - onNewPost: function() {}, - onPostChange: function() {}, - setup: function(focus, force) { - if (!(this.isEnabled && (this.needed() || force))) { - return; - } - if (!this.nodes.iframe) { - this.nodes.iframe = $.el('iframe', { - id: 'qr-captcha-iframe', - src: this.iframeURL() - }); - $.add(QR.nodes.el, this.nodes.iframe); - this.conn.target = this.nodes.iframe; - } else if (!this.occupied || force) { - this.nodes.iframe.src = this.iframeURL(); - } - this.occupied = true; - if (focus) { - return this.nodes.input.focus(); - } - }, - afterSetup: function() { - var container, input, ref; - ref = this.nodes, container = ref.container, input = ref.input; - container.hidden = false; - input.placeholder = 'Verification'; - this.count(); - $.off(input, 'focus click', this.cb.focus); - if (QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight) { - QR.nodes.el.style.top = ''; - return QR.nodes.el.style.bottom = '0px'; - } - }, - destroy: function() { - if (!this.isEnabled) { - return; - } - $.rm(this.nodes.img); - delete this.nodes.img; - $.rm(this.nodes.iframe); - delete this.nodes.iframe; - delete this.occupied; - return this.beforeSetup(); - }, - sync: function(captchas) { - if (captchas == null) { - captchas = []; - } - QR.captcha.captchas = captchas; - return QR.captcha.count(); - }, - getOne: function() { - var captcha; - this.clear(); - if (captcha = this.captchas.shift()) { - this.count(); - $.set('captchas', this.captchas); - return captcha; - } else if (/\S/.test(this.nodes.input.value)) { - return (function(_this) { - return function(cb) { - _this.submitCB = cb; - return _this.sendResponse(); - }; - })(this); - } else { - return null; - } - }, - sendResponse: function() { - var response; - response = this.nodes.input.value; - if (/\S/.test(response)) { - return this.conn.send({ - response: response - }); - } - }, - save: function(token) { - var captcha; - delete this.occupied; - this.nodes.input.value = ''; - captcha = { - challenge: token, - response: 'manual_challenge', - timeout: this.timeout - }; - if (this.submitCB) { - this.submitCB(captcha); - delete this.submitCB; - if (this.needed()) { - return this.reload(); - } else { - return this.destroy(); - } - } else { - $.forceSync('captchas'); - this.captchas.push(captcha); - this.count(); - $.set('captchas', this.captchas); - return this.reload(); - } - }, - error: function(message) { - this.occupied = true; - this.nodes.input.value = ''; - if (this.submitCB) { - this.submitCB(); - delete this.submitCB; - } - return QR.error("Captcha Error: " + message); - }, - clear: function() { - var captcha, i, k, len1, now, ref; - if (!this.captchas.length) { - return; - } - $.forceSync('captchas'); - now = Date.now(); - ref = this.captchas; - for (i = k = 0, len1 = ref.length; k < len1; i = ++k) { - captcha = ref[i]; - if (captcha.timeout > now) { - break; - } - } - if (!i) { - return; - } - this.captchas = this.captchas.slice(i); - this.count(); - return $.set('captchas', this.captchas); - }, - load: function(src) { - var container, img, input, ref; - ref = this.nodes, container = ref.container, input = ref.input, img = ref.img; - this.occupied = true; - this.timeout = Date.now() + this.lifetime; - if (!img) { - img = this.nodes.img = new Image(); - $.one(img, 'load', this.afterSetup.bind(this)); - $.on(img, 'load', function() { - return this.hidden = false; - }); - $.add(container, img); - } - img.src = src; - input.value = ''; - this.clear(); - clearTimeout(this.timers.expire); - return this.timers.expire = setTimeout(this.expire.bind(this), this.lifetime); - }, - count: function() { - var count, placeholder; - count = this.captchas ? this.captchas.length : 0; - placeholder = this.nodes.input.placeholder.replace(/\ \(.*\)$/, ''); - placeholder += (function() { - switch (count) { - case 0: - if (placeholder === 'Verification') { - return ' (Shift + Enter to cache)'; - } else { - return ''; - } - break; - case 1: - return ' (1 cached captcha)'; - default: - return " (" + count + " cached captchas)"; - } - })(); - this.nodes.input.placeholder = placeholder; - this.nodes.input.alt = count; - clearTimeout(this.timers.clear); - if (this.captchas.length) { - return this.timers.clear = setTimeout(this.clear.bind(this), this.captchas[0].timeout - Date.now()); - } - }, - expire: function() { - if (!this.nodes.iframe) { - return; - } - if (!d.hidden && (this.needed() || d.activeElement === this.nodes.input)) { - return this.reload(); - } else { - return this.destroy(); - } - }, - reload: function() { - var ref; - this.nodes.iframe.src = this.iframeURL(); - this.occupied = true; - return (ref = this.nodes.img) != null ? ref.hidden = true : void 0; - }, - keydown: function(e) { - if (e.keyCode === 8 && !this.nodes.input.value) { - if (this.nodes.iframe) { - this.reload(); - } else { - this.setup(); - } - } else if (e.keyCode === 13 && e.shiftKey) { - this.sendResponse(); - } else { - return; - } - return e.preventDefault(); - } - }; - Captcha.replace = { init: function() { var jsEnabled; @@ -9322,20 +8991,19 @@ QR.post = (function() { function _Class(select) { this.select = bind(this.select, this); - var el, event, k, len1, prev, ref; + var el, event, k, label, len1, len2, prev, q, ref, ref1; el = $.el('a', { className: 'qr-preview', draggable: true, href: 'javascript:;' }); $.extend(el, { - innerHTML: "" + innerHTML: "" }); this.nodes = { el: el, rm: el.firstChild, - label: $('label', el), - spoiler: $('input', el), + spoiler: $('.qr-preview-spoiler input', el), span: el.lastChild }; $.on(el, 'click', this.select); @@ -9345,9 +9013,6 @@ return _this.rm(); }; })(this)); - $.on(this.nodes.label, 'click', function(e) { - return e.stopPropagation(); - }); $.on(this.nodes.spoiler, 'change', (function(_this) { return function(e) { _this.spoiler = e.target.checked; @@ -9356,10 +9021,17 @@ } }; })(this)); - $.add(QR.nodes.dumpList, el); - ref = ['dragStart', 'dragEnter', 'dragLeave', 'dragOver', 'dragEnd', 'drop']; + ref = $$('label', el); for (k = 0, len1 = ref.length; k < len1; k++) { - event = ref[k]; + label = ref[k]; + $.on(label, 'click', function(e) { + return e.stopPropagation(); + }); + } + $.add(QR.nodes.dumpList, el); + ref1 = ['dragStart', 'dragEnter', 'dragLeave', 'dragOver', 'dragEnd', 'drop']; + for (q = 0, len2 = ref1.length; q < len2; q++) { + event = ref1[q]; $.on(el, event.toLowerCase(), this[event]); } this.thread = g.VIEW === 'thread' ? g.THREADID : 'new'; @@ -9433,7 +9105,7 @@ _Class.prototype.select = function() { var rectEl, rectList; if (QR.selected) { - QR.selected.nodes.el.id = null; + QR.selected.nodes.el.removeAttribute('id'); QR.selected.forceSave(); } QR.selected = this; @@ -9591,9 +9263,7 @@ } this.filesize = $.bytesToString(this.file.size); this.checkSize(); - if (QR.spoiler) { - this.nodes.label.hidden = false; - } + $.addClass(this.nodes.el, 'has-file'); QR.captcha.onPostChange(); URL.revokeObjectURL(this.URL); this.saveFilename(); @@ -9727,12 +9397,10 @@ delete this.file; delete this.filename; delete this.filesize; - this.nodes.el.title = null; - QR.nodes.filename.title = ''; + this.nodes.el.removeAttribute('title'); + QR.nodes.filename.removeAttribute('title'); this.nodes.el.style.backgroundImage = null; - if (QR.spoiler) { - this.nodes.label.hidden = true; - } + $.rmClass(this.nodes.el, 'has-file'); this.showFileData(); this.updateFlashURL(); URL.revokeObjectURL(this.URL); @@ -9762,11 +9430,11 @@ if (this.file) { this.updateFilename(); QR.nodes.filename.value = this.filename; - QR.nodes.spoiler.checked = this.spoiler; - return $.addClass(QR.nodes.fileSubmit, 'has-file'); + $.addClass(QR.nodes.fileSubmit, 'has-file'); } else { - return $.rmClass(QR.nodes.fileSubmit, 'has-file'); + $.rmClass(QR.nodes.fileSubmit, 'has-file'); } + return QR.nodes.spoiler.checked = this.spoiler; }; _Class.prototype.updateFlashURL = function() { @@ -16311,9 +15979,6 @@ Report = { css: ":root:not(.js-enabled) #captchaContainerAlt {\n" + " height: auto;\n" + -"}\n" + -"noscript > iframe, #recaptcha_challenge_field {\n" + -" width: 500px;\n" + "}", init: function() { var match; @@ -17256,12 +16921,6 @@ } window['4chan X antidup'] = true; if (location.hostname === 'www.google.com') { - if (location.pathname === '/recaptcha/api/noscript') { - $.ready(function() { - return Captcha.noscript.initFrame(); - }); - return; - } if (location.pathname === '/recaptcha/api/fallback') { $.ready(function() { return Captcha.v2.initFrame(); @@ -18477,6 +18136,10 @@ "#captchaContainerAlt td:nth-child(2) {\n" + " display: table-cell !important;\n" + "}\n" + +"/* Disable obnoxious captcha fade-in. */\n" + +"body > div:last-of-type {\n" + +" transition: none !important;\n" + +"}\n" + "/* Anti-autoplay */\n" + "audio.controls-added {\n" + " display: block;\n" + @@ -19785,7 +19448,8 @@ " margin: 0;\n" + " margin-right: 3px;\n" + "}\n" + -"#qr.has-spoiler #file-n-submit:not(.has-file) #qr-spoiler-label,\n" + +"#qr:not(.has-spoiler) #qr-spoiler-label,\n" + +"#file-n-submit:not(.has-file) #qr-spoiler-label,\n" + ".has-file #paste-area,\n" + ".has-file #url-button,\n" + "#file-n-submit:not(.custom-cooldown) #custom-cooldown-button {\n" + @@ -19798,20 +19462,18 @@ " margin: 0;\n" + "}\n" + ".checkbox-letter {\n" + -" pointer-events: none;\n" + -" position: absolute;\n" + -" top: 2px;\n" + -" left: 0;\n" + -" right: 0;\n" + -" text-align: center;\n" + -" font-size: 11px;\n" + " font-weight: bold;\n" + -" color: rgba(0,0,0,.6);\n" + "}\n" + +"#qr-filename-container label:not(:hover) > input[type=\"checkbox\"]:not(:focus):not(:checked),\n" + +"#qr-filename-container label:hover > .checkbox-letter,\n" + +"input[type=\"checkbox\"]:focus ~ .checkbox-letter,\n" + "input[type=\"checkbox\"]:checked ~ .checkbox-letter {\n" + -" display: none;\n" + +" /* not displayed but still focusable */\n" + +" position: absolute;\n" + +" opacity: 0;\n" + +" pointer-events: none;\n" + "}\n" + -"#paste-area, #url-button, #custom-cooldown-button, #dump-button {\n" + +".checkbox-letter, #paste-area, #url-button, #custom-cooldown-button, #dump-button {\n" + " opacity: 0.6;\n" + "}\n" + "#paste-area {\n" + @@ -19906,6 +19568,10 @@ ".remove:hover::after {\n" + " content: \" Remove\";\n" + "}\n" + +".qr-preview:not(.has-file) label,\n" + +"#qr:not(.has-spoiler) .qr-preview-spoiler {\n" + +" display: none;\n" + +"}\n" + ".qr-preview > label {\n" + " background: rgba(0,0,0,.5);\n" + " color: #fff;\n" + diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index fe543393e..fe8acdaed 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 700fc9e10..2fad4a136 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.11.13.4 +// @version 1.11.13.5 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -22,8 +22,6 @@ // @include https://www.google.com/recaptcha/api2/frame?*&k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @include http://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @include https://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* -// @include http://www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* -// @include https://www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index c09b26f97..082992680 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.13.4 +// @version 1.11.13.5 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -23,8 +23,6 @@ // @include https://www.google.com/recaptcha/api2/frame?*&k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @include http://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @include https://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* -// @include http://www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* -// @include https://www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc* // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue @@ -244,7 +242,7 @@ 'Hide Original Post Form': [true, 'Hide the normal post form.', 1], 'Cooldown': [true, 'Indicate the remaining time before posting again.', 1], 'Posting Success Notifications': [true, 'Show notifications on successful post creation or file uploading.', 1], - 'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha in the QR even if Javascript is enabled.', 1], + 'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha in the QR even if Javascript is enabled (Recaptcha v2 only).', 1], 'Auto-load captcha': [false, 'Automatically load the captcha in the QR even if your post is empty.', 1], 'Post on Captcha Completion': [false, 'Submit the post immediately when the captcha is completed.', 1], 'Bottom QR Link': [true, 'Places a link on the bottom of threads to open the QR.', 1], @@ -415,7 +413,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.13.4', + VERSION: '1.11.13.5', NAMESPACE: '4chan X.', boards: {} }; @@ -6866,7 +6864,7 @@ 'webm': 'video/webm' }, init: function() { - var noscript, sc, version; + var sc, version; if (!Conf['Quick Reply']) { return; } @@ -6875,7 +6873,7 @@ if (g.VIEW === 'archive') { return; } - version = Conf['Use Recaptcha v1'] ? (noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled'), noscript ? 'noscript' : 'v1') : 'v2'; + version = Conf['Use Recaptcha v1'] ? 'v1' : 'v2'; this.captcha = Captcha[version]; $.on(d, '4chanXInitFinished', this.initReady); Post.callbacks.push({ @@ -7424,7 +7422,7 @@ var dialog, event, i, items, m, match_max, match_min, name, node, nodes, ref, rules, save, scriptData, setNode; QR.nodes = nodes = { el: dialog = UI.dialog('qr', 'top: 50px; right: 0px;', { - innerHTML: " " + innerHTML: " " }) }; setNode = function(name, query) { @@ -7489,8 +7487,6 @@ QR.spoiler = !!$('.postForm input[name=spoiler]'); if (QR.spoiler) { $.addClass(QR.nodes.el, 'has-spoiler'); - } else { - nodes.spoiler.parentElement.hidden = true; } if (g.BOARD.ID === 'jp' && Conf['sjisPreview']) { $.addClass(QR.nodes.el, 'sjis-preview'); @@ -7884,7 +7880,8 @@ childList: true, subtree: true }); - return $.on(d, 'keydown', this.keybinds.bind(this)); + $.on(d, 'keydown', this.keybinds.bind(this)); + return window.focus(); }, initNoscript: function() { this.noscript = true; @@ -8007,334 +8004,6 @@ } }; - Captcha.noscript = { - lifetime: 30 * $.MINUTE, - init: function() { - var container, input; - if (d.cookie.indexOf('pass_enabled=1') >= 0) { - return; - } - if (!(this.isEnabled = !!$('#g-recaptcha, #captchaContainerAlt'))) { - return; - } - container = $.el('div', { - className: 'captcha-img', - title: 'Reload reCAPTCHA' - }); - input = $.el('input', { - className: 'captcha-input field', - title: 'Verification', - autocomplete: 'off', - spellcheck: false - }); - this.nodes = { - container: container, - input: input - }; - $.on(input, 'keydown', this.keydown.bind(this)); - $.on(this.nodes.container, 'click', (function(_this) { - return function() { - _this.reload(); - return _this.nodes.input.focus(); - }; - })(this)); - this.conn = new Connection(null, location.protocol + "//www.google.com", { - challenge: this.load.bind(this), - token: this.save.bind(this), - error: this.error.bind(this) - }); - $.addClass(QR.nodes.el, 'has-captcha', 'captcha-v1', 'noscript-captcha'); - $.after(QR.nodes.com.parentNode, [container, input]); - this.captchas = []; - $.get('captchas', [], function(arg) { - var captchas; - captchas = arg.captchas; - QR.captcha.sync(captchas); - return QR.captcha.clear(); - }); - $.sync('captchas', this.sync); - this.beforeSetup(); - return this.setup(); - }, - initFrame: function() { - var cb, conn, img, ref, ref1; - conn = new Connection(window.parent, location.protocol + "//boards.4chan.org", { - response: function(response) { - $.id('recaptcha_response_field').value = response; - return HTMLFormElement.prototype.submit.call($('form')); - } - }); - if (location.hash === '#response') { - conn.send({ - token: (ref = $('textarea')) != null ? ref.value : void 0, - error: (ref1 = $('.recaptcha_input_area')) != null ? ref1.textContent.replace(/:$/, '') : void 0 - }); - } - if (!(img = $('img'))) { - return; - } - $('form').action = '#response'; - cb = function() { - var canvas; - canvas = $.el('canvas'); - canvas.width = img.width; - canvas.height = img.height; - canvas.getContext('2d').drawImage(img, 0, 0); - return conn.send({ - challenge: canvas.toDataURL() - }); - }; - if (img.complete) { - return cb(); - } else { - return $.on(img, 'load', cb); - } - }, - timers: {}, - iframeURL: function() { - var lang, url; - url = '//www.google.com/recaptcha/api/noscript?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc'; - if (lang = Conf['captchaLanguage'].trim()) { - url += "&hl=" + (encodeURIComponent(lang)); - } - return url; - }, - cb: { - focus: function() { - return QR.captcha.setup(false, true); - } - }, - beforeSetup: function() { - var container, input, ref; - ref = this.nodes, container = ref.container, input = ref.input; - container.hidden = true; - input.value = ''; - input.placeholder = 'Focus to load reCAPTCHA'; - this.count(); - return $.on(input, 'focus click', this.cb.focus); - }, - needed: function() { - var captchaCount, postsCount; - captchaCount = this.captchas.length; - if (QR.req) { - captchaCount++; - } - postsCount = QR.posts.length; - if (postsCount === 1 && !Conf['Auto-load captcha'] && !QR.posts[0].com && !QR.posts[0].file) { - postsCount = 0; - } - return captchaCount < postsCount; - }, - onNewPost: function() {}, - onPostChange: function() {}, - setup: function(focus, force) { - if (!(this.isEnabled && (this.needed() || force))) { - return; - } - if (!this.nodes.iframe) { - this.nodes.iframe = $.el('iframe', { - id: 'qr-captcha-iframe', - src: this.iframeURL() - }); - $.add(QR.nodes.el, this.nodes.iframe); - this.conn.target = this.nodes.iframe; - } else if (!this.occupied || force) { - this.nodes.iframe.src = this.iframeURL(); - } - this.occupied = true; - if (focus) { - return this.nodes.input.focus(); - } - }, - afterSetup: function() { - var container, input, ref; - ref = this.nodes, container = ref.container, input = ref.input; - container.hidden = false; - input.placeholder = 'Verification'; - this.count(); - $.off(input, 'focus click', this.cb.focus); - if (QR.nodes.el.getBoundingClientRect().bottom > doc.clientHeight) { - QR.nodes.el.style.top = ''; - return QR.nodes.el.style.bottom = '0px'; - } - }, - destroy: function() { - if (!this.isEnabled) { - return; - } - $.rm(this.nodes.img); - delete this.nodes.img; - $.rm(this.nodes.iframe); - delete this.nodes.iframe; - delete this.occupied; - return this.beforeSetup(); - }, - sync: function(captchas) { - if (captchas == null) { - captchas = []; - } - QR.captcha.captchas = captchas; - return QR.captcha.count(); - }, - getOne: function() { - var captcha; - this.clear(); - if (captcha = this.captchas.shift()) { - this.count(); - $.set('captchas', this.captchas); - return captcha; - } else if (/\S/.test(this.nodes.input.value)) { - return (function(_this) { - return function(cb) { - _this.submitCB = cb; - return _this.sendResponse(); - }; - })(this); - } else { - return null; - } - }, - sendResponse: function() { - var response; - response = this.nodes.input.value; - if (/\S/.test(response)) { - return this.conn.send({ - response: response - }); - } - }, - save: function(token) { - var captcha; - delete this.occupied; - this.nodes.input.value = ''; - captcha = { - challenge: token, - response: 'manual_challenge', - timeout: this.timeout - }; - if (this.submitCB) { - this.submitCB(captcha); - delete this.submitCB; - if (this.needed()) { - return this.reload(); - } else { - return this.destroy(); - } - } else { - $.forceSync('captchas'); - this.captchas.push(captcha); - this.count(); - $.set('captchas', this.captchas); - return this.reload(); - } - }, - error: function(message) { - this.occupied = true; - this.nodes.input.value = ''; - if (this.submitCB) { - this.submitCB(); - delete this.submitCB; - } - return QR.error("Captcha Error: " + message); - }, - clear: function() { - var captcha, i, k, len1, now, ref; - if (!this.captchas.length) { - return; - } - $.forceSync('captchas'); - now = Date.now(); - ref = this.captchas; - for (i = k = 0, len1 = ref.length; k < len1; i = ++k) { - captcha = ref[i]; - if (captcha.timeout > now) { - break; - } - } - if (!i) { - return; - } - this.captchas = this.captchas.slice(i); - this.count(); - return $.set('captchas', this.captchas); - }, - load: function(src) { - var container, img, input, ref; - ref = this.nodes, container = ref.container, input = ref.input, img = ref.img; - this.occupied = true; - this.timeout = Date.now() + this.lifetime; - if (!img) { - img = this.nodes.img = new Image(); - $.one(img, 'load', this.afterSetup.bind(this)); - $.on(img, 'load', function() { - return this.hidden = false; - }); - $.add(container, img); - } - img.src = src; - input.value = ''; - this.clear(); - clearTimeout(this.timers.expire); - return this.timers.expire = setTimeout(this.expire.bind(this), this.lifetime); - }, - count: function() { - var count, placeholder; - count = this.captchas ? this.captchas.length : 0; - placeholder = this.nodes.input.placeholder.replace(/\ \(.*\)$/, ''); - placeholder += (function() { - switch (count) { - case 0: - if (placeholder === 'Verification') { - return ' (Shift + Enter to cache)'; - } else { - return ''; - } - break; - case 1: - return ' (1 cached captcha)'; - default: - return " (" + count + " cached captchas)"; - } - })(); - this.nodes.input.placeholder = placeholder; - this.nodes.input.alt = count; - clearTimeout(this.timers.clear); - if (this.captchas.length) { - return this.timers.clear = setTimeout(this.clear.bind(this), this.captchas[0].timeout - Date.now()); - } - }, - expire: function() { - if (!this.nodes.iframe) { - return; - } - if (!d.hidden && (this.needed() || d.activeElement === this.nodes.input)) { - return this.reload(); - } else { - return this.destroy(); - } - }, - reload: function() { - var ref; - this.nodes.iframe.src = this.iframeURL(); - this.occupied = true; - return (ref = this.nodes.img) != null ? ref.hidden = true : void 0; - }, - keydown: function(e) { - if (e.keyCode === 8 && !this.nodes.input.value) { - if (this.nodes.iframe) { - this.reload(); - } else { - this.setup(); - } - } else if (e.keyCode === 13 && e.shiftKey) { - this.sendResponse(); - } else { - return; - } - return e.preventDefault(); - } - }; - Captcha.replace = { init: function() { var jsEnabled; @@ -9322,20 +8991,19 @@ QR.post = (function() { function _Class(select) { this.select = bind(this.select, this); - var el, event, k, len1, prev, ref; + var el, event, k, label, len1, len2, prev, q, ref, ref1; el = $.el('a', { className: 'qr-preview', draggable: true, href: 'javascript:;' }); $.extend(el, { - innerHTML: "" + innerHTML: "" }); this.nodes = { el: el, rm: el.firstChild, - label: $('label', el), - spoiler: $('input', el), + spoiler: $('.qr-preview-spoiler input', el), span: el.lastChild }; $.on(el, 'click', this.select); @@ -9345,9 +9013,6 @@ return _this.rm(); }; })(this)); - $.on(this.nodes.label, 'click', function(e) { - return e.stopPropagation(); - }); $.on(this.nodes.spoiler, 'change', (function(_this) { return function(e) { _this.spoiler = e.target.checked; @@ -9356,10 +9021,17 @@ } }; })(this)); - $.add(QR.nodes.dumpList, el); - ref = ['dragStart', 'dragEnter', 'dragLeave', 'dragOver', 'dragEnd', 'drop']; + ref = $$('label', el); for (k = 0, len1 = ref.length; k < len1; k++) { - event = ref[k]; + label = ref[k]; + $.on(label, 'click', function(e) { + return e.stopPropagation(); + }); + } + $.add(QR.nodes.dumpList, el); + ref1 = ['dragStart', 'dragEnter', 'dragLeave', 'dragOver', 'dragEnd', 'drop']; + for (q = 0, len2 = ref1.length; q < len2; q++) { + event = ref1[q]; $.on(el, event.toLowerCase(), this[event]); } this.thread = g.VIEW === 'thread' ? g.THREADID : 'new'; @@ -9433,7 +9105,7 @@ _Class.prototype.select = function() { var rectEl, rectList; if (QR.selected) { - QR.selected.nodes.el.id = null; + QR.selected.nodes.el.removeAttribute('id'); QR.selected.forceSave(); } QR.selected = this; @@ -9591,9 +9263,7 @@ } this.filesize = $.bytesToString(this.file.size); this.checkSize(); - if (QR.spoiler) { - this.nodes.label.hidden = false; - } + $.addClass(this.nodes.el, 'has-file'); QR.captcha.onPostChange(); URL.revokeObjectURL(this.URL); this.saveFilename(); @@ -9727,12 +9397,10 @@ delete this.file; delete this.filename; delete this.filesize; - this.nodes.el.title = null; - QR.nodes.filename.title = ''; + this.nodes.el.removeAttribute('title'); + QR.nodes.filename.removeAttribute('title'); this.nodes.el.style.backgroundImage = null; - if (QR.spoiler) { - this.nodes.label.hidden = true; - } + $.rmClass(this.nodes.el, 'has-file'); this.showFileData(); this.updateFlashURL(); URL.revokeObjectURL(this.URL); @@ -9762,11 +9430,11 @@ if (this.file) { this.updateFilename(); QR.nodes.filename.value = this.filename; - QR.nodes.spoiler.checked = this.spoiler; - return $.addClass(QR.nodes.fileSubmit, 'has-file'); + $.addClass(QR.nodes.fileSubmit, 'has-file'); } else { - return $.rmClass(QR.nodes.fileSubmit, 'has-file'); + $.rmClass(QR.nodes.fileSubmit, 'has-file'); } + return QR.nodes.spoiler.checked = this.spoiler; }; _Class.prototype.updateFlashURL = function() { @@ -16311,9 +15979,6 @@ Report = { css: ":root:not(.js-enabled) #captchaContainerAlt {\n" + " height: auto;\n" + -"}\n" + -"noscript > iframe, #recaptcha_challenge_field {\n" + -" width: 500px;\n" + "}", init: function() { var match; @@ -17256,12 +16921,6 @@ } window['4chan X antidup'] = true; if (location.hostname === 'www.google.com') { - if (location.pathname === '/recaptcha/api/noscript') { - $.ready(function() { - return Captcha.noscript.initFrame(); - }); - return; - } if (location.pathname === '/recaptcha/api/fallback') { $.ready(function() { return Captcha.v2.initFrame(); @@ -18477,6 +18136,10 @@ "#captchaContainerAlt td:nth-child(2) {\n" + " display: table-cell !important;\n" + "}\n" + +"/* Disable obnoxious captcha fade-in. */\n" + +"body > div:last-of-type {\n" + +" transition: none !important;\n" + +"}\n" + "/* Anti-autoplay */\n" + "audio.controls-added {\n" + " display: block;\n" + @@ -19785,7 +19448,8 @@ " margin: 0;\n" + " margin-right: 3px;\n" + "}\n" + -"#qr.has-spoiler #file-n-submit:not(.has-file) #qr-spoiler-label,\n" + +"#qr:not(.has-spoiler) #qr-spoiler-label,\n" + +"#file-n-submit:not(.has-file) #qr-spoiler-label,\n" + ".has-file #paste-area,\n" + ".has-file #url-button,\n" + "#file-n-submit:not(.custom-cooldown) #custom-cooldown-button {\n" + @@ -19798,20 +19462,18 @@ " margin: 0;\n" + "}\n" + ".checkbox-letter {\n" + -" pointer-events: none;\n" + -" position: absolute;\n" + -" top: 2px;\n" + -" left: 0;\n" + -" right: 0;\n" + -" text-align: center;\n" + -" font-size: 11px;\n" + " font-weight: bold;\n" + -" color: rgba(0,0,0,.6);\n" + "}\n" + +"#qr-filename-container label:not(:hover) > input[type=\"checkbox\"]:not(:focus):not(:checked),\n" + +"#qr-filename-container label:hover > .checkbox-letter,\n" + +"input[type=\"checkbox\"]:focus ~ .checkbox-letter,\n" + "input[type=\"checkbox\"]:checked ~ .checkbox-letter {\n" + -" display: none;\n" + +" /* not displayed but still focusable */\n" + +" position: absolute;\n" + +" opacity: 0;\n" + +" pointer-events: none;\n" + "}\n" + -"#paste-area, #url-button, #custom-cooldown-button, #dump-button {\n" + +".checkbox-letter, #paste-area, #url-button, #custom-cooldown-button, #dump-button {\n" + " opacity: 0.6;\n" + "}\n" + "#paste-area {\n" + @@ -19906,6 +19568,10 @@ ".remove:hover::after {\n" + " content: \" Remove\";\n" + "}\n" + +".qr-preview:not(.has-file) label,\n" + +"#qr:not(.has-spoiler) .qr-preview-spoiler {\n" + +" display: none;\n" + +"}\n" + ".qr-preview > label {\n" + " background: rgba(0,0,0,.5);\n" + " color: #fff;\n" + diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 0f053805e..c6200e2ea 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 ffc489ef4..8f87932cf 100644 --- a/builds/updates-beta.xml +++ b/builds/updates-beta.xml @@ -1,7 +1,7 @@