From 226665a16f2c59bed64cdb41dac369e8f4fe28c3 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 28 Aug 2011 03:30:11 +0200 Subject: [PATCH] replace once --- 4chan_x.user.js | 5 ++++- changelog | 1 + script.coffee | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 803539df3..013161d0d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2117,6 +2117,9 @@ }; quoteBacklink = { init: function() { + var format; + format = conf['backlink'].replace(/%id/, "' + id + '"); + quoteBacklink.funk = Function('id', "return'" + format + "'"); return g.callbacks.push(function(root) { var container, el, id, link, qid, quote, quotes, _i, _len, _ref, _results; if (/inline/.test(root.className)) { @@ -2143,7 +2146,7 @@ link = $.el('a', { href: "#" + id, className: 'backlink', - textContent: conf['backlink'].replace(/%id/, id) + textContent: quoteBacklink.funk(id) }); if (conf['Quote Preview']) { $.bind(link, 'mouseover', quotePreview.mouseover); diff --git a/changelog b/changelog index 96b0781b1..b9db51afd 100644 --- a/changelog +++ b/changelog @@ -2,6 +2,7 @@ master - mayhem fix updater refreshing 404'd threads distinguishable unread favicons on white backgrounds + backlink formatting 2.18.3 - mayhem diff --git a/script.coffee b/script.coffee index 7e17b332d..ed2e6939e 100644 --- a/script.coffee +++ b/script.coffee @@ -1678,6 +1678,8 @@ titlePost = quoteBacklink = init: -> + format = conf['backlink'].replace /%id/, "' + id + '" + quoteBacklink.funk = Function 'id', "return'#{format}'" g.callbacks.push (root) -> return if /inline/.test root.className # op or reply @@ -1695,7 +1697,7 @@ quoteBacklink = link = $.el 'a', href: "##{id}" className: 'backlink' - textContent: conf['backlink'].replace /%id/, id + textContent: quoteBacklink.funk id if conf['Quote Preview'] $.bind link, 'mouseover', quotePreview.mouseover $.bind link, 'mousemove', ui.hover