diff options
author | Peter Grassberger <petertheone@gmail.com> | 2015-07-31 20:54:42 (GMT) |
---|---|---|
committer | Peter Grassberger <petertheone@gmail.com> | 2015-07-31 20:54:42 (GMT) |
commit | e2034bcc39fd1d859626b3ea7512414dfccee499 (patch) | |
tree | 2b003fa6614a8f5584342ea14e048db3d717cb2d /www/js | |
parent | 032b6bcaf2b6811144325e504d6d7edfa248c508 (diff) |
move main css to file, move clock to utils.js, load jingle groups
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/jingles.js | 44 | ||||
-rw-r--r-- | www/js/shows.js | 26 | ||||
-rw-r--r-- | www/js/utils.js | 22 |
3 files changed, 68 insertions, 24 deletions
diff --git a/www/js/jingles.js b/www/js/jingles.js index c8a5c60..3314572 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -19,8 +19,52 @@ * along with rhwebimport. If not, see <http://www.gnu.org/licenses/>. */ +jingle_groups_list = []; + +function jingle_groups_updateList(data, status, req) { + jingle_groups_list = []; + $('#show-selector').find('option').remove(); + var dblist = $(data).find("dropboxList"); + var dbs = dblist.children(); + dbs.each(function() { + type = $(this).find('type').text(); + if (type == 'jingle') { + var jingle_group = { + title: $(this).find('jingle-title').text(), + group: { + name: $(this).find('group').text(), + description: $(this).find('group-description').text(), + lowcart: $(this).find('group-low-cart').text(), + highcart: $(this).find('group-high-cart').text(), + }, + normlevel: $(this).find('normalization-level').text(), + trimlevel: $(this).find('autotrim-level').text(), + }; + + var name = jingle_group.title; + $('#jingle-selector').append($('<option>').attr('value', jingle_group.id).text(name)); + + jingle_groups_list.push(jingle_group); + } + }); + console.log(jingle_groups_list); + //$('#jingle-selector').val(jingles_currentid); + //shows_showSelected(); +} + function jingles_init() { + //jingles_currentid = sessionStorage.getItem("jingles_currentid"); + jingle_groups_list = []; + data = { LOGIN_NAME: auth_username, PASSWORD: auth_token }; + $.post("/rh-bin/listdropboxes.cgi", data, jingle_groups_updateList, "xml"); + drawClock('Do, 1.1.1970', '00:00:00', 0); + clock_add_callback(drawClock); } function jingles_cleanup() { + sessionStorage.removeItem("jingles_currentid"); + delete jingles_currentid; + jingle_groups_list = []; + //jingles_group_carts = {}; + //jingles_log_carts = []; } diff --git a/www/js/shows.js b/www/js/shows.js index 13bc9be..5fd306c 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -321,35 +321,13 @@ function shows_updateList(data, status, req) { shows_showSelected(); } -function shows_drawClock(date, time, week) { - $('#shows-clock span.clock-date').text(date); - $('#shows-clock span.clock-time').text(time); - var weekspan = $('#shows-clock span.current-week').removeClass().addClass('current-week').addClass('label'); - switch(week) { - case 1: - weekspan.addClass('label-info').text('Woche 1'); - break; - case 2: - weekspan.addClass('label-warning').text('Woche 2'); - break; - case 3: - weekspan.addClass('label-success').text('Woche 3'); - break; - case 4: - weekspan.addClass('label-important').text('Woche 4'); - break; - default: - weekspan.addClass('label-inverse').text('Fehler'); - } -} - function shows_init() { shows_currentid = sessionStorage.getItem("shows_currentid"); shows_list = []; data = { LOGIN_NAME: auth_username, PASSWORD: auth_token }; $.post("/rh-bin/listdropboxes.cgi", data, shows_updateList, "xml") - shows_drawClock('Do, 1.1.1970', '00:00:00', 0); - clock_add_callback(shows_drawClock); + drawClock('Do, 1.1.1970', '00:00:00', 0); + clock_add_callback(drawClock); } function shows_cleanup() { diff --git a/www/js/utils.js b/www/js/utils.js index af0b479..e2c494b 100644 --- a/www/js/utils.js +++ b/www/js/utils.js @@ -195,3 +195,25 @@ function locationHashValue() { var hash = window.location.hash.match(/#([a-z]+)\/?.*/); return hash ? hash[1] : ''; } + +function drawClock(date, time, week) { + $('#clock span.clock-date').text(date); + $('#clock span.clock-time').text(time); + var weekspan = $('#clock span.current-week').removeClass().addClass('current-week').addClass('label'); + switch(week) { + case 1: + weekspan.addClass('label-info').text('Woche 1'); + break; + case 2: + weekspan.addClass('label-warning').text('Woche 2'); + break; + case 3: + weekspan.addClass('label-success').text('Woche 3'); + break; + case 4: + weekspan.addClass('label-important').text('Woche 4'); + break; + default: + weekspan.addClass('label-inverse').text('Fehler'); + } +} |