Ah, le détail qui tue...
[svganimation.git] / SVGPlayerButtons.js
1 // -----------------------------------------------------------------------------
2 // Boutons (version B)
3 function SVGPlayerButtons(a) {
4 Controle.call(this,a);
5 SVGPlayerButtons.prototype.connect = Controle.prototype.connect;
6 this.playBtn = true;
7 this.stopBtn = true;
8 this.startBtn = false;
9 this.endBtn = false;
10 this.nextBtn = false;
11 this.previousBtn = false;
12 this.speedupBtn = false;
13 this.slowdownBtn = false;
14
15 this.playBtnName = "Lire";
16 this.stopBtnName = "Stop";
17 this.startBtnName = "Début";
18 this.endBtnName = "Fin";
19 this.nextBtnName = "Suiv.";
20 this.previousBtnName = "Préc.";
21 this.speedupBtnName = "+";
22 this.slowdownBtnName = "-";
23 }
24
25 SVGPlayerButtons.prototype = {
26 style: function(sty){
27 if(sty == "full"){
28 this.playBtn = true;
29 this.stopBtn = true;
30 this.startBtn = true;
31 this.endBtn = true;
32 this.nextBtn = true;
33 this.previousBtn = true;
34 this.speedupBtn = true;
35 this.slowdownBtn = true;
36 }
37 },
38 names: function(lang){
39 if(lang == "en"){
40 this.playBtnName = "Play";
41 this.stopBtnName = "Stop";
42 this.startBtnName = "First";
43 this.endBtnName = "Last";
44 this.nextBtnName = "Next";
45 this.previousBtnName = "Previous";
46 this.speedupBtnName = "+";
47 this.slowdownBtnName = "-";
48 }
49 }
50 }
51
52 // Surcharge de la méthode [Initialisation]
53 SVGPlayerButtons.prototype.Initialisation = function() {
54 var a = this.a;
55 var self = this.me;
56 a.image.style.display = 'inline';
57 a.message.parentNode.removeChild(a.message);
58 if(this.playBtn == true){
59 var play = document.createElement('button');
60 play.className = "SVGplay playBtn"; // ajout de classe
61 play.innerHTML = this.playBtnName; // texte
62 play.onclick = function(){a.action = true; a.rotate(self.a)};
63 a.boutons.appendChild(play);
64 }
65 if(this.stopBtn == true){
66 var stop = document.createElement('button');
67 stop.className = "SVGplay stopBtn";
68 stop.innerHTML = this.stopBtnName;
69 stop.onclick = function(){a.action = false; };
70 a.boutons.appendChild(stop);
71 }
72 if(this.startBtn == true){
73 var debut = document.createElement('button');
74 debut.className = "SVGplay startBtn";
75 debut.innerHTML = this.startBtnName;
76 debut.onclick = function(){a.action = false; a.first(self.a)};
77 a.boutons.appendChild(debut);
78 }
79 if(this.endBtn == true){
80 var fin = document.createElement('button');
81 fin.className = "SVGplay endBtn";
82 fin.innerHTML = this.endBtnName;
83 fin.onclick = function(){a.action = false; a.last(self.a)};
84 a.boutons.appendChild(fin);
85 }
86 if(this.previousBtn == true){
87 var precedent = document.createElement('button');
88 precedent.className = "SVGplay previousBtn";
89 precedent.innerHTML = this.previousBtnName;
90 precedent.onclick = function(){a.action = false; a.previous(self.a)};
91 a.boutons.appendChild(precedent);
92 }
93 if(this.nextBtn == true){
94 var suivant = document.createElement('button');
95 suivant.className = "SVGplay nextBtn";
96 suivant.innerHTML = this.nextBtnName;
97 suivant.onclick = function(){a.action = false; a.next(self.a)};
98 a.boutons.appendChild(suivant);
99 }
100 if(this.slowdownBtn == true){
101 var moins = document.createElement('button');
102 moins.className = "SVGplay slowdownBtn";
103 moins.innerHTML = this.slowdownBtnName;
104 moins.onclick = function(){a.delai = a.delai > 2000 ? 2000 : a.delai * 1.414};
105 a.boutons.appendChild(moins);
106 }
107 if(this.speedupBtn == true){
108 var plus = document.createElement('button');
109 plus.className = "SVGplay speedupBtn";
110 plus.innerHTML = this.speedupBtnName;
111 plus.onclick = function(){a.delai = a.delai < 30 ? 30 : a.delai / 1.414};
112 a.boutons.appendChild(plus);
113 }
114 }

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.