This commit is contained in:
James Campos 2011-04-19 22:54:10 -07:00
parent 6c91690afb
commit 80defac720
2 changed files with 409 additions and 396 deletions

View File

@ -59,7 +59,7 @@
*/ */
(function() { (function() {
var $, $$, NAMESPACE, Recaptcha, anonymize, callback, config, d, expandComment, expandThread, fav, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, nav, navtopr, nodeInserted, options, pathname, qr, quickReport, redirect, replyHiding, sauce, temp, threadHiding, titlePost, tzOffset, ui, unread, updater, watcher, _config, _i, _len, _ref, _ref2; var $, $$, NAMESPACE, Recaptcha, anonymize, config, d, expandComment, expandThread, fav, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, main, nav, nodeInserted, options, qr, quickReport, redirect, replyHiding, sauce, threadHiding, 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) {
@ -1982,227 +1982,234 @@
haloSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVR4XrWRQQoAIQwD+6L97j7Ih9WTQQxhDqJQCk4Mranuvqod6LgwawSqSuUmWSPw/UNlJlnDAmA2ARjABLYj8ZyCzJHHqOg+GdAKZmKPIQUzuYrxicHqEgHzP9g7M0+hj45sAnRWxtPj3zSPAAAAAElFTkSuQmCC', haloSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVR4XrWRQQoAIQwD+6L97j7Ih9WTQQxhDqJQCk4Mranuvqod6LgwawSqSuUmWSPw/UNlJlnDAmA2ARjABLYj8ZyCzJHHqOg+GdAKZmKPIQUzuYrxicHqEgHzP9g7M0+hj45sAnRWxtPj3zSPAAAAAElFTkSuQmCC',
haloNSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAABmzDP///8AAABet0i+AAAAAXRSTlMAQObYZgAAAExJREFUeF4tyrENgDAMAMFXKuQswQLBG3mOlBnFS1gwDfIYLpEivvjq2MlqjmYvYg5jWEzCwtDSQlwcXKCVLrpFbvLvvSf9uZJ2HusDtJAY7Tkn1oYAAAAASUVORK5CYII=' haloNSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAABmzDP///8AAABet0i+AAAAAXRSTlMAQObYZgAAAExJREFUeF4tyrENgDAMAMFXKuQswQLBG3mOlBnFS1gwDfIYLpEivvjq2MlqjmYvYg5jWEzCwtDSQlwcXKCVLrpFbvLvvSf9uZJ2HusDtJAY7Tkn1oYAAAAASUVORK5CYII='
}; };
fav.halo = /ws/.test(fav["default"]) ? fav.haloSFW : fav.haloNSFW; main = {
pathname = location.pathname.substring(1).split('/'); init: function() {
g.BOARD = pathname[0], temp = pathname[1]; var callback, navtopr, pathname, temp, tzOffset, _i, _len, _ref;
if (temp === 'res') { fav.halo = /ws/.test(fav["default"]) ? fav.haloSFW : fav.haloNSFW;
g.REPLY = temp; pathname = location.pathname.substring(1).split('/');
g.THREAD_ID = pathname[2]; g.BOARD = pathname[0], temp = pathname[1];
} else { if (temp === 'res') {
g.PAGENUM = parseInt(temp) || 0; g.REPLY = temp;
} g.THREAD_ID = pathname[2];
g.hiddenReply = $.getValue("hiddenReply/" + g.BOARD + "/", {}); } else {
tzOffset = (new Date()).getTimezoneOffset() / 60; g.PAGENUM = parseInt(temp) || 0;
g.chanOffset = 5 - tzOffset; }
if ($.isDST()) { g.hiddenReply = $.getValue("hiddenReply/" + g.BOARD + "/", {});
g.chanOffset -= 1; tzOffset = (new Date()).getTimezoneOffset() / 60;
} g.chanOffset = 5 - tzOffset;
/* if ($.isDST()) {
lastChecked = Number GM_getValue('lastChecked', '0') g.chanOffset -= 1;
now = Date.now() }
DAY = 1000 * 60 * 60 * 24 /*
if lastChecked < now - 1*DAY lastChecked = Number GM_getValue('lastChecked', '0')
cutoff = now - 7*DAY now = Date.now()
while g.hiddenThreads.length DAY = 1000 * 60 * 60 * 24
if g.hiddenThreads[0].timestamp > cutoff if lastChecked < now - 1*DAY
break cutoff = now - 7*DAY
g.hiddenThreads.shift() while g.hiddenThreads.length
if g.hiddenThreads[0].timestamp > cutoff
break
g.hiddenThreads.shift()
while g.hiddenReplies.length while g.hiddenReplies.length
if g.hiddenReplies[0].timestamp > cutoff if g.hiddenReplies[0].timestamp > cutoff
break break
g.hiddenReplies.shift() g.hiddenReplies.shift()
GM_setValue("hiddenThreads/#{g.BOARD}/", JSON.stringify(g.hiddenThreads)) GM_setValue("hiddenThreads/#{g.BOARD}/", JSON.stringify(g.hiddenThreads))
GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies)) GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies))
GM_setValue('lastChecked', now.toString()) GM_setValue('lastChecked', now.toString())
*/ */
$.addStyle('\ $.addStyle(main.css);
/* dialog styling */\ if (location.hostname === 'sys.4chan.org') {
div.dialog {\ qr.sys();
border: 1px solid;\ return;
}\ }
div.dialog > div.move {\ if (navtopr = $('#navtopr')) {
cursor: move;\ options.init();
}\ } else if ($.config('404 Redirect') && d.title === '4chan - 404') {
label, a {\ redirect();
cursor: pointer;\ } else {
}\ return;
}
Recaptcha.init();
$.bind($('form[name=post]'), 'submit', qr.cb.submit);
if ($.config('Image Expansion')) {
imgExpand.init();
}
if ($.config('Image Auto-Gif')) {
imgGif.init();
}
if ($.config('Localize Time')) {
localize.init();
}
if ($.config('Sauce')) {
sauce.init();
}
if ($.config('Anonymize')) {
anonymize.init();
}
if ($.config('Image Hover')) {
imageHover.init();
}
if ($.config('Reply Hiding')) {
replyHiding.init();
}
if ($.config('Quick Reply')) {
qr.init();
}
if ($.config('Quick Report')) {
quickReport.init();
}
if ($.config('Thread Watcher')) {
watcher.init();
}
if ($.config('Keybinds')) {
keybinds.init();
}
if (g.REPLY) {
if ($.config('Thread Updater')) {
updater.init();
}
if ($.config('Image Preloading')) {
imgPreloading.init();
}
if ($.config('Quick Reply') && $.config('Persistent QR')) {
qr.persist();
}
if ($.config('Post in Title')) {
titlePost.init();
}
if ($.config('Unread Count')) {
unread.init();
}
if ($.config('Auto Watch') && location.hash === '#watch') {
watcher.watch();
}
} else {
if ($.config('Thread Hiding')) {
threadHiding.init();
}
if ($.config('Thread Navigation')) {
nav.init();
}
if ($.config('Thread Expansion')) {
expandThread.init();
}
if ($.config('Comment Expansion')) {
expandComment.init();
}
}
_ref = g.callbacks;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
callback = _ref[_i];
callback();
}
return $.bind(d.body, 'DOMNodeInserted', nodeInserted);
},
css: '\
/* dialog styling */\
div.dialog {\
border: 1px solid;\
}\
div.dialog > div.move {\
cursor: move;\
}\
label, a {\
cursor: pointer;\
}\
\ \
.new {\ .new {\
background: lime;\ background: lime;\
}\ }\
.favicon {\ .favicon {\
cursor: pointer;\ cursor: pointer;\
}\ }\
.error {\ .error {\
color: red;\ color: red;\
}\ }\
\ \
div.thread.stub > *:not(.block) {\ div.thread.stub > *:not(.block) {\
display: none;\ display: none;\
}\ }\
\ \
form[name=delform] a img {\ form[name=delform] a img {\
border: 0px;\ border: 0px;\
float: left;\ float: left;\
margin: 0px 20px;\ margin: 0px 20px;\
}\ }\
iframe {\ iframe {\
display: none;\ display: none;\
}\ }\
\ \
#iHover {\ #iHover {\
position: fixed;\ position: fixed;\
}\ }\
\ \
#navlinks {\ #navlinks {\
position: fixed;\ position: fixed;\
top: 25px;\ top: 25px;\
right: 5px;\ right: 5px;\
}\ }\
#navlinks > a {\ #navlinks > a {\
font-size: 16px;\ font-size: 16px;\
}\ }\
\ \
#options {\ #options {\
position: fixed;\ position: fixed;\
padding: 5px;\ padding: 5px;\
text-align: right;\ text-align: right;\
}\ }\
#options textarea {\ #options textarea {\
height: 100px;\ height: 100px;\
width: 500px;\ width: 500px;\
}\ }\
\ \
#qr {\ #qr {\
position: fixed;\ position: fixed;\
}\ }\
#qr > div.move {\ #qr > div.move {\
text-align: right;\ text-align: right;\
}\ }\
#qr > form > div, /* ad */\ #qr > form > div, /* ad */\
#qr td.rules {\ #qr td.rules {\
display: none;\ display: none;\
}\ }\
#qr.auto:not(:hover) form {\ #qr.auto:not(:hover) form {\
display: none;\ display: none;\
}\ }\
#qr span.error {\ #qr span.error {\
position: absolute;\ position: absolute;\
bottom: 0;\ bottom: 0;\
left: 0;\ left: 0;\
}\ }\
\ \
#updater {\ #updater {\
position: fixed;\ position: fixed;\
text-align: right;\ text-align: right;\
}\ }\
#updater input[type=text] {\ #updater input[type=text] {\
width: 50px;\ width: 50px;\
}\ }\
#updater:not(:hover) {\ #updater:not(:hover) {\
border: none;\ border: none;\
background: transparent;\ background: transparent;\
}\ }\
#updater:not(:hover) > div:not(.move) {\ #updater:not(:hover) > div:not(.move) {\
display: none;\ display: none;\
}\ }\
\ \
#watcher {\ #watcher {\
position: absolute;\ position: absolute;\
}\ }\
#watcher > div.move {\ #watcher > div.move {\
text-decoration: underline;\ text-decoration: underline;\
padding: 5px 5px 0 5px;\ padding: 5px 5px 0 5px;\
}\ }\
#watcher > div:last-child {\ #watcher > div:last-child {\
padding: 0 5px 5px 5px;\ padding: 0 5px 5px 5px;\
}\ }\
'); '
if (location.hostname === 'sys.4chan.org') { };
qr.sys(); main.init();
return;
}
if (navtopr = $('#navtopr')) {
options.init();
} else if ($.config('404 Redirect') && d.title === '4chan - 404') {
redirect();
} else {
return;
}
Recaptcha.init();
$.bind($('form[name=post]'), 'submit', qr.cb.submit);
if ($.config('Image Expansion')) {
imgExpand.init();
}
if ($.config('Image Auto-Gif')) {
imgGif.init();
}
if ($.config('Localize Time')) {
localize.init();
}
if ($.config('Sauce')) {
sauce.init();
}
if ($.config('Anonymize')) {
anonymize.init();
}
if ($.config('Image Hover')) {
imageHover.init();
}
if ($.config('Reply Hiding')) {
replyHiding.init();
}
if ($.config('Quick Reply')) {
qr.init();
}
if ($.config('Quick Report')) {
quickReport.init();
}
if ($.config('Thread Watcher')) {
watcher.init();
}
if ($.config('Keybinds')) {
keybinds.init();
}
if (g.REPLY) {
if ($.config('Thread Updater')) {
updater.init();
}
if ($.config('Image Preloading')) {
imgPreloading.init();
}
if ($.config('Quick Reply') && $.config('Persistent QR')) {
qr.persist();
}
if ($.config('Post in Title')) {
titlePost.init();
}
if ($.config('Unread Count')) {
unread.init();
}
if ($.config('Auto Watch') && location.hash === '#watch') {
watcher.watch();
}
} else {
if ($.config('Thread Hiding')) {
threadHiding.init();
}
if ($.config('Thread Navigation')) {
nav.init();
}
if ($.config('Thread Expansion')) {
expandThread.init();
}
if ($.config('Comment Expansion')) {
expandComment.init();
}
}
_ref2 = g.callbacks;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
callback = _ref2[_i];
callback();
}
$.bind(d.body, 'DOMNodeInserted', nodeInserted);
}).call(this); }).call(this);

