main()
This commit is contained in:
parent
6c91690afb
commit
80defac720
183
4chan_x.js
183
4chan_x.js
@ -59,7 +59,7 @@
|
||||
*/
|
||||
|
||||
(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;
|
||||
if (typeof console != "undefined" && console !== null) {
|
||||
log = function(arg) {
|
||||
@ -1982,6 +1982,9 @@
|
||||
haloSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVR4XrWRQQoAIQwD+6L97j7Ih9WTQQxhDqJQCk4Mranuvqod6LgwawSqSuUmWSPw/UNlJlnDAmA2ARjABLYj8ZyCzJHHqOg+GdAKZmKPIQUzuYrxicHqEgHzP9g7M0+hj45sAnRWxtPj3zSPAAAAAElFTkSuQmCC',
|
||||
haloNSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAABmzDP///8AAABet0i+AAAAAXRSTlMAQObYZgAAAExJREFUeF4tyrENgDAMAMFXKuQswQLBG3mOlBnFS1gwDfIYLpEivvjq2MlqjmYvYg5jWEzCwtDSQlwcXKCVLrpFbvLvvSf9uZJ2HusDtJAY7Tkn1oYAAAAASUVORK5CYII='
|
||||
};
|
||||
main = {
|
||||
init: function() {
|
||||
var callback, navtopr, pathname, temp, tzOffset, _i, _len, _ref;
|
||||
fav.halo = /ws/.test(fav["default"]) ? fav.haloSFW : fav.haloNSFW;
|
||||
pathname = location.pathname.substring(1).split('/');
|
||||
g.BOARD = pathname[0], temp = pathname[1];
|
||||
@ -2017,7 +2020,94 @@
|
||||
GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies))
|
||||
GM_setValue('lastChecked', now.toString())
|
||||
*/
|
||||
$.addStyle('\
|
||||
$.addStyle(main.css);
|
||||
if (location.hostname === 'sys.4chan.org') {
|
||||
qr.sys();
|
||||
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();
|
||||
}
|
||||
}
|
||||
_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;\
|
||||
@ -2119,90 +2209,7 @@
|
||||
#watcher > div:last-child {\
|
||||
padding: 0 5px 5px 5px;\
|
||||
}\
|
||||
');
|
||||
if (location.hostname === 'sys.4chan.org') {
|
||||
qr.sys();
|
||||
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);
|
||||
'
|
||||
};
|
||||
main.init();
|
||||
}).call(this);
|
||||
|
||||
206
script.coffee
206
script.coffee
@ -1514,25 +1514,27 @@ fav =
|
||||
haloSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVR4XrWRQQoAIQwD+6L97j7Ih9WTQQxhDqJQCk4Mranuvqod6LgwawSqSuUmWSPw/UNlJlnDAmA2ARjABLYj8ZyCzJHHqOg+GdAKZmKPIQUzuYrxicHqEgHzP9g7M0+hj45sAnRWxtPj3zSPAAAAAElFTkSuQmCC'
|
||||
haloNSFW: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAADFBMVEUAAABmzDP///8AAABet0i+AAAAAXRSTlMAQObYZgAAAExJREFUeF4tyrENgDAMAMFXKuQswQLBG3mOlBnFS1gwDfIYLpEivvjq2MlqjmYvYg5jWEzCwtDSQlwcXKCVLrpFbvLvvSf9uZJ2HusDtJAY7Tkn1oYAAAAASUVORK5CYII='
|
||||
|
||||
fav.halo = if /ws/.test fav.default then fav.haloSFW else fav.haloNSFW
|
||||
pathname = location.pathname.substring(1).split('/')
|
||||
[g.BOARD, temp] = pathname
|
||||
if temp is 'res'
|
||||
main =
|
||||
init: ->
|
||||
fav.halo = if /ws/.test fav.default then fav.haloSFW else fav.haloNSFW
|
||||
pathname = location.pathname.substring(1).split('/')
|
||||
[g.BOARD, temp] = pathname
|
||||
if temp is 'res'
|
||||
g.REPLY = temp
|
||||
g.THREAD_ID = pathname[2]
|
||||
else
|
||||
else
|
||||
g.PAGENUM = parseInt(temp) || 0
|
||||
g.hiddenReply = $.getValue "hiddenReply/#{g.BOARD}/", {}
|
||||
tzOffset = (new Date()).getTimezoneOffset() / 60
|
||||
# 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
|
||||
g.hiddenReply = $.getValue "hiddenReply/#{g.BOARD}/", {}
|
||||
tzOffset = (new Date()).getTimezoneOffset() / 60
|
||||
# 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')
|
||||
now = Date.now()
|
||||
DAY = 1000 * 60 * 60 * 24
|
||||
if lastChecked < now - 1*DAY
|
||||
###
|
||||
lastChecked = Number GM_getValue('lastChecked', '0')
|
||||
now = Date.now()
|
||||
DAY = 1000 * 60 * 60 * 24
|
||||
if lastChecked < now - 1*DAY
|
||||
cutoff = now - 7*DAY
|
||||
while g.hiddenThreads.length
|
||||
if g.hiddenThreads[0].timestamp > cutoff
|
||||
@ -1547,9 +1549,94 @@ if lastChecked < now - 1*DAY
|
||||
GM_setValue("hiddenThreads/#{g.BOARD}/", JSON.stringify(g.hiddenThreads))
|
||||
GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies))
|
||||
GM_setValue('lastChecked', now.toString())
|
||||
###
|
||||
###
|
||||
|
||||
$.addStyle '
|
||||
$.addStyle main.css
|
||||
|
||||
if location.hostname is 'sys.4chan.org'
|
||||
qr.sys()
|
||||
return
|
||||
if navtopr = $ '#navtopr'
|
||||
options.init()
|
||||
else if $.config('404 Redirect') and d.title is '4chan - 404'
|
||||
redirect()
|
||||
else
|
||||
return
|
||||
|
||||
Recaptcha.init()
|
||||
|
||||
$.bind $('form[name=post]'), 'submit', qr.cb.submit
|
||||
|
||||
#major features
|
||||
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') and $.config 'Persistent QR'
|
||||
qr.persist()
|
||||
|
||||
if $.config 'Post in Title'
|
||||
titlePost.init()
|
||||
|
||||
if $.config 'Unread Count'
|
||||
unread.init()
|
||||
|
||||
if $.config('Auto Watch') and location.hash is '#watch'
|
||||
watcher.watch()
|
||||
|
||||
else #not reply
|
||||
if $.config 'Thread Hiding'
|
||||
threadHiding.init()
|
||||
|
||||
if $.config 'Thread Navigation'
|
||||
nav.init()
|
||||
|
||||
if $.config 'Thread Expansion'
|
||||
expandThread.init()
|
||||
|
||||
if $.config 'Comment Expansion'
|
||||
expandComment.init()
|
||||
|
||||
callback() for callback in g.callbacks
|
||||
$.bind d.body, 'DOMNodeInserted', nodeInserted
|
||||
|
||||
css: '
|
||||
/* dialog styling */
|
||||
div.dialog {
|
||||
border: 1px solid;
|
||||
@ -1651,87 +1738,6 @@ $.addStyle '
|
||||
#watcher > div:last-child {
|
||||
padding: 0 5px 5px 5px;
|
||||
}
|
||||
'
|
||||
'
|
||||
|
||||
if location.hostname is 'sys.4chan.org'
|
||||
qr.sys()
|
||||
return
|
||||
if navtopr = $ '#navtopr'
|
||||
options.init()
|
||||
else if $.config('404 Redirect') and d.title is '4chan - 404'
|
||||
redirect()
|
||||
else
|
||||
return
|
||||
|
||||
Recaptcha.init()
|
||||
|
||||
$.bind $('form[name=post]'), 'submit', qr.cb.submit
|
||||
|
||||
#major features
|
||||
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') and $.config 'Persistent QR'
|
||||
qr.persist()
|
||||
|
||||
if $.config 'Post in Title'
|
||||
titlePost.init()
|
||||
|
||||
if $.config 'Unread Count'
|
||||
unread.init()
|
||||
|
||||
if $.config('Auto Watch') and location.hash is '#watch'
|
||||
watcher.watch()
|
||||
|
||||
else #not reply
|
||||
if $.config 'Thread Hiding'
|
||||
threadHiding.init()
|
||||
|
||||
if $.config 'Thread Navigation'
|
||||
nav.init()
|
||||
|
||||
if $.config 'Thread Expansion'
|
||||
expandThread.init()
|
||||
|
||||
if $.config 'Comment Expansion'
|
||||
expandComment.init()
|
||||
|
||||
callback() for callback in g.callbacks
|
||||
$.bind d.body, 'DOMNodeInserted', nodeInserted
|
||||
main.init()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user