diff options
author | nachoparker <nacho@ownyourbits.com> | 2019-01-04 01:52:52 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2019-01-05 04:14:53 +0300 |
commit | 6c954989906c53a0fda44bfd71d8ec409d42ad94 (patch) | |
tree | 2339a3e08a8b67a529d29f5fb22fa9a04ad4198e | |
parent | cbf746e47bd18add6063fe30fe2032c741ee87ea (diff) |
fix selectedID from URL
-rw-r--r-- | ncp-web/js/ncp.js | 12 |
1 files changed, 8 insertions, 4 deletions
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'); |