Merge branch 'master' of github.com:aeosynth/4chan-x
This commit is contained in:
commit
2a91e76008
126
4chan_x.user.js
126
4chan_x.user.js
@ -59,10 +59,44 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(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, revealSpoilers, sauce, threadHiding, threadStats, threading, titlePost, ui, unread, updater, watcher, _config, _ref;
|
var $, $$, Favicon, NAMESPACE, Recaptcha, Time, anonymize, config, cooldown, d, expandComment, expandThread, firstRun, g, imgExpand, imgGif, imgHover, 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;
|
||||||
config = {
|
config = {
|
||||||
main: {
|
main: {
|
||||||
|
Enhancing: {
|
||||||
|
'404 Redirect': [true, 'Redirect dead threads'],
|
||||||
|
'Anonymize': [false, 'Make everybody anonymous'],
|
||||||
|
'Keybinds': [false, 'Binds actions to keys'],
|
||||||
|
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'],
|
||||||
|
'Report Button': [true, 'Add report buttons'],
|
||||||
|
'Comment Expansion': [true, 'Expand too long comments'],
|
||||||
|
'Thread Expansion': [true, 'View all replies'],
|
||||||
|
'Index Navigation': [true, 'Navigate to previous / next thread'],
|
||||||
|
'Reply Navigation': [false, 'Navigate to top / bottom of thread']
|
||||||
|
},
|
||||||
|
Hiding: {
|
||||||
|
'Reply Hiding': [true, 'Hide single replies'],
|
||||||
|
'Thread Hiding': [true, 'Hide entire threads'],
|
||||||
|
'Show Stubs': [true, 'Of hidden threads / replies']
|
||||||
|
},
|
||||||
|
Imaging: {
|
||||||
|
'Image Auto-Gif': [false, 'Animate gif thumbnails'],
|
||||||
|
'Image Expansion': [true, 'Expand images'],
|
||||||
|
'Image Hover': [false, 'Show full image on mouseover'],
|
||||||
|
'Image Preloading': [false, 'Preload Images'],
|
||||||
|
'Sauce': [true, 'Add sauce to images'],
|
||||||
|
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
|
||||||
|
},
|
||||||
|
Monitoring: {
|
||||||
|
'Thread Updater': [true, 'Update threads'],
|
||||||
|
'IRC Updating': [false, 'Scroll updated posts into view'],
|
||||||
|
'Unread Count': [true, 'Show unread post count in tab title'],
|
||||||
|
'Post in Title': [true, 'Show the op\'s post in the tab title'],
|
||||||
|
'Thread Stats': [true, 'Display reply and image count'],
|
||||||
|
'Thread Watcher': [true, 'Bookmark threads'],
|
||||||
|
'Auto Watch': [true, 'Automatically watch threads that you start'],
|
||||||
|
'Auto Watch Reply': [false, 'Automatically watch threads that you reply to']
|
||||||
|
},
|
||||||
Posting: {
|
Posting: {
|
||||||
'Auto Noko': [true, 'Always redirect to your post'],
|
'Auto Noko': [true, 'Always redirect to your post'],
|
||||||
'Cooldown': [true, 'Prevent \'flood detected\' errors'],
|
'Cooldown': [true, 'Prevent \'flood detected\' errors'],
|
||||||
@ -76,39 +110,6 @@
|
|||||||
'Quote Inline': [true, 'Show quoted post inline on quote click'],
|
'Quote Inline': [true, 'Show quoted post inline on quote click'],
|
||||||
'Quote Preview': [true, 'Show quote content on hover'],
|
'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']
|
||||||
},
|
|
||||||
Monitoring: {
|
|
||||||
'Thread Updater': [true, 'Update threads'],
|
|
||||||
'Unread Count': [true, 'Show unread post count in tab title'],
|
|
||||||
'Post in Title': [true, 'Show the op\'s post in the tab title'],
|
|
||||||
'Thread Stats': [true, 'Display reply and image count'],
|
|
||||||
'Thread Watcher': [true, 'Bookmark threads'],
|
|
||||||
'Auto Watch': [true, 'Automatically watch threads that you start'],
|
|
||||||
'Auto Watch Reply': [false, 'Automatically watch threads that you reply to']
|
|
||||||
},
|
|
||||||
Imaging: {
|
|
||||||
'Image Auto-Gif': [false, 'Animate gif thumbnails'],
|
|
||||||
'Image Expansion': [true, 'Expand images'],
|
|
||||||
'Image Hover': [false, 'Show full image on mouseover'],
|
|
||||||
'Image Preloading': [false, 'Preload Images'],
|
|
||||||
'Sauce': [true, 'Add sauce to images'],
|
|
||||||
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
|
|
||||||
},
|
|
||||||
Hiding: {
|
|
||||||
'Reply Hiding': [true, 'Hide single replies'],
|
|
||||||
'Thread Hiding': [true, 'Hide entire threads'],
|
|
||||||
'Show Stubs': [true, 'Of hidden threads / replies']
|
|
||||||
},
|
|
||||||
Enhancing: {
|
|
||||||
'404 Redirect': [true, 'Redirect dead threads'],
|
|
||||||
'Anonymize': [false, 'Make everybody anonymous'],
|
|
||||||
'Keybinds': [false, 'Binds actions to keys'],
|
|
||||||
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'],
|
|
||||||
'Report Button': [true, 'Add report buttons'],
|
|
||||||
'Comment Expansion': [true, 'Expand too long comments'],
|
|
||||||
'Thread Expansion': [true, 'View all replies'],
|
|
||||||
'Index Navigation': [true, 'Navigate to previous / next thread'],
|
|
||||||
'Reply Navigation': [false, 'Navigate to top / bottom of thread']
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
flavors: ['http://regex.info/exif.cgi?url=', 'http://iqdb.org/?url=', 'http://google.com/searchbyimage?image_url=', '#http://tineye.com/search?url=', '#http://saucenao.com/search.php?db=999&url='].join('\n'),
|
flavors: ['http://regex.info/exif.cgi?url=', 'http://iqdb.org/?url=', 'http://google.com/searchbyimage?image_url=', '#http://tineye.com/search?url=', '#http://saucenao.com/search.php?db=999&url='].join('\n'),
|
||||||
@ -1615,7 +1616,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
update: function(e) {
|
update: function(e) {
|
||||||
var arr, body, br, id, input, replies, reply, _i, _len, _ref, _ref2, _results;
|
var arr, body, br, id, input, replies, reply, _i, _len, _ref, _ref2;
|
||||||
if (this.status === 404) {
|
if (this.status === 404) {
|
||||||
updater.timer.textContent = '';
|
updater.timer.textContent = '';
|
||||||
updater.count.textContent = 404;
|
updater.count.textContent = 404;
|
||||||
@ -1651,11 +1652,12 @@
|
|||||||
updater.count.className = 'new';
|
updater.count.className = 'new';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_results = [];
|
|
||||||
while (reply = arr.pop()) {
|
while (reply = arr.pop()) {
|
||||||
_results.push($.before(br, reply));
|
$.before(br, reply);
|
||||||
|
}
|
||||||
|
if ($.config('IRC Updating')) {
|
||||||
|
return scrollTo(0, d.body.scrollHeight);
|
||||||
}
|
}
|
||||||
return _results;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
timeout: function() {
|
timeout: function() {
|
||||||
@ -2439,30 +2441,34 @@
|
|||||||
return _results;
|
return _results;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
imageHover = {
|
imgHover = {
|
||||||
init: function() {
|
init: function() {
|
||||||
imageHover.img = $.el('img', {
|
return g.callbacks.push(function(root) {
|
||||||
id: 'iHover'
|
var thumb;
|
||||||
|
if (!(thumb = $('img[md5]', root))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.bind(thumb, 'mouseover', imgHover.mouseover);
|
||||||
|
$.bind(thumb, 'mousemove', ui.hover);
|
||||||
|
return $.bind(thumb, 'mouseout', imgHover.mouseout);
|
||||||
});
|
});
|
||||||
$.append(d.body, imageHover.img);
|
|
||||||
return g.callbacks.push(imageHover.node);
|
|
||||||
},
|
|
||||||
node: function(root) {
|
|
||||||
var thumb;
|
|
||||||
if (!(thumb = $('img[md5]', root))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$.bind(thumb, 'mouseover', imageHover.mouseover);
|
|
||||||
$.bind(thumb, 'mousemove', ui.hover);
|
|
||||||
return $.bind(thumb, 'mouseout', ui.hoverend);
|
|
||||||
},
|
},
|
||||||
mouseover: function(e) {
|
mouseover: function(e) {
|
||||||
/*
|
/*
|
||||||
img.src = null doesn't work on Chrome
|
http://code.google.com/p/chromium/issues/detail?id=36142
|
||||||
http://code.google.com/p/chromium/issues/detail?id=36142
|
manipulating img src via javascript will generate a massive memory leak
|
||||||
*/ imageHover.img.src = null;
|
|
||||||
imageHover.img.src = this.parentNode.href;
|
instead of manipulating src, we manipulate the entire img
|
||||||
return ui.el = imageHover.img;
|
*/ var img;
|
||||||
|
img = $.el('img', {
|
||||||
|
id: 'iHover',
|
||||||
|
src: this.parentNode.href
|
||||||
|
});
|
||||||
|
ui.el = img;
|
||||||
|
return $.append(d.body, img);
|
||||||
|
},
|
||||||
|
mouseout: function(e) {
|
||||||
|
return $.rm(ui.el);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
imgPreloading = {
|
imgPreloading = {
|
||||||
@ -2498,8 +2504,8 @@
|
|||||||
g.callbacks.push(imgExpand.node);
|
g.callbacks.push(imgExpand.node);
|
||||||
imgExpand.dialog();
|
imgExpand.dialog();
|
||||||
$.bind(window, 'resize', imgExpand.resize);
|
$.bind(window, 'resize', imgExpand.resize);
|
||||||
imgExpand.style = $.addStyle("body.fitheight img[md5] + img { max-height: " + d.body.clientHeight + "px }");
|
imgExpand.style = $.addStyle('');
|
||||||
return imgExpand.style.className = 'height';
|
return imgExpand.resize();
|
||||||
},
|
},
|
||||||
node: function(root) {
|
node: function(root) {
|
||||||
var a, thumb;
|
var a, thumb;
|
||||||
@ -2716,7 +2722,7 @@
|
|||||||
anonymize.init();
|
anonymize.init();
|
||||||
}
|
}
|
||||||
if ($.config('Image Hover')) {
|
if ($.config('Image Hover')) {
|
||||||
imageHover.init();
|
imgHover.init();
|
||||||
}
|
}
|
||||||
if ($.config('Reply Hiding')) {
|
if ($.config('Reply Hiding')) {
|
||||||
replyHiding.init();
|
replyHiding.init();
|
||||||
|
|||||||
100
script.coffee
100
script.coffee
@ -1,5 +1,35 @@
|
|||||||
config =
|
config =
|
||||||
main:
|
main:
|
||||||
|
Enhancing:
|
||||||
|
'404 Redirect': [true, 'Redirect dead threads']
|
||||||
|
'Anonymize': [false, 'Make everybody anonymous']
|
||||||
|
'Keybinds': [false, 'Binds actions to keys']
|
||||||
|
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time']
|
||||||
|
'Report Button': [true, 'Add report buttons']
|
||||||
|
'Comment Expansion': [true, 'Expand too long comments']
|
||||||
|
'Thread Expansion': [true, 'View all replies']
|
||||||
|
'Index Navigation': [true, 'Navigate to previous / next thread']
|
||||||
|
'Reply Navigation': [false, 'Navigate to top / bottom of thread']
|
||||||
|
Hiding:
|
||||||
|
'Reply Hiding': [true, 'Hide single replies']
|
||||||
|
'Thread Hiding': [true, 'Hide entire threads']
|
||||||
|
'Show Stubs': [true, 'Of hidden threads / replies']
|
||||||
|
Imaging:
|
||||||
|
'Image Auto-Gif': [false, 'Animate gif thumbnails']
|
||||||
|
'Image Expansion': [true, 'Expand images']
|
||||||
|
'Image Hover': [false, 'Show full image on mouseover']
|
||||||
|
'Image Preloading': [false, 'Preload Images']
|
||||||
|
'Sauce': [true, 'Add sauce to images']
|
||||||
|
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
|
||||||
|
Monitoring:
|
||||||
|
'Thread Updater': [true, 'Update threads']
|
||||||
|
'IRC Updating': [false, 'Scroll updated posts into view']
|
||||||
|
'Unread Count': [true, 'Show unread post count in tab title']
|
||||||
|
'Post in Title': [true, 'Show the op\'s post in the tab title']
|
||||||
|
'Thread Stats': [true, 'Display reply and image count']
|
||||||
|
'Thread Watcher': [true, 'Bookmark threads']
|
||||||
|
'Auto Watch': [true, 'Automatically watch threads that you start']
|
||||||
|
'Auto Watch Reply': [false, 'Automatically watch threads that you reply to']
|
||||||
Posting:
|
Posting:
|
||||||
'Auto Noko': [true, 'Always redirect to your post']
|
'Auto Noko': [true, 'Always redirect to your post']
|
||||||
'Cooldown': [true, 'Prevent \'flood detected\' errors']
|
'Cooldown': [true, 'Prevent \'flood detected\' errors']
|
||||||
@ -12,35 +42,6 @@ config =
|
|||||||
'Quote Inline': [true, 'Show quoted post inline on quote click']
|
'Quote Inline': [true, 'Show quoted post inline on quote click']
|
||||||
'Quote Preview': [true, 'Show quote content on hover']
|
'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']
|
||||||
Monitoring:
|
|
||||||
'Thread Updater': [true, 'Update threads']
|
|
||||||
'Unread Count': [true, 'Show unread post count in tab title']
|
|
||||||
'Post in Title': [true, 'Show the op\'s post in the tab title']
|
|
||||||
'Thread Stats': [true, 'Display reply and image count']
|
|
||||||
'Thread Watcher': [true, 'Bookmark threads']
|
|
||||||
'Auto Watch': [true, 'Automatically watch threads that you start']
|
|
||||||
'Auto Watch Reply': [false, 'Automatically watch threads that you reply to']
|
|
||||||
Imaging:
|
|
||||||
'Image Auto-Gif': [false, 'Animate gif thumbnails']
|
|
||||||
'Image Expansion': [true, 'Expand images']
|
|
||||||
'Image Hover': [false, 'Show full image on mouseover']
|
|
||||||
'Image Preloading': [false, 'Preload Images']
|
|
||||||
'Sauce': [true, 'Add sauce to images']
|
|
||||||
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
|
|
||||||
Hiding:
|
|
||||||
'Reply Hiding': [true, 'Hide single replies']
|
|
||||||
'Thread Hiding': [true, 'Hide entire threads']
|
|
||||||
'Show Stubs': [true, 'Of hidden threads / replies']
|
|
||||||
Enhancing:
|
|
||||||
'404 Redirect': [true, 'Redirect dead threads']
|
|
||||||
'Anonymize': [false, 'Make everybody anonymous']
|
|
||||||
'Keybinds': [false, 'Binds actions to keys']
|
|
||||||
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time']
|
|
||||||
'Report Button': [true, 'Add report buttons']
|
|
||||||
'Comment Expansion': [true, 'Expand too long comments']
|
|
||||||
'Thread Expansion': [true, 'View all replies']
|
|
||||||
'Index Navigation': [true, 'Navigate to previous / next thread']
|
|
||||||
'Reply Navigation': [false, 'Navigate to top / bottom of thread']
|
|
||||||
flavors: [
|
flavors: [
|
||||||
'http://regex.info/exif.cgi?url='
|
'http://regex.info/exif.cgi?url='
|
||||||
'http://iqdb.org/?url='
|
'http://iqdb.org/?url='
|
||||||
@ -1348,9 +1349,11 @@ updater =
|
|||||||
else
|
else
|
||||||
updater.count.className = 'new'
|
updater.count.className = 'new'
|
||||||
|
|
||||||
#XXX add replies in correct order so /b/acklinks resolve
|
#XXX add replies in correct order so backlinks resolve
|
||||||
while reply = arr.pop()
|
while reply = arr.pop()
|
||||||
$.before br, reply
|
$.before br, reply
|
||||||
|
if $.config 'IRC Updating'
|
||||||
|
scrollTo 0, d.body.scrollHeight
|
||||||
|
|
||||||
timeout: ->
|
timeout: ->
|
||||||
n = Number updater.timer.textContent
|
n = Number updater.timer.textContent
|
||||||
@ -1842,24 +1845,27 @@ nodeInserted = (e) ->
|
|||||||
for callback in g.callbacks
|
for callback in g.callbacks
|
||||||
callback target
|
callback target
|
||||||
|
|
||||||
imageHover =
|
imgHover =
|
||||||
init: ->
|
init: ->
|
||||||
imageHover.img = $.el 'img', id: 'iHover'
|
g.callbacks.push (root) ->
|
||||||
$.append d.body, imageHover.img
|
return unless thumb = $ 'img[md5]', root
|
||||||
g.callbacks.push imageHover.node
|
$.bind thumb, 'mouseover', imgHover.mouseover
|
||||||
node: (root) ->
|
$.bind thumb, 'mousemove', ui.hover
|
||||||
return unless thumb = $ 'img[md5]', root
|
$.bind thumb, 'mouseout', imgHover.mouseout
|
||||||
$.bind thumb, 'mouseover', imageHover.mouseover
|
|
||||||
$.bind thumb, 'mousemove', ui.hover
|
|
||||||
$.bind thumb, 'mouseout', ui.hoverend
|
|
||||||
mouseover: (e) ->
|
mouseover: (e) ->
|
||||||
###
|
###
|
||||||
img.src = null doesn't work on Chrome
|
http://code.google.com/p/chromium/issues/detail?id=36142
|
||||||
http://code.google.com/p/chromium/issues/detail?id=36142
|
manipulating img src via javascript will generate a massive memory leak
|
||||||
|
|
||||||
|
instead of manipulating src, we manipulate the entire img
|
||||||
###
|
###
|
||||||
imageHover.img.src = null
|
img = $.el 'img'
|
||||||
imageHover.img.src = @parentNode.href
|
id: 'iHover'
|
||||||
ui.el = imageHover.img
|
src: @parentNode.href
|
||||||
|
ui.el = img
|
||||||
|
$.append d.body, img
|
||||||
|
mouseout: (e) ->
|
||||||
|
$.rm ui.el
|
||||||
|
|
||||||
imgPreloading =
|
imgPreloading =
|
||||||
init: ->
|
init: ->
|
||||||
@ -1881,8 +1887,8 @@ imgExpand =
|
|||||||
g.callbacks.push imgExpand.node
|
g.callbacks.push imgExpand.node
|
||||||
imgExpand.dialog()
|
imgExpand.dialog()
|
||||||
$.bind window, 'resize', imgExpand.resize
|
$.bind window, 'resize', imgExpand.resize
|
||||||
imgExpand.style = $.addStyle "body.fitheight img[md5] + img { max-height: #{d.body.clientHeight}px }"
|
imgExpand.style = $.addStyle ''
|
||||||
imgExpand.style.className = 'height'
|
imgExpand.resize()
|
||||||
|
|
||||||
node: (root) ->
|
node: (root) ->
|
||||||
return unless thumb = $ 'img[md5]', root
|
return unless thumb = $ 'img[md5]', root
|
||||||
@ -2121,7 +2127,7 @@ main =
|
|||||||
anonymize.init()
|
anonymize.init()
|
||||||
|
|
||||||
if $.config 'Image Hover'
|
if $.config 'Image Hover'
|
||||||
imageHover.init()
|
imgHover.init()
|
||||||
|
|
||||||
if $.config 'Reply Hiding'
|
if $.config 'Reply Hiding'
|
||||||
replyHiding.init()
|
replyHiding.init()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user