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); var a;
return $.on(window, 'popstate', Navigate.popstate = function() { a = $.el('a', {
var a; href: window.location,
a = $.el('a', { id: 'popState'
href: window.location,
id: 'popState'
});
return Navigate.navigate.call(a);
}); });
return Navigate.navigate.call(a);
} }
}; };

View File

@ -1,7 +1,10 @@
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'
$.on window, 'popstate', Navigate.popstate
# blink/webkit throw a popstate on page load. Not what we want.
ready: ->
$.on window, 'popstate', Navigate.popstate
Thread.callbacks.push Thread.callbacks.push
name: 'Navigate' name: 'Navigate'
@ -295,13 +298,9 @@ Navigate =
Unread.read() Unread.read()
Unread.update() Unread.update()
popstate: -> <% if (type === 'crx') { %> popstate: ->
$.off window, 'popstate', Navigate.popstate a = $.el 'a',
$.on window, 'popstate', Navigate.popstate = -> href: window.location
<% } %> # blink/webkit throw a popstate on page load. Not what we want. id: 'popState'
a = $.el 'a', Navigate.navigate.call a
href: window.location
id: 'popState'
Navigate.navigate.call a