Added check for button combo (will exit app in future)

This commit is contained in:
Vaclav Siml 2023-02-24 20:35:04 +01:00
parent 9412091524
commit d6154ad3f5

View file

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
@ -7,10 +8,11 @@
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<title>UI</title> <title>UI</title>
</head> </head>
<body> <body>
<script src ="Vars.js"> <script src="Vars.js">
</script> <!--Loadne Vars.js--> </script> <!--Loadne Vars.js-->
<div class="hlavnidiv"> <div class="hlavnidiv">
<div class="container"> <div class="container">
<button class="move" type="button" id="sdvx3-button" onclick="vers=3;sdvx()"> <button class="move" type="button" id="sdvx3-button" onclick="vers=3;sdvx()">
<img src="JPGS/sound-voltex-iii-gravity-wars-1.png" alt=""> <img src="JPGS/sound-voltex-iii-gravity-wars-1.png" alt="">
@ -39,26 +41,19 @@
</div> </div>
</div> </div>
<!-- <audio id="Switchfocus"> <script>
<source src="Audio/switchfocus.mp3" type="audio/mpeg">
</audio>
<audio id="Audiostart">
<source src="Audio/audiostart.mp3" type="audio/mpeg">
</audio> -->
<script>
const prvnihra = [...document.querySelectorAll("button")] const prvnihra = [...document.querySelectorAll("button")]
// for (i = 0; i < prvnihra.length; i++) { // for (i = 0; i < prvnihra.length; i++) {
//console.log(prvnihra[i]); //console.log(prvnihra[i]);
//} //}
console.log(prvnihra[0]) console.log(prvnihra[0])
prvnihra[0].focus(); /* Handles interaction with bindable buttons and focus*/ prvnihra[0].focus(); /* Handles interaction with bindable buttons and focus*/
</script> </script>
<script> <script>
/**/ /**/
var i = 0; var i = 0;
const switchfocus = new Audio("Audio/switchfocus.mp3"); const switchfocus = new Audio("Audio/switchfocus.mp3");
@ -102,8 +97,25 @@
//document.body.requestFullscreen(); //document.body.requestFullscreen();
}) })
</script> let keysPressed = {};
<script> document.addEventListener('keydown', (event) => {
keysPressed[event.key] = true;
if (keysPressed[ExitKey1] && event.key == ExitKey2) {
alert(event.key);
}
});
document.addEventListener('keyup', (event) => {
delete keysPressed[event.key];
});
</script>
<script>
var vers = 0; /* Handles Running of apps */ var vers = 0; /* Handles Running of apps */
const { execFile, exec, spawn } = require('child_process'); const { execFile, exec, spawn } = require('child_process');
function sdvx() { function sdvx() {
@ -137,8 +149,8 @@
default: default:
break; break;
} }
} }
</script> </script>
</body> </body>
</html> </html>