2023-02-17 15:43:23 -05:00
|
|
|
var images = [];
|
|
|
|
var indexImages = 0;
|
|
|
|
|
|
|
|
function afficherIndex() {
|
|
|
|
$('#debug').text(indexImages);
|
|
|
|
}
|
|
|
|
|
|
|
|
function afficherImage() {
|
2023-11-29 17:15:27 -05:00
|
|
|
$('#image').attr('src', "/api/contenu/"+images[indexImages]);
|
2023-02-17 15:43:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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, 10000);
|
|
|
|
});
|