A bit of random cleaning.

This commit is contained in:
Nicolas Stepien 2012-02-04 20:06:51 +01:00
parent 547afd0143
commit 5bfb3d4c18
2 changed files with 17 additions and 23 deletions

View File

@ -2756,8 +2756,8 @@
quoteBacklink = { quoteBacklink = {
init: function() { init: function() {
var format; var format;
format = conf['backlink'].replace(/%id/, "' + id + '"); format = conf['backlink'].replace(/%id/g, "' + id + '");
quoteBacklink.funk = Function('id', "return'" + format + "'"); quoteBacklink.funk = Function('id', "return '" + format + "'");
return g.callbacks.push(function(root) { return g.callbacks.push(function(root) {
var a, container, el, id, link, qid, quote, quotes, _i, _len, _ref, _results; var a, container, el, id, link, qid, quote, quotes, _i, _len, _ref, _results;
if (/\binline\b/.test(root.className)) return; if (/\binline\b/.test(root.className)) return;
@ -2765,7 +2765,7 @@
_ref = $$('.quotelink', root); _ref = $$('.quotelink', root);
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i]; quote = _ref[_i];
if (qid = quote.hash.slice(1)) quotes[qid] = quote; if (qid = quote.hash.slice(1)) quotes[qid] = true;
} }
id = $('input', root).name; id = $('input', root).name;
a = $.el('a', { a = $.el('a', {
@ -2775,8 +2775,9 @@
}); });
_results = []; _results = [];
for (qid in quotes) { for (qid in quotes) {
if (!(el = $.id(qid))) continue; if (!(el = $.id(qid)) || el.className === 'op' && !conf['OP Backlinks']) {
if (el.className === 'op' && !conf['OP Backlinks']) continue; continue;
}
link = a.cloneNode(true); link = a.cloneNode(true);
if (conf['Quote Preview']) { if (conf['Quote Preview']) {
$.on(link, 'mouseover', quotePreview.mouseover); $.on(link, 'mouseover', quotePreview.mouseover);
@ -3178,15 +3179,11 @@
empty: 'data:image/gif;base64,R0lGODlhEAAQAJEAAAAAAP///9vb2////yH5BAEAAAMALAAAAAAQABAAAAIvnI+pq+D9DBAUoFkPFnbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw==', empty: 'data:image/gif;base64,R0lGODlhEAAQAJEAAAAAAP///9vb2////yH5BAEAAAMALAAAAAAQABAAAAIvnI+pq+D9DBAUoFkPFnbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw==',
dead: 'data:image/gif;base64,R0lGODlhEAAQAKECAAAAAP8AAP///////yH5BAEKAAIALAAAAAAQABAAAAIvlI+pq+D9DAgUoFkPDlbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw==', dead: 'data:image/gif;base64,R0lGODlhEAAQAKECAAAAAP8AAP///////yH5BAEKAAIALAAAAAAQABAAAAIvlI+pq+D9DAgUoFkPDlbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw==',
update: function() { update: function() {
var clone, favicon, l; var favicon, l;
l = unread.replies.length; l = unread.replies.length;
favicon = $('link[rel="shortcut icon"]', d.head); favicon = $('link[rel="shortcut icon"]', d.head);
favicon.href = g.dead ? l ? this.unreadDead : this.dead : l ? this.unread : this["default"]; favicon.href = g.dead ? l ? this.unreadDead : this.dead : l ? this.unread : this["default"];
if (engine !== 'webkit') { if (engine !== 'webkit') return $.add(d.head, $.rm(favicon));
clone = favicon.cloneNode(true);
favicon.href = null;
return $.replace(favicon, clone);
}
} }
}; };

View File

@ -2157,26 +2157,25 @@ titlePost =
quoteBacklink = quoteBacklink =
init: -> init: ->
format = conf['backlink'].replace /%id/, "' + id + '" format = conf['backlink'].replace /%id/g, "' + id + '"
quoteBacklink.funk = Function 'id', "return'#{format}'" quoteBacklink.funk = Function 'id', "return '#{format}'"
g.callbacks.push (root) -> g.callbacks.push (root) ->
return if /\binline\b/.test root.className return if /\binline\b/.test root.className
quotes = {} quotes = {}
for quote in $$ '.quotelink', root for quote in $$ '.quotelink', root
#don't process >>>/b/ # Don't process >>>/b/.
if qid = quote.hash[1..] if qid = quote.hash[1..]
#duplicate quotes get overwritten # Duplicate quotes get overwritten.
quotes[qid] = quote quotes[qid] = true
# op or reply # OP or reply id.
id = $('input', root).name id = $('input', root).name
a = $.el 'a', a = $.el 'a',
href: "##{id}" href: "##{id}"
className: if root.hidden then 'filtered backlink' else 'backlink' className: if root.hidden then 'filtered backlink' else 'backlink'
textContent: quoteBacklink.funk id textContent: quoteBacklink.funk id
for qid of quotes for qid of quotes
continue unless el = $.id qid # Don't backlink the OP.
#don't backlink the op continue if !(el = $.id qid) or el.className is 'op' and !conf['OP Backlinks']
continue if el.className is 'op' and !conf['OP Backlinks']
link = a.cloneNode true link = a.cloneNode true
if conf['Quote Preview'] if conf['Quote Preview']
$.on link, 'mouseover', quotePreview.mouseover $.on link, 'mouseover', quotePreview.mouseover
@ -2472,9 +2471,7 @@ Favicon =
#`favicon.href = href` isn't enough on Opera #`favicon.href = href` isn't enough on Opera
#Opera won't always update the favicon if the href do not change #Opera won't always update the favicon if the href do not change
if engine isnt 'webkit' if engine isnt 'webkit'
clone = favicon.cloneNode true $.add d.head, $.rm favicon
favicon.href = null
$.replace favicon, clone
redirect = redirect =
init: -> init: ->