View File

@ -1514,224 +1514,230 @@ fav =
haloSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVR4XrWRQQoAIQwD+6L97j7Ih9WTQQxhDqJQCk4Mranuvqod6LgwawSqSuUmWSPw/UNlJlnDAmA2ARjABLYj8ZyCzJHHqOg+GdAKZmKPIQUzuYrxicHqEgHzP9g7M0+hj45sAnRWxtPj3zSPAAAAAElFTkSuQmCC' haloSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVR4XrWRQQoAIQwD+6L97j7Ih9WTQQxhDqJQCk4Mranuvqod6LgwawSqSuUmWSPw/UNlJlnDAmA2ARjABLYj8ZyCzJHHqOg+GdAKZmKPIQUzuYrxicHqEgHzP9g7M0+hj45sAnRWxtPj3zSPAAAAAElFTkSuQmCC'
haloNSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAABmzDP///8AAABet0i+AAAAAXRSTlMAQObYZgAAAExJREFUeF4tyrENgDAMAMFXKuQswQLBG3mOlBnFS1gwDfIYLpEivvjq2MlqjmYvYg5jWEzCwtDSQlwcXKCVLrpFbvLvvSf9uZJ2HusDtJAY7Tkn1oYAAAAASUVORK5CYII=' haloNSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAABmzDP///8AAABet0i+AAAAAXRSTlMAQObYZgAAAExJREFUeF4tyrENgDAMAMFXKuQswQLBG3mOlBnFS1gwDfIYLpEivvjq2MlqjmYvYg5jWEzCwtDSQlwcXKCVLrpFbvLvvSf9uZJ2HusDtJAY7Tkn1oYAAAAASUVORK5CYII='
fav.halo = if /ws/.test fav.default then fav.haloSFW else fav.haloNSFW main =
pathname = location.pathname.substring(1).split('/') init: ->
[g.BOARD, temp] = pathname fav.halo = if /ws/.test fav.default then fav.haloSFW else fav.haloNSFW
if temp is 'res' pathname = location.pathname.substring(1).split('/')
g.REPLY = temp [g.BOARD, temp] = pathname
g.THREAD_ID = pathname[2] if temp is 'res'
else g.REPLY = temp
g.PAGENUM = parseInt(temp) || 0 g.THREAD_ID = pathname[2]
g.hiddenReply = $.getValue "hiddenReply/#{g.BOARD}/", {} else
tzOffset = (new Date()).getTimezoneOffset() / 60 g.PAGENUM = parseInt(temp) || 0
# GMT -8 is given as +480; would GMT +8 be -480 ? g.hiddenReply = $.getValue "hiddenReply/#{g.BOARD}/", {}
g.chanOffset = 5 - tzOffset# 4chan = EST = GMT -5 tzOffset = (new Date()).getTimezoneOffset() / 60
if $.isDST() then g.chanOffset -= 1 # GMT -8 is given as +480; would GMT +8 be -480 ?
g.chanOffset = 5 - tzOffset# 4chan = EST = GMT -5
if $.isDST() then g.chanOffset -= 1
### ###
lastChecked = Number GM_getValue('lastChecked', '0') lastChecked = Number GM_getValue('lastChecked', '0')
now = Date.now() now = Date.now()
DAY = 1000 * 60 * 60 * 24 DAY = 1000 * 60 * 60 * 24
if lastChecked < now - 1*DAY if lastChecked < now - 1*DAY
cutoff = now - 7*DAY cutoff = now - 7*DAY
while g.hiddenThreads.length while g.hiddenThreads.length
if g.hiddenThreads[0].timestamp > cutoff if g.hiddenThreads[0].timestamp > cutoff
break break
g.hiddenThreads.shift() g.hiddenThreads.shift()
while g.hiddenReplies.length while g.hiddenReplies.length
if g.hiddenReplies[0].timestamp > cutoff if g.hiddenReplies[0].timestamp > cutoff
break break
g.hiddenReplies.shift() g.hiddenReplies.shift()
GM_setValue("hiddenThreads/#{g.BOARD}/", JSON.stringify(g.hiddenThreads)) GM_setValue("hiddenThreads/#{g.BOARD}/", JSON.stringify(g.hiddenThreads))
GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies)) GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies))
GM_setValue('lastChecked', now.toString()) GM_setValue('lastChecked', now.toString())
### ###
$.addStyle ' $.addStyle main.css
/* dialog styling */
div.dialog {
border: 1px solid;
}
div.dialog > div.move {
cursor: move;
}
label, a {
cursor: pointer;
}
.new { if location.hostname is 'sys.4chan.org'
background: lime; qr.sys()
} return
.favicon { if navtopr = $ '#navtopr'
cursor: pointer; options.init()
} else if $.config('404 Redirect') and d.title is '4chan - 404'
.error { redirect()
color: red; else
} return
div.thread.stub > *:not(.block) { Recaptcha.init()
display: none;
}
form[name=delform] a img { $.bind $('form[name=post]'), 'submit', qr.cb.submit
border: 0px;
float: left;
margin: 0px 20px;
}
iframe {
display: none;
}
#iHover { #major features
position: fixed; if $.config 'Image Expansion'
} imgExpand.init()
#navlinks { if $.config 'Image Auto-Gif'
position: fixed; imgGif.init()
top: 25px;
right: 5px;
}
#navlinks > a {
font-size: 16px;
}
#options { if $.config 'Localize Time'
position: fixed; localize.init()
padding: 5px;
text-align: right;
}
#options textarea {
height: 100px;
width: 500px;
}
#qr { if $.config 'Sauce'
position: fixed; sauce.init()
}
#qr > div.move {
text-align: right;
}
#qr > form > div, /* ad */
#qr td.rules {
display: none;
}
#qr.auto:not(:hover) form {
display: none;
}
#qr span.error {
position: absolute;
bottom: 0;
left: 0;
}
#updater { if $.config 'Anonymize'
position: fixed; anonymize.init()
text-align: right;
}
#updater input[type=text] {
width: 50px;
}
#updater:not(:hover) {
border: none;
background: transparent;
}
#updater:not(:hover) > div:not(.move) {
display: none;
}
#watcher { if $.config 'Image Hover'
position: absolute; imageHover.init()
}
#watcher > div.move {
text-decoration: underline;
padding: 5px 5px 0 5px;
}
#watcher > div:last-child {
padding: 0 5px 5px 5px;
}
'
if location.hostname is 'sys.4chan.org' if $.config 'Reply Hiding'
qr.sys() replyHiding.init()
return
if navtopr = $ '#navtopr'
options.init()
else if $.config('404 Redirect') and d.title is '4chan - 404'
redirect()
else
return
Recaptcha.init() if $.config 'Quick Reply'
qr.init()
$.bind $('form[name=post]'), 'submit', qr.cb.submit if $.config 'Quick Report'
quickReport.init()
#major features if $.config 'Thread Watcher'
if $.config 'Image Expansion' watcher.init()
imgExpand.init()
if $.config 'Image Auto-Gif' if $.config 'Keybinds'
imgGif.init() keybinds.init()
if $.config 'Localize Time' if g.REPLY
localize.init() if $.config 'Thread Updater'
updater.init()
if $.config 'Sauce' if $.config 'Image Preloading'
sauce.init() imgPreloading.init()
if $.config 'Anonymize' if $.config('Quick Reply') and $.config 'Persistent QR'
anonymize.init() qr.persist()
if $.config 'Image Hover' if $.config 'Post in Title'
imageHover.init() titlePost.init()
if $.config 'Reply Hiding' if $.config 'Unread Count'
replyHiding.init() unread.init()
if $.config 'Quick Reply' if $.config('Auto Watch') and location.hash is '#watch'
qr.init() watcher.watch()
if $.config 'Quick Report' else #not reply
quickReport.init() if $.config 'Thread Hiding'
threadHiding.init()
if $.config 'Thread Watcher' if $.config 'Thread Navigation'
watcher.init() nav.init()
if $.config 'Keybinds' if $.config 'Thread Expansion'
keybinds.init() expandThread.init()
if g.REPLY if $.config 'Comment Expansion'
if $.config 'Thread Updater' expandComment.init()
updater.init()
if $.config 'Image Preloading' callback() for callback in g.callbacks
imgPreloading.init() $.bind d.body, 'DOMNodeInserted', nodeInserted
if $.config('Quick Reply') and $.config 'Persistent QR' css: '
qr.persist() /* dialog styling */
div.dialog {
border: 1px solid;
}
div.dialog > div.move {
cursor: move;
}
label, a {
cursor: pointer;
}
if $.config 'Post in Title' .new {
titlePost.init() background: lime;
}
.favicon {
cursor: pointer;
}
.error {
color: red;
}
if $.config 'Unread Count' div.thread.stub > *:not(.block) {
unread.init() display: none;
}
if $.config('Auto Watch') and location.hash is '#watch' form[name=delform] a img {
watcher.watch() border: 0px;
float: left;
margin: 0px 20px;
}
iframe {
display: none;
}
else #not reply #iHover {
if $.config 'Thread Hiding' position: fixed;
threadHiding.init() }
if $.config 'Thread Navigation' #navlinks {
nav.init() position: fixed;
top: 25px;
right: 5px;
}
#navlinks > a {
font-size: 16px;
}
if $.config 'Thread Expansion' #options {
expandThread.init() position: fixed;
padding: 5px;
text-align: right;
}
#options textarea {
height: 100px;
width: 500px;
}
if $.config 'Comment Expansion' #qr {
expandComment.init() position: fixed;
}
#qr > div.move {
text-align: right;
}
#qr > form > div, /* ad */
#qr td.rules {
display: none;
}
#qr.auto:not(:hover) form {
display: none;
}
#qr span.error {
position: absolute;
bottom: 0;
left: 0;
}
callback() for callback in g.callbacks #updater {
$.bind d.body, 'DOMNodeInserted', nodeInserted position: fixed;
text-align: right;
}
#updater input[type=text] {
width: 50px;
}
#updater:not(:hover) {
border: none;
background: transparent;
}
#updater:not(:hover) > div:not(.move) {
display: none;
}
#watcher {
position: absolute;
}
#watcher > div.move {
text-decoration: underline;
padding: 5px 5px 0 5px;
}
#watcher > div:last-child {
padding: 0 5px 5px 5px;
}
'
main.init()