404 redirect
This commit is contained in:
parent
ebbc5458c1
commit
73dadbfe27
@ -16,6 +16,7 @@ config =
|
|||||||
'Quick Report': true
|
'Quick Report': true
|
||||||
'Auto Watch': true
|
'Auto Watch': true
|
||||||
'Anonymize': false
|
'Anonymize': false
|
||||||
|
'404 Redirect': true
|
||||||
|
|
||||||
#TODO - expose 'hidden' configs
|
#TODO - expose 'hidden' configs
|
||||||
|
|
||||||
@ -203,9 +204,11 @@ if location.hostname.split('.')[0] is 'sys'
|
|||||||
GM_setValue('watched', JSON.stringify(watched))
|
GM_setValue('watched', JSON.stringify(watched))
|
||||||
return
|
return
|
||||||
|
|
||||||
[nop, BOARD, magic] = location.pathname.split('/')
|
pathname = location.pathname.substring(1).split('/')
|
||||||
|
[BOARD, magic] = pathname
|
||||||
if magic is 'res'
|
if magic is 'res'
|
||||||
REPLY = magic
|
REPLY = magic
|
||||||
|
THREAD_ID = pathname[2]
|
||||||
else
|
else
|
||||||
PAGENUM = parseInt(magic) || 0
|
PAGENUM = parseInt(magic) || 0
|
||||||
xhrs = []
|
xhrs = []
|
||||||
@ -730,19 +733,30 @@ recaptchaListener = (e) ->
|
|||||||
if e.keyCode is 8 and this.value is ''
|
if e.keyCode is 8 and this.value is ''
|
||||||
recaptchaReload()
|
recaptchaReload()
|
||||||
|
|
||||||
#graceful exit
|
redirect = ->
|
||||||
unless navtopr = $ '#navtopr a'
|
switch BOARD
|
||||||
return
|
when 'a', 'g', 'lit', 'sci', 'tv'
|
||||||
text = navtopr.nextSibling
|
url = "http://green-oval.net/cgi-board.pl/#{BOARD}/thread/#{THREAD_ID}#p"
|
||||||
a = n 'a', {
|
when 'cgl', 'jp', 'm', 'tg'
|
||||||
textContent: 'X'
|
url = "http://archive.easymodo.net/cgi-board.pl/#{BOARD}/thread/#{THREAD_ID}#p"
|
||||||
className: 'pointer'
|
else
|
||||||
listener: ['click', options]
|
url = "http://boards.4chan.org/#{BOARD}"
|
||||||
}
|
location.href = url
|
||||||
inBefore text, tn(' / ')
|
|
||||||
inBefore text, a
|
|
||||||
|
|
||||||
#various minor tweaks. TODO - `Minor Tweaks` option
|
#main part 2...
|
||||||
|
if navtopr = $ '#navtopr a'
|
||||||
|
text = navtopr.nextSibling
|
||||||
|
a = n 'a', {
|
||||||
|
textContent: 'X'
|
||||||
|
className: 'pointer'
|
||||||
|
listener: ['click', options]
|
||||||
|
}
|
||||||
|
inBefore text, tn(' / ')
|
||||||
|
inBefore text, a
|
||||||
|
else if getConfig('404 Redirect') and d.title is '4chan - 404'
|
||||||
|
redirect()
|
||||||
|
else
|
||||||
|
return
|
||||||
|
|
||||||
#hack to tab from comment straight to recaptcha
|
#hack to tab from comment straight to recaptcha
|
||||||
for el in $$ '#recaptcha_table a'
|
for el in $$ '#recaptcha_table a'
|
||||||
|
|||||||
56
4chan_x.js
56
4chan_x.js
@ -1,5 +1,5 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var $, $$, AEOS, BOARD, DAY, PAGENUM, REPLY, _i, _j, _len, _len2, _ref, _ref2, a, addTo, arr, as, autoWatch, autohide, b, board, callback, callbacks, clearHidden, close, config, cutoff, d, delform, down, el, expandComment, expandThread, favEmpty, favNormal, favicon, getConfig, getTime, head, hiddenReplies, hiddenThreads, hide, hideReply, hideThread, href, html, i, i1, id, iframe, iframeLoad, iframeLoop, img, inAfter, inBefore, input, inputs, l, l1, lastChecked, magic, n, navtopr, nodeInserted, nop, now, omitted, onloadComment, onloadThread, options, optionsSave, parseResponse, quickReply, r, recaptcha, recaptchaListener, recaptchaReload, remove, replace, replyNav, report, show, showReply, showThread, slice, span, src, stopPropagation, submit, text, textContent, thread, threadF, threads, tn, up, watch, watchX, watched, watcher, watcherUpdate, x, xhrs;
|
var $, $$, AEOS, BOARD, DAY, PAGENUM, REPLY, THREAD_ID, _i, _j, _len, _len2, _ref, _ref2, a, addTo, arr, as, autoWatch, autohide, b, board, callback, callbacks, clearHidden, close, config, cutoff, d, delform, down, el, expandComment, expandThread, favEmpty, favNormal, favicon, getConfig, getTime, head, hiddenReplies, hiddenThreads, hide, hideReply, hideThread, href, html, i, i1, id, iframe, iframeLoad, iframeLoop, img, inAfter, inBefore, input, inputs, l, l1, lastChecked, magic, n, navtopr, nodeInserted, nop, now, omitted, onloadComment, onloadThread, options, optionsSave, parseResponse, pathname, quickReply, r, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, show, showReply, showThread, slice, span, src, stopPropagation, submit, text, textContent, thread, threadF, threads, tn, up, watch, watchX, watched, watcher, watcherUpdate, x, xhrs;
|
||||||
var __slice = Array.prototype.slice, __hasProp = Object.prototype.hasOwnProperty;
|
var __slice = Array.prototype.slice, __hasProp = Object.prototype.hasOwnProperty;
|
||||||
config = {
|
config = {
|
||||||
'Thread Hiding': true,
|
'Thread Hiding': true,
|
||||||
@ -14,7 +14,8 @@
|
|||||||
'Persistent QR': false,
|
'Persistent QR': false,
|
||||||
'Quick Report': true,
|
'Quick Report': true,
|
||||||
'Auto Watch': true,
|
'Auto Watch': true,
|
||||||
'Anonymize': false
|
'Anonymize': false,
|
||||||
|
'404 Redirect': true
|
||||||
};
|
};
|
||||||
AEOS = {
|
AEOS = {
|
||||||
init: function() {
|
init: function() {
|
||||||
@ -257,12 +258,13 @@
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_ref = location.pathname.split('/');
|
pathname = location.pathname.substring(1).split('/');
|
||||||
nop = _ref[0];
|
_ref = pathname;
|
||||||
BOARD = _ref[1];
|
BOARD = _ref[0];
|
||||||
magic = _ref[2];
|
magic = _ref[1];
|
||||||
if (magic === 'res') {
|
if (magic === 'res') {
|
||||||
REPLY = magic;
|
REPLY = magic;
|
||||||
|
THREAD_ID = pathname[2];
|
||||||
} else {
|
} else {
|
||||||
PAGENUM = parseInt(magic) || 0;
|
PAGENUM = parseInt(magic) || 0;
|
||||||
}
|
}
|
||||||
@ -823,17 +825,41 @@
|
|||||||
recaptchaListener = function(e) {
|
recaptchaListener = function(e) {
|
||||||
return e.keyCode === 8 && this.value === '' ? recaptchaReload() : null;
|
return e.keyCode === 8 && this.value === '' ? recaptchaReload() : null;
|
||||||
};
|
};
|
||||||
if (!(navtopr = $('#navtopr a'))) {
|
redirect = function() {
|
||||||
|
var url;
|
||||||
|
switch (BOARD) {
|
||||||
|
case 'a':
|
||||||
|
case 'g':
|
||||||
|
case 'lit':
|
||||||
|
case 'sci':
|
||||||
|
case 'tv':
|
||||||
|
url = ("http://green-oval.net/cgi-board.pl/" + (BOARD) + "/thread/" + (THREAD_ID) + "#p");
|
||||||
|
break;
|
||||||
|
case 'cgl':
|
||||||
|
case 'jp':
|
||||||
|
case 'm':
|
||||||
|
case 'tg':
|
||||||
|
url = ("http://archive.easymodo.net/cgi-board.pl/" + (BOARD) + "/thread/" + (THREAD_ID) + "#p");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
url = ("http://boards.4chan.org/" + (BOARD));
|
||||||
|
}
|
||||||
|
return (location.href = url);
|
||||||
|
};
|
||||||
|
if (navtopr = $('#navtopr a')) {
|
||||||
|
text = navtopr.nextSibling;
|
||||||
|
a = n('a', {
|
||||||
|
textContent: 'X',
|
||||||
|
className: 'pointer',
|
||||||
|
listener: ['click', options]
|
||||||
|
});
|
||||||
|
inBefore(text, tn(' / '));
|
||||||
|
inBefore(text, a);
|
||||||
|
} else if (getConfig('404 Redirect') && d.title === '4chan - 404') {
|
||||||
|
redirect();
|
||||||
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
text = navtopr.nextSibling;
|
|
||||||
a = n('a', {
|
|
||||||
textContent: 'X',
|
|
||||||
className: 'pointer',
|
|
||||||
listener: ['click', options]
|
|
||||||
});
|
|
||||||
inBefore(text, tn(' / '));
|
|
||||||
inBefore(text, a);
|
|
||||||
_ref = $$('#recaptcha_table a');
|
_ref = $$('#recaptcha_table a');
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
el = _ref[_i];
|
el = _ref[_i];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user