Replace the state on init rather than adding a new entry

Fixes #1042
This commit is contained in:
Alistair McKinlay 2017-04-24 12:20:48 +01:00
parent ac9101ed61
commit d0987719ce

View File

@ -132,7 +132,9 @@ $(function() {
$("#sign-in").remove(); $("#sign-in").remove();
var id = data.active; var id = data.active;
var target = sidebar.find("[data-id='" + id + "']").trigger("click"); var target = sidebar.find("[data-id='" + id + "']").trigger("click", {
replaceHistory: true
});
if (target.length === 0) { if (target.length === 0) {
var first = sidebar.find(".chan") var first = sidebar.find(".chan")
.eq(0) .eq(0)
@ -820,7 +822,11 @@ $(function() {
} }
if (history && history.pushState) { if (history && history.pushState) {
history.pushState(state, null, null); if (data && data.replaceHistory && history.replaceState) {
history.replaceState(state, null, null);
} else {
history.pushState(state, null, null);
}
} }
}); });