diff options
Diffstat (limited to 'www/js/apps.js')
-rw-r--r-- | www/js/apps.js | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/www/js/apps.js b/www/js/apps.js index 8f30ef0..af5cd6d 100644 --- a/www/js/apps.js +++ b/www/js/apps.js @@ -31,6 +31,8 @@ function apps_select(app) { $('#app-musicpools').show(); $('#nav-btn-musicpools').addClass('active'); + + apps_current = app; musicpools_init(); break; case "jingles": @@ -42,6 +44,7 @@ function apps_select(app) { $('#app-jingles').show(); $('#nav-btn-jingles').addClass('active'); + apps_current = app; jingles_init(); break; default: @@ -53,17 +56,26 @@ function apps_select(app) { $('#app-shows').show(); $('#nav-btn-shows').addClass('active'); - apps_current = 'shows'; + apps_current = app = 'shows'; shows_init(); - } - sessionStorage.setItem("apps_current", app); + } + if (locationHashValue() !== app) { + history.pushState(null, null, '/#' + app + '/'); + } } function apps_init() { - apps_current = sessionStorage.getItem("apps_current"); + apps_current = locationHashValue(); + if(auth_token && auth_username) { apps_select(apps_current); } + + $(window).on('popstate', function(event) { + if(auth_token && auth_username) { + apps_select(locationHashValue()); + } + }); } function apps_cleanup() { @@ -71,6 +83,8 @@ function apps_cleanup() { jingles_cleanup(); musicpools_cleanup(); + $(window).off('popstate'); + sessionStorage.removeItem("apps_current"); delete apps_current; } |