From b87825e558601412a6ff3199d4f3096fede78c60 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Thu, 9 Jan 2014 19:25:47 -0700 Subject: [PATCH] That... should fix those errors. --- builds/4chan-X.user.js | 15 ++++++++------- builds/crx/script.js | 15 ++++++++------- src/General/Navigate.coffee | 9 +++++---- src/General/lib/callbacks.class | 2 +- src/General/lib/thread.class | 2 +- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 693aa2aeb..766065368 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -865,7 +865,7 @@ errors = []; } errors.push({ - message: ['"', name, '" crashed on node ', this.type, ' No.', node, ' (', node.board, ').'].join(''), + message: ['"', name, '" crashed on node ', this.type, ' No.', node.ID, ' (', node.board, ').'].join(''), error: err }); } @@ -911,7 +911,7 @@ this.isClosed = false; this.postLimit = false; this.fileLimit = false; - g.threads[this.fullID] = board.threads[this.ID] = this; + g.threads[this.fullID] = board.threads[this] = this; } Thread.prototype.setPage = function(pageNum) { @@ -11962,16 +11962,17 @@ return Header.scrollToIfNeeded($('.board')); }, parse: function(data) { - var errors, makePost, nodes, obj, post, posts, thread, threadRoot, _i, _len; - threadRoot = Build.thread(g.BOARD, data.shift(), true); - thread = new Thread(threadRoot, g.BOARD); + var OP, board, errors, makePost, nodes, obj, post, posts, thread, threadRoot, _i, _len; + board = g.BOARD; + threadRoot = Build.thread(board, OP = data.shift(), true); + thread = new Thread(OP.no, board); nodes = [threadRoot]; posts = []; errors = null; makePost = function(postNode) { var err; try { - return posts.push(new Post(postNode, thread, g.BOARD)); + return posts.push(new Post(postNode, thread, board)); } catch (_error) { err = _error; if (!errors) { @@ -11986,7 +11987,7 @@ makePost($('.opContainer', threadRoot)); for (_i = 0, _len = data.length; _i < _len; _i++) { obj = data[_i]; - posts.push(post = Build.postFromObject(obj)); + nodes.push(post = Build.postFromObject(obj, board)); makePost(post); } if (errors) { diff --git a/builds/crx/script.js b/builds/crx/script.js index f8134eab3..1b81caf07 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -870,7 +870,7 @@ errors = []; } errors.push({ - message: ['"', name, '" crashed on node ', this.type, ' No.', node, ' (', node.board, ').'].join(''), + message: ['"', name, '" crashed on node ', this.type, ' No.', node.ID, ' (', node.board, ').'].join(''), error: err }); } @@ -916,7 +916,7 @@ this.isClosed = false; this.postLimit = false; this.fileLimit = false; - g.threads[this.fullID] = board.threads[this.ID] = this; + g.threads[this.fullID] = board.threads[this] = this; } Thread.prototype.setPage = function(pageNum) { @@ -11951,16 +11951,17 @@ return Header.scrollToIfNeeded($('.board')); }, parse: function(data) { - var errors, makePost, nodes, obj, post, posts, thread, threadRoot, _i, _len; - threadRoot = Build.thread(g.BOARD, data.shift(), true); - thread = new Thread(threadRoot, g.BOARD); + var OP, board, errors, makePost, nodes, obj, post, posts, thread, threadRoot, _i, _len; + board = g.BOARD; + threadRoot = Build.thread(board, OP = data.shift(), true); + thread = new Thread(OP.no, board); nodes = [threadRoot]; posts = []; errors = null; makePost = function(postNode) { var err; try { - return posts.push(new Post(postNode, thread, g.BOARD)); + return posts.push(new Post(postNode, thread, board)); } catch (_error) { err = _error; if (!errors) { @@ -11975,7 +11976,7 @@ makePost($('.opContainer', threadRoot)); for (_i = 0, _len = data.length; _i < _len; _i++) { obj = data[_i]; - posts.push(post = Build.postFromObject(obj)); + nodes.push(post = Build.postFromObject(obj, board)); makePost(post); } if (errors) { diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index 6cb2a753f..548fa2f90 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -129,8 +129,9 @@ Navigate = Header.scrollToIfNeeded $ '.board' parse: (data) -> - threadRoot = Build.thread g.BOARD, data.shift(), true - thread = new Thread threadRoot, g.BOARD + board = g.BOARD + threadRoot = Build.thread board, OP = data.shift(), true + thread = new Thread OP.no, board nodes = [threadRoot] posts = [] @@ -138,7 +139,7 @@ Navigate = makePost = (postNode) -> try - posts.push new Post postNode, thread, g.BOARD + posts.push new Post postNode, thread, board catch err # Skip posts that we failed to parse. errors = [] unless errors @@ -149,7 +150,7 @@ Navigate = makePost $('.opContainer', threadRoot) for obj in data - posts.push post = Build.postFromObject obj + nodes.push post = Build.postFromObject obj, board makePost post Main.handleErrors errors if errors diff --git a/src/General/lib/callbacks.class b/src/General/lib/callbacks.class index 4c7b816a5..4ac1e43ed 100644 --- a/src/General/lib/callbacks.class +++ b/src/General/lib/callbacks.class @@ -21,7 +21,7 @@ class Callbacks catch err errors = [] unless errors errors.push - message: ['"', name, '" crashed on node ', @type, ' No.', node, ' (', node.board, ').'].join('') + message: ['"', name, '" crashed on node ', @type, ' No.', node.ID, ' (', node.board, ').'].join('') error: err Main.handleErrors errors if errors diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index ea720f662..395e06eb6 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -10,7 +10,7 @@ class Thread @postLimit = false @fileLimit = false - g.threads[@fullID] = board.threads[@ID] = @ + g.threads[@fullID] = board.threads[@] = @ setPage: (pageNum) -> icon = $ '.page-num', @OP.nodes.post