From 8947d62deceff10399756da08bdf59d2f0297db1 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 8 May 2011 02:33:47 +0200 Subject: [PATCH] Preview the OP too. --- 4chan_x.js | 31 ++++++++++++++++--------------- script.coffee | 30 +++++++++++++++--------------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 2226a658e..ac8680af2 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1240,18 +1240,20 @@ } $.append(op, node); op.id = $('input[name]', op).name; - node = op; - div = $.el('div', { - className: 'thread' - }); - $.before(node, div); - while (node.nodeName !== 'HR') { - $.append(div, node); - node = div.nextSibling; - } - node = node.nextElementSibling; - if (!(node.align || node.nodeName === 'CENTER')) { - return threading.thread(node); + if (!g.REPLY) { + node = op; + div = $.el('div', { + className: 'thread' + }); + $.before(node, div); + while (node.nodeName !== 'HR') { + $.append(div, node); + node = div.nextSibling; + } + node = node.nextElementSibling; + if (!(node.align || node.nodeName === 'CENTER')) { + return threading.thread(node); + } } }, stopPropagation: function(e) { @@ -1707,8 +1709,7 @@ var clientX, clientY, id, preview, target; target = e.target, clientX = e.clientX, clientY = e.clientY; preview = $('#qp'); - id = target.textContent; - id = id.replace(">>", ''); + id = target.textContent.replace(">>", ''); preview.innerHTML = d.getElementById(id).innerHTML; $.show(preview); $.bind(target, 'mousemove', quotePreview.mousemove); @@ -2238,6 +2239,7 @@ if ($.config('Keybinds')) { keybinds.init(); } + threading.init(); if (g.REPLY) { if ($.config('Thread Updater')) { updater.init(); @@ -2258,7 +2260,6 @@ watcher.watch(null, g.THREAD_ID); } } else { - threading.init(); if ($.config('Thread Hiding')) { threadHiding.init(); } diff --git a/script.coffee b/script.coffee index 503391747..bae7c8d90 100644 --- a/script.coffee +++ b/script.coffee @@ -966,20 +966,21 @@ threading = $.append op, node #add the blockquote op.id = $('input[name]', op).name - node = op + unless g.REPLY + node = op - div = $.el 'div', - className: 'thread' - $.before node, div + div = $.el 'div', + className: 'thread' + $.before node, div - while node.nodeName isnt 'HR' - $.append div, node - node = div.nextSibling + while node.nodeName isnt 'HR' + $.append div, node + node = div.nextSibling - node = node.nextElementSibling #skip text node - #{N,}SFW - unless node.align or node.nodeName is 'CENTER' - threading.thread node + node = node.nextElementSibling #skip text node + #{N,}SFW + unless node.align or node.nodeName is 'CENTER' + threading.thread node stopPropagation: (e) -> e.stopPropagation() @@ -1329,8 +1330,7 @@ quotePreview = mouseover: (e) -> {target, clientX, clientY} = e preview = $ '#qp' - id = target.textContent - id = id.replace ">>", '' + id = target.textContent.replace ">>", '' preview.innerHTML = d.getElementById(id).innerHTML $.show preview $.bind target, 'mousemove', quotePreview.mousemove @@ -1724,6 +1724,8 @@ main = if $.config 'Keybinds' keybinds.init() + threading.init() + if g.REPLY if $.config 'Thread Updater' updater.init() @@ -1745,8 +1747,6 @@ main = watcher.watch null, g.THREAD_ID else #not reply - threading.init() - if $.config 'Thread Hiding' threadHiding.init()