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() { (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; var __slice = Array.prototype.slice;
if (typeof console !== "undefined" && console !== null) { if (typeof console !== "undefined" && console !== null) {
log = function(arg) { log = function(arg) {
@ -91,7 +91,8 @@
quote: { quote: {
'Quote Backlinks': [false, 'Add quote backlinks'], 'Quote Backlinks': [false, 'Add quote backlinks'],
'Quote Inline': [false, 'Show quoted post inline on quote click'], '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: { hide: {
'Reply Hiding': [true, 'Hide single replies'], 'Reply Hiding': [true, 'Hide single replies'],
@ -947,7 +948,7 @@
title = conf[name][1]; title = conf[name][1];
checked = $.config(name) ? "checked" : ""; checked = $.config(name) ? "checked" : "";
li = $.el('li', { 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)); _results.push($.append(id, li));
} }
@ -1884,6 +1885,22 @@
return qp.innerHTML = html; 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 = { reportButton = {
init: function() { init: function() {
return g.callbacks.push(reportButton.cb.node); return g.callbacks.push(reportButton.cb.node);
@ -2345,6 +2362,9 @@
if ($.config('Quote Preview')) { if ($.config('Quote Preview')) {
quotePreview.init(); quotePreview.init();
} }
if ($.config('Indicate OP quote')) {
quoteOP.init();
}
if ($.config('Thread Watcher')) { if ($.config('Thread Watcher')) {
watcher.init(); watcher.init();
} }

View File

@ -32,6 +32,7 @@ config =
'Quote Backlinks': [false, 'Add quote backlinks'] 'Quote Backlinks': [false, 'Add quote backlinks']
'Quote Inline': [false, 'Show quoted post inline on quote click'] '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: hide:
'Reply Hiding': [true, 'Hide single replies'] 'Reply Hiding': [true, 'Hide single replies']
'Thread Hiding': [true, 'Hide entire threads'] 'Thread Hiding': [true, 'Hide entire threads']
@ -733,7 +734,7 @@ options =
title = conf[name][1] title = conf[name][1]
checked = if $.config name then "checked" else "" checked = if $.config name then "checked" else ""
li = $.el 'li', 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 $.append id, li
flavors: -> flavors: ->
@ -1489,6 +1490,15 @@ quotePreview =
break break
qp.innerHTML = html 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 = reportButton =
init: -> init: ->
g.callbacks.push reportButton.cb.node g.callbacks.push reportButton.cb.node
@ -1820,6 +1830,9 @@ main =
if $.config 'Quote Preview' if $.config 'Quote Preview'
quotePreview.init() quotePreview.init()
if $.config 'Indicate OP quote'
quoteOP.init()
if $.config 'Thread Watcher' if $.config 'Thread Watcher'
watcher.init() watcher.init()