diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2f6fbd500..a484c92da 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,9 @@ The links to individual versions below are to copies of the script with the upda
### v1.10.1
+**v1.10.1.4** *(2015-02-15)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.1.4/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.1.4/builds/4chan-X-noupdate.crx "Chromium version")]
+- Better, more reliable cleaning of old data.
+
**v1.10.1.3** *(2015-02-15)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.1.3/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.10.1.3/builds/4chan-X-noupdate.crx "Chromium version")]
- Fix HTTP links (from embedding) in inlined quotes.
diff --git a/LICENSE b/LICENSE
index d80a3f6b1..4400e0e29 100755
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
/*
-* 4chan X - Version 1.10.1.3
+* 4chan X - Version 1.10.1.4
*
* Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx
index 2f20cf820..1cb52d901 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 722471fab..ba47a3210 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.10.1.3
+// @version 1.10.1.4
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js
index 7259bfb25..ec4ee6134 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.10.1.3
+// @version 1.10.1.4
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -25,7 +25,7 @@
// ==/UserScript==
/*
-* 4chan X - Version 1.10.1.3
+* 4chan X - Version 1.10.1.4
*
* Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
@@ -405,7 +405,7 @@
doc = d.documentElement;
g = {
- VERSION: '1.10.1.3',
+ VERSION: '1.10.1.4',
NAMESPACE: '4chan X.',
NAME: '4chan X',
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
@@ -1706,7 +1706,7 @@
};
DataBoard.prototype.clean = function() {
- var boardID, now, threadID, val, _ref;
+ var boardID, now, val, _ref;
$.forceSync(this.key);
_ref = this.data.boards;
for (boardID in _ref) {
@@ -1719,28 +1719,57 @@
if ((this.data.lastChecked || 0) < now - 2 * $.HOUR) {
this.data.lastChecked = now;
for (boardID in this.data.boards) {
- for (threadID in this.data.boards[boardID]) {
- this.ajaxClean(boardID, threadID);
- }
+ this.ajaxClean(boardID);
}
}
};
- DataBoard.prototype.ajaxClean = function(boardID, threadID) {
- return $.ajax("//a.4cdn.org/" + boardID + "/thread/" + threadID + ".json", {
- onloadend: (function(_this) {
- return function(e) {
- if (e.target.status === 404) {
- return _this["delete"]({
- boardID: boardID,
- threadID: threadID
+ DataBoard.prototype.ajaxClean = function(boardID) {
+ return $.cache("//a.4cdn.org/" + boardID + "/threads.json", (function(_this) {
+ return function(e1) {
+ if (e1.target.status === 200) {
+ if (boardID === 'b' || boardID === 'f') {
+ return _this.ajaxCleanParse(boardID, e1.target.response);
+ } else {
+ return $.cache("//a.4cdn.org/" + boardID + "/archive.json", function(e2) {
+ if (e2.target.status === 200) {
+ return _this.ajaxCleanParse(boardID, e1.target.response, e2.target.response);
+ }
});
}
- };
- })(this)
- }, {
- type: 'head'
+ }
+ };
+ })(this));
+ };
+
+ DataBoard.prototype.ajaxCleanParse = function(boardID, response1, response2) {
+ var ID, board, page, thread, threads, _i, _j, _k, _len, _len1, _len2, _ref;
+ board = this.data.boards[boardID];
+ threads = {};
+ for (_i = 0, _len = response1.length; _i < _len; _i++) {
+ page = response1[_i];
+ _ref = page.threads;
+ for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
+ thread = _ref[_j];
+ ID = thread.no;
+ if (ID in board) {
+ threads[ID] = board[ID];
+ }
+ }
+ }
+ if (response2) {
+ for (_k = 0, _len2 = response2.length; _k < _len2; _k++) {
+ ID = response2[_k];
+ if (ID in board) {
+ threads[ID] = board[ID];
+ }
+ }
+ }
+ this.data.boards[boardID] = threads;
+ this.deleteIfEmpty({
+ boardID: boardID
});
+ return this.save();
};
DataBoard.prototype.onSync = function(data) {
@@ -7957,7 +7986,7 @@
this.occupied = true;
this.timeout = Date.now() + this.lifetime;
if (!img) {
- img = this.nodes.img = new Image;
+ img = this.nodes.img = new Image();
$.one(img, 'load', this.afterSetup.bind(this));
$.on(img, 'load', function() {
return this.hidden = false;
@@ -12489,6 +12518,7 @@
if ($.hasClass(this, 'disabled')) {
return;
}
+ ThreadWatcher.db.forceSync();
_ref = ThreadWatcher.getAll();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
_ref1 = _ref[_i], boardID = _ref1.boardID, threadID = _ref1.threadID, data = _ref1.data;
diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx
index bee7ae136..fa89dc3d1 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 1960268b9..39a76d3ff 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.10.1.3
+// @version 1.10.1.4
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -24,7 +24,7 @@
// ==/UserScript==
/*
-* 4chan X - Version 1.10.1.3
+* 4chan X - Version 1.10.1.4
*
* Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
@@ -404,7 +404,7 @@
doc = d.documentElement;
g = {
- VERSION: '1.10.1.3',
+ VERSION: '1.10.1.4',
NAMESPACE: '4chan X.',
NAME: '4chan X',
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
@@ -1705,7 +1705,7 @@
};
DataBoard.prototype.clean = function() {
- var boardID, now, threadID, val, _ref;
+ var boardID, now, val, _ref;
$.forceSync(this.key);
_ref = this.data.boards;
for (boardID in _ref) {
@@ -1718,28 +1718,57 @@
if ((this.data.lastChecked || 0) < now - 2 * $.HOUR) {
this.data.lastChecked = now;
for (boardID in this.data.boards) {
- for (threadID in this.data.boards[boardID]) {
- this.ajaxClean(boardID, threadID);
- }
+ this.ajaxClean(boardID);
}
}
};
- DataBoard.prototype.ajaxClean = function(boardID, threadID) {
- return $.ajax("//a.4cdn.org/" + boardID + "/thread/" + threadID + ".json", {
- onloadend: (function(_this) {
- return function(e) {
- if (e.target.status === 404) {
- return _this["delete"]({
- boardID: boardID,
- threadID: threadID
+ DataBoard.prototype.ajaxClean = function(boardID) {
+ return $.cache("//a.4cdn.org/" + boardID + "/threads.json", (function(_this) {
+ return function(e1) {
+ if (e1.target.status === 200) {
+ if (boardID === 'b' || boardID === 'f') {
+ return _this.ajaxCleanParse(boardID, e1.target.response);
+ } else {
+ return $.cache("//a.4cdn.org/" + boardID + "/archive.json", function(e2) {
+ if (e2.target.status === 200) {
+ return _this.ajaxCleanParse(boardID, e1.target.response, e2.target.response);
+ }
});
}
- };
- })(this)
- }, {
- type: 'head'
+ }
+ };
+ })(this));
+ };
+
+ DataBoard.prototype.ajaxCleanParse = function(boardID, response1, response2) {
+ var ID, board, page, thread, threads, _i, _j, _k, _len, _len1, _len2, _ref;
+ board = this.data.boards[boardID];
+ threads = {};
+ for (_i = 0, _len = response1.length; _i < _len; _i++) {
+ page = response1[_i];
+ _ref = page.threads;
+ for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
+ thread = _ref[_j];
+ ID = thread.no;
+ if (ID in board) {
+ threads[ID] = board[ID];
+ }
+ }
+ }
+ if (response2) {
+ for (_k = 0, _len2 = response2.length; _k < _len2; _k++) {
+ ID = response2[_k];
+ if (ID in board) {
+ threads[ID] = board[ID];
+ }
+ }
+ }
+ this.data.boards[boardID] = threads;
+ this.deleteIfEmpty({
+ boardID: boardID
});
+ return this.save();
};
DataBoard.prototype.onSync = function(data) {
@@ -7956,7 +7985,7 @@
this.occupied = true;
this.timeout = Date.now() + this.lifetime;
if (!img) {
- img = this.nodes.img = new Image;
+ img = this.nodes.img = new Image();
$.one(img, 'load', this.afterSetup.bind(this));
$.on(img, 'load', function() {
return this.hidden = false;
@@ -12488,6 +12517,7 @@
if ($.hasClass(this, 'disabled')) {
return;
}
+ ThreadWatcher.db.forceSync();
_ref = ThreadWatcher.getAll();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
_ref1 = _ref[_i], boardID = _ref1.boardID, threadID = _ref1.threadID, data = _ref1.data;
diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx
index 6e0fddfe1..b582b25f1 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 ea19ce760..5dd9f0f03 100644
--- a/builds/4chan-X.meta.js
+++ b/builds/4chan-X.meta.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
-// @version 1.10.1.3
+// @version 1.10.1.4
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js
index 179795a39..13a9f07ba 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.10.1.3
+// @version 1.10.1.4
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -25,7 +25,7 @@
// ==/UserScript==
/*
-* 4chan X - Version 1.10.1.3
+* 4chan X - Version 1.10.1.4
*
* Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
@@ -405,7 +405,7 @@
doc = d.documentElement;
g = {
- VERSION: '1.10.1.3',
+ VERSION: '1.10.1.4',
NAMESPACE: '4chan X.',
NAME: '4chan X',
FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions',
@@ -1706,7 +1706,7 @@
};
DataBoard.prototype.clean = function() {
- var boardID, now, threadID, val, _ref;
+ var boardID, now, val, _ref;
$.forceSync(this.key);
_ref = this.data.boards;
for (boardID in _ref) {
@@ -1719,28 +1719,57 @@
if ((this.data.lastChecked || 0) < now - 2 * $.HOUR) {
this.data.lastChecked = now;
for (boardID in this.data.boards) {
- for (threadID in this.data.boards[boardID]) {
- this.ajaxClean(boardID, threadID);
- }
+ this.ajaxClean(boardID);
}
}
};
- DataBoard.prototype.ajaxClean = function(boardID, threadID) {
- return $.ajax("//a.4cdn.org/" + boardID + "/thread/" + threadID + ".json", {
- onloadend: (function(_this) {
- return function(e) {
- if (e.target.status === 404) {
- return _this["delete"]({
- boardID: boardID,
- threadID: threadID
+ DataBoard.prototype.ajaxClean = function(boardID) {
+ return $.cache("//a.4cdn.org/" + boardID + "/threads.json", (function(_this) {
+ return function(e1) {
+ if (e1.target.status === 200) {
+ if (boardID === 'b' || boardID === 'f') {
+ return _this.ajaxCleanParse(boardID, e1.target.response);
+ } else {
+ return $.cache("//a.4cdn.org/" + boardID + "/archive.json", function(e2) {
+ if (e2.target.status === 200) {
+ return _this.ajaxCleanParse(boardID, e1.target.response, e2.target.response);
+ }
});
}
- };
- })(this)
- }, {
- type: 'head'
+ }
+ };
+ })(this));
+ };
+
+ DataBoard.prototype.ajaxCleanParse = function(boardID, response1, response2) {
+ var ID, board, page, thread, threads, _i, _j, _k, _len, _len1, _len2, _ref;
+ board = this.data.boards[boardID];
+ threads = {};
+ for (_i = 0, _len = response1.length; _i < _len; _i++) {
+ page = response1[_i];
+ _ref = page.threads;
+ for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
+ thread = _ref[_j];
+ ID = thread.no;
+ if (ID in board) {
+ threads[ID] = board[ID];
+ }
+ }
+ }
+ if (response2) {
+ for (_k = 0, _len2 = response2.length; _k < _len2; _k++) {
+ ID = response2[_k];
+ if (ID in board) {
+ threads[ID] = board[ID];
+ }
+ }
+ }
+ this.data.boards[boardID] = threads;
+ this.deleteIfEmpty({
+ boardID: boardID
});
+ return this.save();
};
DataBoard.prototype.onSync = function(data) {
@@ -7957,7 +7986,7 @@
this.occupied = true;
this.timeout = Date.now() + this.lifetime;
if (!img) {
- img = this.nodes.img = new Image;
+ img = this.nodes.img = new Image();
$.one(img, 'load', this.afterSetup.bind(this));
$.on(img, 'load', function() {
return this.hidden = false;
@@ -12489,6 +12518,7 @@
if ($.hasClass(this, 'disabled')) {
return;
}
+ ThreadWatcher.db.forceSync();
_ref = ThreadWatcher.getAll();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
_ref1 = _ref[_i], boardID = _ref1.boardID, threadID = _ref1.threadID, data = _ref1.data;
diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip
index 6b40a202c..949cf8e39 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 cf03e2b8e..c6e41b06e 100644
--- a/builds/updates-beta.xml
+++ b/builds/updates-beta.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/builds/updates.xml b/builds/updates.xml
index 38362a108..b475f39da 100644
--- a/builds/updates.xml
+++ b/builds/updates.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/package.json b/package.json
index 04d3c9a69..ab28c7e3c 100755
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"meta": {
"name": "4chan X",
- "version": "1.10.1.3",
+ "version": "1.10.1.4",
"repo": "https://github.com/ccd0/4chan-x/",
"page": "https://github.com/ccd0/4chan-x",
"downloads": "https://ccd0.github.io/4chan-x/builds/",