From 350db1f73a60aeb79c4f5cc2615879f2d7aa4e00 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 20 Jun 2011 16:17:49 +0200 Subject: [PATCH] Fix time traveling backlinks. --- 4chan_x.user.js | 18 ++++++++++++++---- script.coffee | 9 ++++++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 56dc868db..7fa80898e 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1820,6 +1820,14 @@ }; quoteBacklink = { init: function() { + var span, _i, _len, _ref; + _ref = $$('span[id^=no]'); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + span = _ref[_i]; + $.after(span, $.el('span', { + className: 'container' + })); + } return g.callbacks.push(quoteBacklink.node); }, node: function(root) { @@ -1827,10 +1835,12 @@ if (/inline/.test(root.className)) { return; } - container = $.el('span', { - className: 'container' - }); - $.after($('span[id^=no]', root), container); + if (!$('.container', root)) { + container = $.el('span', { + className: 'container' + }); + $.after($('span[id^=no]', root), container); + } id = root.id || $('td[id]', root).id; quotes = {}; opbl = $.config('OP Backlinks'); diff --git a/script.coffee b/script.coffee index 51f19e994..f0b46164c 100644 --- a/script.coffee +++ b/script.coffee @@ -1437,12 +1437,15 @@ titlePost = quoteBacklink = init: -> + for span in $$('span[id^=no]') + $.after span, $.el 'span', className: 'container' g.callbacks.push quoteBacklink.node node: (root) -> return if /inline/.test root.className - container = $.el 'span', - className: 'container' - $.after $('span[id^=no]', root), container + unless $ '.container', root + container = $.el 'span', + className: 'container' + $.after $('span[id^=no]', root), container id = root.id or $('td[id]', root).id quotes = {} opbl = $.config 'OP Backlinks'