2023-02-27 10:42:51 +01:00
|
|
|
window.addEventListener('DOMContentLoaded', function () {
|
|
|
|
|
|
|
|
var predvajaj = document.querySelector('#predvajaj');
|
|
|
|
var gumbi = document.querySelector('#predvajaj');
|
|
|
|
var glavno = document.querySelector('#glavno');
|
|
|
|
|
|
|
|
var gLevo = document.querySelector('#levo');
|
|
|
|
var gDesno = document.querySelector('#desno');
|
|
|
|
var gRavno = document.querySelector('#ravno');
|
|
|
|
var vsiGumbi = [gLevo, gDesno, gRavno];
|
|
|
|
|
2023-03-21 03:32:00 +01:00
|
|
|
// Funkcije za veckratno rabo
|
|
|
|
function omogociGumbe(kdaj) {
|
|
|
|
setTimeout(function () {
|
2023-06-06 13:24:19 +02:00
|
|
|
vsiGumbi.forEach(function (gEl) {
|
2023-03-21 03:32:00 +01:00
|
|
|
gEl.toggleAttribute('disabled', false);
|
2023-06-06 13:24:19 +02:00
|
|
|
});
|
2023-03-21 03:32:00 +01:00
|
|
|
}, kdaj);
|
|
|
|
}
|
|
|
|
|
|
|
|
function onemogociGumbe() {
|
|
|
|
vsiGumbi.forEach(function (gEl) {
|
2023-06-06 13:24:19 +02:00
|
|
|
gEl.toggleAttribute('disabled', true);
|
2023-03-21 03:32:00 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-06 13:24:19 +02:00
|
|
|
// Gumbi levo in desno
|
|
|
|
gLevo.addEventListener('click', function () {
|
2023-06-06 05:19:51 +02:00
|
|
|
console.log('GREMO LEVO!');
|
|
|
|
window.peljiLevo();
|
|
|
|
|
|
|
|
onemogociGumbe();
|
|
|
|
omogociGumbe(DOLZINA + PAVZA);
|
2023-06-06 13:24:19 +02:00
|
|
|
});
|
|
|
|
gDesno.addEventListener('click', function () {
|
2023-06-06 05:19:51 +02:00
|
|
|
console.log('GREMO DESNO!');
|
|
|
|
window.peljiDesno();
|
|
|
|
|
|
|
|
onemogociGumbe();
|
|
|
|
omogociGumbe(DOLZINA + PAVZA);
|
2023-06-06 13:24:19 +02:00
|
|
|
});
|
|
|
|
gRavno.addEventListener('click', function () {
|
|
|
|
console.log('GREMO RAVNO!');
|
|
|
|
window.peljiRavno();
|
2023-03-20 02:34:49 +01:00
|
|
|
|
2023-06-06 13:24:19 +02:00
|
|
|
onemogociGumbe();
|
|
|
|
omogociGumbe(DOLZINA + PAVZA);
|
|
|
|
});
|
2023-06-06 15:58:20 +02:00
|
|
|
});
|