Merge branch 'v3'

Conflicts:
	LICENSE
	builds/appchan-x.user.js
	builds/crx/script.js
This commit is contained in:
Zixaphir 2014-03-26 15:21:29 -07:00
commit 0ad639c4a9
4 changed files with 34 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/* /*
* appchan x - Version 2.9.7 - 2014-03-24 * appchan x - Version 2.9.7 - 2014-03-26
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE

View File

@ -25,7 +25,7 @@
// ==/UserScript== // ==/UserScript==
/* /*
* appchan x - Version 2.9.7 - 2014-03-24 * appchan x - Version 2.9.7 - 2014-03-26
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -3809,12 +3809,17 @@
}; };
DataBoard.prototype.clean = function() { DataBoard.prototype.clean = function() {
var boardID, now; var boardID, keys, now, _i, _len;
now = Date.now(); now = Date.now();
if ((this.data.lastChecked || 0) > now - 2 * $.HOUR) { if ((this.data.lastChecked || 0) > now - 2 * $.HOUR) {
return; return;
} }
for (boardID in this.data.boards) { keys = Object.keys(this.data.boards);
if (!keys.length) {
return;
}
for (_i = 0, _len = keys.length; _i < _len; _i++) {
boardID = keys[_i];
this.deleteIfEmpty({ this.deleteIfEmpty({
boardID: boardID boardID: boardID
}); });

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // Generated by CoffeeScript
/* /*
* appchan x - Version 2.9.7 - 2014-03-24 * appchan x - Version 2.9.7 - 2014-03-26
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE * https://github.com/zixaphir/appchan-x/blob/master/LICENSE
@ -3096,7 +3096,9 @@
Callbacks.prototype.execute = function(nodes) { Callbacks.prototype.execute = function(nodes) {
var cb, err, errors, i, j, name, node; var cb, err, errors, i, j, name, node;
i = 0; i = 0;
c.time("Features");
while (name = this.keys[i++]) { while (name = this.keys[i++]) {
c.time(name);
j = 0; j = 0;
cb = this[name]; cb = this[name];
while (node = nodes[j++]) { while (node = nodes[j++]) {
@ -3115,7 +3117,9 @@
}); });
} }
} }
c.timeEnd(name);
} }
c.timeEnd("Features");
if (errors) { if (errors) {
return Main.handleErrors(errors); return Main.handleErrors(errors);
} }
@ -3865,12 +3869,20 @@
}; };
DataBoard.prototype.clean = function() { DataBoard.prototype.clean = function() {
var boardID, now; var boardID, keys, now, _i, _len;
now = Date.now(); now = Date.now();
if ((this.data.lastChecked || 0) > now - 2 * $.HOUR) { if ((this.data.lastChecked || 0) > now - 2 * $.HOUR) {
c.log('return now');
return; return;
} }
for (boardID in this.data.boards) { keys = Object.keys(this.data.boards);
if (!keys.length) {
c.log('return empty');
return;
}
c.log('no return');
for (_i = 0, _len = keys.length; _i < _len; _i++) {
boardID = keys[_i];
this.deleteIfEmpty({ this.deleteIfEmpty({
boardID: boardID boardID: boardID
}); });
@ -5448,6 +5460,7 @@
return Index.scrollToIndex(); return Index.scrollToIndex();
}, },
parse: function(pages, pageNum) { parse: function(pages, pageNum) {
c.time("Generating Index");
Index.parseThreadList(pages); Index.parseThreadList(pages);
Index.buildThreads(); Index.buildThreads();
Index.sort(); Index.sort();
@ -5455,7 +5468,8 @@
Index.pageNav(pageNum); Index.pageNav(pageNum);
return; return;
} }
return Index.buildIndex(); Index.buildIndex();
c.timeEnd("Generating Index");
}, },
parseThreadList: function(pages) { parseThreadList: function(pages) {
var i, j, live, page, thread, threads; var i, j, live, page, thread, threads;

View File

@ -64,7 +64,13 @@ class DataBoard
now = Date.now() now = Date.now()
return if (@data.lastChecked or 0) > now - 2 * $.HOUR return if (@data.lastChecked or 0) > now - 2 * $.HOUR
for boardID of @data.boards # Don't even bother writing unless we have data to write
keys = Object.keys @data.boards
return unless keys.length
# Since we generated the keys anyways, use them to avoid the slow ``Object::hasOwnProperty`` method
# Not that ``Object.keys`` is fast
for boardID in keys
@deleteIfEmpty {boardID} @deleteIfEmpty {boardID}
@ajaxClean boardID if boardID of @data.boards @ajaxClean boardID if boardID of @data.boards