'+ message + '
Here is your picture:
" + now_time + "
"); + setTimeout(update_clock, 1000); +} + +t = 'all' +window.setInterval(function(){ + execute_api_call_get_new_pictures(t, view); +}, do_api_call_every_x_seconds * 1000); + +function execute_api_call_get_new_pictures(timestamp, view) +{ + url = "api/get_new_pictures/" + timestamp; + console.log(url); + var jqxhr = $.getJSON( url, function(data) { + number_of_new_pictures = data['number_of_pictures']; + if(number_of_new_pictures > 0) + { + show_new_pictures_popup(number_of_new_pictures) + } + append_new_pictures(data.new_pictures, view); + show_photoboot_status(data.photobooth_status); + last_image = data['last_picture'] + t= data['last_picture']['picture_timestamp']; + }) + .done(function(data) { + console.log("ready") + }) + .fail(function() { + console.log("error"); + }); +} + +function show_new_pictures_popup(number) +{ + if(number==1) + pictures = "picture was" + else { + pictures = "pictures were" + } + $("#new_pictures_added").html("Hooray, " + number + " new " + pictures + " taken...Go and grab yours now!
").fadeIn().delay(show_new_pictures_popup_for_x_seconds * 1000).fadeOut(); +} + +function prepare_window(name, remove_container){ + $("", { + rel: "stylesheet", + type: "text/css", + href: "/css/" + name + ".css" + }).appendTo("head"); + + $("", { + type: "text/javascript", + src: "/js/" + name + ".js" + }).appendTo("head"); + + $("body").addClass(name); + + if(remove_container){ + $(".container").removeClass(); + } + +} + +function append_new_pictures(picture_information, view){ + $.each( picture_information, function( key, value ) { + generate_picture(key, value, view, "#picture_list"); + lst_images.push(value); + + }); +} + +function add_picture_html_view_for(i, view){ + +} + +current_row = 0; +current_picture_number = 0; +function generate_picture(i, data, view, object){ + the_list = $(object); + current_picture_number ++; + console.log(current_picture_number); + current_html_row = ""; + picture_name = data['picture_name']; + picture_timestamp = data['picture_timestamp']; + picture_datetime = data['picture_datetime']; + picture_download_link = 'f/download/picture/' + picture_name; + picture_show_link = 'f/show/picture/' + picture_name; + if(view.toUpperCase() == 'SLIDESHOW') + { + the_list.append("" + status + "
") +} + + +var getUrlParameter = function getUrlParameter(sParam) { + var sPageURL = window.location.search.substring(1), + sURLVariables = sPageURL.split('&'), + sParameterName, + i; + + for (i = 0; i < sURLVariables.length; i++) { + sParameterName = sURLVariables[i].split('='); + + if (sParameterName[0] === sParam) { + return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); + } + } +}; diff --git a/photobooth/webserver/js/show_qrs.js b/photobooth/webserver/js/show_qrs.js new file mode 100644 index 00000000..99757ee9 --- /dev/null +++ b/photobooth/webserver/js/show_qrs.js @@ -0,0 +1,24 @@ +var picture = getUrlParameter('picture'); + +execute_api_call_get_single_picture(picture); + +function execute_api_call_get_single_picture(picture){ + url = "api/get_picture/" + picture; + console.log(url); + var jqxhr = $.getJSON( url, function(data) { + number_of_new_pictures = data['number_of_pictures']; + if(number_of_new_pictures > 0) + { + show_new_pictures_popup(number_of_new_pictures) + } + append_new_pictures(data.new_pictures, view); + show_photoboot_status(data.photobooth_status); + t= data['last_picture']['picture_timestamp']; + }) + .done(function(data) { + console.log("ready") + }) + .fail(function() { + console.log("error"); + }); +} diff --git a/photobooth/webserver/js/slideshow.js b/photobooth/webserver/js/slideshow.js new file mode 100644 index 00000000..874d6987 --- /dev/null +++ b/photobooth/webserver/js/slideshow.js @@ -0,0 +1,39 @@ +console.log("I'm your slideshow script!"); + +showSlides(); +update_clock(); + +function generate_full_screen_info(){ + picture_name = lst_images[slideIndex-1]['picture_name']; + picture_datetime = lst_images[slideIndex-1]['picture_datetime']; + picture_number = slideIndex; + + $("#fullscreen_info").removeClass("hidden"); + $("#picture_name").text(picture_name); + $("#picture_datetime").text(format_datetime(picture_datetime, 'datetime')); + $("#picture_number").text("Picture " + picture_number + " of " + lst_images.length); +} + +var slideIndex = 0; +function showSlides() { + var i; + var slides = document.getElementsByClassName("mySlides"); + // console.log(slides); + // console.log(slides.length); + if(slides.length > 0){ + for (i = 0; i < slides.length; i++) { + slides[i].style.display = "none"; + } + slideIndex++; + if (slideIndex > slides.length) {slideIndex = 1} + if(show_in_fullscreen) + { + $('body').css('background-image', 'url(/f/show/picture/' + lst_images[slideIndex-1]['picture_name'] + ')'); + generate_full_screen_info(); + } + else { + slides[slideIndex-1].style.display = "block"; + } + } + setTimeout(showSlides, change_slides_every_x_secondes * 1000); +} diff --git a/photobooth/webserver/templates/footer.html b/photobooth/webserver/templates/footer.html new file mode 100644 index 00000000..9943ff0f --- /dev/null +++ b/photobooth/webserver/templates/footer.html @@ -0,0 +1,3 @@ +