Handle popstate on Chrome a bit better

This commit is contained in:
Zixaphir 2014-01-11 11:28:33 -07:00
parent 805c40d3bf
commit c2ac7e66b1
3 changed files with 24 additions and 20 deletions

View File

@ -11875,7 +11875,11 @@
if (g.VIEW === 'catalog' || g.BOARD.ID === 'f') { if (g.VIEW === 'catalog' || g.BOARD.ID === 'f') {
return; return;
} }
$.on(window, 'popstate', Navigate.popstate); ({
ready: function() {
return $.on(window, 'popstate', Navigate.popstate);
}
});
Thread.callbacks.push({ Thread.callbacks.push({
name: 'Navigate', name: 'Navigate',
cb: this.thread cb: this.thread

View File

@ -11864,7 +11864,11 @@
if (g.VIEW === 'catalog' || g.BOARD.ID === 'f') { if (g.VIEW === 'catalog' || g.BOARD.ID === 'f') {
return; return;
} }
$.on(window, 'popstate', Navigate.popstate); ({
ready: function() {
return $.on(window, 'popstate', Navigate.popstate);
}
});
Thread.callbacks.push({ Thread.callbacks.push({
name: 'Navigate', name: 'Navigate',
cb: this.thread cb: this.thread
@ -12194,15 +12198,12 @@
} }
}, },
popstate: function() { popstate: function() {
$.off(window, 'popstate', Navigate.popstate);
return $.on(window, 'popstate', Navigate.popstate = function() {
var a; var a;
a = $.el('a', { a = $.el('a', {
href: window.location, href: window.location,
id: 'popState' id: 'popState'
}); });
return Navigate.navigate.call(a); return Navigate.navigate.call(a);
});
} }
}; };

View File

@ -1,6 +1,9 @@
Navigate = Navigate =
init: -> init: ->
return if g.VIEW is 'catalog' or g.BOARD.ID is 'f' return if g.VIEW is 'catalog' or g.BOARD.ID is 'f'
# blink/webkit throw a popstate on page load. Not what we want.
ready: ->
$.on window, 'popstate', Navigate.popstate $.on window, 'popstate', Navigate.popstate
Thread.callbacks.push Thread.callbacks.push
@ -295,11 +298,7 @@ Navigate =
Unread.read() Unread.read()
Unread.update() Unread.update()
popstate: -> <% if (type === 'crx') { %> popstate: ->
$.off window, 'popstate', Navigate.popstate
$.on window, 'popstate', Navigate.popstate = ->
<% } %> # blink/webkit throw a popstate on page load. Not what we want.
a = $.el 'a', a = $.el 'a',
href: window.location href: window.location
id: 'popState' id: 'popState'