From 5991153a593bb2244fc69b314f27d45588eb8848 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 20 Sep 2014 03:52:34 +0000 Subject: persistent show selection diff --git a/index.html b/index.html index 00f8cee..8e75c5a 100644 --- a/index.html +++ b/index.html @@ -53,6 +53,7 @@ + var shows_currentid; var shows_list = []; var current_show; var group_carts = []; @@ -102,8 +103,9 @@ } function showSelectedShow() { - var id = $('#show-selector option:selected').attr('value'); - current_show = $.grep(shows_list, function(elem) { return elem.id == id; })[0]; + shows_currentid = $('#show-selector option:selected').attr('value'); + sessionStorage.setItem("shows_currentid", shows_currentid); + current_show = $.grep(shows_list, function(elem) { return elem.id == shows_currentid; })[0]; $('#show-title').text(current_show.title); $('#show-dow').text(weekday[current_show.dow]); $('#show-rhythm').text(current_show.rhythm); @@ -160,15 +162,21 @@ } } ); + $('#show-selector').val(shows_currentid); showSelectedShow(); } - function app_shows_init() { + function shows_init() { + shows_currentid = sessionStorage.getItem("shows_currentid"); shows_list = []; data = { LOGIN_NAME: username, PASSWORD: token }; $.post("/listdropboxes.cgi", data, updateShowsList, "xml") } + function shows_cleanup() { + sessionStorage.removeItem("shows_currentid"); + delete shows_currentid; + } @@ -186,7 +194,7 @@ $('#app-musicpools').hide(); $('#nav-btn-musicpools').removeClass('active'); app = 'shows'; - app_shows_init(); + shows_init(); } sessionStorage.setItem("app", app); } @@ -249,6 +257,8 @@ delete token; sessionStorage.removeItem("app"); delete app; + + shows_cleanup(); $(".alert").alert('close'); $("#username").val(''); -- cgit v0.10.2