-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.js
More file actions
57 lines (57 loc) · 2.02 KB
/
common.js
File metadata and controls
57 lines (57 loc) · 2.02 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
(function ($) {
var createAudio = function (url) {
return $(document.createElement('embed')).attr({
src: url,
autostart: 'true',
loop: 'false'
});
}
// check if <audio> is supported and able to play our media
if (!!document.createElement('audio').canPlayType) {
$(document.createElement('audio'))
.attr('src', 'snd/а.wav')
.bind('loadeddata', function (e) {
createAudio = function (url) {
return $(document.createElement('audio')).attr({
src: url,
autoplay: 'true'
});
}
});
}
function playSound(url) {
$('#dummyspan').empty().append(createAudio(url));
}
$('li').click(function () {
playSound($(this).find('span').attr('data-sound-url'));
$(this).addClass('clicked');
$(this).find('b').fadeIn(300);
$(this).find('i').animate({
width: '30',
height: '30',
fontSize: '26px',
'line-height': '30px'
}, 300);
if($('li:not(.clicked)').length === 0) {
setTimeout(function () {
$('#winCont').fadeIn(300);
playSound('snd/Молодец.wav');
$('#winCont span').click(function () {
playSound('snd/Попробуй_ещё.wav');
$('#winCont').fadeOut(300);
$('#dummyspan').html();
$('li').removeClass('clicked');
setTimeout(function () {
$('li').find('b').fadeOut(300);
$('li').find('i').animate({
width: '100',
height: '100',
fontSize: '72px',
'line-height': '100px'
}, 300);
}, 1000);
});
}, 2000);
}
});
}(jQuery));