-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
102 lines (91 loc) · 2.43 KB
/
index.php
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE HTML>
<html>
<head>
<title>Disco, Disco, Partizani!</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//loading audio
var blop = document.createElement('audio');
blop.setAttribute('src', 'audio/blop.mp3');
$.get();
blop.addEventListener("load", function() {
blop.play();
}, true);
var tick = document.createElement('audio');
tick.setAttribute('src', 'audio/tick.mp3');
$.get();
tick.addEventListener("load", function(){
tick.play();
}, true);
var button = document.createElement('audio');
button.setAttribute('src', 'audio/button.mp3');
$.get();
button.addEventListener("load", function(){
button.play();
}, true);
//mute button
var $mute = $('#mute');
var mute = true;
$mute.click(function(){
if (mute == true) {
mute = false;
$mute.css('color', 'white');
} else {
mute = true;
$mute.css('color', 'red');
}
});
//set color
$('li').mouseenter(function(){
randColor = Math.random();
if (randColor < 0.25) {
randColor = "blue";
} else if (randColor < 0.50) {
randColor = "red";
} else if (randColor < 0.75) {
randColor = "green";
} else {
randColor = "yellow";
}
$(this).css('background-color', randColor);
//play sound
if (!mute) {
randAudio = Math.random();
if (randAudio < 0.33) {
blop.play();
} else if (randAudio < 0.66) {
tick.play();
} else {
button.play();
}
}
});
//click to erase
$('li').click(function(){
$(this).css('background-color', '#061E05');
});
$('#clear_all').click(function(){
$('li').css('background-color', '#061E05');
})
});
</script>
</head>
<body>
<h1 id="mute">Mute</h1>
<h1 id="clear_all">Clear All</h1>
<div class="clear"></div>
<?php
for($i = 0; $i < 9; $i++)
{
echo "<ul>";
for ($j = 0; $j < 17; $j++)
{
echo "<li></li>";
}
echo "</ul>";
}
?>
</body>
</html>