85 lines
2.3 KiB
JavaScript
85 lines
2.3 KiB
JavaScript
//let imgs_index = [ 59, 58, 56, 55, 54, 67, 66, 64, 61, 60 ];
|
|
let imgs_index = [ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63 ];
|
|
let last_index = imgs_index.length - 1;
|
|
|
|
let login_clicked = false;
|
|
let register_clicked = false;
|
|
|
|
function change_slideshow_img()
|
|
{
|
|
if (last_index == imgs_index.length - 1)
|
|
{
|
|
let first_index = imgs_index[0];
|
|
|
|
do
|
|
{
|
|
imgs_index.sort(() => Math.random() - 0.5);
|
|
} while (first_index == imgs_index[0]);
|
|
|
|
last_index = 0;
|
|
}
|
|
|
|
document.getElementById("slideshow").src = "http://109.123.243.163/fht/fabrika_imgs/downscaled/" + imgs_index[last_index++] + ".jpg";
|
|
}
|
|
|
|
function repeat_panorama()
|
|
{
|
|
setInterval(change_slideshow_img, 3000);
|
|
}
|
|
|
|
function show_login()
|
|
{
|
|
if (!login_clicked)
|
|
{
|
|
document.getElementById("sub_btn").value = "Přihlásit se";
|
|
document.getElementById("login_pane").style.visibility = "visible";
|
|
} else
|
|
{
|
|
document.getElementById("login_pane").style.visibility = "hidden";
|
|
}
|
|
|
|
login_clicked = !login_clicked;
|
|
register_clicked = false;
|
|
}
|
|
|
|
function show_register()
|
|
{
|
|
if (!register_clicked)
|
|
{
|
|
document.getElementById("sub_btn").value = "Registrovat se";
|
|
document.getElementById("login_pane").style.visibility = "visible";
|
|
} else
|
|
{
|
|
document.getElementById("login_pane").style.visibility = "hidden";
|
|
}
|
|
|
|
register_clicked = !register_clicked;
|
|
login_clicked = false;
|
|
}
|
|
|
|
function set_login_uname(uname)
|
|
{
|
|
if (document.getElementById("login_indicator").style.visibility == "visible") return;
|
|
|
|
document.getElementById("login_indicator").style.visibility = "visible";
|
|
document.getElementById("login_indicator_text").innerText += " " + uname;
|
|
|
|
document.getElementById("login_buttons").style.display = "none";
|
|
document.getElementById("logout_button").style.display = "inline";
|
|
}
|
|
|
|
function logout()
|
|
{
|
|
document.getElementById("login_buttons").style.display = "inline";
|
|
document.getElementById("logout_button").style.display = "none";
|
|
document.getElementById("login_indicator").style.display = "none";
|
|
}
|
|
|
|
document.addEventListener("keypress", function(event)
|
|
{
|
|
if (event.key == "Enter" && document.getElementById("login_pane").style.display == "visible")
|
|
{
|
|
event.preventDefault();
|
|
document.getElementById("sub_btn").click();
|
|
}
|
|
}); |