replace once

This commit is contained in:
Nicolas Stepien 2011-08-28 03:30:11 +02:00
parent baac2a1bcd
commit 226665a16f
3 changed files with 8 additions and 2 deletions

View File

@ -2117,6 +2117,9 @@
}; };
quoteBacklink = { quoteBacklink = {
init: function() { init: function() {
var format;
format = conf['backlink'].replace(/%id/, "' + id + '");
quoteBacklink.funk = Function('id', "return'" + format + "'");
return g.callbacks.push(function(root) { return g.callbacks.push(function(root) {
var container, el, id, link, qid, quote, quotes, _i, _len, _ref, _results; var container, el, id, link, qid, quote, quotes, _i, _len, _ref, _results;
if (/inline/.test(root.className)) { if (/inline/.test(root.className)) {
@ -2143,7 +2146,7 @@
link = $.el('a', { link = $.el('a', {
href: "#" + id, href: "#" + id,
className: 'backlink', className: 'backlink',
textContent: conf['backlink'].replace(/%id/, id) textContent: quoteBacklink.funk(id)
}); });
if (conf['Quote Preview']) { if (conf['Quote Preview']) {
$.bind(link, 'mouseover', quotePreview.mouseover); $.bind(link, 'mouseover', quotePreview.mouseover);

View File

@ -2,6 +2,7 @@ master
- mayhem - mayhem
fix updater refreshing 404'd threads fix updater refreshing 404'd threads
distinguishable unread favicons on white backgrounds distinguishable unread favicons on white backgrounds
backlink formatting
2.18.3 2.18.3
- mayhem - mayhem

View File

@ -1678,6 +1678,8 @@ titlePost =
quoteBacklink = quoteBacklink =
init: -> init: ->
format = conf['backlink'].replace /%id/, "' + id + '"
quoteBacklink.funk = Function 'id', "return'#{format}'"
g.callbacks.push (root) -> g.callbacks.push (root) ->
return if /inline/.test root.className return if /inline/.test root.className
# op or reply # op or reply
@ -1695,7 +1697,7 @@ quoteBacklink =
link = $.el 'a', link = $.el 'a',
href: "##{id}" href: "##{id}"
className: 'backlink' className: 'backlink'
textContent: conf['backlink'].replace /%id/, id textContent: quoteBacklink.funk id
if conf['Quote Preview'] if conf['Quote Preview']
$.bind link, 'mouseover', quotePreview.mouseover $.bind link, 'mouseover', quotePreview.mouseover
$.bind link, 'mousemove', ui.hover $.bind link, 'mousemove', ui.hover