35 lines
983 B
JavaScript
Raw Normal View History

2023-06-02 08:57:30 +02:00
let imgs_index = [ 59, 58, 56, 55, 54, 67, 66, 64, 61, 60 ];
let imgs_index_2 = [];
let last_index = -1;
function change_slideshow_img()
{
2023-06-02 20:35:56 +02:00
let buffer = (imgs_index === undefined || imgs_index.length === 0) ? imgs_index_2 : imgs_index;
2023-06-02 08:57:30 +02:00
let random_index;
do
{
random_index = Math.floor(Math.random() * buffer.length);
2023-06-02 20:35:56 +02:00
} while (buffer[random_index] == last_index);
2023-06-02 08:57:30 +02:00
document.getElementById("slideshow").src = "http://207.180.212.190/fht/fabrika_imgs/downscaled/" + buffer[random_index] + ".jpg";
if (imgs_index.includes(buffer[random_index]))
{
imgs_index_2.push(buffer[random_index]);
imgs_index.splice(random_index, 1);
} else
{
imgs_index.push(buffer[random_index]);
imgs_index_2.splice(random_index, 1);
}
//console.log(buffer[random_index] + "\n" + last_index + "\n\n");
2023-06-02 08:57:30 +02:00
2023-06-02 20:35:56 +02:00
last_index = buffer[random_index];
}
2023-06-02 20:35:56 +02:00
function repeat_panorama()
{
setInterval(change_slideshow_img, 3000);
2023-06-02 08:57:30 +02:00
}