Image spoiler revealer. Close #187
This commit is contained in:
parent
cd20db879e
commit
5431fd5311
@ -59,7 +59,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, Favicon, NAMESPACE, Recaptcha, Time, anonymize, config, cooldown, d, expandComment, expandThread, firstRun, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, log, main, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, sauce, threadHiding, threadStats, threading, titlePost, ui, unread, updater, watcher, _config, _ref;
|
var $, $$, Favicon, NAMESPACE, Recaptcha, Time, anonymize, config, cooldown, d, expandComment, expandThread, firstRun, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, log, main, nav, nodeInserted, options, qr, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, threadHiding, threadStats, 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) {
|
||||||
@ -95,7 +95,8 @@
|
|||||||
'Image Expansion': [true, 'Expand images'],
|
'Image Expansion': [true, 'Expand images'],
|
||||||
'Image Hover': [false, 'Show full image on mouseover'],
|
'Image Hover': [false, 'Show full image on mouseover'],
|
||||||
'Image Preloading': [false, 'Preload Images'],
|
'Image Preloading': [false, 'Preload Images'],
|
||||||
'Sauce': [true, 'Add sauce to images']
|
'Sauce': [true, 'Add sauce to images'],
|
||||||
|
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
|
||||||
},
|
},
|
||||||
Hiding: {
|
Hiding: {
|
||||||
'Reply Hiding': [true, 'Hide single replies'],
|
'Reply Hiding': [true, 'Hide single replies'],
|
||||||
@ -1817,6 +1818,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
revealSpoilers = {
|
||||||
|
init: function() {
|
||||||
|
return g.callbacks.push(revealSpoilers.cb.node);
|
||||||
|
},
|
||||||
|
cb: {
|
||||||
|
node: function(root) {
|
||||||
|
var board, img, nb, _, _ref;
|
||||||
|
if (root.className === 'inline' || !(img = $('img[alt^=Spoiler]', root))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
img.removeAttribute('height');
|
||||||
|
img.removeAttribute('width');
|
||||||
|
_ref = img.parentNode.href.match(/(\w+)\/src\/(\d+)/), _ = _ref[0], board = _ref[1], nb = _ref[2];
|
||||||
|
return img.src = "http://0.thumbs.4chan.org/" + board + "/thumb/" + nb + "s.jpg";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
Time = {
|
Time = {
|
||||||
init: function() {
|
init: function() {
|
||||||
Time.foo();
|
Time.foo();
|
||||||
@ -2679,6 +2697,9 @@
|
|||||||
if ($.config('Sauce')) {
|
if ($.config('Sauce')) {
|
||||||
sauce.init();
|
sauce.init();
|
||||||
}
|
}
|
||||||
|
if ($.config('Reveal Spoilers')) {
|
||||||
|
revealSpoilers.init();
|
||||||
|
}
|
||||||
if ($.config('Anonymize')) {
|
if ($.config('Anonymize')) {
|
||||||
anonymize.init();
|
anonymize.init();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ config =
|
|||||||
'Image Hover': [false, 'Show full image on mouseover']
|
'Image Hover': [false, 'Show full image on mouseover']
|
||||||
'Image Preloading': [false, 'Preload Images']
|
'Image Preloading': [false, 'Preload Images']
|
||||||
'Sauce': [true, 'Add sauce to images']
|
'Sauce': [true, 'Add sauce to images']
|
||||||
|
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
|
||||||
Hiding:
|
Hiding:
|
||||||
'Reply Hiding': [true, 'Hide single replies']
|
'Reply Hiding': [true, 'Hide single replies']
|
||||||
'Thread Hiding': [true, 'Hide entire threads']
|
'Thread Hiding': [true, 'Hide entire threads']
|
||||||
@ -1463,6 +1464,17 @@ sauce =
|
|||||||
href: prefix + suffix
|
href: prefix + suffix
|
||||||
$.append span, $.tn(' '), link
|
$.append span, $.tn(' '), link
|
||||||
|
|
||||||
|
revealSpoilers =
|
||||||
|
init: ->
|
||||||
|
g.callbacks.push revealSpoilers.cb.node
|
||||||
|
cb:
|
||||||
|
node: (root) ->
|
||||||
|
return if root.className is 'inline' or not img = $('img[alt^=Spoiler]', root)
|
||||||
|
img.removeAttribute 'height'
|
||||||
|
img.removeAttribute 'width'
|
||||||
|
[_, board, nb] = img.parentNode.href.match /(\w+)\/src\/(\d+)/
|
||||||
|
img.src = "http://0.thumbs.4chan.org/#{board}/thumb/#{nb}s.jpg"
|
||||||
|
|
||||||
Time =
|
Time =
|
||||||
init: ->
|
init: ->
|
||||||
Time.foo()
|
Time.foo()
|
||||||
@ -2099,6 +2111,9 @@ main =
|
|||||||
if $.config 'Sauce'
|
if $.config 'Sauce'
|
||||||
sauce.init()
|
sauce.init()
|
||||||
|
|
||||||
|
if $.config 'Reveal Spoilers'
|
||||||
|
revealSpoilers.init()
|
||||||
|
|
||||||
if $.config 'Anonymize'
|
if $.config 'Anonymize'
|
||||||
anonymize.init()
|
anonymize.init()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user