Release 4chan X v1.13.15.4.

This commit is contained in:
ccd0 2018-01-23 11:12:19 -08:00
parent ea08bc8822
commit 29b5f315f2
15 changed files with 253 additions and 479 deletions

View File

@ -4,6 +4,11 @@
### v1.13.15 ### v1.13.15
**v1.13.15.4** *(2018-01-23)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.15.4/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.15.4/builds/4chan-X-noupdate.crx)]
- Remove Recaptcha v1 options.
- Don't require captcha if cookie is set indicating captcha not needed yet. #1767
- Revert race condition bugfixes from v1.13.15.0 until I'm sure they're not making things worse.
**v1.13.15.3** *(2018-01-02)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.15.3/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.15.3/builds/4chan-X-noupdate.crx)] **v1.13.15.3** *(2018-01-02)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.15.3/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.15.3/builds/4chan-X-noupdate.crx)]
- Fix removal of stale cached thread data on index refresh which was broken by updates for GM4. - Fix removal of stale cached thread data on index refresh which was broken by updates for GM4.

Binary file not shown.

View File

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

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.13.15.3 // @version 1.13.15.4
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -159,7 +159,7 @@ docSet = function() {
}; };
g = { g = {
VERSION: '1.13.15.3', VERSION: '1.13.15.4',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -322,11 +322,7 @@ Config = (function() {
'Auto-load captcha': [false, 'Automatically load the captcha in the QR even if your post is empty.', 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], 'Post on Captcha Completion': [false, 'Submit the post immediately when the captcha is completed.', 1],
'Captcha Fixes': [true, 'Make captcha easier to use, especially with the keyboard.'], 'Captcha Fixes': [true, 'Make captcha easier to use, especially with the keyboard.'],
'Use Recaptcha v1': [false, 'Use the old text version of Recaptcha in the post form in threads.'],
'Use Recaptcha v1 on Index': [false, 'Use the old text version of Recaptcha on the index and catalog. Warning: May interfere with starting threads.'],
'Use Recaptcha v1 in Reports': [false, 'Use the text captcha in the report window.'],
'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha even if Javascript is enabled (Recaptcha v2 only).'], 'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha even if Javascript is enabled (Recaptcha v2 only).'],
'Force Noscript Captcha for v1': [true, 'Force the non-Javascript fallback captcha for Recaptcha v1. Currently only works on HTTPS.'],
'Pass Link': [false, 'Add a 4chan Pass login link to the bottom of the page.'] 'Pass Link': [false, 'Add a 4chan Pass login link to the bottom of the page.']
}, },
'Quote Links': { 'Quote Links': {
@ -5620,91 +5616,35 @@ DataBoard = (function() {
$.on(d, '4chanXInitFinished', init); $.on(d, '4chanXInitFinished', init);
} }
DataBoard.prototype.changes = []; DataBoard.prototype.save = function(cb) {
return $.set(this.key, this.data, cb);
DataBoard.prototype.save = function(change, cb) {
var changes, snapshot1;
snapshot1 = JSON.stringify(this.data);
change();
changes = this.changes;
changes.push(change);
return $.get(this.key, {
boards: {}
}, (function(_this) {
return function(items) {
var c, i, len, snapshot2;
_this.data = items[_this.key];
snapshot2 = JSON.stringify(_this.data);
for (i = 0, len = changes.length; i < len; i++) {
c = changes[i];
c();
}
return $.set(_this.key, _this.data, function() {
_this.changes = [];
if (snapshot1 !== snapshot2) {
if (typeof _this.sync === "function") {
_this.sync();
}
}
return typeof cb === "function" ? cb() : void 0;
});
};
})(this));
};
DataBoard.prototype.forceSync = function(cb) {
var changes, snapshot1;
snapshot1 = JSON.stringify(this.data);
changes = this.changes;
return $.get(this.key, {
boards: {}
}, (function(_this) {
return function(items) {
var c, i, len, snapshot2;
_this.data = items[_this.key];
snapshot2 = JSON.stringify(_this.data);
for (i = 0, len = changes.length; i < len; i++) {
c = changes[i];
c();
}
if (snapshot1 !== snapshot2) {
if (typeof _this.sync === "function") {
_this.sync();
}
}
return typeof cb === "function" ? cb() : void 0;
};
})(this));
}; };
DataBoard.prototype["delete"] = function(arg) { DataBoard.prototype["delete"] = function(arg) {
var boardID, postID, threadID; var boardID, postID, ref, threadID;
boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID; boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID;
return this.save((function(_this) { $.forceSync(this.key);
return function() { if (postID) {
var ref; if (!((ref = this.data.boards[boardID]) != null ? ref[threadID] : void 0)) {
if (postID) { return;
if (!((ref = _this.data.boards[boardID]) != null ? ref[threadID] : void 0)) { }
return; delete this.data.boards[boardID][threadID][postID];
} this.deleteIfEmpty({
delete _this.data.boards[boardID][threadID][postID]; boardID: boardID,
return _this.deleteIfEmpty({ threadID: threadID
boardID: boardID, });
threadID: threadID } else if (threadID) {
}); if (!this.data.boards[boardID]) {
} else if (threadID) { return;
if (!_this.data.boards[boardID]) { }
return; delete this.data.boards[boardID][threadID];
} this.deleteIfEmpty({
delete _this.data.boards[boardID][threadID]; boardID: boardID
return _this.deleteIfEmpty({ });
boardID: boardID } else {
}); delete this.data.boards[boardID];
} else { }
return delete _this.data.boards[boardID]; return this.save();
}
};
})(this));
}; };
DataBoard.prototype.deleteIfEmpty = function(arg) { DataBoard.prototype.deleteIfEmpty = function(arg) {
@ -5723,59 +5663,45 @@ DataBoard = (function() {
}; };
DataBoard.prototype.set = function(data, cb) { DataBoard.prototype.set = function(data, cb) {
return this.save((function(_this) { $.forceSync(this.key);
return function() { return this.setUnsafe(data, cb);
return _this.setUnsafe(data);
};
})(this), cb);
}; };
DataBoard.prototype.setUnsafe = function(arg) { DataBoard.prototype.setUnsafe = function(arg, cb) {
var base, base1, base2, boardID, postID, threadID, val; var base, base1, base2, boardID, postID, threadID, val;
boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val; boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val;
if (postID !== void 0) { if (postID !== void 0) {
return ((base = ((base1 = this.data.boards)[boardID] || (base1[boardID] = {})))[threadID] || (base[threadID] = {}))[postID] = val; ((base = ((base1 = this.data.boards)[boardID] || (base1[boardID] = {})))[threadID] || (base[threadID] = {}))[postID] = val;
} else if (threadID !== void 0) { } else if (threadID !== void 0) {
return ((base2 = this.data.boards)[boardID] || (base2[boardID] = {}))[threadID] = val; ((base2 = this.data.boards)[boardID] || (base2[boardID] = {}))[threadID] = val;
} else { } else {
return this.data.boards[boardID] = val; this.data.boards[boardID] = val;
} }
return this.save(cb);
}; };
DataBoard.prototype.extend = function(arg, cb) { DataBoard.prototype.extend = function(arg, cb) {
var boardID, postID, rm, threadID, val; var boardID, i, key, len, oldVal, postID, ref, rm, threadID, val;
boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val, rm = arg.rm; boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val, rm = arg.rm;
return this.save((function(_this) { $.forceSync(this.key);
return function() { oldVal = this.get({
var i, key, len, oldVal, ref; boardID: boardID,
oldVal = _this.get({ threadID: threadID,
boardID: boardID, postID: postID,
threadID: threadID, val: {}
postID: postID, });
val: {} ref = rm || [];
}); for (i = 0, len = ref.length; i < len; i++) {
ref = rm || []; key = ref[i];
for (i = 0, len = ref.length; i < len; i++) { delete oldVal[key];
key = ref[i]; }
delete oldVal[key]; $.extend(oldVal, val);
} return this.setUnsafe({
$.extend(oldVal, val); boardID: boardID,
return _this.setUnsafe({ threadID: threadID,
boardID: boardID, postID: postID,
threadID: threadID, val: oldVal
postID: postID, }, cb);
val: oldVal
});
};
})(this), cb);
};
DataBoard.prototype.setLastChecked = function() {
return this.save((function(_this) {
return function() {
return _this.data.lastChecked = Date.now();
};
})(this));
}; };
DataBoard.prototype.get = function(arg) { DataBoard.prototype.get = function(arg) {
@ -5801,8 +5727,13 @@ DataBoard = (function() {
return val || defaultValue; return val || defaultValue;
}; };
DataBoard.prototype.forceSync = function() {
return $.forceSync(this.key);
};
DataBoard.prototype.clean = function() { DataBoard.prototype.clean = function() {
var boardID, now, ref, ref1, val; var boardID, now, ref, ref1, val;
$.forceSync(this.key);
ref = this.data.boards; ref = this.data.boards;
for (boardID in ref) { for (boardID in ref) {
val = ref[boardID]; val = ref[boardID];
@ -5868,7 +5799,7 @@ DataBoard = (function() {
this.deleteIfEmpty({ this.deleteIfEmpty({
boardID: boardID boardID: boardID
}); });
return $.set(this.key, this.data); return this.save();
}; };
DataBoard.prototype.onSync = function(data) { DataBoard.prototype.onSync = function(data) {
@ -19408,7 +19339,8 @@ ThreadWatcher = (function() {
now = Date.now(); now = Date.now();
if (!((now - interval < (ref = db.data.lastChecked || 0) && ref <= now))) { if (!((now - interval < (ref = db.data.lastChecked || 0) && ref <= now))) {
ThreadWatcher.fetchAllStatus(); ThreadWatcher.fetchAllStatus();
db.setLastChecked(); db.data.lastChecked = now;
db.save();
} }
return ThreadWatcher.timeout = setTimeout(ThreadWatcher.fetchAuto, interval); return ThreadWatcher.timeout = setTimeout(ThreadWatcher.fetchAuto, interval);
}, },
@ -19420,26 +19352,19 @@ ThreadWatcher = (function() {
} }
}, },
fetchAllStatus: function() { fetchAllStatus: function() {
var db, dbs, i, len, n, results; var i, len, ref, thread, threads;
dbs = [ThreadWatcher.db, ThreadWatcher.unreaddb, QuoteYou.db].filter(function(x) { ThreadWatcher.db.forceSync();
return x; ThreadWatcher.unreaddb.forceSync();
}); if ((ref = QuoteYou.db) != null) {
n = 0; ref.forceSync();
results = []; }
for (i = 0, len = dbs.length; i < len; i++) { if (!(threads = ThreadWatcher.getAll()).length) {
db = dbs[i]; return;
results.push(db.forceSync(function() { }
var j, len1, thread, threads; for (i = 0, len = threads.length; i < len; i++) {
if ((++n) === dbs.length) { thread = threads[i];
threads = ThreadWatcher.getAll(); ThreadWatcher.fetchStatus(thread);
for (j = 0, len1 = threads.length; j < len1; j++) {
thread = threads[j];
ThreadWatcher.fetchStatus(thread);
}
}
}));
} }
return results;
}, },
fetchStatus: function(thread, force) { fetchStatus: function(thread, force) {
var boardID, data, req, threadID; var boardID, data, req, threadID;
@ -20243,7 +20168,7 @@ Captcha = {};
needed: function() { needed: function() {
var captchaCount, postsCount; var captchaCount, postsCount;
captchaCount = this.captchas.length; captchaCount = this.captchas.length;
if (QR.req) { if (QR.req || /\b_ct=/.test(d.cookie)) {
captchaCount++; captchaCount++;
} }
postsCount = QR.posts.length; postsCount = QR.posts.length;
@ -22326,7 +22251,7 @@ QR = (function() {
if (g.BOARD.ID === 'r9k' && !((ref = post.com) != null ? ref.match(/[a-z-]/i) : void 0)) { if (g.BOARD.ID === 'r9k' && !((ref = post.com) != null ? ref.match(/[a-z-]/i) : void 0)) {
err || (err = 'Original comment required.'); err || (err = 'Original comment required.');
} }
if (QR.captcha.isEnabled && !err) { if (QR.captcha.isEnabled && !/\b_ct=/.test(d.cookie) && !err) {
captcha = QR.captcha.getOne(!!threadID); captcha = QR.captcha.getOne(!!threadID);
if (!captcha) { if (!captcha) {
err = 'No valid captcha.'; err = 'No valid captcha.';
@ -24364,11 +24289,9 @@ QuoteYou = (function() {
return Conf['Remember Your Posts'] = enabled; return Conf['Remember Your Posts'] = enabled;
}); });
$.on(d, 'QRPostSuccessful', function(e) { $.on(d, 'QRPostSuccessful', function(e) {
return $.get('Remember Your Posts', Conf['Remember Your Posts'], function(items) { var boardID, postID, ref, threadID;
var boardID, postID, ref, threadID; $.forceSync('Remember Your Posts');
if (!items['Remember Your Posts']) { if (Conf['Remember Your Posts']) {
return;
}
ref = e.detail, boardID = ref.boardID, threadID = ref.threadID, postID = ref.postID; ref = e.detail, boardID = ref.boardID, threadID = ref.threadID, postID = ref.postID;
return QuoteYou.db.set({ return QuoteYou.db.set({
boardID: boardID, boardID: boardID,
@ -24376,7 +24299,7 @@ QuoteYou = (function() {
postID: postID, postID: postID,
val: true val: true
}); });
}); }
}); });
if ((ref = g.VIEW) !== 'index' && ref !== 'thread' && ref !== 'archive') { if ((ref = g.VIEW) !== 'index' && ref !== 'thread' && ref !== 'archive') {
return; return;

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.13.15.3 // @version 1.13.15.4
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -159,7 +159,7 @@ docSet = function() {
}; };
g = { g = {
VERSION: '1.13.15.3', VERSION: '1.13.15.4',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -322,11 +322,7 @@ Config = (function() {
'Auto-load captcha': [false, 'Automatically load the captcha in the QR even if your post is empty.', 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], 'Post on Captcha Completion': [false, 'Submit the post immediately when the captcha is completed.', 1],
'Captcha Fixes': [true, 'Make captcha easier to use, especially with the keyboard.'], 'Captcha Fixes': [true, 'Make captcha easier to use, especially with the keyboard.'],
'Use Recaptcha v1': [false, 'Use the old text version of Recaptcha in the post form in threads.'],
'Use Recaptcha v1 on Index': [false, 'Use the old text version of Recaptcha on the index and catalog. Warning: May interfere with starting threads.'],
'Use Recaptcha v1 in Reports': [false, 'Use the text captcha in the report window.'],
'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha even if Javascript is enabled (Recaptcha v2 only).'], 'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha even if Javascript is enabled (Recaptcha v2 only).'],
'Force Noscript Captcha for v1': [true, 'Force the non-Javascript fallback captcha for Recaptcha v1. Currently only works on HTTPS.'],
'Pass Link': [false, 'Add a 4chan Pass login link to the bottom of the page.'] 'Pass Link': [false, 'Add a 4chan Pass login link to the bottom of the page.']
}, },
'Quote Links': { 'Quote Links': {
@ -5620,91 +5616,35 @@ DataBoard = (function() {
$.on(d, '4chanXInitFinished', init); $.on(d, '4chanXInitFinished', init);
} }
DataBoard.prototype.changes = []; DataBoard.prototype.save = function(cb) {
return $.set(this.key, this.data, cb);
DataBoard.prototype.save = function(change, cb) {
var changes, snapshot1;
snapshot1 = JSON.stringify(this.data);
change();
changes = this.changes;
changes.push(change);
return $.get(this.key, {
boards: {}
}, (function(_this) {
return function(items) {
var c, i, len, snapshot2;
_this.data = items[_this.key];
snapshot2 = JSON.stringify(_this.data);
for (i = 0, len = changes.length; i < len; i++) {
c = changes[i];
c();
}
return $.set(_this.key, _this.data, function() {
_this.changes = [];
if (snapshot1 !== snapshot2) {
if (typeof _this.sync === "function") {
_this.sync();
}
}
return typeof cb === "function" ? cb() : void 0;
});
};
})(this));
};
DataBoard.prototype.forceSync = function(cb) {
var changes, snapshot1;
snapshot1 = JSON.stringify(this.data);
changes = this.changes;
return $.get(this.key, {
boards: {}
}, (function(_this) {
return function(items) {
var c, i, len, snapshot2;
_this.data = items[_this.key];
snapshot2 = JSON.stringify(_this.data);
for (i = 0, len = changes.length; i < len; i++) {
c = changes[i];
c();
}
if (snapshot1 !== snapshot2) {
if (typeof _this.sync === "function") {
_this.sync();
}
}
return typeof cb === "function" ? cb() : void 0;
};
})(this));
}; };
DataBoard.prototype["delete"] = function(arg) { DataBoard.prototype["delete"] = function(arg) {
var boardID, postID, threadID; var boardID, postID, ref, threadID;
boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID; boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID;
return this.save((function(_this) { $.forceSync(this.key);
return function() { if (postID) {
var ref; if (!((ref = this.data.boards[boardID]) != null ? ref[threadID] : void 0)) {
if (postID) { return;
if (!((ref = _this.data.boards[boardID]) != null ? ref[threadID] : void 0)) { }
return; delete this.data.boards[boardID][threadID][postID];
} this.deleteIfEmpty({
delete _this.data.boards[boardID][threadID][postID]; boardID: boardID,
return _this.deleteIfEmpty({ threadID: threadID
boardID: boardID, });
threadID: threadID } else if (threadID) {
}); if (!this.data.boards[boardID]) {
} else if (threadID) { return;
if (!_this.data.boards[boardID]) { }
return; delete this.data.boards[boardID][threadID];
} this.deleteIfEmpty({
delete _this.data.boards[boardID][threadID]; boardID: boardID
return _this.deleteIfEmpty({ });
boardID: boardID } else {
}); delete this.data.boards[boardID];
} else { }
return delete _this.data.boards[boardID]; return this.save();
}
};
})(this));
}; };
DataBoard.prototype.deleteIfEmpty = function(arg) { DataBoard.prototype.deleteIfEmpty = function(arg) {
@ -5723,59 +5663,45 @@ DataBoard = (function() {
}; };
DataBoard.prototype.set = function(data, cb) { DataBoard.prototype.set = function(data, cb) {
return this.save((function(_this) { $.forceSync(this.key);
return function() { return this.setUnsafe(data, cb);
return _this.setUnsafe(data);
};
})(this), cb);
}; };
DataBoard.prototype.setUnsafe = function(arg) { DataBoard.prototype.setUnsafe = function(arg, cb) {
var base, base1, base2, boardID, postID, threadID, val; var base, base1, base2, boardID, postID, threadID, val;
boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val; boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val;
if (postID !== void 0) { if (postID !== void 0) {
return ((base = ((base1 = this.data.boards)[boardID] || (base1[boardID] = {})))[threadID] || (base[threadID] = {}))[postID] = val; ((base = ((base1 = this.data.boards)[boardID] || (base1[boardID] = {})))[threadID] || (base[threadID] = {}))[postID] = val;
} else if (threadID !== void 0) { } else if (threadID !== void 0) {
return ((base2 = this.data.boards)[boardID] || (base2[boardID] = {}))[threadID] = val; ((base2 = this.data.boards)[boardID] || (base2[boardID] = {}))[threadID] = val;
} else { } else {
return this.data.boards[boardID] = val; this.data.boards[boardID] = val;
} }
return this.save(cb);
}; };
DataBoard.prototype.extend = function(arg, cb) { DataBoard.prototype.extend = function(arg, cb) {
var boardID, postID, rm, threadID, val; var boardID, i, key, len, oldVal, postID, ref, rm, threadID, val;
boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val, rm = arg.rm; boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val, rm = arg.rm;
return this.save((function(_this) { $.forceSync(this.key);
return function() { oldVal = this.get({
var i, key, len, oldVal, ref; boardID: boardID,
oldVal = _this.get({ threadID: threadID,
boardID: boardID, postID: postID,
threadID: threadID, val: {}
postID: postID, });
val: {} ref = rm || [];
}); for (i = 0, len = ref.length; i < len; i++) {
ref = rm || []; key = ref[i];
for (i = 0, len = ref.length; i < len; i++) { delete oldVal[key];
key = ref[i]; }
delete oldVal[key]; $.extend(oldVal, val);
} return this.setUnsafe({
$.extend(oldVal, val); boardID: boardID,
return _this.setUnsafe({ threadID: threadID,
boardID: boardID, postID: postID,
threadID: threadID, val: oldVal
postID: postID, }, cb);
val: oldVal
});
};
})(this), cb);
};
DataBoard.prototype.setLastChecked = function() {
return this.save((function(_this) {
return function() {
return _this.data.lastChecked = Date.now();
};
})(this));
}; };
DataBoard.prototype.get = function(arg) { DataBoard.prototype.get = function(arg) {
@ -5801,8 +5727,13 @@ DataBoard = (function() {
return val || defaultValue; return val || defaultValue;
}; };
DataBoard.prototype.forceSync = function() {
return $.forceSync(this.key);
};
DataBoard.prototype.clean = function() { DataBoard.prototype.clean = function() {
var boardID, now, ref, ref1, val; var boardID, now, ref, ref1, val;
$.forceSync(this.key);
ref = this.data.boards; ref = this.data.boards;
for (boardID in ref) { for (boardID in ref) {
val = ref[boardID]; val = ref[boardID];
@ -5868,7 +5799,7 @@ DataBoard = (function() {
this.deleteIfEmpty({ this.deleteIfEmpty({
boardID: boardID boardID: boardID
}); });
return $.set(this.key, this.data); return this.save();
}; };
DataBoard.prototype.onSync = function(data) { DataBoard.prototype.onSync = function(data) {
@ -19408,7 +19339,8 @@ ThreadWatcher = (function() {
now = Date.now(); now = Date.now();
if (!((now - interval < (ref = db.data.lastChecked || 0) && ref <= now))) { if (!((now - interval < (ref = db.data.lastChecked || 0) && ref <= now))) {
ThreadWatcher.fetchAllStatus(); ThreadWatcher.fetchAllStatus();
db.setLastChecked(); db.data.lastChecked = now;
db.save();
} }
return ThreadWatcher.timeout = setTimeout(ThreadWatcher.fetchAuto, interval); return ThreadWatcher.timeout = setTimeout(ThreadWatcher.fetchAuto, interval);
}, },
@ -19420,26 +19352,19 @@ ThreadWatcher = (function() {
} }
}, },
fetchAllStatus: function() { fetchAllStatus: function() {
var db, dbs, i, len, n, results; var i, len, ref, thread, threads;
dbs = [ThreadWatcher.db, ThreadWatcher.unreaddb, QuoteYou.db].filter(function(x) { ThreadWatcher.db.forceSync();
return x; ThreadWatcher.unreaddb.forceSync();
}); if ((ref = QuoteYou.db) != null) {
n = 0; ref.forceSync();
results = []; }
for (i = 0, len = dbs.length; i < len; i++) { if (!(threads = ThreadWatcher.getAll()).length) {
db = dbs[i]; return;
results.push(db.forceSync(function() { }
var j, len1, thread, threads; for (i = 0, len = threads.length; i < len; i++) {
if ((++n) === dbs.length) { thread = threads[i];
threads = ThreadWatcher.getAll(); ThreadWatcher.fetchStatus(thread);
for (j = 0, len1 = threads.length; j < len1; j++) {
thread = threads[j];
ThreadWatcher.fetchStatus(thread);
}
}
}));
} }
return results;
}, },
fetchStatus: function(thread, force) { fetchStatus: function(thread, force) {
var boardID, data, req, threadID; var boardID, data, req, threadID;
@ -20243,7 +20168,7 @@ Captcha = {};
needed: function() { needed: function() {
var captchaCount, postsCount; var captchaCount, postsCount;
captchaCount = this.captchas.length; captchaCount = this.captchas.length;
if (QR.req) { if (QR.req || /\b_ct=/.test(d.cookie)) {
captchaCount++; captchaCount++;
} }
postsCount = QR.posts.length; postsCount = QR.posts.length;
@ -22326,7 +22251,7 @@ QR = (function() {
if (g.BOARD.ID === 'r9k' && !((ref = post.com) != null ? ref.match(/[a-z-]/i) : void 0)) { if (g.BOARD.ID === 'r9k' && !((ref = post.com) != null ? ref.match(/[a-z-]/i) : void 0)) {
err || (err = 'Original comment required.'); err || (err = 'Original comment required.');
} }
if (QR.captcha.isEnabled && !err) { if (QR.captcha.isEnabled && !/\b_ct=/.test(d.cookie) && !err) {
captcha = QR.captcha.getOne(!!threadID); captcha = QR.captcha.getOne(!!threadID);
if (!captcha) { if (!captcha) {
err = 'No valid captcha.'; err = 'No valid captcha.';
@ -24364,11 +24289,9 @@ QuoteYou = (function() {
return Conf['Remember Your Posts'] = enabled; return Conf['Remember Your Posts'] = enabled;
}); });
$.on(d, 'QRPostSuccessful', function(e) { $.on(d, 'QRPostSuccessful', function(e) {
return $.get('Remember Your Posts', Conf['Remember Your Posts'], function(items) { var boardID, postID, ref, threadID;
var boardID, postID, ref, threadID; $.forceSync('Remember Your Posts');
if (!items['Remember Your Posts']) { if (Conf['Remember Your Posts']) {
return;
}
ref = e.detail, boardID = ref.boardID, threadID = ref.threadID, postID = ref.postID; ref = e.detail, boardID = ref.boardID, threadID = ref.threadID, postID = ref.postID;
return QuoteYou.db.set({ return QuoteYou.db.set({
boardID: boardID, boardID: boardID,
@ -24376,7 +24299,7 @@ QuoteYou = (function() {
postID: postID, postID: postID,
val: true val: true
}); });
}); }
}); });
if ((ref = g.VIEW) !== 'index' && ref !== 'thread' && ref !== 'archive') { if ((ref = g.VIEW) !== 'index' && ref !== 'thread' && ref !== 'archive') {
return; return;

Binary file not shown.

View File

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

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.13.15.3 // @version 1.13.15.4
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -159,7 +159,7 @@ docSet = function() {
}; };
g = { g = {
VERSION: '1.13.15.3', VERSION: '1.13.15.4',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -322,11 +322,7 @@ Config = (function() {
'Auto-load captcha': [false, 'Automatically load the captcha in the QR even if your post is empty.', 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], 'Post on Captcha Completion': [false, 'Submit the post immediately when the captcha is completed.', 1],
'Captcha Fixes': [true, 'Make captcha easier to use, especially with the keyboard.'], 'Captcha Fixes': [true, 'Make captcha easier to use, especially with the keyboard.'],
'Use Recaptcha v1': [false, 'Use the old text version of Recaptcha in the post form in threads.'],
'Use Recaptcha v1 on Index': [false, 'Use the old text version of Recaptcha on the index and catalog. Warning: May interfere with starting threads.'],
'Use Recaptcha v1 in Reports': [false, 'Use the text captcha in the report window.'],
'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha even if Javascript is enabled (Recaptcha v2 only).'], 'Force Noscript Captcha': [false, 'Use the non-Javascript fallback captcha even if Javascript is enabled (Recaptcha v2 only).'],
'Force Noscript Captcha for v1': [true, 'Force the non-Javascript fallback captcha for Recaptcha v1. Currently only works on HTTPS.'],
'Pass Link': [false, 'Add a 4chan Pass login link to the bottom of the page.'] 'Pass Link': [false, 'Add a 4chan Pass login link to the bottom of the page.']
}, },
'Quote Links': { 'Quote Links': {
@ -5620,91 +5616,35 @@ DataBoard = (function() {
$.on(d, '4chanXInitFinished', init); $.on(d, '4chanXInitFinished', init);
} }
DataBoard.prototype.changes = []; DataBoard.prototype.save = function(cb) {
return $.set(this.key, this.data, cb);
DataBoard.prototype.save = function(change, cb) {
var changes, snapshot1;
snapshot1 = JSON.stringify(this.data);
change();
changes = this.changes;
changes.push(change);
return $.get(this.key, {
boards: {}
}, (function(_this) {
return function(items) {
var c, i, len, snapshot2;
_this.data = items[_this.key];
snapshot2 = JSON.stringify(_this.data);
for (i = 0, len = changes.length; i < len; i++) {
c = changes[i];
c();
}
return $.set(_this.key, _this.data, function() {
_this.changes = [];
if (snapshot1 !== snapshot2) {
if (typeof _this.sync === "function") {
_this.sync();
}
}
return typeof cb === "function" ? cb() : void 0;
});
};
})(this));
};
DataBoard.prototype.forceSync = function(cb) {
var changes, snapshot1;
snapshot1 = JSON.stringify(this.data);
changes = this.changes;
return $.get(this.key, {
boards: {}
}, (function(_this) {
return function(items) {
var c, i, len, snapshot2;
_this.data = items[_this.key];
snapshot2 = JSON.stringify(_this.data);
for (i = 0, len = changes.length; i < len; i++) {
c = changes[i];
c();
}
if (snapshot1 !== snapshot2) {
if (typeof _this.sync === "function") {
_this.sync();
}
}
return typeof cb === "function" ? cb() : void 0;
};
})(this));
}; };
DataBoard.prototype["delete"] = function(arg) { DataBoard.prototype["delete"] = function(arg) {
var boardID, postID, threadID; var boardID, postID, ref, threadID;
boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID; boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID;
return this.save((function(_this) { $.forceSync(this.key);
return function() { if (postID) {
var ref; if (!((ref = this.data.boards[boardID]) != null ? ref[threadID] : void 0)) {
if (postID) { return;
if (!((ref = _this.data.boards[boardID]) != null ? ref[threadID] : void 0)) { }
return; delete this.data.boards[boardID][threadID][postID];
} this.deleteIfEmpty({
delete _this.data.boards[boardID][threadID][postID]; boardID: boardID,
return _this.deleteIfEmpty({ threadID: threadID
boardID: boardID, });
threadID: threadID } else if (threadID) {
}); if (!this.data.boards[boardID]) {
} else if (threadID) { return;
if (!_this.data.boards[boardID]) { }
return; delete this.data.boards[boardID][threadID];
} this.deleteIfEmpty({
delete _this.data.boards[boardID][threadID]; boardID: boardID
return _this.deleteIfEmpty({ });
boardID: boardID } else {
}); delete this.data.boards[boardID];
} else { }
return delete _this.data.boards[boardID]; return this.save();
}
};
})(this));
}; };
DataBoard.prototype.deleteIfEmpty = function(arg) { DataBoard.prototype.deleteIfEmpty = function(arg) {
@ -5723,59 +5663,45 @@ DataBoard = (function() {
}; };
DataBoard.prototype.set = function(data, cb) { DataBoard.prototype.set = function(data, cb) {
return this.save((function(_this) { $.forceSync(this.key);
return function() { return this.setUnsafe(data, cb);
return _this.setUnsafe(data);
};
})(this), cb);
}; };
DataBoard.prototype.setUnsafe = function(arg) { DataBoard.prototype.setUnsafe = function(arg, cb) {
var base, base1, base2, boardID, postID, threadID, val; var base, base1, base2, boardID, postID, threadID, val;
boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val; boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val;
if (postID !== void 0) { if (postID !== void 0) {
return ((base = ((base1 = this.data.boards)[boardID] || (base1[boardID] = {})))[threadID] || (base[threadID] = {}))[postID] = val; ((base = ((base1 = this.data.boards)[boardID] || (base1[boardID] = {})))[threadID] || (base[threadID] = {}))[postID] = val;
} else if (threadID !== void 0) { } else if (threadID !== void 0) {
return ((base2 = this.data.boards)[boardID] || (base2[boardID] = {}))[threadID] = val; ((base2 = this.data.boards)[boardID] || (base2[boardID] = {}))[threadID] = val;
} else { } else {
return this.data.boards[boardID] = val; this.data.boards[boardID] = val;
} }
return this.save(cb);
}; };
DataBoard.prototype.extend = function(arg, cb) { DataBoard.prototype.extend = function(arg, cb) {
var boardID, postID, rm, threadID, val; var boardID, i, key, len, oldVal, postID, ref, rm, threadID, val;
boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val, rm = arg.rm; boardID = arg.boardID, threadID = arg.threadID, postID = arg.postID, val = arg.val, rm = arg.rm;
return this.save((function(_this) { $.forceSync(this.key);
return function() { oldVal = this.get({
var i, key, len, oldVal, ref; boardID: boardID,
oldVal = _this.get({ threadID: threadID,
boardID: boardID, postID: postID,
threadID: threadID, val: {}
postID: postID, });
val: {} ref = rm || [];
}); for (i = 0, len = ref.length; i < len; i++) {
ref = rm || []; key = ref[i];
for (i = 0, len = ref.length; i < len; i++) { delete oldVal[key];
key = ref[i]; }
delete oldVal[key]; $.extend(oldVal, val);
} return this.setUnsafe({
$.extend(oldVal, val); boardID: boardID,
return _this.setUnsafe({ threadID: threadID,
boardID: boardID, postID: postID,
threadID: threadID, val: oldVal
postID: postID, }, cb);
val: oldVal
});
};
})(this), cb);
};
DataBoard.prototype.setLastChecked = function() {
return this.save((function(_this) {
return function() {
return _this.data.lastChecked = Date.now();
};
})(this));
}; };
DataBoard.prototype.get = function(arg) { DataBoard.prototype.get = function(arg) {
@ -5801,8 +5727,13 @@ DataBoard = (function() {
return val || defaultValue; return val || defaultValue;
}; };
DataBoard.prototype.forceSync = function() {
return $.forceSync(this.key);
};
DataBoard.prototype.clean = function() { DataBoard.prototype.clean = function() {
var boardID, now, ref, ref1, val; var boardID, now, ref, ref1, val;
$.forceSync(this.key);
ref = this.data.boards; ref = this.data.boards;
for (boardID in ref) { for (boardID in ref) {
val = ref[boardID]; val = ref[boardID];
@ -5868,7 +5799,7 @@ DataBoard = (function() {
this.deleteIfEmpty({ this.deleteIfEmpty({
boardID: boardID boardID: boardID
}); });
return $.set(this.key, this.data); return this.save();
}; };
DataBoard.prototype.onSync = function(data) { DataBoard.prototype.onSync = function(data) {
@ -19408,7 +19339,8 @@ ThreadWatcher = (function() {
now = Date.now(); now = Date.now();
if (!((now - interval < (ref = db.data.lastChecked || 0) && ref <= now))) { if (!((now - interval < (ref = db.data.lastChecked || 0) && ref <= now))) {
ThreadWatcher.fetchAllStatus(); ThreadWatcher.fetchAllStatus();
db.setLastChecked(); db.data.lastChecked = now;
db.save();
} }
return ThreadWatcher.timeout = setTimeout(ThreadWatcher.fetchAuto, interval); return ThreadWatcher.timeout = setTimeout(ThreadWatcher.fetchAuto, interval);
}, },
@ -19420,26 +19352,19 @@ ThreadWatcher = (function() {
} }
}, },
fetchAllStatus: function() { fetchAllStatus: function() {
var db, dbs, i, len, n, results; var i, len, ref, thread, threads;
dbs = [ThreadWatcher.db, ThreadWatcher.unreaddb, QuoteYou.db].filter(function(x) { ThreadWatcher.db.forceSync();
return x; ThreadWatcher.unreaddb.forceSync();
}); if ((ref = QuoteYou.db) != null) {
n = 0; ref.forceSync();
results = []; }
for (i = 0, len = dbs.length; i < len; i++) { if (!(threads = ThreadWatcher.getAll()).length) {
db = dbs[i]; return;
results.push(db.forceSync(function() { }
var j, len1, thread, threads; for (i = 0, len = threads.length; i < len; i++) {
if ((++n) === dbs.length) { thread = threads[i];
threads = ThreadWatcher.getAll(); ThreadWatcher.fetchStatus(thread);
for (j = 0, len1 = threads.length; j < len1; j++) {
thread = threads[j];
ThreadWatcher.fetchStatus(thread);
}
}
}));
} }
return results;
}, },
fetchStatus: function(thread, force) { fetchStatus: function(thread, force) {
var boardID, data, req, threadID; var boardID, data, req, threadID;
@ -20243,7 +20168,7 @@ Captcha = {};
needed: function() { needed: function() {
var captchaCount, postsCount; var captchaCount, postsCount;
captchaCount = this.captchas.length; captchaCount = this.captchas.length;
if (QR.req) { if (QR.req || /\b_ct=/.test(d.cookie)) {
captchaCount++; captchaCount++;
} }
postsCount = QR.posts.length; postsCount = QR.posts.length;
@ -22326,7 +22251,7 @@ QR = (function() {
if (g.BOARD.ID === 'r9k' && !((ref = post.com) != null ? ref.match(/[a-z-]/i) : void 0)) { if (g.BOARD.ID === 'r9k' && !((ref = post.com) != null ? ref.match(/[a-z-]/i) : void 0)) {
err || (err = 'Original comment required.'); err || (err = 'Original comment required.');
} }
if (QR.captcha.isEnabled && !err) { if (QR.captcha.isEnabled && !/\b_ct=/.test(d.cookie) && !err) {
captcha = QR.captcha.getOne(!!threadID); captcha = QR.captcha.getOne(!!threadID);
if (!captcha) { if (!captcha) {
err = 'No valid captcha.'; err = 'No valid captcha.';
@ -24364,11 +24289,9 @@ QuoteYou = (function() {
return Conf['Remember Your Posts'] = enabled; return Conf['Remember Your Posts'] = enabled;
}); });
$.on(d, 'QRPostSuccessful', function(e) { $.on(d, 'QRPostSuccessful', function(e) {
return $.get('Remember Your Posts', Conf['Remember Your Posts'], function(items) { var boardID, postID, ref, threadID;
var boardID, postID, ref, threadID; $.forceSync('Remember Your Posts');
if (!items['Remember Your Posts']) { if (Conf['Remember Your Posts']) {
return;
}
ref = e.detail, boardID = ref.boardID, threadID = ref.threadID, postID = ref.postID; ref = e.detail, boardID = ref.boardID, threadID = ref.threadID, postID = ref.postID;
return QuoteYou.db.set({ return QuoteYou.db.set({
boardID: boardID, boardID: boardID,
@ -24376,7 +24299,7 @@ QuoteYou = (function() {
postID: postID, postID: postID,
val: true val: true
}); });
}); }
}); });
if ((ref = g.VIEW) !== 'index' && ref !== 'thread' && ref !== 'archive') { if ((ref = g.VIEW) !== 'index' && ref !== 'thread' && ref !== 'archive') {
return; return;

Binary file not shown.

View File

@ -3,7 +3,7 @@
"4chan-x@4chan-x.net": { "4chan-x@4chan-x.net": {
"updates": [ "updates": [
{ {
"version": "1.13.15.3", "version": "1.13.15.4",
"update_link": "https://www.4chan-x.net/builds/4chan-X-beta.crx" "update_link": "https://www.4chan-x.net/builds/4chan-X-beta.crx"
} }
] ]

View File

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

View File

@ -3,7 +3,7 @@
"4chan-x@4chan-x.net": { "4chan-x@4chan-x.net": {
"updates": [ "updates": [
{ {
"version": "1.13.15.3", "version": "1.13.15.4",
"update_link": "https://www.4chan-x.net/builds/4chan-X.crx" "update_link": "https://www.4chan-x.net/builds/4chan-X.crx"
} }
] ]

View File

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

View File

@ -1,4 +1,4 @@
{ {
"version": "1.13.15.3", "version": "1.13.15.4",
"date": "2018-01-02T02:02:35.584Z" "date": "2018-01-23T19:04:36.978Z"
} }