-
Notifications
You must be signed in to change notification settings - Fork 0
/
ListenerAll.js
60 lines (49 loc) · 1.67 KB
/
ListenerAll.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
class ListenerAll {
constructor(checkForm, canvas, diapo, document) {
this.lancementDiapo = document.getElementById('suivant');
this.lancementCompteur = document.getElementById('LancementCompteur');
this.canvasErase = document.getElementById('canvasErase');
this.lancementCanvas = document.getElementById('c1');
this.checkForm = checkForm;
this.canvas = canvas;
this.diapo = diapo;
this.pause = document.getElementById('pause');
this.play = document.getElementById('play');
this.precedent = document.getElementById('precedent');
let defilementAuto = setInterval(this.diapo.switchDiapo, 5000);
this.pause.addEventListener('click', _ => {
clearInterval(defilementAuto);
this.play.style.display = "inline-block";
this.pause.style.display = "none";
});
this.play.addEventListener('click', _ => {
defilementAuto = setInterval(this.diapo.switchDiapo, 5000);
this.pause.style.display = "inline-block";
this.play.style.display = "none";
});
document.addEventListener("keydown", (e) => {
if (e.keyCode === 39) {
this.diapo.switchDiapo();
}
else if (e.keyCode === 37) {
this.diapo.precedentDiapo();
}
});
}
start() {
this.lancementDiapo.addEventListener('click', this.diapo.switchDiapo);
this.precedent.addEventListener('click', this.diapo.precedentDiapo);
this.lancementCanvas.addEventListener('mouseover', _ => {
this.canvas.signature();
});
this.canvasErase.addEventListener('click', _ => {
this.canvas.clearCanvas();
});
document.addEventListener("DOMContentLoaded", _ => {
this.checkForm.checkDate();
});
this.lancementCompteur.addEventListener('click', function (e) {
checkForm.checkForm(e);
});
}
}