From e6071fe834cfe69d945864db546b0f7983d0c746 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Sun, 27 Jul 2014 12:51:03 -0700 Subject: [PATCH] Fix #706. Bad state-tracking fail --- LICENSE | 2 +- builds/appchan-x.user.js | 15 ++++++--------- builds/crx/script.js | 15 ++++++--------- src/General/Navigate.coffee | 16 +++++++--------- 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/LICENSE b/LICENSE index 310d07ab4..ebafaff4d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* appchan x - Version 2.9.31 - 2014-07-26 +* appchan x - Version 2.9.31 - 2014-07-27 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 5fdbec03a..953a0abfb 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -25,7 +25,7 @@ // ==/UserScript== /* -* appchan x - Version 2.9.31 - 2014-07-26 +* appchan x - Version 2.9.31 - 2014-07-27 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -16774,8 +16774,9 @@ } Navigate.makeBreadCrumb(this.href, view, boardID, threadID); if (this.id !== 'popState') { - Navigate.pushState(path); + history.pushState(null, '', path); } + Navigate.path = window.location; Navigate.setMode(this); if (!(view === 'index' && 'index' === g.VIEW && boardID === g.BOARD.ID)) { Navigate.disconnect(); @@ -16854,12 +16855,12 @@ } }, parse: function(data) { - var OP, board, errors, i, makePost, obj, post, posts, thread, threadRoot; + var board, errors, i, makePost, obj, post, posts, thread, threadRoot; posts = []; errors = null; board = g.BOARD; - threadRoot = Build.thread(board, OP = data[0], true); - thread = new Thread(OP.no, board); + threadRoot = Build.thread(board, data[0], true); + thread = new Thread(data[0].no, board); makePost = function(postNode) { var err; try { @@ -16899,10 +16900,6 @@ return Main.handleErrors(errors); } }, - pushState: function(path) { - history.pushState(null, '', path); - return Navigate.path = window.location.pathname; - }, popstate: function() { var a; a = $.el('a', { diff --git a/builds/crx/script.js b/builds/crx/script.js index 742b88a22..51e2e8afa 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* appchan x - Version 2.9.31 - 2014-07-26 +* appchan x - Version 2.9.31 - 2014-07-27 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -16793,8 +16793,9 @@ } Navigate.makeBreadCrumb(this.href, view, boardID, threadID); if (this.id !== 'popState') { - Navigate.pushState(path); + history.pushState(null, '', path); } + Navigate.path = window.location; Navigate.setMode(this); if (!(view === 'index' && 'index' === g.VIEW && boardID === g.BOARD.ID)) { Navigate.disconnect(); @@ -16873,12 +16874,12 @@ } }, parse: function(data) { - var OP, board, errors, i, makePost, obj, post, posts, thread, threadRoot; + var board, errors, i, makePost, obj, post, posts, thread, threadRoot; posts = []; errors = null; board = g.BOARD; - threadRoot = Build.thread(board, OP = data[0], true); - thread = new Thread(OP.no, board); + threadRoot = Build.thread(board, data[0], true); + thread = new Thread(data[0].no, board); makePost = function(postNode) { var err; try { @@ -16918,10 +16919,6 @@ return Main.handleErrors(errors); } }, - pushState: function(path) { - history.pushState(null, '', path); - return Navigate.path = window.location.pathname; - }, popstate: function() { var a; a = $.el('a', { diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index e93d9c015..03b2daa59 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -5,7 +5,7 @@ Navigate = <% if (type === 'crx') { %> # blink/webkit throw a popstate on page load. Not what we want. - popstateHack = -> + popstateHack = -> $.off window, 'popstate', popstateHack $.on window, 'popstate', Navigate.popstate @@ -189,7 +189,7 @@ Navigate = $.set 'Index Sort', Conf['Index Sort'] = Index.selectSort.value = indexSort Index.cb.sort() result = true - + return result navigate: (e) -> @@ -234,7 +234,9 @@ Navigate = Navigate.makeBreadCrumb @href, view, boardID, threadID - Navigate.pushState path unless @id is 'popState' + history.pushState null, '', path unless @id is 'popState' + + Navigate.path = window.location Navigate.setMode @ @@ -309,8 +311,8 @@ Navigate = posts = [] errors = null board = g.BOARD - threadRoot = Build.thread board, OP = data[0], true - thread = new Thread OP.no, board + threadRoot = Build.thread board, data[0], true + thread = new Thread data[0].no, board makePost = (postNode) -> try @@ -346,10 +348,6 @@ Navigate = Main.handleErrors errors if errors - pushState: (path) -> - history.pushState null, '', path - Navigate.path = window.location.pathname - popstate: -> a = $.el 'a', href: window.location