Make the back and forward buttons kinda-sorta work
This commit is contained in:
parent
c28d455225
commit
57742dd397
@ -12597,11 +12597,12 @@
|
||||
break;
|
||||
}
|
||||
try {
|
||||
return localStorage.getItem('4chan-settings');
|
||||
localStorage.getItem('4chan-settings');
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
return new Notice('warning', 'Cookies need to be enabled on 4chan for 4chan X to operate properly.', 30);
|
||||
new Notice('warning', 'Cookies need to be enabled on 4chan for 4chan X to operate properly.', 30);
|
||||
}
|
||||
return $.on(window, 'popstate', Main.popstate);
|
||||
},
|
||||
initThread: function(threadRoot) {
|
||||
var err, errors, post, postRoot, posts, thread, _i, _len, _ref;
|
||||
@ -12783,8 +12784,12 @@
|
||||
if (view === 'catalog') {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
history.pushState(null, '', this.pathname);
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if (this.id !== 'popState') {
|
||||
history.pushState(null, '', this.pathname);
|
||||
}
|
||||
view = threadID ? 'thread' : view || 'index';
|
||||
if (view === g.VIEW) {
|
||||
if (view === 'index') {
|
||||
@ -12818,6 +12823,14 @@
|
||||
}
|
||||
return Header.setBoardList();
|
||||
},
|
||||
popstate: function() {
|
||||
var a;
|
||||
a = $.el('a', {
|
||||
href: window.location,
|
||||
id: 'popState'
|
||||
});
|
||||
return Main.navigate.call(a);
|
||||
},
|
||||
updateBoard: function(boardID) {
|
||||
var onload, req;
|
||||
g.BOARD = new Board(boardID);
|
||||
|
||||
@ -12571,11 +12571,12 @@
|
||||
Main.initThread(threadRoot);
|
||||
}
|
||||
try {
|
||||
return localStorage.getItem('4chan-settings');
|
||||
localStorage.getItem('4chan-settings');
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
return new Notice('warning', 'Cookies need to be enabled on 4chan for 4chan X to operate properly.', 30);
|
||||
new Notice('warning', 'Cookies need to be enabled on 4chan for 4chan X to operate properly.', 30);
|
||||
}
|
||||
return $.on(window, 'popstate', Main.popstate);
|
||||
},
|
||||
initThread: function(threadRoot) {
|
||||
var err, errors, post, postRoot, posts, thread, _i, _len, _ref;
|
||||
@ -12757,8 +12758,12 @@
|
||||
if (view === 'catalog') {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
history.pushState(null, '', this.pathname);
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
if (this.id !== 'popState') {
|
||||
history.pushState(null, '', this.pathname);
|
||||
}
|
||||
view = threadID ? 'thread' : view || 'index';
|
||||
if (view === g.VIEW) {
|
||||
if (view === 'index') {
|
||||
@ -12792,6 +12797,14 @@
|
||||
}
|
||||
return Header.setBoardList();
|
||||
},
|
||||
popstate: function() {
|
||||
var a;
|
||||
a = $.el('a', {
|
||||
href: window.location,
|
||||
id: 'popState'
|
||||
});
|
||||
return Main.navigate.call(a);
|
||||
},
|
||||
updateBoard: function(boardID) {
|
||||
var onload, req;
|
||||
g.BOARD = new Board(boardID);
|
||||
|
||||
@ -144,6 +144,8 @@ Main =
|
||||
catch err
|
||||
new Notice 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to operate properly.', 30
|
||||
|
||||
$.on window, 'popstate', Main.popstate
|
||||
|
||||
initThread: (threadRoot) ->
|
||||
thread = new Thread +threadRoot.id[1..], g.BOARD
|
||||
posts = []
|
||||
@ -358,8 +360,8 @@ Main =
|
||||
|
||||
return if view is 'catalog'
|
||||
|
||||
e.preventDefault()
|
||||
history.pushState null, '', @pathname
|
||||
e.preventDefault() if e
|
||||
history.pushState null, '', @pathname unless @id is 'popState'
|
||||
|
||||
view = if threadID
|
||||
'thread'
|
||||
@ -390,6 +392,13 @@ Main =
|
||||
|
||||
Header.setBoardList()
|
||||
|
||||
popstate: ->
|
||||
a = $.el 'a',
|
||||
href: window.location
|
||||
id: 'popState'
|
||||
|
||||
Main.navigate.call a
|
||||
|
||||
updateBoard: (boardID) ->
|
||||
g.BOARD = new Board boardID
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user