diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 20bc6178d..40dc95014 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -2965,8 +2965,8 @@ href: "/" + boardID + "/res/" + threadID }); }, - thread: function(board, data) { - var OP, files, nodes, posts, root, _ref; + thread: function(board, data, full) { + var OP, root; Build.spoilerRange[board] = data.custom_spoiler; if ((OP = board.posts[data.no]) && (root = OP.nodes.root.parentNode)) { $.rmAll(root); @@ -2976,6 +2976,11 @@ id: "t" + data.no }); } + $.add(root, Build[full ? 'fullThread' : 'excerptThread'](board, data, OP)); + return root; + }, + excerptThread: function(board, data, OP) { + var files, nodes, posts, _ref; nodes = [OP ? OP.nodes.root : Build.postFromObject(data, board.ID)]; if (data.omitted_posts || !Conf['Show Replies'] && data.replies) { _ref = Conf['Show Replies'] ? [data.omitted_posts, data.omitted_images] : [ @@ -2985,8 +2990,10 @@ ], posts = _ref[0], files = _ref[1]; nodes.push(Build.summary(board.ID, data.no, posts, files)); } - $.add(root, nodes); - return root; + return nodes; + }, + fullThread: function(board, data) { + return [Build.postFromObject(data, board.ID)]; } }; diff --git a/builds/crx/script.js b/builds/crx/script.js index ee8a8102f..fcefa5db7 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -2975,8 +2975,8 @@ href: "/" + boardID + "/res/" + threadID }); }, - thread: function(board, data) { - var OP, files, nodes, posts, root, _ref; + thread: function(board, data, full) { + var OP, root; Build.spoilerRange[board] = data.custom_spoiler; if ((OP = board.posts[data.no]) && (root = OP.nodes.root.parentNode)) { $.rmAll(root); @@ -2986,6 +2986,11 @@ id: "t" + data.no }); } + $.add(root, Build[full ? 'fullThread' : 'excerptThread'](board, data, OP)); + return root; + }, + excerptThread: function(board, data, OP) { + var files, nodes, posts, _ref; nodes = [OP ? OP.nodes.root : Build.postFromObject(data, board.ID)]; if (data.omitted_posts || !Conf['Show Replies'] && data.replies) { _ref = Conf['Show Replies'] ? [data.omitted_posts, data.omitted_images] : [ @@ -2995,8 +3000,10 @@ ], posts = _ref[0], files = _ref[1]; nodes.push(Build.summary(board.ID, data.no, posts, files)); } - $.add(root, nodes); - return root; + return nodes; + }, + fullThread: function(board, data) { + return [Build.postFromObject(data, board.ID)]; } }; diff --git a/src/General/Build.coffee b/src/General/Build.coffee index cd03aecf5..653293680 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -208,7 +208,8 @@ Build = className: 'summary' textContent: text.join ' ' href: "/#{boardID}/res/#{threadID}" - thread: (board, data) -> + + thread: (board, data, full) -> Build.spoilerRange[board] = data.custom_spoiler if (OP = board.posts[data.no]) and root = OP.nodes.root.parentNode @@ -218,6 +219,10 @@ Build = className: 'thread' id: "t#{data.no}" + $.add root, Build[if full then 'fullThread' else 'excerptThread'] board, data, OP + root + + excerptThread: (board, data, OP) -> nodes = [if OP then OP.nodes.root else Build.postFromObject data, board.ID] if data.omitted_posts or !Conf['Show Replies'] and data.replies [posts, files] = if Conf['Show Replies'] @@ -226,6 +231,7 @@ Build = # XXX data.images is not accurate. [data.replies, data.omitted_images + data.last_replies.filter((data) -> !!data.ext).length] nodes.push Build.summary board.ID, data.no, posts, files + nodes - $.add root, nodes - root + fullThread: (board, data) -> + [Build.postFromObject data, board.ID] \ No newline at end of file