You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
3.4 KiB
PHTML

2 years ago
<div class="grid">
<div id="box-0" class="box" title="Vidlice"></div>
<div id="box-1" class="box" title="Přišpendlení"></div>
<div id="box-2" class="box" title="Špíz"></div>
<div id="box-3" class="box" title="Přetížení"></div>
<div id="box-4" class="box" title="Mezi-tah"></div>
<div id="box-5" class="box" title="Danajský dar"></div>
<div id="box-6" class="box" title="Přitažlivost"></div>
<div id="box-7" class="box" title="Povýšení ?"></div>
<div id="box-8" class="box" title="Cesta v před"></div>
<div id="box-9" class="box" title="Věžová koncovka"></div>
<div id="box-10" class="box" title="Dobývání"></div>
<div id="box-11" class="box" title="Věž je někdy málo"></div>
<div id="title">
<div class="fakeScreen">
<p class="line1">&#91; CHESS APP v7.0 &#93;<span class="cursor1">_</span></p>
<p class="line2">Vyberte úroveň:<span class="cursor2"></span></p>
<p class="line3">><span class="cursor3">_</span></p>
<p class="line1" id="cheatLine">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
</div>
<img src="resources/img/topicIcons/King.svg" alt="title picture">
<div id="progress">
<progress value="0" max="12"></progress>
</div>
</div>
</div>
<script>
const boxes = document.querySelectorAll(".box")
const titleImage = document.querySelector("#title img")
const fakeScreen = document.querySelector(".fakeScreen")
answerFlag = 0
boxes.forEach((lesson, index) => {
lesson.addEventListener("click", (e) => {
let target = e.target
cinemaMode(index)
answerFlag = 0;
answeredQuestions.forEach((answeredQuestion) =>{
if(index == answeredQuestion){
answerFlag += 1;
}
})
if(answerFlag == 0){
loadQuestion(index)
target.style.backgroundColor = "orange"
}
})
lesson.addEventListener('mouseenter', (e) => {
titleImage.src=("resources/img/topicIcons/lesson" + (index + 1) +".svg")
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="Compiling... &#91; DONE! &#93;"
fakeScreen.children[1].innerHTML="Running " + lesson.title + "..."
fakeScreen.children[2].innerHTML="> Click to Continue...<span class=\"cursor3\">_</span>"
})
lesson.addEventListener('mouseleave', (e) => {
titleImage.src=("resources/img/topicIcons/King.svg")
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="&#91; CHESS APP v7.0 &#93;<span class=\"cursor1\">_</span>"
fakeScreen.children[1].innerHTML="Vyberte úroveň:<span class=\"cursor2\"></span>"
fakeScreen.children[2].innerHTML="><span class=\"cursor3\">_</span>"
})
})
</script>