Merge branch 'v3'
Conflicts: LICENSE builds/appchan-x.user.js builds/crx/script.js
This commit is contained in:
commit
b19149cd15
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.3 - 2014-03-13
|
* appchan x - Version 2.9.3 - 2014-03-14
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.3 - 2014-03-13
|
* appchan x - Version 2.9.3 - 2014-03-14
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -3036,24 +3036,27 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Callbacks.prototype.execute = function(node) {
|
Callbacks.prototype.execute = function(nodes) {
|
||||||
var err, errors, name, _i, _len, _ref;
|
var cb, err, errors, i, j, name, node;
|
||||||
_ref = this.keys;
|
i = 0;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
while (name = this.keys[i++]) {
|
||||||
name = _ref[_i];
|
j = 0;
|
||||||
try {
|
cb = this[name];
|
||||||
if (!this[name].disconnected) {
|
while (node = nodes[j++]) {
|
||||||
this[name].call(node);
|
try {
|
||||||
|
if (!cb.disconnected) {
|
||||||
|
cb.call(node);
|
||||||
|
}
|
||||||
|
} catch (_error) {
|
||||||
|
err = _error;
|
||||||
|
if (!errors) {
|
||||||
|
errors = [];
|
||||||
|
}
|
||||||
|
errors.push({
|
||||||
|
message: ['"', name, '" crashed on node ', this.type, ' No.', node.ID, ' (', node.board, ').'].join(''),
|
||||||
|
error: err
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (_error) {
|
|
||||||
err = _error;
|
|
||||||
if (!errors) {
|
|
||||||
errors = [];
|
|
||||||
}
|
|
||||||
errors.push({
|
|
||||||
message: ['"', name, '" crashed on node ', this.type, ' No.', node.ID, ' (', node.board, ').'].join(''),
|
|
||||||
error: err
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errors) {
|
if (errors) {
|
||||||
@ -5439,8 +5442,8 @@
|
|||||||
if (errors) {
|
if (errors) {
|
||||||
Main.handleErrors(errors);
|
Main.handleErrors(errors);
|
||||||
}
|
}
|
||||||
Main.callbackNodes(Thread, threads);
|
Thread.callbacks.execute(threads);
|
||||||
Main.callbackNodes(Post, posts);
|
Post.callbacks.execute(posts);
|
||||||
Index.updateHideLabel();
|
Index.updateHideLabel();
|
||||||
return $.event('IndexRefresh');
|
return $.event('IndexRefresh');
|
||||||
},
|
},
|
||||||
@ -5478,7 +5481,7 @@
|
|||||||
if (errors) {
|
if (errors) {
|
||||||
Main.handleErrors(errors);
|
Main.handleErrors(errors);
|
||||||
}
|
}
|
||||||
return Main.callbackNodes(Post, posts);
|
return Post.callbacks.execute(posts);
|
||||||
},
|
},
|
||||||
buildCatalogViews: function() {
|
buildCatalogViews: function() {
|
||||||
var catalogThreads, i, nodes, thread, _i, _len, _ref;
|
var catalogThreads, i, nodes, thread, _i, _len, _ref;
|
||||||
@ -5490,7 +5493,7 @@
|
|||||||
catalogThreads.push(new CatalogThread(Build.catalogThread(thread), thread));
|
catalogThreads.push(new CatalogThread(Build.catalogThread(thread), thread));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Main.callbackNodes(CatalogThread, catalogThreads);
|
CatalogThread.callbacks.execute(catalogThreads);
|
||||||
nodes = [];
|
nodes = [];
|
||||||
i = 0;
|
i = 0;
|
||||||
while (thread = Index.sortedThreads[i++]) {
|
while (thread = Index.sortedThreads[i++]) {
|
||||||
@ -6109,7 +6112,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clone = post.addClone(context);
|
clone = post.addClone(context);
|
||||||
Main.callbackNodes(Clone, [clone]);
|
Clone.callbacks.execute([clone]);
|
||||||
nodes = clone.nodes;
|
nodes = clone.nodes;
|
||||||
$.rmAll(nodes.root);
|
$.rmAll(nodes.root);
|
||||||
$.add(nodes.root, nodes.post);
|
$.add(nodes.root, nodes.post);
|
||||||
@ -6166,7 +6169,7 @@
|
|||||||
board = g.boards[boardID] || new Board(boardID);
|
board = g.boards[boardID] || new Board(boardID);
|
||||||
thread = g.threads["" + boardID + "." + threadID] || new Thread(threadID, board);
|
thread = g.threads["" + boardID + "." + threadID] || new Thread(threadID, board);
|
||||||
post = new Post(Build.postFromObject(post, boardID), thread, board);
|
post = new Post(Build.postFromObject(post, boardID), thread, board);
|
||||||
Main.callbackNodes(Post, [post]);
|
Post.callbacks.execute([post]);
|
||||||
return Get.insert(post, root, context);
|
return Get.insert(post, root, context);
|
||||||
},
|
},
|
||||||
archivedPost: function(req, boardID, postID, root, context) {
|
archivedPost: function(req, boardID, postID, root, context) {
|
||||||
@ -6235,7 +6238,7 @@
|
|||||||
if ((_ref1 = $('.page-num', post.nodes.info)) != null) {
|
if ((_ref1 = $('.page-num', post.nodes.info)) != null) {
|
||||||
_ref1.hidden = true;
|
_ref1.hidden = true;
|
||||||
}
|
}
|
||||||
Main.callbackNodes(Post, [post]);
|
Post.callbacks.execute([post]);
|
||||||
return Get.insert(post, root, context);
|
return Get.insert(post, root, context);
|
||||||
},
|
},
|
||||||
parseMarkup: function(text) {
|
parseMarkup: function(text) {
|
||||||
@ -12117,7 +12120,7 @@
|
|||||||
ThreadUpdater.audio.play();
|
ThreadUpdater.audio.play();
|
||||||
}
|
}
|
||||||
ThreadUpdater.lastPost = posts[count - 1].ID;
|
ThreadUpdater.lastPost = posts[count - 1].ID;
|
||||||
Main.callbackNodes(Post, posts);
|
Post.callbacks.execute(posts);
|
||||||
scroll = Conf['Auto Scroll'] && ThreadUpdater.scrollBG() && Header.getBottomOf(ThreadUpdater.root) > -75;
|
scroll = Conf['Auto Scroll'] && ThreadUpdater.scrollBG() && Header.getBottomOf(ThreadUpdater.root) > -75;
|
||||||
for (_j = 0, _len1 = posts.length; _j < _len1; _j++) {
|
for (_j = 0, _len1 = posts.length; _j < _len1; _j++) {
|
||||||
post = posts[_j];
|
post = posts[_j];
|
||||||
@ -15179,7 +15182,7 @@
|
|||||||
posts.push(post);
|
posts.push(post);
|
||||||
postsRoot.push(root);
|
postsRoot.push(root);
|
||||||
}
|
}
|
||||||
Main.callbackNodes(Post, posts);
|
Post.callbacks.execute(posts);
|
||||||
$.after(a, postsRoot);
|
$.after(a, postsRoot);
|
||||||
postsCount = postsRoot.length;
|
postsCount = postsRoot.length;
|
||||||
return a.textContent = ExpandThread.text('-', postsRoot.length, filesCount);
|
return a.textContent = ExpandThread.text('-', postsRoot.length, filesCount);
|
||||||
@ -16613,8 +16616,8 @@
|
|||||||
makePost(post);
|
makePost(post);
|
||||||
$.add(threadRoot, post);
|
$.add(threadRoot, post);
|
||||||
}
|
}
|
||||||
Main.callbackNodes(Thread, [thread]);
|
Thread.callbacks.execute([thread]);
|
||||||
Main.callbackNodes(Post, posts);
|
Post.callbacks.execute(posts);
|
||||||
if (Conf['Quote Threading'] && !Conf['Unread Count']) {
|
if (Conf['Quote Threading'] && !Conf['Unread Count']) {
|
||||||
QuoteThreading.force();
|
QuoteThreading.force();
|
||||||
}
|
}
|
||||||
@ -17973,10 +17976,9 @@
|
|||||||
if (errors) {
|
if (errors) {
|
||||||
Main.handleErrors(errors);
|
Main.handleErrors(errors);
|
||||||
}
|
}
|
||||||
Main.callbackNodes(Thread, threads);
|
Thread.callbacks.execute(threads);
|
||||||
Main.callbackNodesDB(Post, posts, function() {
|
Post.callbacks.execute(posts);
|
||||||
return $.event('4chanXInitFinished');
|
$.event('4chanXInitFinished');
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return $.get('previousversion', null, function(_arg) {
|
return $.get('previousversion', null, function(_arg) {
|
||||||
var changelog, el, previousversion;
|
var changelog, el, previousversion;
|
||||||
@ -17996,40 +17998,6 @@
|
|||||||
return $.set('previousversion', g.VERSION);
|
return $.set('previousversion', g.VERSION);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
callbackNodes: function(klass, nodes) {
|
|
||||||
var cb, i, node;
|
|
||||||
i = 0;
|
|
||||||
cb = klass.callbacks;
|
|
||||||
while (node = nodes[i++]) {
|
|
||||||
cb.execute(node);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callbackNodesDB: function(klass, nodes, cb) {
|
|
||||||
var cbs, fn, i, softTask;
|
|
||||||
i = 0;
|
|
||||||
cbs = klass.callbacks;
|
|
||||||
fn = function() {
|
|
||||||
var node;
|
|
||||||
if (!(node = nodes[i])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
cbs.execute(node);
|
|
||||||
return ++i % 25;
|
|
||||||
};
|
|
||||||
softTask = function() {
|
|
||||||
while (fn()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!nodes[i]) {
|
|
||||||
if (cb) {
|
|
||||||
cb();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return setTimeout(softTask, 0);
|
|
||||||
};
|
|
||||||
return softTask();
|
|
||||||
},
|
|
||||||
addCallback: function(e) {
|
addCallback: function(e) {
|
||||||
var Klass, obj;
|
var Klass, obj;
|
||||||
obj = e.detail;
|
obj = e.detail;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.3 - 2014-03-13
|
* appchan x - Version 2.9.3 - 2014-03-14
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -3089,24 +3089,27 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Callbacks.prototype.execute = function(node) {
|
Callbacks.prototype.execute = function(nodes) {
|
||||||
var err, errors, name, _i, _len, _ref;
|
var cb, err, errors, i, j, name, node;
|
||||||
_ref = this.keys;
|
i = 0;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
while (name = this.keys[i++]) {
|
||||||
name = _ref[_i];
|
j = 0;
|
||||||
try {
|
cb = this[name];
|
||||||
if (!this[name].disconnected) {
|
while (node = nodes[j++]) {
|
||||||
this[name].call(node);
|
try {
|
||||||
|
if (!cb.disconnected) {
|
||||||
|
cb.call(node);
|
||||||
|
}
|
||||||
|
} catch (_error) {
|
||||||
|
err = _error;
|
||||||
|
if (!errors) {
|
||||||
|
errors = [];
|
||||||
|
}
|
||||||
|
errors.push({
|
||||||
|
message: ['"', name, '" crashed on node ', this.type, ' No.', node.ID, ' (', node.board, ').'].join(''),
|
||||||
|
error: err
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (_error) {
|
|
||||||
err = _error;
|
|
||||||
if (!errors) {
|
|
||||||
errors = [];
|
|
||||||
}
|
|
||||||
errors.push({
|
|
||||||
message: ['"', name, '" crashed on node ', this.type, ' No.', node.ID, ' (', node.board, ').'].join(''),
|
|
||||||
error: err
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errors) {
|
if (errors) {
|
||||||
@ -5497,8 +5500,8 @@
|
|||||||
if (errors) {
|
if (errors) {
|
||||||
Main.handleErrors(errors);
|
Main.handleErrors(errors);
|
||||||
}
|
}
|
||||||
Main.callbackNodes(Thread, threads);
|
Thread.callbacks.execute(threads);
|
||||||
Main.callbackNodes(Post, posts);
|
Post.callbacks.execute(posts);
|
||||||
Index.updateHideLabel();
|
Index.updateHideLabel();
|
||||||
return $.event('IndexRefresh');
|
return $.event('IndexRefresh');
|
||||||
},
|
},
|
||||||
@ -5536,7 +5539,7 @@
|
|||||||
if (errors) {
|
if (errors) {
|
||||||
Main.handleErrors(errors);
|
Main.handleErrors(errors);
|
||||||
}
|
}
|
||||||
return Main.callbackNodes(Post, posts);
|
return Post.callbacks.execute(posts);
|
||||||
},
|
},
|
||||||
buildCatalogViews: function() {
|
buildCatalogViews: function() {
|
||||||
var catalogThreads, i, nodes, thread, _i, _len, _ref;
|
var catalogThreads, i, nodes, thread, _i, _len, _ref;
|
||||||
@ -5548,7 +5551,7 @@
|
|||||||
catalogThreads.push(new CatalogThread(Build.catalogThread(thread), thread));
|
catalogThreads.push(new CatalogThread(Build.catalogThread(thread), thread));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Main.callbackNodes(CatalogThread, catalogThreads);
|
CatalogThread.callbacks.execute(catalogThreads);
|
||||||
nodes = [];
|
nodes = [];
|
||||||
i = 0;
|
i = 0;
|
||||||
while (thread = Index.sortedThreads[i++]) {
|
while (thread = Index.sortedThreads[i++]) {
|
||||||
@ -6167,7 +6170,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clone = post.addClone(context);
|
clone = post.addClone(context);
|
||||||
Main.callbackNodes(Clone, [clone]);
|
Clone.callbacks.execute([clone]);
|
||||||
nodes = clone.nodes;
|
nodes = clone.nodes;
|
||||||
$.rmAll(nodes.root);
|
$.rmAll(nodes.root);
|
||||||
$.add(nodes.root, nodes.post);
|
$.add(nodes.root, nodes.post);
|
||||||
@ -6224,7 +6227,7 @@
|
|||||||
board = g.boards[boardID] || new Board(boardID);
|
board = g.boards[boardID] || new Board(boardID);
|
||||||
thread = g.threads["" + boardID + "." + threadID] || new Thread(threadID, board);
|
thread = g.threads["" + boardID + "." + threadID] || new Thread(threadID, board);
|
||||||
post = new Post(Build.postFromObject(post, boardID), thread, board);
|
post = new Post(Build.postFromObject(post, boardID), thread, board);
|
||||||
Main.callbackNodes(Post, [post]);
|
Post.callbacks.execute([post]);
|
||||||
return Get.insert(post, root, context);
|
return Get.insert(post, root, context);
|
||||||
},
|
},
|
||||||
archivedPost: function(req, boardID, postID, root, context) {
|
archivedPost: function(req, boardID, postID, root, context) {
|
||||||
@ -6293,7 +6296,7 @@
|
|||||||
if ((_ref1 = $('.page-num', post.nodes.info)) != null) {
|
if ((_ref1 = $('.page-num', post.nodes.info)) != null) {
|
||||||
_ref1.hidden = true;
|
_ref1.hidden = true;
|
||||||
}
|
}
|
||||||
Main.callbackNodes(Post, [post]);
|
Post.callbacks.execute([post]);
|
||||||
return Get.insert(post, root, context);
|
return Get.insert(post, root, context);
|
||||||
},
|
},
|
||||||
parseMarkup: function(text) {
|
parseMarkup: function(text) {
|
||||||
@ -12131,7 +12134,7 @@
|
|||||||
ThreadUpdater.audio.play();
|
ThreadUpdater.audio.play();
|
||||||
}
|
}
|
||||||
ThreadUpdater.lastPost = posts[count - 1].ID;
|
ThreadUpdater.lastPost = posts[count - 1].ID;
|
||||||
Main.callbackNodes(Post, posts);
|
Post.callbacks.execute(posts);
|
||||||
scroll = Conf['Auto Scroll'] && ThreadUpdater.scrollBG() && Header.getBottomOf(ThreadUpdater.root) > -75;
|
scroll = Conf['Auto Scroll'] && ThreadUpdater.scrollBG() && Header.getBottomOf(ThreadUpdater.root) > -75;
|
||||||
for (_j = 0, _len1 = posts.length; _j < _len1; _j++) {
|
for (_j = 0, _len1 = posts.length; _j < _len1; _j++) {
|
||||||
post = posts[_j];
|
post = posts[_j];
|
||||||
@ -15198,7 +15201,7 @@
|
|||||||
posts.push(post);
|
posts.push(post);
|
||||||
postsRoot.push(root);
|
postsRoot.push(root);
|
||||||
}
|
}
|
||||||
Main.callbackNodes(Post, posts);
|
Post.callbacks.execute(posts);
|
||||||
$.after(a, postsRoot);
|
$.after(a, postsRoot);
|
||||||
postsCount = postsRoot.length;
|
postsCount = postsRoot.length;
|
||||||
return a.textContent = ExpandThread.text('-', postsRoot.length, filesCount);
|
return a.textContent = ExpandThread.text('-', postsRoot.length, filesCount);
|
||||||
@ -16632,8 +16635,8 @@
|
|||||||
makePost(post);
|
makePost(post);
|
||||||
$.add(threadRoot, post);
|
$.add(threadRoot, post);
|
||||||
}
|
}
|
||||||
Main.callbackNodes(Thread, [thread]);
|
Thread.callbacks.execute([thread]);
|
||||||
Main.callbackNodes(Post, posts);
|
Post.callbacks.execute(posts);
|
||||||
if (Conf['Quote Threading'] && !Conf['Unread Count']) {
|
if (Conf['Quote Threading'] && !Conf['Unread Count']) {
|
||||||
QuoteThreading.force();
|
QuoteThreading.force();
|
||||||
}
|
}
|
||||||
@ -17969,10 +17972,9 @@
|
|||||||
if (errors) {
|
if (errors) {
|
||||||
Main.handleErrors(errors);
|
Main.handleErrors(errors);
|
||||||
}
|
}
|
||||||
Main.callbackNodes(Thread, threads);
|
Thread.callbacks.execute(threads);
|
||||||
Main.callbackNodesDB(Post, posts, function() {
|
Post.callbacks.execute(posts);
|
||||||
return $.event('4chanXInitFinished');
|
$.event('4chanXInitFinished');
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return $.get('previousversion', null, function(_arg) {
|
return $.get('previousversion', null, function(_arg) {
|
||||||
var changelog, el, previousversion;
|
var changelog, el, previousversion;
|
||||||
@ -17992,40 +17994,6 @@
|
|||||||
return $.set('previousversion', g.VERSION);
|
return $.set('previousversion', g.VERSION);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
callbackNodes: function(klass, nodes) {
|
|
||||||
var cb, i, node;
|
|
||||||
i = 0;
|
|
||||||
cb = klass.callbacks;
|
|
||||||
while (node = nodes[i++]) {
|
|
||||||
cb.execute(node);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callbackNodesDB: function(klass, nodes, cb) {
|
|
||||||
var cbs, fn, i, softTask;
|
|
||||||
i = 0;
|
|
||||||
cbs = klass.callbacks;
|
|
||||||
fn = function() {
|
|
||||||
var node;
|
|
||||||
if (!(node = nodes[i])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
cbs.execute(node);
|
|
||||||
return ++i % 25;
|
|
||||||
};
|
|
||||||
softTask = function() {
|
|
||||||
while (fn()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!nodes[i]) {
|
|
||||||
if (cb) {
|
|
||||||
cb();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return setTimeout(softTask, 0);
|
|
||||||
};
|
|
||||||
return softTask();
|
|
||||||
},
|
|
||||||
addCallback: function(e) {
|
addCallback: function(e) {
|
||||||
var Klass, obj;
|
var Klass, obj;
|
||||||
obj = e.detail;
|
obj = e.detail;
|
||||||
|
|||||||
@ -81,7 +81,7 @@ Get =
|
|||||||
# Stop here if the container has been removed while loading.
|
# Stop here if the container has been removed while loading.
|
||||||
return unless root.parentNode
|
return unless root.parentNode
|
||||||
clone = post.addClone context
|
clone = post.addClone context
|
||||||
Main.callbackNodes Clone, [clone]
|
Clone.callbacks.execute [clone]
|
||||||
|
|
||||||
# Get rid of the side arrows/stubs.
|
# Get rid of the side arrows/stubs.
|
||||||
{nodes} = clone
|
{nodes} = clone
|
||||||
@ -136,7 +136,7 @@ Get =
|
|||||||
thread = g.threads["#{boardID}.#{threadID}"] or
|
thread = g.threads["#{boardID}.#{threadID}"] or
|
||||||
new Thread threadID, board
|
new Thread threadID, board
|
||||||
post = new Post Build.postFromObject(post, boardID), thread, board
|
post = new Post Build.postFromObject(post, boardID), thread, board
|
||||||
Main.callbackNodes Post, [post]
|
Post.callbacks.execute [post]
|
||||||
Get.insert post, root, context
|
Get.insert post, root, context
|
||||||
archivedPost: (req, boardID, postID, root, context) ->
|
archivedPost: (req, boardID, postID, root, context) ->
|
||||||
# In case of multiple callbacks for the same request,
|
# In case of multiple callbacks for the same request,
|
||||||
@ -209,7 +209,7 @@ Get =
|
|||||||
new Thread threadID, board
|
new Thread threadID, board
|
||||||
post = new Post Build.post(o, true), thread, board, {isArchived: true}
|
post = new Post Build.post(o, true), thread, board, {isArchived: true}
|
||||||
$('.page-num', post.nodes.info)?.hidden = true
|
$('.page-num', post.nodes.info)?.hidden = true
|
||||||
Main.callbackNodes Post, [post]
|
Post.callbacks.execute [post]
|
||||||
Get.insert post, root, context
|
Get.insert post, root, context
|
||||||
parseMarkup: (text) ->
|
parseMarkup: (text) ->
|
||||||
{
|
{
|
||||||
|
|||||||
@ -624,8 +624,8 @@ Index =
|
|||||||
error: err
|
error: err
|
||||||
|
|
||||||
Main.handleErrors errors if errors
|
Main.handleErrors errors if errors
|
||||||
Main.callbackNodes Thread, threads
|
Thread.callbacks.execute threads
|
||||||
Main.callbackNodes Post, posts
|
Post.callbacks.execute posts
|
||||||
Index.updateHideLabel()
|
Index.updateHideLabel()
|
||||||
|
|
||||||
$.event 'IndexRefresh'
|
$.event 'IndexRefresh'
|
||||||
@ -651,13 +651,13 @@ Index =
|
|||||||
$.add thread.OP.nodes.root.parentNode, nodes
|
$.add thread.OP.nodes.root.parentNode, nodes
|
||||||
|
|
||||||
Main.handleErrors errors if errors
|
Main.handleErrors errors if errors
|
||||||
Main.callbackNodes Post, posts
|
Post.callbacks.execute posts
|
||||||
|
|
||||||
buildCatalogViews: ->
|
buildCatalogViews: ->
|
||||||
catalogThreads = []
|
catalogThreads = []
|
||||||
for thread in Index.sortedThreads when !thread.catalogView
|
for thread in Index.sortedThreads when !thread.catalogView
|
||||||
catalogThreads.push new CatalogThread Build.catalogThread(thread), thread
|
catalogThreads.push new CatalogThread Build.catalogThread(thread), thread
|
||||||
Main.callbackNodes CatalogThread, catalogThreads
|
CatalogThread.callbacks.execute catalogThreads
|
||||||
nodes = []
|
nodes = []
|
||||||
i = 0
|
i = 0
|
||||||
while thread = Index.sortedThreads[i++]
|
while thread = Index.sortedThreads[i++]
|
||||||
|
|||||||
@ -239,9 +239,10 @@ Main =
|
|||||||
error: err
|
error: err
|
||||||
Main.handleErrors errors if errors
|
Main.handleErrors errors if errors
|
||||||
|
|
||||||
Main.callbackNodes Thread, threads
|
Thread.callbacks.execute threads
|
||||||
Main.callbackNodesDB Post, posts, ->
|
Post.callbacks.execute posts
|
||||||
$.event '4chanXInitFinished'
|
|
||||||
|
$.event '4chanXInitFinished'
|
||||||
|
|
||||||
$.get 'previousversion', null, ({previousversion}) ->
|
$.get 'previousversion', null, ({previousversion}) ->
|
||||||
return if previousversion is g.VERSION
|
return if previousversion is g.VERSION
|
||||||
@ -254,31 +255,6 @@ Main =
|
|||||||
Settings.open()
|
Settings.open()
|
||||||
$.set 'previousversion', g.VERSION
|
$.set 'previousversion', g.VERSION
|
||||||
|
|
||||||
callbackNodes: (klass, nodes) ->
|
|
||||||
i = 0
|
|
||||||
cb = klass.callbacks
|
|
||||||
while node = nodes[i++]
|
|
||||||
cb.execute node
|
|
||||||
return
|
|
||||||
|
|
||||||
callbackNodesDB: (klass, nodes, cb) ->
|
|
||||||
i = 0
|
|
||||||
cbs = klass.callbacks
|
|
||||||
fn = ->
|
|
||||||
return false unless node = nodes[i]
|
|
||||||
cbs.execute node
|
|
||||||
++i % 25
|
|
||||||
|
|
||||||
softTask = ->
|
|
||||||
while fn()
|
|
||||||
continue
|
|
||||||
unless nodes[i]
|
|
||||||
cb() if cb
|
|
||||||
return
|
|
||||||
setTimeout softTask, 0
|
|
||||||
|
|
||||||
softTask()
|
|
||||||
|
|
||||||
addCallback: (e) ->
|
addCallback: (e) ->
|
||||||
obj = e.detail
|
obj = e.detail
|
||||||
unless typeof obj.callback.name is 'string'
|
unless typeof obj.callback.name is 'string'
|
||||||
|
|||||||
@ -305,8 +305,8 @@ Navigate =
|
|||||||
makePost post
|
makePost post
|
||||||
$.add threadRoot, post
|
$.add threadRoot, post
|
||||||
|
|
||||||
Main.callbackNodes Thread, [thread]
|
Thread.callbacks.execute [thread]
|
||||||
Main.callbackNodes Post, posts
|
Post.callbacks.execute posts
|
||||||
|
|
||||||
QuoteThreading.force() if Conf['Quote Threading'] and not Conf['Unread Count']
|
QuoteThreading.force() if Conf['Quote Threading'] and not Conf['Unread Count']
|
||||||
|
|
||||||
|
|||||||
@ -10,14 +10,22 @@ class Callbacks
|
|||||||
connect: (name) -> delete @[name].disconnected if @[name].disconnected
|
connect: (name) -> delete @[name].disconnected if @[name].disconnected
|
||||||
disconnect: (name) -> @[name].disconnected = true if @[name]
|
disconnect: (name) -> @[name].disconnected = true if @[name]
|
||||||
|
|
||||||
execute: (node) ->
|
execute: (nodes) ->
|
||||||
for name in @keys
|
i = 0
|
||||||
try
|
# c.time 'Features'
|
||||||
@[name].call node unless @[name].disconnected
|
while name = @keys[i++]
|
||||||
catch err
|
j = 0
|
||||||
errors = [] unless errors
|
cb = @[name]
|
||||||
errors.push
|
# c.time name
|
||||||
message: ['"', name, '" crashed on node ', @type, ' No.', node.ID, ' (', node.board, ').'].join('')
|
while node = nodes[j++]
|
||||||
error: err
|
try
|
||||||
|
cb.call node unless cb.disconnected
|
||||||
|
catch err
|
||||||
|
errors = [] unless errors
|
||||||
|
errors.push
|
||||||
|
message: ['"', name, '" crashed on node ', @type, ' No.', node.ID, ' (', node.board, ').'].join('')
|
||||||
|
error: err
|
||||||
|
# c.timeEnd name
|
||||||
|
# c.timeEnd 'Features'
|
||||||
|
|
||||||
Main.handleErrors errors if errors
|
Main.handleErrors errors if errors
|
||||||
|
|||||||
@ -100,7 +100,7 @@ ExpandThread =
|
|||||||
filesCount++ if 'file' of post
|
filesCount++ if 'file' of post
|
||||||
posts.push post
|
posts.push post
|
||||||
postsRoot.push root
|
postsRoot.push root
|
||||||
Main.callbackNodes Post, posts
|
Post.callbacks.execute posts
|
||||||
$.after a, postsRoot
|
$.after a, postsRoot
|
||||||
|
|
||||||
postsCount = postsRoot.length
|
postsCount = postsRoot.length
|
||||||
|
|||||||
@ -333,7 +333,7 @@ ThreadUpdater =
|
|||||||
ThreadUpdater.audio.play()
|
ThreadUpdater.audio.play()
|
||||||
|
|
||||||
ThreadUpdater.lastPost = posts[count - 1].ID
|
ThreadUpdater.lastPost = posts[count - 1].ID
|
||||||
Main.callbackNodes Post, posts
|
Post.callbacks.execute posts
|
||||||
|
|
||||||
scroll = Conf['Auto Scroll'] and ThreadUpdater.scrollBG() and Header.getBottomOf(ThreadUpdater.root) > -75
|
scroll = Conf['Auto Scroll'] and ThreadUpdater.scrollBG() and Header.getBottomOf(ThreadUpdater.root) > -75
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user