From 6c954989906c53a0fda44bfd71d8ec409d42ad94 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Thu, 3 Jan 2019 15:52:52 -0700 Subject: fix selectedID from URL --- ncp-web/js/ncp.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ncp-web') diff --git a/ncp-web/js/ncp.js b/ncp-web/js/ncp.js index 4229a585..6c35db0c 100644 --- a/ncp-web/js/ncp.js +++ b/ncp-web/js/ncp.js @@ -14,13 +14,13 @@ var lock = false; // URL based navigation window.onpopstate = function(event) { - var ncp_app = location.search.split('=')[1]; - if (ncp_app == 'config') + selectedID = location.search.split('=')[1]; + if (selectedID == 'config') switch_to_section('nc-config'); - else if (ncp_app == 'dashboard') + else if (selectedID == 'dashboard') switch_to_section('dashboard'); else - app_clicked($('#' + ncp_app)); + app_clicked($('#' + selectedID)); }; function errorMsg() @@ -158,6 +158,10 @@ function app_clicked(item) $(function() { + // parse selected app from URL + if (location.search) + selectedID = location.search.split('=')[1]; + // Event source to receive process output in real time if (!!window.EventSource) var source = new EventSource('ncp-output.php'); -- cgit v1.2.3