From 7476c51f0f18469b014843abd0e59726a2967069 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Sun, 27 Jul 2014 12:52:47 -0700 Subject: [PATCH] Navigate.pushState is being used elsewhere... --- builds/appchan-x.user.js | 11 ++++++++--- builds/crx/script.js | 11 ++++++++--- src/General/Navigate.coffee | 15 ++++++++++----- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 953a0abfb..80ef6493c 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -16773,10 +16773,11 @@ path += this.hash; } Navigate.makeBreadCrumb(this.href, view, boardID, threadID); - if (this.id !== 'popState') { - history.pushState(null, '', path); + if (this.id === 'popState') { + Navigate.path = window.location; + } else { + Navigate.pushState(path); } - Navigate.path = window.location; Navigate.setMode(this); if (!(view === 'index' && 'index' === g.VIEW && boardID === g.BOARD.ID)) { Navigate.disconnect(); @@ -16900,6 +16901,10 @@ 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 51e2e8afa..68f78f205 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -16792,10 +16792,11 @@ path += this.hash; } Navigate.makeBreadCrumb(this.href, view, boardID, threadID); - if (this.id !== 'popState') { - history.pushState(null, '', path); + if (this.id === 'popState') { + Navigate.path = window.location; + } else { + Navigate.pushState(path); } - Navigate.path = window.location; Navigate.setMode(this); if (!(view === 'index' && 'index' === g.VIEW && boardID === g.BOARD.ID)) { Navigate.disconnect(); @@ -16919,6 +16920,10 @@ 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 03b2daa59..219571948 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,9 +234,10 @@ Navigate = Navigate.makeBreadCrumb @href, view, boardID, threadID - history.pushState null, '', path unless @id is 'popState' - - Navigate.path = window.location + if @id is 'popState' + Navigate.path = window.location + else + Navigate.pushState path Navigate.setMode @ @@ -348,6 +349,10 @@ Navigate = Main.handleErrors errors if errors + pushState: (path) -> + history.pushState null, '', path + Navigate.path = window.location.pathname + popstate: -> a = $.el 'a', href: window.location