-
Notifications
You must be signed in to change notification settings - Fork 0
/
casques.php
114 lines (96 loc) · 4.14 KB
/
casques.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
103
104
105
106
107
108
109
110
111
112
113
114
<?php
include('header.php');
?>
<div style="z-index:1 ;" class="fixed-top nav2 text-center nav-green pr-1">Audio game</div>
<br>
<main id="audio" class="container pt-5">
<div class="row col-sm-12 pisteBlock" data-toggle="modal" data-target="#piste1">
<div class="col-sm-11 pisteAudio">
<div class="indice text-center mt-2"></div>
</div>
</div>
<div class="row col-sm-12 pisteBlock" data-toggle="modal" data-target="#piste2">
<div class="col-sm-11 pisteAudio">
<div class="indice text-center mt-2"></div></div>
</div>
<div class="row col-sm-12 pisteBlock" data-toggle="modal" data-target="#piste3">
<div class="col-sm-11 pisteAudio">
<div class="indice text-center mt-2"></div></div>
</div>
<div class="row col-sm-12 pisteBlock" data-toggle="modal" data-target="#piste4">
<div class="col-sm-11 pisteAudio">
<div class="indice text-center mt-2"></div></div>
</div>
<div class="row col-sm-12 pisteBlock" data-toggle="modal" data-target="#piste5">
<div class="col-sm-11 pisteAudio">
<div class="indice text-center mt-2"></div></div>
</div>
<div class="row col-sm-12 pisteBlock" data-toggle="modal" data-target="#piste6">
<div class="col-sm-11 pisteAudio">
<div class="indice text-center mt-2"></div>
</div>
</div>
</main>
<?php
include('php/config.php');
for ($i = 1; $i < 7; $i++) { ?>
<div class="modal fade" id="piste<?php echo $i ?>">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content bg-green border-green black text-center">
<!-- Modal Header -->
<div class="modal-header border-bottom-0">
<h4 class="modal-title">Casque <?php echo $i ?></h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<img class="sound" src="casque/img/200w.gif">
<audio src="casque/audio/casque<?php echo $i ?>.mp3" preload="auto"></audio>
<input class="m-auto audioRef rounded input-black border-green mb-2 text-center" type="number"
name="a"
id="val_a" min="0000" max="9999" step="1" value="0">
<input id="sol_a" value="<?php echo $solutions[$i][0] ?>" hidden>
<input class="m-auto audioRef rounded input-black border-green mb-2 text-center" type="number"
name="b"
id="val_b" min="0000" max="9999" step="1" value="0">
<input id="sol_b" value="<?php echo $solutions[$i][1] ?>" hidden>
</div>
<!-- Modal footer -->
<div class="modal-footer border-top-0 text-left">
<button class="rounded btn-black btn" data-dismiss="modal" id="close">ok</button>
</div>
</div>
</div>
</div>
<?php
}
include('footer.php');
?>
<script>
$(function () {
$(".indice").hide();
$('.pisteBlock').click(function () {
var target = $(this).attr('data-target');
setInterval(function () {
$(target).find("audio")[0].play()
}, 1000);
});
$("input").change(function () {
current_modal = $('.modal:visible');
current_modal_id = '#'+current_modal.attr('id');
val_a = current_modal.find('#val_a').val();
sol_a = current_modal.find('#sol_a').val();
val_b = current_modal.find('#val_b').val();
sol_b = current_modal.find('#sol_b').val();
current_audio = $('[data-target="'+current_modal_id+'"]');
if (val_a === sol_a && val_b === sol_b) {
$(current_modal_id).find("button").trigger('click');
$(current_modal_id).remove();
current_audio.find('.indice').show();
current_audio.addClass('completed');
}
});
});
</script>
</body>
</html>