From c4ebd141c5a2c955a76f53a57154b867c88b4f16 Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Wed, 28 Jun 2017 14:37:07 -0700 Subject: [PATCH] Add anchor tag to URL to signify open page for reloading --- client/js/lounge.js | 7 ++++--- client/js/socket-events/init.js | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/js/lounge.js b/client/js/lounge.js index 27bbc960..679c21e6 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -338,9 +338,9 @@ $(function() { if (history && history.pushState) { if (data && data.replaceHistory && history.replaceState) { - history.replaceState(state, null, null); + history.replaceState(state, null, target); } else { - history.pushState(state, null, null); + history.pushState(state, null, target); } } }); @@ -594,7 +594,8 @@ $(function() { } }); }); - if ($("body").hasClass("public")) { + + if ($("body").hasClass("public") && window.location.hash === "#connect") { $("#connect").one("show", function() { var params = URI(document.location.search); params = params.search(true); diff --git a/client/js/socket-events/init.js b/client/js/socket-events/init.js index a78c07fa..cd66f391 100644 --- a/client/js/socket-events/init.js +++ b/client/js/socket-events/init.js @@ -32,7 +32,10 @@ socket.on("init", function(data) { const target = sidebar.find("[data-id='" + id + "']").trigger("click", { replaceHistory: true }); - if (target.length === 0) { + const dataTarget = document.querySelector("[data-target='" + window.location.hash + "']"); + if (window.location.hash && dataTarget) { + dataTarget.click(); + } else if (target.length === 0) { const first = sidebar.find(".chan") .eq(0) .trigger("click");