function cinemaMode(videoId){
let source = document.querySelector("source")
source.setAttribute("src", "resources/video/lq" + videoId + ".webm")
video.load()
video.play()
cinema.removeAttribute("hidden")
}
function loadQuestion(questionId){
questionFiller(questionId)
shuffleChildren(answers)
}
function questionMode(){
if(window.answerFlag == 0){
question.removeAttribute("hidden")
}
}
function exit(){
question.setAttribute("hidden", "")
cinema.setAttribute("hidden", "")
video.pause()
}
const exitBoxes = document.querySelectorAll("#close")
exitBoxes.forEach(x => {
x.addEventListener("click", (e) => {
exit()
})
})
function shuffleChildren(parent){
var children = parent.children;
var frag = document.createDocumentFragment();
var randomChild;
while (children.length) {
randomChild = children[Math.floor(Math.random() * children.length)]
frag.appendChild(randomChild);
}
parent.appendChild(frag);
}
function pushScore() {
document.querySelector("progress").value = score
if(score == document.querySelector("progress").max) {
// vyhral jsi, zde udelej co chces
// Chci se stát obecně lepším člověkem ;)
//alert("Dobrá práce člověče, figurkama umíš tahat na výbornou jako správnej flamendr, ale co na to češi?Stala se z vás ikona této aplikace!")
boxes.forEach(
(boxRemove) => {
boxRemove.remove();
}
)
document.querySelector(".grid").style.display = "flex"
document.querySelector("#title").style.width = "100"
document.documentElement.style.setProperty('--termLength', 60 + "vw");
document.querySelector("audio").remove();
fakeScreen.replaceChild(fakeScreen.children[0],fakeScreen.children[0])
fakeScreen.replaceChild(fakeScreen.children[1],fakeScreen.children[1])
fakeScreen.replaceChild(fakeScreen.children[2],fakeScreen.children[2])
fakeScreen.children[0].innerHTML="[ RUN ENDED ]_"
fakeScreen.children[1].innerHTML="Gratuluji!"
fakeScreen.children[2].innerHTML=">Bye_"
fakeScreen.children[3].innerHTML=""
}
}
function audioplayer(){
playlist = ["intro","cyber","minute","supremers","violence"]
music = document.querySelector("audio");
music.play()
music.onended = function(e){
if(i < 4){
i += 1
}
else{
i=0
}
music.innerHTML=""
music.play()
}
}
const bodyForAudio = document.querySelector("body");
function onetime(node, type, callback) {
// create event
node.addEventListener(type, function(e) {
// remove event
e.target.removeEventListener(e.type, arguments.callee);
// call handler
return callback(e);
});
}
onetime(bodyForAudio, "click", audioplayer)