Release 4chan X v1.11.0.3.

This commit is contained in:
ccd0 2015-06-19 15:56:13 -07:00
parent 69c882f9bf
commit e1ee1ce6a1
13 changed files with 210 additions and 957 deletions

View File

@ -4,6 +4,9 @@ The links to individual versions below are to copies of the script with the upda
## v1.11.0
**v1.11.0.3** *(2015-06-19)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.3/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.3/builds/4chan-X-noupdate.crx "Chromium version")]
- Merge v1.10.14.4: Update script for new non-Javascript captcha using image selection.
**v1.11.0.2** *(2015-06-19)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.2/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.0.2/builds/4chan-X-noupdate.crx "Chromium version")]
- Remove code that focused on first image of the captcha as Google now focuses on the refresh button.

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X beta
// @version 1.11.0.2
// @version 1.11.0.3
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript
// ==UserScript==
// @name 4chan X beta
// @version 1.11.0.2
// @version 1.11.0.3
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@ -399,7 +399,7 @@
doc = d.documentElement;
g = {
VERSION: '1.11.0.2',
VERSION: '1.11.0.3',
NAMESPACE: '4chan X.',
boards: {}
};
@ -6670,7 +6670,7 @@
QR = {
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'],
init: function() {
var noscript, sc;
var sc;
if (!Conf['Quick Reply']) {
return;
}
@ -6679,8 +6679,7 @@
if (g.VIEW === 'archive') {
return;
}
noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled');
this.captcha = Captcha[noscript ? 'noscript' : 'v2'];
this.captcha = Captcha.v2;
$.on(d, '4chanXInitFinished', this.initReady);
Post.callbacks.push({
name: 'Quick Reply',
@ -7704,55 +7703,6 @@
};
Captcha.noscript = {
lifetime: 2 * $.MINUTE,
iframeURL: '//www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc',
init: function() {
var container, input;
if (d.cookie.indexOf('pass_enabled=1') >= 0) {
return;
}
if (!(this.isEnabled = !!$.id('g-recaptcha'))) {
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');
$.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", {
@ -7783,247 +7733,12 @@
} else {
return $.on(img, 'load', cb);
}
},
timers: {},
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(d.body, this.nodes.iframe);
this.conn.target = this.nodes.iframe.contentWindow;
} 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;
}
if (this.nodes.img) {
$.rm(this.nodes.img);
}
delete this.nodes.img;
if (this.nodes.iframe) {
$.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.response;
} 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) {
delete this.occupied;
this.nodes.input.value = '';
if (this.submitCB) {
this.submitCB(token);
delete this.submitCB;
if (this.needed()) {
return this.reload();
} else {
return this.destroy();
}
} else {
$.forceSync('captchas');
this.captchas.push({
response: token,
timeout: this.timeout
});
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.v2 = {
lifetime: 2 * $.MINUTE,
noscriptURL: '//www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc',
init: function() {
var counter, root;
if (d.cookie.indexOf('pass_enabled=1') >= 0) {
@ -8032,6 +7747,15 @@
if (!(this.isEnabled = !!$.id('g-recaptcha'))) {
return;
}
if (this.noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled')) {
this.conn = new Connection(null, location.protocol + "//www.google.com", {
token: (function(_this) {
return function(token) {
return _this.save(true, token);
};
})(this)
});
}
this.captchas = [];
$.get('captchas', [], function(arg) {
var captchas;
@ -8124,6 +7848,22 @@
childList: true,
subtree: true
});
if (this.noscript) {
return this.setupNoscript();
} else {
return this.setupJS();
}
},
setupNoscript: function() {
var iframe;
iframe = $.el('iframe', {
id: 'qr-captcha-iframe',
src: this.noscriptURL
});
$.add(this.nodes.container, iframe);
return this.conn.target = iframe.contentWindow;
},
setupJS: function() {
return $.globalEval('(function() {\n function render() {\n var container = document.querySelector("#qr .captcha-container");\n container.dataset.widgetID = window.grecaptcha.render(container, {\n sitekey: \'6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc\',\n theme: document.documentElement.classList.contains(\'tomorrow\') ? \'dark\' : \'light\',\n callback: function(response) {\n window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));\n }\n });\n }\n if (window.grecaptcha) {\n render();\n } else {\n var cbNative = window.onRecaptchaLoaded;\n window.onRecaptchaLoaded = function() {\n render();\n cbNative();\n }\n }\n})();');
},
afterSetup: function(mutations) {
@ -8200,12 +7940,12 @@
return null;
}
},
save: function(pasted) {
save: function(pasted, token) {
var base1, focus, ref, ref1;
$.forceSync('captchas');
this.captchas.push({
response: $('textarea', this.nodes.container).value,
timeout: (pasted ? this.setupTime : Date.now()) + this.lifetime
response: token || $('textarea', this.nodes.container).value,
timeout: Date.now() + this.lifetime
});
$.set('captchas', this.captchas);
this.count();
@ -8265,7 +8005,11 @@
}
},
reload: function() {
return $.globalEval('(function() {\n var container = document.querySelector("#qr .captcha-container");\n window.grecaptcha.reset(container.dataset.widgetID);\n})();');
if (this.noscript) {
return $('iframe', this.nodes.container).src = this.noscriptURL;
} else {
return $.globalEval('(function() {\n var container = document.querySelector("#qr .captcha-container");\n window.grecaptcha.reset(container.dataset.widgetID);\n})();');
}
}
};
@ -15439,8 +15183,11 @@
};
Report = {
css: "noscript div:first-child, noscript iframe {\n" +
" height: 422px !important;\n" +
css: "noscript > div, noscript > div > div {\n" +
" height: 545px !important;\n" +
"}\n" +
"noscript > div > div > div:first-child, noscript iframe {\n" +
" height: 423px !important;\n" +
"}\n" +
":root:not(.js-enabled) #g-recaptcha {\n" +
" height: auto;\n" +
@ -17304,8 +17051,14 @@
" 0% {transform:rotate(0deg);}\n" +
" 100% {transform:rotate(359deg);}\n" +
"}\n" +
"noscript div:first-child, noscript iframe {\n" +
" height: 422px !important;\n" +
"noscript > div, noscript > div > div {\n" +
" height: 545px !important;\n" +
"}\n" +
"noscript > div > div > div:first-child, noscript iframe {\n" +
" height: 423px !important;\n" +
"}\n" +
":root:not(.js-enabled) #g-recaptcha {\n" +
" height: auto;\n" +
"}\n" +
"/* General */\n" +
".dialog {\n" +
@ -18505,23 +18258,7 @@
" position: relative;\n" +
" top: 2px;\n" +
"}\n" +
"/* Noscript Recaptcha */\n" +
".captcha-img {\n" +
" margin: 0px;\n" +
" text-align: center;\n" +
" background-image: #fff;\n" +
" font-size: 0px;\n" +
" min-height: 59px;\n" +
" min-width: 302px;\n" +
"}\n" +
".captcha-input{\n" +
" width: 100%;\n" +
" margin: 1px 0 0;\n" +
"}\n" +
"#qr-captcha-iframe {\n" +
" display: none;\n" +
"}\n" +
"/* Recaptcha v2 */\n" +
"/* Captcha */\n" +
"#qr .captcha-root {\n" +
" position: relative;\n" +
"}\n" +
@ -18545,6 +18282,13 @@
" display: block;\n" +
" width: 100%;\n" +
"}\n" +
"#qr-captcha-iframe {\n" +
" width: 302px;\n" +
" height: 423px;\n" +
" max-width: 100vw;\n" +
" max-height: calc(100vh - 210px);\n" +
" overflow: auto;\n" +
"}\n" +
".goog-bubble-content {\n" +
" max-width: 100vw;\n" +
" max-height: 100vh;\n" +
@ -19696,8 +19440,14 @@
" font-family: sans-serif !important;\n" +
" text-shadow: 1px 1px 1px rgba(0,74,153,0.6);\n" +
"}",
cssWWW: "noscript div:first-child, noscript iframe {\n" +
" height: 422px !important;\n" +
cssWWW: "noscript > div, noscript > div > div {\n" +
" height: 545px !important;\n" +
"}\n" +
"noscript > div > div > div:first-child, noscript iframe {\n" +
" height: 423px !important;\n" +
"}\n" +
":root:not(.js-enabled) #g-recaptcha {\n" +
" height: auto;\n" +
"}\n" +
"#captcha-cnt {\n" +
" height: auto;\n" +

Binary file not shown.

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript
// ==UserScript==
// @name 4chan X
// @version 1.11.0.2
// @version 1.11.0.3
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@ -398,7 +398,7 @@
doc = d.documentElement;
g = {
VERSION: '1.11.0.2',
VERSION: '1.11.0.3',
NAMESPACE: '4chan X.',
boards: {}
};
@ -6669,7 +6669,7 @@
QR = {
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'],
init: function() {
var noscript, sc;
var sc;
if (!Conf['Quick Reply']) {
return;
}
@ -6678,8 +6678,7 @@
if (g.VIEW === 'archive') {
return;
}
noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled');
this.captcha = Captcha[noscript ? 'noscript' : 'v2'];
this.captcha = Captcha.v2;
$.on(d, '4chanXInitFinished', this.initReady);
Post.callbacks.push({
name: 'Quick Reply',
@ -7703,55 +7702,6 @@
};
Captcha.noscript = {
lifetime: 2 * $.MINUTE,
iframeURL: '//www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc',
init: function() {
var container, input;
if (d.cookie.indexOf('pass_enabled=1') >= 0) {
return;
}
if (!(this.isEnabled = !!$.id('g-recaptcha'))) {
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');
$.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", {
@ -7782,247 +7732,12 @@
} else {
return $.on(img, 'load', cb);
}
},
timers: {},
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(d.body, this.nodes.iframe);
this.conn.target = this.nodes.iframe.contentWindow;
} 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;
}
if (this.nodes.img) {
$.rm(this.nodes.img);
}
delete this.nodes.img;
if (this.nodes.iframe) {
$.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.response;
} 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) {
delete this.occupied;
this.nodes.input.value = '';
if (this.submitCB) {
this.submitCB(token);
delete this.submitCB;
if (this.needed()) {
return this.reload();
} else {
return this.destroy();
}
} else {
$.forceSync('captchas');
this.captchas.push({
response: token,
timeout: this.timeout
});
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.v2 = {
lifetime: 2 * $.MINUTE,
noscriptURL: '//www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc',
init: function() {
var counter, root;
if (d.cookie.indexOf('pass_enabled=1') >= 0) {
@ -8031,6 +7746,15 @@
if (!(this.isEnabled = !!$.id('g-recaptcha'))) {
return;
}
if (this.noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled')) {
this.conn = new Connection(null, location.protocol + "//www.google.com", {
token: (function(_this) {
return function(token) {
return _this.save(true, token);
};
})(this)
});
}
this.captchas = [];
$.get('captchas', [], function(arg) {
var captchas;
@ -8123,6 +7847,22 @@
childList: true,
subtree: true
});
if (this.noscript) {
return this.setupNoscript();
} else {
return this.setupJS();
}
},
setupNoscript: function() {
var iframe;
iframe = $.el('iframe', {
id: 'qr-captcha-iframe',
src: this.noscriptURL
});
$.add(this.nodes.container, iframe);
return this.conn.target = iframe.contentWindow;
},
setupJS: function() {
return $.globalEval('(function() {\n function render() {\n var container = document.querySelector("#qr .captcha-container");\n container.dataset.widgetID = window.grecaptcha.render(container, {\n sitekey: \'6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc\',\n theme: document.documentElement.classList.contains(\'tomorrow\') ? \'dark\' : \'light\',\n callback: function(response) {\n window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));\n }\n });\n }\n if (window.grecaptcha) {\n render();\n } else {\n var cbNative = window.onRecaptchaLoaded;\n window.onRecaptchaLoaded = function() {\n render();\n cbNative();\n }\n }\n})();');
},
afterSetup: function(mutations) {
@ -8199,12 +7939,12 @@
return null;
}
},
save: function(pasted) {
save: function(pasted, token) {
var base1, focus, ref, ref1;
$.forceSync('captchas');
this.captchas.push({
response: $('textarea', this.nodes.container).value,
timeout: (pasted ? this.setupTime : Date.now()) + this.lifetime
response: token || $('textarea', this.nodes.container).value,
timeout: Date.now() + this.lifetime
});
$.set('captchas', this.captchas);
this.count();
@ -8264,7 +8004,11 @@
}
},
reload: function() {
return $.globalEval('(function() {\n var container = document.querySelector("#qr .captcha-container");\n window.grecaptcha.reset(container.dataset.widgetID);\n})();');
if (this.noscript) {
return $('iframe', this.nodes.container).src = this.noscriptURL;
} else {
return $.globalEval('(function() {\n var container = document.querySelector("#qr .captcha-container");\n window.grecaptcha.reset(container.dataset.widgetID);\n})();');
}
}
};
@ -15438,8 +15182,11 @@
};
Report = {
css: "noscript div:first-child, noscript iframe {\n" +
" height: 422px !important;\n" +
css: "noscript > div, noscript > div > div {\n" +
" height: 545px !important;\n" +
"}\n" +
"noscript > div > div > div:first-child, noscript iframe {\n" +
" height: 423px !important;\n" +
"}\n" +
":root:not(.js-enabled) #g-recaptcha {\n" +
" height: auto;\n" +
@ -17303,8 +17050,14 @@
" 0% {transform:rotate(0deg);}\n" +
" 100% {transform:rotate(359deg);}\n" +
"}\n" +
"noscript div:first-child, noscript iframe {\n" +
" height: 422px !important;\n" +
"noscript > div, noscript > div > div {\n" +
" height: 545px !important;\n" +
"}\n" +
"noscript > div > div > div:first-child, noscript iframe {\n" +
" height: 423px !important;\n" +
"}\n" +
":root:not(.js-enabled) #g-recaptcha {\n" +
" height: auto;\n" +
"}\n" +
"/* General */\n" +
".dialog {\n" +
@ -18504,23 +18257,7 @@
" position: relative;\n" +
" top: 2px;\n" +
"}\n" +
"/* Noscript Recaptcha */\n" +
".captcha-img {\n" +
" margin: 0px;\n" +
" text-align: center;\n" +
" background-image: #fff;\n" +
" font-size: 0px;\n" +
" min-height: 59px;\n" +
" min-width: 302px;\n" +
"}\n" +
".captcha-input{\n" +
" width: 100%;\n" +
" margin: 1px 0 0;\n" +
"}\n" +
"#qr-captcha-iframe {\n" +
" display: none;\n" +
"}\n" +
"/* Recaptcha v2 */\n" +
"/* Captcha */\n" +
"#qr .captcha-root {\n" +
" position: relative;\n" +
"}\n" +
@ -18544,6 +18281,13 @@
" display: block;\n" +
" width: 100%;\n" +
"}\n" +
"#qr-captcha-iframe {\n" +
" width: 302px;\n" +
" height: 423px;\n" +
" max-width: 100vw;\n" +
" max-height: calc(100vh - 210px);\n" +
" overflow: auto;\n" +
"}\n" +
".goog-bubble-content {\n" +
" max-width: 100vw;\n" +
" max-height: 100vh;\n" +
@ -19695,8 +19439,14 @@
" font-family: sans-serif !important;\n" +
" text-shadow: 1px 1px 1px rgba(0,74,153,0.6);\n" +
"}",
cssWWW: "noscript div:first-child, noscript iframe {\n" +
" height: 422px !important;\n" +
cssWWW: "noscript > div, noscript > div > div {\n" +
" height: 545px !important;\n" +
"}\n" +
"noscript > div > div > div:first-child, noscript iframe {\n" +
" height: 423px !important;\n" +
"}\n" +
":root:not(.js-enabled) #g-recaptcha {\n" +
" height: auto;\n" +
"}\n" +
"#captcha-cnt {\n" +
" height: auto;\n" +

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
// @version 1.11.0.2
// @version 1.11.0.3
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript
// ==UserScript==
// @name 4chan X
// @version 1.11.0.2
// @version 1.11.0.3
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@ -399,7 +399,7 @@
doc = d.documentElement;
g = {
VERSION: '1.11.0.2',
VERSION: '1.11.0.3',
NAMESPACE: '4chan X.',
boards: {}
};
@ -6670,7 +6670,7 @@
QR = {
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'],
init: function() {
var noscript, sc;
var sc;
if (!Conf['Quick Reply']) {
return;
}
@ -6679,8 +6679,7 @@
if (g.VIEW === 'archive') {
return;
}
noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled');
this.captcha = Captcha[noscript ? 'noscript' : 'v2'];
this.captcha = Captcha.v2;
$.on(d, '4chanXInitFinished', this.initReady);
Post.callbacks.push({
name: 'Quick Reply',
@ -7704,55 +7703,6 @@
};
Captcha.noscript = {
lifetime: 2 * $.MINUTE,
iframeURL: '//www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc',
init: function() {
var container, input;
if (d.cookie.indexOf('pass_enabled=1') >= 0) {
return;
}
if (!(this.isEnabled = !!$.id('g-recaptcha'))) {
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');
$.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", {
@ -7783,247 +7733,12 @@
} else {
return $.on(img, 'load', cb);
}
},
timers: {},
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(d.body, this.nodes.iframe);
this.conn.target = this.nodes.iframe.contentWindow;
} 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;
}
if (this.nodes.img) {
$.rm(this.nodes.img);
}
delete this.nodes.img;
if (this.nodes.iframe) {
$.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.response;
} 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) {
delete this.occupied;
this.nodes.input.value = '';
if (this.submitCB) {
this.submitCB(token);
delete this.submitCB;
if (this.needed()) {
return this.reload();
} else {
return this.destroy();
}
} else {
$.forceSync('captchas');
this.captchas.push({
response: token,
timeout: this.timeout
});
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.v2 = {
lifetime: 2 * $.MINUTE,
noscriptURL: '//www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc',
init: function() {
var counter, root;
if (d.cookie.indexOf('pass_enabled=1') >= 0) {
@ -8032,6 +7747,15 @@
if (!(this.isEnabled = !!$.id('g-recaptcha'))) {
return;
}
if (this.noscript = Conf['Force Noscript Captcha'] || !$.hasClass(doc, 'js-enabled')) {
this.conn = new Connection(null, location.protocol + "//www.google.com", {
token: (function(_this) {
return function(token) {
return _this.save(true, token);
};
})(this)
});
}
this.captchas = [];
$.get('captchas', [], function(arg) {
var captchas;
@ -8124,6 +7848,22 @@
childList: true,
subtree: true
});
if (this.noscript) {
return this.setupNoscript();
} else {
return this.setupJS();
}
},
setupNoscript: function() {
var iframe;
iframe = $.el('iframe', {
id: 'qr-captcha-iframe',
src: this.noscriptURL
});
$.add(this.nodes.container, iframe);
return this.conn.target = iframe.contentWindow;
},
setupJS: function() {
return $.globalEval('(function() {\n function render() {\n var container = document.querySelector("#qr .captcha-container");\n container.dataset.widgetID = window.grecaptcha.render(container, {\n sitekey: \'6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc\',\n theme: document.documentElement.classList.contains(\'tomorrow\') ? \'dark\' : \'light\',\n callback: function(response) {\n window.dispatchEvent(new CustomEvent("captcha:success", {detail: response}));\n }\n });\n }\n if (window.grecaptcha) {\n render();\n } else {\n var cbNative = window.onRecaptchaLoaded;\n window.onRecaptchaLoaded = function() {\n render();\n cbNative();\n }\n }\n})();');
},
afterSetup: function(mutations) {
@ -8200,12 +7940,12 @@
return null;
}
},
save: function(pasted) {
save: function(pasted, token) {
var base1, focus, ref, ref1;
$.forceSync('captchas');
this.captchas.push({
response: $('textarea', this.nodes.container).value,
timeout: (pasted ? this.setupTime : Date.now()) + this.lifetime
response: token || $('textarea', this.nodes.container).value,
timeout: Date.now() + this.lifetime
});
$.set('captchas', this.captchas);
this.count();
@ -8265,7 +8005,11 @@
}
},
reload: function() {
return $.globalEval('(function() {\n var container = document.querySelector("#qr .captcha-container");\n window.grecaptcha.reset(container.dataset.widgetID);\n})();');
if (this.noscript) {
return $('iframe', this.nodes.container).src = this.noscriptURL;
} else {
return $.globalEval('(function() {\n var container = document.querySelector("#qr .captcha-container");\n window.grecaptcha.reset(container.dataset.widgetID);\n})();');
}
}
};
@ -15439,8 +15183,11 @@
};
Report = {
css: "noscript div:first-child, noscript iframe {\n" +
" height: 422px !important;\n" +
css: "noscript > div, noscript > div > div {\n" +
" height: 545px !important;\n" +
"}\n" +
"noscript > div > div > div:first-child, noscript iframe {\n" +
" height: 423px !important;\n" +
"}\n" +
":root:not(.js-enabled) #g-recaptcha {\n" +
" height: auto;\n" +
@ -17304,8 +17051,14 @@
" 0% {transform:rotate(0deg);}\n" +
" 100% {transform:rotate(359deg);}\n" +
"}\n" +
"noscript div:first-child, noscript iframe {\n" +
" height: 422px !important;\n" +
"noscript > div, noscript > div > div {\n" +
" height: 545px !important;\n" +
"}\n" +
"noscript > div > div > div:first-child, noscript iframe {\n" +
" height: 423px !important;\n" +
"}\n" +
":root:not(.js-enabled) #g-recaptcha {\n" +
" height: auto;\n" +
"}\n" +
"/* General */\n" +
".dialog {\n" +
@ -18505,23 +18258,7 @@
" position: relative;\n" +
" top: 2px;\n" +
"}\n" +
"/* Noscript Recaptcha */\n" +
".captcha-img {\n" +
" margin: 0px;\n" +
" text-align: center;\n" +
" background-image: #fff;\n" +
" font-size: 0px;\n" +
" min-height: 59px;\n" +
" min-width: 302px;\n" +
"}\n" +
".captcha-input{\n" +
" width: 100%;\n" +
" margin: 1px 0 0;\n" +
"}\n" +
"#qr-captcha-iframe {\n" +
" display: none;\n" +
"}\n" +
"/* Recaptcha v2 */\n" +
"/* Captcha */\n" +
"#qr .captcha-root {\n" +
" position: relative;\n" +
"}\n" +
@ -18545,6 +18282,13 @@
" display: block;\n" +
" width: 100%;\n" +
"}\n" +
"#qr-captcha-iframe {\n" +
" width: 302px;\n" +
" height: 423px;\n" +
" max-width: 100vw;\n" +
" max-height: calc(100vh - 210px);\n" +
" overflow: auto;\n" +
"}\n" +
".goog-bubble-content {\n" +
" max-width: 100vw;\n" +
" max-height: 100vh;\n" +
@ -19696,8 +19440,14 @@
" font-family: sans-serif !important;\n" +
" text-shadow: 1px 1px 1px rgba(0,74,153,0.6);\n" +
"}",
cssWWW: "noscript div:first-child, noscript iframe {\n" +
" height: 422px !important;\n" +
cssWWW: "noscript > div, noscript > div > div {\n" +
" height: 545px !important;\n" +
"}\n" +
"noscript > div > div > div:first-child, noscript iframe {\n" +
" height: 423px !important;\n" +
"}\n" +
":root:not(.js-enabled) #g-recaptcha {\n" +
" height: auto;\n" +
"}\n" +
"#captcha-cnt {\n" +
" height: auto;\n" +

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.11.0.2' />
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X-beta.crx' version='1.11.0.3' />
</app>
</gupdate>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.11.0.2' />
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/4chan-X.crx' version='1.11.0.3' />
</app>
</gupdate>

View File

@ -3,8 +3,8 @@
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"meta": {
"name": "4chan X",
"version": "1.11.0.2",
"date": "2015-06-19T07:03:57.192Z",
"version": "1.11.0.3",
"date": "2015-06-19T22:55:10.677Z",
"repo": "https://github.com/ccd0/4chan-x/",
"page": "https://github.com/ccd0/4chan-x",
"downloads": "https://ccd0.github.io/4chan-x/builds/",