From 685f74de506560e6557069710bd00786fca5ae04 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Fri, 10 Jan 2014 23:14:02 -0700 Subject: [PATCH] Fix Navigate.popstate on Chrome --- builds/crx/script.js | 5 +++-- src/General/Navigate.coffee | 14 +++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/builds/crx/script.js b/builds/crx/script.js index 584f1fe19..9d44de773 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -12173,14 +12173,15 @@ } }, popstate: function() { - return Navigate.popstate = function() { + $.off(window, 'popstate', Navigate.popstate); + return $.on(window, 'popstate', Navigate.popstate = function() { var a; a = $.el('a', { href: window.location, id: 'popState' }); return Navigate.navigate.call(a); - }; + }); }, refresh: function(context) { var boardID, feature, name, threadID, view, _i, _len, _ref, _ref1; diff --git a/src/General/Navigate.coffee b/src/General/Navigate.coffee index 4fe66277c..8dc95b6a8 100644 --- a/src/General/Navigate.coffee +++ b/src/General/Navigate.coffee @@ -290,12 +290,16 @@ Navigate = Unread.read() Unread.update() - popstate: -> <% if (type === 'crx') { %> Navigate.popstate = -> <% } %> # blink/webkit throw a popstate on page load. Not what we want. - a = $.el 'a', - href: window.location - id: 'popState' + popstate: -> <% if (type === 'crx') { %> + $.off window, 'popstate', Navigate.popstate + $.on window, 'popstate', Navigate.popstate = -> +<% } %> # blink/webkit throw a popstate on page load. Not what we want. - Navigate.navigate.call a + a = $.el 'a', + href: window.location + id: 'popState' + + Navigate.navigate.call a refresh: (context) -> return