-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathengine.js
67 lines (52 loc) · 1.55 KB
/
engine.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Coloring bike
const redBtn = document.getElementById("red");
const blueBtn = document.getElementById("blue");
const blackBtn = document.getElementById("black");
const bike = document.getElementById("bike");
redBtn.onclick = function () {
bike.style.backgroundImage = "url(images/BMW1.png)";
};
blueBtn.onclick = function () {
bike.style.backgroundImage = "url(images/BMW2.png)";
};
blackBtn.onclick = function () {
bike.style.backgroundImage = "url(images/BMW3.png)";
};
// Start stop engine
var audio;
function startAudio() {
if (!audio) {
audio = new Audio("images/start.mp3");
audio.addEventListener("ended", function () {
document.getElementById("startButton").disabled = false;
document.getElementById("stopButton").disabled = true;
});
}
audio.play();
document.getElementById("startButton").disabled = true;
document.getElementById("stopButton").disabled = false;
}
function stopAudio() {
if (audio) {
audio.pause();
audio.currentTime = 0;
}
document.getElementById("startButton").disabled = false;
document.getElementById("stopButton").disabled = true;
}
function withoutCSS() {
var stylesheet = document.getElementById("customStylesheet");
if (stylesheet) {
stylesheet.parentNode.removeChild(stylesheet);
}
}
function withoutHTML() {
document.body.innerHTML = "";
}
function withoutJS() {
document.getElementById("stopButton").onclick = null;
document.getElementById("startButton").onclick = null;
}
document.getElementById("relaunch").onclick = function () {
window.location.reload();
};