Add (OP) to op quotes, fix label title with 's. close #97

This commit is contained in:
Nicolas Stepien 2011-05-19 13:42:48 +02:00
parent 1ab233727e
commit f74b7ff348
2 changed files with 37 additions and 4 deletions

View File

@ -59,7 +59,7 @@
*/
(function() {
var $, $$, Favicon, NAMESPACE, Recaptcha, anonymize, config, d, expandComment, expandThread, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, main, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quotePreview, redirect, replyHiding, reportButton, sauce, threadHiding, threading, titlePost, ui, unread, updater, watcher, _config, _ref;
var $, $$, Favicon, NAMESPACE, Recaptcha, anonymize, config, d, expandComment, expandThread, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, main, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, sauce, threadHiding, threading, titlePost, ui, unread, updater, watcher, _config, _ref;
var __slice = Array.prototype.slice;
if (typeof console !== "undefined" && console !== null) {
log = function(arg) {
@ -91,7 +91,8 @@
quote: {
'Quote Backlinks': [false, 'Add quote backlinks'],
'Quote Inline': [false, 'Show quoted post inline on quote click'],
'Quote Preview': [false, 'Show quote content on hover']
'Quote Preview': [false, 'Show quote content on hover'],
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes']
},
hide: {
'Reply Hiding': [true, 'Hide single replies'],
@ -947,7 +948,7 @@
title = conf[name][1];
checked = $.config(name) ? "checked" : "";
li = $.el('li', {
innerHTML: "<label title='" + title + "'><input name='" + name + "' " + checked + " type=checkbox>" + name + "</label>"
innerHTML: "<label title=\"" + title + "\"><input name='" + name + "' " + checked + " type=checkbox>" + name + "</label>"
});
_results.push($.append(id, li));
}
@ -1884,6 +1885,22 @@
return qp.innerHTML = html;
}
};
quoteOP = {
init: function() {
return g.callbacks.push(quoteOP.node);
},
node: function(root) {
var quote, tid, _i, _len, _ref, _results;
tid = g.THREAD_ID || root.parentNode.firstChild.id;
_ref = $$('a.quotelink', root);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quote = _ref[_i];
_results.push(quote.hash.slice(1) === tid ? quote.textContent += ' (OP)' : void 0);
}
return _results;
}
};
reportButton = {
init: function() {
return g.callbacks.push(reportButton.cb.node);
@ -2345,6 +2362,9 @@
if ($.config('Quote Preview')) {
quotePreview.init();
}
if ($.config('Indicate OP quote')) {
quoteOP.init();
}
if ($.config('Thread Watcher')) {
watcher.init();
}

View File

@ -32,6 +32,7 @@ config =
'Quote Backlinks': [false, 'Add quote backlinks']
'Quote Inline': [false, 'Show quoted post inline on quote click']
'Quote Preview': [false, 'Show quote content on hover']
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes']
hide:
'Reply Hiding': [true, 'Hide single replies']
'Thread Hiding': [true, 'Hide entire threads']
@ -733,7 +734,7 @@ options =
title = conf[name][1]
checked = if $.config name then "checked" else ""
li = $.el 'li',
innerHTML: "<label title='#{title}'><input name='#{name}' #{checked} type=checkbox>#{name}</label>"
innerHTML: "<label title=\"#{title}\"><input name='#{name}' #{checked} type=checkbox>#{name}</label>"
$.append id, li
flavors: ->
@ -1489,6 +1490,15 @@ quotePreview =
break
qp.innerHTML = html
quoteOP =
init: ->
g.callbacks.push quoteOP.node
node: (root) ->
tid = g.THREAD_ID or root.parentNode.firstChild.id
for quote in $$ 'a.quotelink', root
if quote.hash[1..] is tid
quote.textContent += ' (OP)'
reportButton =
init: ->
g.callbacks.push reportButton.cb.node
@ -1820,6 +1830,9 @@ main =
if $.config 'Quote Preview'
quotePreview.init()
if $.config 'Indicate OP quote'
quoteOP.init()
if $.config 'Thread Watcher'
watcher.init()