diff --git a/ui/html/index.html b/ui/html/index.html index baa09fa..b564060 100644 --- a/ui/html/index.html +++ b/ui/html/index.html @@ -2,8 +2,10 @@ AGECEM | babillard + - + + diff --git a/ui/js/slider.js b/ui/js/slider.js new file mode 100644 index 0000000..dbe227e --- /dev/null +++ b/ui/js/slider.js @@ -0,0 +1,45 @@ +var images = []; +var indexImages = 0; + +function afficherIndex() { + $('#debug').text(indexImages); +} + +function afficherImage() { + $('#image').attr('src', "/api/contenu/"+images[indexImages]); +} + +function augmenterIndex() { + if (indexImages >= images.length - 1) { + indexImages = 0; + } else { + indexImages ++; + } +} + +function executionLoop(){ + //afficherIndex(); + afficherImage(); + augmenterIndex(); +} + +function obtenirContenu(){ + var response = ''; + $.ajax({ + type: "GET", + url: window.location.origin + "/api/contenu", + async: false, + success: function(text) { + response = text; + } + }); + + console.log(response); + images = response.split(';'); + console.log(images); +} + +$(function(){ + obtenirContenu(); + var executionInterval = setInterval(executionLoop, (Math.floor(Math.random() * 6)+15)*1000); +});