Fix redirection loop. #932

This commit is contained in:
Nicolas Stepien 2013-03-05 23:34:02 +01:00
parent cc842807c8
commit a45a9fe641
2 changed files with 12 additions and 10 deletions

View File

@ -7417,20 +7417,21 @@
} }
}, },
initReady: function() { initReady: function() {
var board, boardChild, errors, posts, thread, threadChild, threads, _i, _j, _len, _len1, _ref, _ref1; var board, boardChild, errors, href, posts, thread, threadChild, threads, _i, _j, _len, _len1, _ref, _ref1;
if (!$.hasClass(doc, 'fourchan-x')) {
Main.initStyle();
}
if (d.title === '4chan - 404 Not Found') { if (d.title === '4chan - 404 Not Found') {
if (Conf['404 Redirect'] && g.VIEW === 'thread') { if (Conf['404 Redirect'] && g.VIEW === 'thread') {
location.href = Redirect.to({ href = Redirect.to({
board: g.BOARD, board: g.BOARD,
threadID: g.THREAD, threadID: g.THREAD,
postID: location.hash postID: location.hash
}); });
location.href = href || ("/" + g.BOARD + "/");
} }
return; return;
} }
if (!$.hasClass(doc, 'fourchan-x')) {
Main.initStyle();
}
if (board = $('.board')) { if (board = $('.board')) {
threads = []; threads = [];
posts = []; posts = [];

View File

@ -397,18 +397,19 @@ Main =
$.on mainStyleSheet, 'DOMAttrModified', setStyle $.on mainStyleSheet, 'DOMAttrModified', setStyle
initReady: -> initReady: ->
unless $.hasClass doc, 'fourchan-x'
# Something might have gone wrong!
Main.initStyle()
if d.title is '4chan - 404 Not Found' if d.title is '4chan - 404 Not Found'
if Conf['404 Redirect'] and g.VIEW is 'thread' if Conf['404 Redirect'] and g.VIEW is 'thread'
location.href = Redirect.to href = Redirect.to
board: g.BOARD board: g.BOARD
threadID: g.THREAD threadID: g.THREAD
postID: location.hash postID: location.hash
location.href = href or "/#{g.BOARD}/"
return return
unless $.hasClass doc, 'fourchan-x'
# Something might have gone wrong!
Main.initStyle()
if board = $ '.board' if board = $ '.board'
threads = [] threads = []
posts = [] posts = []