diff --git a/4chan_x.user.js b/4chan_x.user.js index ff7213755..61f77b8e3 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -7417,20 +7417,21 @@ } }, initReady: function() { - var board, boardChild, errors, posts, thread, threadChild, threads, _i, _j, _len, _len1, _ref, _ref1; - if (!$.hasClass(doc, 'fourchan-x')) { - Main.initStyle(); - } + var board, boardChild, errors, href, posts, thread, threadChild, threads, _i, _j, _len, _len1, _ref, _ref1; if (d.title === '4chan - 404 Not Found') { if (Conf['404 Redirect'] && g.VIEW === 'thread') { - location.href = Redirect.to({ + href = Redirect.to({ board: g.BOARD, threadID: g.THREAD, postID: location.hash }); + location.href = href || ("/" + g.BOARD + "/"); } return; } + if (!$.hasClass(doc, 'fourchan-x')) { + Main.initStyle(); + } if (board = $('.board')) { threads = []; posts = []; diff --git a/src/main.coffee b/src/main.coffee index d9c381250..14ce5f4c6 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -397,18 +397,19 @@ Main = $.on mainStyleSheet, 'DOMAttrModified', setStyle initReady: -> - unless $.hasClass doc, 'fourchan-x' - # Something might have gone wrong! - Main.initStyle() - if d.title is '4chan - 404 Not Found' if Conf['404 Redirect'] and g.VIEW is 'thread' - location.href = Redirect.to + href = Redirect.to board: g.BOARD threadID: g.THREAD postID: location.hash + location.href = href or "/#{g.BOARD}/" return + unless $.hasClass doc, 'fourchan-x' + # Something might have gone wrong! + Main.initStyle() + if board = $ '.board' threads = [] posts = []