We can now popstate pages.

This commit is contained in:
Zixaphir 2014-01-10 23:08:00 -07:00
parent d0e0a21e2f
commit 865c5acfb6
3 changed files with 33 additions and 10 deletions

View File

@ -12048,7 +12048,7 @@
return $('.boardTitle').textContent = d.title = "/" + board + "/ - " + title;
},
navigate: function(e) {
var boardID, hash, onload, path, threadID, view;
var boardID, hash, onload, pageNum, path, threadID, view;
if (this.hostname !== 'boards.4chan.org' || window.location.hostname === 'rs.4chan.org' || (e && (e.shiftKey || (e.type === 'click' && e.button !== 0)))) {
return;
}
@ -12068,7 +12068,12 @@
if (this.id !== 'popState') {
history.pushState(null, '', this.pathname);
}
view = threadID ? 'thread' : view || 'index';
if (threadID) {
view = 'thread';
} else {
pageNum = view;
view = 'index';
}
if (view !== g.VIEW) {
Navigate.disconnect();
Navigate.clean();
@ -12081,7 +12086,11 @@
} else {
Navigate.updateBoard(boardID);
}
return Index.update();
if (Conf['Index Mode'] === 'paged' && pageNum) {
return Index.update(pageNum);
} else {
return Index.update();
}
} else {
onload = function(e) {
return Navigate.load(e, hash);

View File

@ -12037,7 +12037,7 @@
return $('.boardTitle').textContent = d.title = "/" + board + "/ - " + title;
},
navigate: function(e) {
var boardID, hash, onload, path, threadID, view;
var boardID, hash, onload, pageNum, path, threadID, view;
if (this.hostname !== 'boards.4chan.org' || window.location.hostname === 'rs.4chan.org' || (e && (e.shiftKey || (e.type === 'click' && e.button !== 0)))) {
return;
}
@ -12057,7 +12057,12 @@
if (this.id !== 'popState') {
history.pushState(null, '', this.pathname);
}
view = threadID ? 'thread' : view || 'index';
if (threadID) {
view = 'thread';
} else {
pageNum = view;
view = 'index';
}
if (view !== g.VIEW) {
Navigate.disconnect();
Navigate.clean();
@ -12070,7 +12075,11 @@
} else {
Navigate.updateBoard(boardID);
}
return Index.update();
if (Conf['Index Mode'] === 'paged' && pageNum) {
return Index.update(pageNum);
} else {
return Index.update();
}
} else {
onload = function(e) {
return Navigate.load(e, hash);

View File

@ -185,10 +185,11 @@ Navigate =
e.preventDefault() if e
history.pushState null, '', @pathname unless @id is 'popState'
view = if threadID
'thread'
if threadID
view = 'thread'
else
view or 'index' # path is "/boardID/". See the problem?
pageNum = view
view = 'index' # path is "/boardID/". See the problem?
if view isnt g.VIEW
Navigate.disconnect()
@ -201,7 +202,11 @@ Navigate =
d.title = $('.boardTitle').textContent
else
Navigate.updateBoard boardID
Index.update()
if Conf['Index Mode'] is 'paged' and pageNum
Index.update pageNum
else
Index.update()
# Moving from index to thread or thread to thread
else