diff --git a/4chan_x.user.js b/4chan_x.user.js index bdef3fc5f..345823581 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -66,7 +66,7 @@ */ (function() { - var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, Recaptcha, SECOND, Time, VERSION, anonymize, conf, config, cooldown, d, engine, expandComment, expandThread, filter, flatten, g, getTitle, imgExpand, imgGif, imgHover, key, keybinds, log, nav, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, strikethroughQuotes, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher; + var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, Recaptcha, SECOND, Time, VERSION, anonymize, conf, config, cooldown, d, engine, expandComment, expandThread, filter, flatten, g, getTitle, imgExpand, imgGif, imgHover, key, keybinds, log, nav, options, qr, quoteBacklink, quoteDR, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, strikethroughQuotes, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher; var __slice = Array.prototype.slice; config = { @@ -120,7 +120,8 @@ 'Quote Highlighting': [true, 'Highlight the previewed post'], 'Quote Inline': [true, 'Show quoted post inline on quote click'], 'Quote Preview': [true, 'Show quote content on hover'], - 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'] + 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'], + 'Indicate Duckrolls': [false, 'Add \'(Duckroll)\' to cross threads quotes'] } }, filter: { @@ -2581,6 +2582,27 @@ } }; + quoteDR = { + init: function() { + return g.callbacks.push(function(root) { + var quote, tid, _i, _len, _ref, _results; + if (root.className === 'inline') return; + tid = g.THREAD_ID || $.x('ancestor::div[contains(@class,"thread")]/div', root).id; + _ref = $$('.quotelink', root); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + quote = _ref[_i]; + if (quote.pathname.indexOf("res/" + tid) === -1) { + _results.push(quote.innerHTML += ' (Duckroll)'); + } else { + _results.push(void 0); + } + } + return _results; + }); + } + }; + reportButton = { init: function() { return g.callbacks.push(function(root) { @@ -2962,6 +2984,7 @@ if (conf['Quote Preview']) quotePreview.init(); if (conf['Quote Backlinks']) quoteBacklink.init(); if (conf['Indicate OP quote']) quoteOP.init(); + if (conf['Indicate Duckrolls']) quoteDR.init(); if (d.body) { return Main.onLoad(); } else { diff --git a/changelog b/changelog index 07ba4c087..fcfad3c9a 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- mayhem + new Indicate Duckrolls feature 2.21.4 - mayhem diff --git a/script.coffee b/script.coffee index f792b676b..3aaf29789 100644 --- a/script.coffee +++ b/script.coffee @@ -45,6 +45,7 @@ config = 'Quote Inline': [true, 'Show quoted post inline on quote click'] 'Quote Preview': [true, 'Show quote content on hover'] 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'] + 'Indicate Duckrolls': [false, 'Add \'(Duckroll)\' to cross threads quotes'] filter: name: '' tripcode: '' @@ -1995,6 +1996,15 @@ quoteOP = if quote.hash[1..] is tid quote.innerHTML += ' (OP)' +quoteDR = + init: -> + g.callbacks.push (root) -> + return if root.className is 'inline' + tid = g.THREAD_ID or $.x('ancestor::div[contains(@class,"thread")]/div', root).id + for quote in $$ '.quotelink', root + if quote.pathname.indexOf("res/#{tid}") is -1 + quote.innerHTML += ' (Duckroll)' + reportButton = init: -> g.callbacks.push (root) -> @@ -2317,6 +2327,9 @@ Main = if conf['Indicate OP quote'] quoteOP.init() + if conf['Indicate Duckrolls'] + quoteDR.init() + if d.body Main.onLoad()