-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
227 lines (206 loc) · 5.65 KB
/
index.html
File metadata and controls
227 lines (206 loc) · 5.65 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link href='http://fonts.googleapis.com/css?family=Fjalla+One' rel='stylesheet' type='text/css'>
<title>Hiisi Soundboard</title>
<script>
// String.prototype.trim() shim
if(!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
};
}
var html5_audiotypes={ //define list of audio file extensions and their associated audio types. Add to it if your specified audio file isn't on this list:
"mp3": "audio/mpeg",
"mp4": "audio/mp4",
"ogg": "audio/ogg",
"wav": "audio/wav"
}
function createsoundbite(sound){
var html5audio=document.createElement('audio')
if (html5audio.canPlayType){ //check support for HTML5 audio
for (var i=0; i<arguments.length; i++){
var sourceel=document.createElement('source')
sourceel.setAttribute('src', arguments[i])
if (arguments[i].match(/\.(\w+)$/i))
sourceel.setAttribute('type', html5_audiotypes[RegExp.$1])
html5audio.appendChild(sourceel)
}
html5audio.load()
html5audio.playclip=function(){
html5audio.pause()
html5audio.currentTime=0
html5audio.play()
}
return html5audio
}
else{
return {playclip:function(){throw new Error("Your browser doesn't support HTML5 audio unfortunately")}}
}
}
var clicksounds = [
[9000, createsoundbite("hiisi1.mp3")],
[3000, createsoundbite("hiisi2.mp3")],
[5600, createsoundbite("hiisi3.mp3")],
[6000, createsoundbite("hiisi4.mp3")],
[4800, createsoundbite("hiisi5.mp3")],
[3000, createsoundbite("hiisi6.mp3")],
[3000, createsoundbite("hiisi7.mp3")],
[4500, createsoundbite("hiisi8.mp3")],
[3500, createsoundbite("hiisi9.mp3")]
];
</script>
<style>
* {
margin: 0;
padding: 0;
}
body, html {
font-family: 'Fjalla One';
text-transform: uppercase;
height: 100%;
max-width: 600px;
width: 100%;
text-align: center;
overflow: hidden;
}
.description {
height: 10%;
background: #333;
color: #fff;
position: relative;
}
.description h1 {
position: relative;
top: 50%;
font-size: 16px;
line-height: 0;
}
a.area {
display: block;
height: 200px;
width: 33.333%;
float: left;
font-size: 19px;
text-decoration: none;
opacity: .8;
}
a.area:hover {
opacity: 1;
}
a.area p {
position: relative;
top: 50%;
color: #fff;
line-height: 0;
}
.hiisi {
background: url('jussi-virtanen.jpg');
background-size: cover;
}
.hiisi-alt {
background: url('jussi-virtanen2.jpg');
}
.party a, .party a:visited {
color: #5ba2c4;
text-decoration: none;
}
.color1 {
background: #62ac28;
}
.color2 {
background: #5ba2c4;
}
.color3 {
background: #3964b1;
}
.color4 {
background: #0c17a0;
}
.color5 {
background: #5500a0;
}
.color6 {
background: #a80079;
}
.color7 {
background: #db0000;
}
.color8 {
background: #e06618;
}
.withlove {
position: relative;
height: 10%;
background: #333;
color: #fff;
clear: both;
}
.withlove p {
position: relative;
top: 40%;
font-size: 16px;
line-height: 16px;
}
a {
text-decoration: none;
}
a:visited {
color: white;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(function() {
$("a[data-action]").click(function (evt) {
evt.preventDefault();
var $this = $(this),
action = $this.data('action');
if (action === 'play') {
clicksounds[$this.data('tile') -1][1].playclip();
}
$('.hiisi').addClass('hiisi-alt');
setTimeout(function(){
$('.hiisi').removeClass('hiisi-alt');
}, clicksounds[$this.data('tile') -1][0]);
console.log(clicksounds[$this.data('tile') -1]);
})
})
</script>
</head>
<body>
<div class="description">
<h1>Mitä Hiisi sanoo?</h1>
</div>
<a href="#" data-action="play" data-tile=1 class="area color1">
<p>Vihaisena</p>
</a>
<a href="#" data-action="play" data-tile=2 class="area color2">
<p>Huonosta designista</p>
</a>
<a href="#" data-action="play" data-tile=3 class="area color3">
<p>Kaupintien hississä</p>
</a>
<a href="#" data-action="play" data-tile=4 class="area color6">
<p>"Roskakori" -logosta</p>
</a>
<a href="#" data-action="play" data-tile=5 class="area hiisi">
</a>
<a href="#" data-action="play" data-tile=6 class="area color5">
<p>Lattekahvin loppuessa</p>
</a>
<a href="#" data-action="play" data-tile=7 class="area color4">
<p>Kuorsatessaan</p>
</a>
<a href="#" data-action="play" data-tile=8 class="area color7">
<p>Tytöistä</p>
</a>
<a href="#" data-action="play" data-tile=9 class="area color8">
<p>Larpatessaan</p>
</a>
<div class="withlove">
<p>Rakkaudella: <a href="http://fraktio.fi">Fraktio</a></p>
</div>
</body>
</html>