yetty 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +2 -0
  3. data/LICENSE +0 -0
  4. data/README.md +66 -0
  5. data/bin/yetty +9 -4
  6. data/lib/yetty.rb +15 -0
  7. data/lib/yetty/command.rb +136 -0
  8. data/lib/yetty/play.rb +23 -0
  9. data/lib/yetty/push.rb +44 -0
  10. data/lib/yetty/record.rb +73 -0
  11. data/lib/yetty/site.rb +23 -0
  12. data/lib/yetty/site/app.rb +91 -0
  13. data/lib/yetty/site/static/assets/term/bg-gradient.png +0 -0
  14. data/lib/yetty/site/static/config.rb +26 -0
  15. data/lib/yetty/site/static/css/fd-slider.css +1004 -0
  16. data/lib/yetty/site/static/css/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  17. data/lib/yetty/site/static/css/fonts/bootstrap/glyphicons-halflings-regular.svg +229 -0
  18. data/lib/yetty/site/static/css/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  19. data/lib/yetty/site/static/css/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  20. data/lib/yetty/site/static/css/player.css +165 -0
  21. data/lib/yetty/site/static/css/styles.css +8035 -0
  22. data/lib/yetty/site/static/js/bootstrap.js +2323 -0
  23. data/lib/yetty/site/static/js/bootstrap.min.js +12 -0
  24. data/lib/yetty/site/static/js/config.json +429 -0
  25. data/lib/yetty/site/static/js/jquery-2.1.1.min.js +4 -0
  26. data/lib/yetty/site/static/js/nyan/runner.js +92 -0
  27. data/lib/yetty/site/static/js/nyan/three.min.js +724 -0
  28. data/lib/yetty/site/static/js/nyan/threex.nyancat.js +193 -0
  29. data/lib/yetty/site/static/js/nyan/threex.nyancatrainbow.js +89 -0
  30. data/lib/yetty/site/static/js/nyan/threex.nyancatsound.js +33 -0
  31. data/lib/yetty/site/static/js/nyan/threex.nyancatstars.js +116 -0
  32. data/lib/yetty/site/static/js/player/fd-slider.min.js +2 -0
  33. data/lib/yetty/site/static/js/player/player.js +371 -0
  34. data/lib/yetty/site/static/js/player/term.js +4177 -0
  35. data/lib/yetty/site/static/sass/_bootstrap-variables.scss +818 -0
  36. data/lib/yetty/site/static/sass/player.scss +139 -0
  37. data/lib/yetty/site/static/sass/styles.scss +3 -0
  38. data/lib/yetty/site/static/sounds/nyanlooped.mp3 +0 -0
  39. data/lib/yetty/site/static/sounds/nyanslow.mp3 +0 -0
  40. data/lib/yetty/site/views/about.haml +8 -0
  41. data/lib/yetty/site/views/index.haml +13 -0
  42. data/lib/yetty/site/views/layout.haml +33 -0
  43. data/lib/yetty/site/views/recording.haml +34 -0
  44. data/lib/yetty/site/views/recordings.haml +7 -0
  45. data/lib/yetty/site/views/user.haml +28 -0
  46. data/lib/yetty/site/views/users.haml +16 -0
  47. data/lib/yetty/ui.rb +103 -0
  48. data/lib/yetty/user.rb +42 -0
  49. data/lib/yetty/version.rb +4 -0
  50. data/yetty.gemspec +21 -0
  51. metadata +49 -16
@@ -0,0 +1,193 @@
1
+ var THREEx = THREEx || {};
2
+
3
+ /**
4
+ * from original webgl anonymous demo
5
+ */
6
+ THREEx.NyanCat = function(){
7
+ var container = new THREE.Object3D()
8
+ this.container = container
9
+ //POPTART
10
+ var poptart = new THREE.Object3D();
11
+ this.poptart = poptart
12
+ // object x y z w h d color
13
+ helper( poptart, 0, -2, -1, 21, 14, 3, 0x222222);
14
+ helper( poptart, 1, -1, -1, 19, 16, 3, 0x222222);
15
+ helper( poptart, 2, 0, -1, 17, 18, 3, 0x222222);
16
+
17
+ helper( poptart, 1, -2,-1.5, 19, 14, 4, 0xffcc99);
18
+ helper( poptart, 2, -1,-1.5, 17, 16, 4, 0xffcc99);
19
+
20
+ helper( poptart, 2, -4, 2, 17, 10, .6, 0xff99ff);
21
+ helper( poptart, 3, -3, 2, 15, 12, .6, 0xff99ff);
22
+ helper( poptart, 4, -2, 2, 13, 14, .6, 0xff99ff);
23
+
24
+ helper( poptart, 4, -4, 2, 1, 1, .7, 0xff3399);
25
+ helper( poptart, 9, -3, 2, 1, 1, .7, 0xff3399);
26
+ helper( poptart, 12, -3, 2, 1, 1, .7, 0xff3399);
27
+ helper( poptart, 16, -5, 2, 1, 1, .7, 0xff3399);
28
+ helper( poptart, 8, -7, 2, 1, 1, .7, 0xff3399);
29
+ helper( poptart, 5, -9, 2, 1, 1, .7, 0xff3399);
30
+ helper( poptart, 9, -10, 2, 1, 1, .7, 0xff3399);
31
+ helper( poptart, 3, -11, 2, 1, 1, .7, 0xff3399);
32
+ helper( poptart, 7, -13, 2, 1, 1, .7, 0xff3399);
33
+ helper( poptart, 4, -14, 2, 1, 1, .7, 0xff3399);
34
+
35
+ poptart.position.x=-10.5;
36
+ poptart.position.y=9;
37
+ container.add( poptart );
38
+
39
+ //FEET
40
+ var feet = new THREE.Object3D();
41
+ this.feet = feet
42
+ helper( feet, 0, -2, .49, 3, 3, 1, 0x222222);
43
+ helper( feet, 1, -1, .49, 3, 3, 1, 0x222222);
44
+ helper( feet, 1, -2,-.01, 2, 2, 2, 0x999999);
45
+ helper( feet, 2, -1,-.01, 2, 2, 2, 0x999999);
46
+
47
+ helper( feet, 6, -2, -.5, 3, 3, 1, 0x222222);
48
+ helper( feet, 6, -2, -.5, 4, 2, 1, 0x222222);
49
+ helper( feet, 7, -2,-.99, 2, 2, 2, 0x999999);
50
+
51
+ helper( feet, 16, -3, .49, 3, 2, 1, 0x222222);
52
+ helper( feet, 15, -2, .49, 3, 2, 1, 0x222222);
53
+ helper( feet, 15, -2,-.01, 2, 1, 2, 0x999999);
54
+ helper( feet, 16, -3,-.01, 2, 1, 2, 0x999999);
55
+
56
+ helper( feet, 21, -3, -.5, 3, 2, 1, 0x222222);
57
+ helper( feet, 20, -2, -.5, 3, 2, 1, 0x222222);
58
+ helper( feet, 20, -2,-.99, 2, 1, 2, 0x999999);
59
+ helper( feet, 21, -3,-.99, 2, 1, 2, 0x999999);
60
+
61
+ feet.position.x=-12.5;
62
+ feet.position.y=-6;
63
+ container.add( feet );
64
+
65
+ //TAIL
66
+ var tail = new THREE.Object3D();
67
+ this.tail = tail
68
+ helper( tail, 0, 0,-.25, 4, 3, 1.5, 0x222222);
69
+ helper( tail, 1, -1,-.25, 4, 3, 1.5, 0x222222);
70
+ helper( tail, 2, -2,-.25, 4, 3, 1.5, 0x222222);
71
+ helper( tail, 3, -3,-.25, 4, 3, 1.5, 0x222222);
72
+ helper( tail, 1, -1, -.5, 2, 1, 2, 0x999999);
73
+ helper( tail, 2, -2, -.5, 2, 1, 2, 0x999999);
74
+ helper( tail, 3, -3, -.5, 2, 1, 2, 0x999999);
75
+ helper( tail, 4, -4, -.5, 2, 1, 2, 0x999999);
76
+
77
+ tail.position.x=-16.5;
78
+ tail.position.y=2;
79
+ container.add( tail );
80
+
81
+ //FACE
82
+ var face = new THREE.Object3D();
83
+ this.face = face;
84
+ helper( face, 2, -3, -3, 12, 9, 4, 0x222222);
85
+ helper( face, 0, -5, 0, 16, 5, 1, 0x222222);
86
+ helper( face, 1, -1, 0, 4, 10, 1, 0x222222);
87
+ helper( face, 11, -1, 0, 4, 10, 1, 0x222222);
88
+ helper( face, 3, -11, 0, 10, 2, 1, 0x222222);
89
+ helper( face, 2, 0, 0, 2, 2, 1, 0x222222);
90
+ helper( face, 4, -2, 0, 2, 2, 1, 0x222222);
91
+ helper( face, 12, 0, 0, 2, 2, 1, 0x222222);
92
+ helper( face, 10, -2, 0, 2, 2, 1, 0x222222);
93
+
94
+ helper( face, 1, -5, .5, 14, 5, 1, 0x999999);
95
+ helper( face, 3, -4, .5, 10, 8, 1, 0x999999);
96
+ helper( face, 2, -1, .5, 2, 10, 1, 0x999999);
97
+ helper( face, 12, -1, .5, 2, 10, 1, 0x999999);
98
+ helper( face, 4, -2, .5, 1, 2, 1, 0x999999);
99
+ helper( face, 5, -3, .5, 1, 1, 1, 0x999999);
100
+ helper( face, 11, -2, .5, 1, 2, 1, 0x999999);
101
+ helper( face, 10, -3, .5, 1, 1, 1, 0x999999);
102
+ //Eyes
103
+ helper( face, 4, -6, .6, 2, 2, 1, 0x222222);
104
+ helper( face, 11, -6, .6, 2, 2, 1, 0x222222);
105
+ helper( face,3.99,-5.99, .6,1.01,1.01,1.01, 0xffffff);
106
+ helper( face,10.99,-5.99, .6,1.01,1.01,1.01, 0xffffff);
107
+ //MOUTH
108
+ helper( face, 5, -10, .6, 7, 1, 1, 0x222222);
109
+ helper( face, 5, -9, .6, 1, 2, 1, 0x222222);
110
+ helper( face, 8, -9, .6, 1, 2, 1, 0x222222);
111
+ helper( face, 11, -9, .6, 1, 2, 1, 0x222222);
112
+ //CHEEKS
113
+ helper( face, 2, -8, .6, 2, 2, .91, 0xff9999);
114
+ helper( face, 13, -8, .6, 2, 2, .91, 0xff9999);
115
+
116
+ face.position.x=-.5;
117
+ face.position.y=4;
118
+ face.position.z=4;
119
+ container.add(face);
120
+ return;
121
+
122
+ function helper(o, x, y, z, w, h, d, c){
123
+ var material = new THREE.MeshLambertMaterial( { color: c} );
124
+ var geometry = new THREE.CubeGeometry(w, h, d, 1, 1, 1);
125
+ var mesh = new THREE.Mesh( geometry, material );
126
+ mesh.position.x=x+(w/2);
127
+ mesh.position.y=y-(h/2);
128
+ mesh.position.z=z+(d/2);
129
+ o.add( mesh );
130
+ }
131
+ }
132
+
133
+ THREEx.NyanCat.prototype.update = function(delta, now){
134
+ var past = now - delta;
135
+ // compute the frameIdx for present time
136
+ var nFrames = 12
137
+ var animSpeed = 10
138
+ var frameIdxOld = Math.floor((past*animSpeed) % nFrames)
139
+ var frameIdxNow = Math.floor((now *animSpeed) % nFrames)
140
+ // if it is the same as last time, do nothing
141
+ if( frameIdxNow === frameIdxOld ) return;
142
+ // else move the object
143
+ switch(frameIdxNow){
144
+ case 0://2nd frame
145
+ this.face.position.x++;
146
+ this.feet.position.x++;
147
+ break;
148
+ case 1:
149
+ this.face.position.y--;
150
+ this.feet.position.x++;
151
+ this.feet.position.y--;
152
+ this.poptart.position.y--;
153
+ break;
154
+ case 2:
155
+ this.feet.position.x--;
156
+ break;
157
+ case 3:
158
+ this.face.position.x--;
159
+ this.feet.position.x--;
160
+ break;
161
+ case 4:
162
+ this.face.position.y++;
163
+ break;
164
+ case 5:
165
+ this.poptart.position.y++;
166
+ this.feet.position.y++;
167
+ break;
168
+ case 6://8th frame
169
+ this.face.position.x++;
170
+ this.feet.position.x++;
171
+ break;
172
+ case 7:
173
+ this.poptart.position.y--;
174
+ this.face.position.y--;
175
+ this.feet.position.x++;
176
+ this.feet.position.y--;
177
+ break;
178
+ case 8:
179
+ this.feet.position.x--;
180
+ break;
181
+ case 9:
182
+ this.face.position.x--;
183
+ this.feet.position.x--;
184
+ break;
185
+ case 10:
186
+ this.face.position.y++;
187
+ break;
188
+ case 11://1st frame
189
+ this.poptart.position.y++;
190
+ this.feet.position.y++;
191
+ break;
192
+ }
193
+ }
@@ -0,0 +1,89 @@
1
+ var THREEx = THREEx || {};
2
+
3
+ /**
4
+ * from original webgl anonymous demo
5
+ */
6
+ THREEx.NyanCatRainbow = function(){
7
+ var container = new THREE.Object3D()
8
+ this.container = container
9
+
10
+ var numRainChunks=30;
11
+ //RAINBOW
12
+ var rainbow = new THREE.Object3D();
13
+ this.rainbow = rainbow
14
+
15
+ for(var c=0;c<numRainChunks-1;c++){
16
+ var yOffset=8;
17
+ if(c%2==1) yOffset=7;
18
+ var xOffset=(-c*8)-16.5;
19
+ helper( rainbow,xOffset,yOffset, 0, 8, 3, 1, 0xff0000);
20
+ helper( rainbow,xOffset,yOffset-3, 0, 8, 3, 1, 0xff9900);
21
+ helper( rainbow,xOffset,yOffset-6, 0, 8, 3, 1, 0xffff00);
22
+ helper( rainbow,xOffset,yOffset-9, 0, 8, 3, 1, 0x33ff00);
23
+ helper( rainbow,xOffset,yOffset-12, 0, 8, 3, 1, 0x0099ff);
24
+ helper( rainbow,xOffset,yOffset-15, 0, 8, 3, 1, 0x6633ff);
25
+ }
26
+ container.add( rainbow );
27
+
28
+ var rainChunk = new THREE.Object3D();
29
+ this.rainChunk = rainChunk
30
+ helper( rainChunk, -16.5, 7, 0, 8, 3, 1, 0xff0000);
31
+ helper( rainChunk, -16.5, 4, 0, 8, 3, 1, 0xff9900);
32
+ helper( rainChunk, -16.5, 1, 0, 8, 3, 1, 0xffff00);
33
+ helper( rainChunk, -16.5, -2, 0, 8, 3, 1, 0x33ff00);
34
+ helper( rainChunk, -16.5, -5, 0, 8, 3, 1, 0x0099ff);
35
+ helper( rainChunk, -16.5, -8, 0, 8, 3, 1, 0x6633ff);
36
+ rainChunk.position.x-=(8*(numRainChunks-1));
37
+ container.add( rainChunk );
38
+ return
39
+
40
+ function helper(o, x, y, z, w, h, d, c){
41
+ var material = new THREE.MeshLambertMaterial( { color: c} );
42
+ var geometry = new THREE.CubeGeometry(w, h, d, 1, 1, 1);
43
+ var mesh = new THREE.Mesh( geometry, material );
44
+ mesh.position.x=x+(w/2);
45
+ mesh.position.y=y-(h/2);
46
+ mesh.position.z=z+(d/2);
47
+ o.add( mesh );
48
+ }
49
+ }
50
+
51
+
52
+ THREEx.NyanCatRainbow.prototype.update = function(delta, now){
53
+ var past = now - delta;
54
+ // compute the frameIdx for present time
55
+ var nFrames = 12
56
+ var animSpeed = 10
57
+ var frameIdxOld = Math.floor((past*animSpeed) % nFrames)
58
+ var frameIdxNow = Math.floor((now *animSpeed) % nFrames)
59
+ // if it is the same as last time, do nothing
60
+ if( frameIdxNow === frameIdxOld ) return;
61
+ // else move the object
62
+ var numRainChunks=30;
63
+ switch(frameIdxNow){
64
+ case 1:
65
+ this.rainbow.position.x-=9;
66
+ this.rainChunk.position.x+=(8*(numRainChunks-1))-1;
67
+ break;
68
+ case 3:
69
+ this.rainbow.position.x+=9;
70
+ this.rainChunk.position.x-=(8*(numRainChunks-1))-1;
71
+ break;
72
+ case 5:
73
+ this.rainbow.position.x-=9;
74
+ this.rainChunk.position.x+=(8*(numRainChunks-1))-1;
75
+ break;
76
+ case 7:
77
+ this.rainbow.position.x+=9;
78
+ this.rainChunk.position.x-=(8*(numRainChunks-1))-1;
79
+ break;
80
+ case 9:
81
+ this.rainbow.position.x-=9;
82
+ this.rainChunk.position.x+=(8*(numRainChunks-1))-1;
83
+ break;
84
+ case 11://1st frame
85
+ this.rainbow.position.x+=9;
86
+ this.rainChunk.position.x-=(8*(numRainChunks-1))-1;
87
+ break;
88
+ }
89
+ }
@@ -0,0 +1,33 @@
1
+ var THREEx = THREEx || {};
2
+
3
+ /**
4
+ * from original webgl anonymous demo
5
+ */
6
+ THREEx.NyanCatSound = function(){
7
+ var songPaused = document.createElement('audio');
8
+ var soundUrl = THREEx.NyanCatSound.baseUrl+'sounds/nyanslow.mp3'
9
+ this.songPaused = songPaused
10
+ songPaused.setAttribute('src', soundUrl);
11
+ songPaused.setAttribute('loop', 'true');
12
+
13
+ var songRunning = document.createElement('audio')
14
+ var soundUrl = THREEx.NyanCatSound.baseUrl+'sounds/nyanlooped.mp3'
15
+ this.songRunning= songRunning
16
+ songRunning.setAttribute('src', soundUrl);
17
+ songRunning.setAttribute('loop', 'true');
18
+ songRunning.play();
19
+
20
+ var running = true
21
+ this.toggle = function(){
22
+ running = running ? false : true;
23
+ if(running){
24
+ songRunning.play();
25
+ songPaused.pause();
26
+ }else{
27
+ songRunning.pause();
28
+ songPaused.play();
29
+ }
30
+ }.bind(this);
31
+ }
32
+
33
+ THREEx.NyanCatSound.baseUrl = '../'
@@ -0,0 +1,116 @@
1
+ var THREEx = THREEx || {};
2
+
3
+ /**
4
+ * from original webgl anonymous demo
5
+ */
6
+ THREEx.NyanCatStars = function(){
7
+ var container = new THREE.Object3D()
8
+ this.container = container
9
+ var numStars = 10
10
+ this.numStars = numStars
11
+
12
+ var stars = new Array();
13
+ this.stars = stars
14
+ for(var state=0;state<6;state++){
15
+ stars.push(new Array());
16
+ for(var c=0;c<numStars;c++){
17
+ var star = new THREE.Object3D();
18
+ star.position.x=Math.random() * 200 - 100;
19
+ star.position.y=Math.random() * 200 - 100;
20
+ star.position.z=Math.random() * 200 - 100;
21
+ buildStar(star, state);
22
+ container.add( star );
23
+ stars[state].push(star);
24
+ }
25
+ }
26
+
27
+ function buildStar(star, state) {
28
+ switch(state){
29
+ case 0:
30
+ helper( star, 0, 0, 0, 1, 1, 1, 0xffffff);
31
+ break;
32
+ case 1:
33
+ helper( star, 1, 0, 0, 1, 1, 1, 0xffffff);
34
+ helper( star,-1, 0, 0, 1, 1, 1, 0xffffff);
35
+ helper( star, 0, 1, 0, 1, 1, 1, 0xffffff);
36
+ helper( star, 0,-1, 0, 1, 1, 1, 0xffffff);
37
+ break;
38
+ case 2:
39
+ helper( star, 1, 0, 0, 2, 1, 1, 0xffffff);
40
+ helper( star,-2, 0, 0, 2, 1, 1, 0xffffff);
41
+ helper( star, 0, 2, 0, 1, 2, 1, 0xffffff);
42
+ helper( star, 0,-1, 0, 1, 2, 1, 0xffffff);
43
+ break;
44
+ case 3:
45
+ helper( star, 0, 0, 0, 1, 1, 1, 0xffffff);
46
+ helper( star, 2, 0, 0, 2, 1, 1, 0xffffff);
47
+ helper( star,-3, 0, 0, 2, 1, 1, 0xffffff);
48
+ helper( star, 0, 3, 0, 1, 2, 1, 0xffffff);
49
+ helper( star, 0,-2, 0, 1, 2, 1, 0xffffff);
50
+ break;
51
+ case 4:
52
+ helper( star, 0, 3, 0, 1, 1, 1, 0xffffff);
53
+ helper( star, 2, 2, 0, 1, 1, 1, 0xffffff);
54
+ helper( star, 3, 0, 0, 1, 1, 1, 0xffffff);
55
+ helper( star, 2,-2, 0, 1, 1, 1, 0xffffff);
56
+ helper( star, 0,-3, 0, 1, 1, 1, 0xffffff);
57
+ helper( star,-2,-2, 0, 1, 1, 1, 0xffffff);
58
+ helper( star,-3, 0, 0, 1, 1, 1, 0xffffff);
59
+ helper( star,-2, 2, 0, 1, 1, 1, 0xffffff);
60
+ break;
61
+ case 5:
62
+ helper( star, 2, 0, 0, 1, 1, 1, 0xffffff);
63
+ helper( star,-2, 0, 0, 1, 1, 1, 0xffffff);
64
+ helper( star, 0, 2, 0, 1, 1, 1, 0xffffff);
65
+ helper( star, 0,-2, 0, 1, 1, 1, 0xffffff);
66
+ break;
67
+ }
68
+ }
69
+ function helper(o, x, y, z, w, h, d, c){
70
+ var material = new THREE.MeshLambertMaterial( { color: c} );
71
+ var geometry = new THREE.CubeGeometry(w, h, d, 1, 1, 1);
72
+ var mesh = new THREE.Mesh( geometry, material );
73
+ mesh.position.x=x+(w/2);
74
+ mesh.position.y=y-(h/2);
75
+ mesh.position.z=z+(d/2);
76
+ o.add( mesh );
77
+ }
78
+ }
79
+
80
+
81
+ THREEx.NyanCatStars.prototype.update = function(delta, now){
82
+ var numStars = this.numStars
83
+ // compute the frameIdx for present time
84
+ var nFrames = 6
85
+ var animSpeed = 7
86
+ var past = now - delta;
87
+ var frameIdxOld = Math.floor((past*animSpeed) % nFrames)
88
+ var frameIdxNow = Math.floor((now *animSpeed) % nFrames)
89
+ // if it is the same as last time, do nothing
90
+ if( frameIdxNow === frameIdxOld ) return;
91
+ // else move the object
92
+ var stars = this.stars
93
+ for(var c = 0;c < numStars ;c++){
94
+ var tempX = stars[5][c].position.x
95
+ var tempY = stars[5][c].position.y
96
+ var tempZ = stars[5][c].position.z
97
+
98
+ for(var state=5;state>0;state--){
99
+ var star = stars[state ][c];
100
+ var star2 = stars[state-1][c];
101
+
102
+ star.position.x = star2.position.x-8;
103
+ star.position.y = star2.position.y;
104
+ star.position.z = star2.position.z;
105
+
106
+ if( star.position.x < -100 ){
107
+ star.position.x+=200;
108
+ star.position.y = Math.random() * 200 - 100;
109
+ star.position.z = Math.random() * 200 - 100;
110
+ }
111
+ }
112
+ stars[0][c].position.x=tempX;
113
+ stars[0][c].position.y=tempY;
114
+ stars[0][c].position.z=tempZ;
115
+ }
116
+ }
@@ -0,0 +1,2 @@
1
+ /*! Unobtrusive Slider Control / HTML5 Input Range polyfill - MIT/GPL2 @freqdec */
2
+ var fdSlider=function(){function ut(n){function nf(n){n=!!n,n!=ft&&(ft=n,pt(kt()))}function nu(){if(!p||d=="select")return;var n=g(e);if(n.min==tt&&n.max==st&&n.step==nt)return;tt=+n.min,st=+n.max,ut=tt,it=st,nt=+n.step,ir=Math.abs(st-tt),li=nt*2,bi=Math.ceil(ir/nt),ft=!1,ar(tt,st)}function gr(n){if(oi&&!n)return;try{di(l,-1),i(l,"focus",fu),i(l,"blur",su),o?i(l,"keypress",yi):(i(l,"keydown",yi),i(l,"keypress",ou)),i(a,"mouseover",br),i(a,"mouseout",sr),i(a,"mousedown",fi),i(a,"touchstart",fi),c&&(window.addEventListener&&!window.devicePixelRatio?window.removeEventListener("DOMMouseScroll",at,!1):(i(document,"mousewheel",at),i(window,"mousewheel",at)))}catch(t){}u(v,"fd-slider-focused"),u(v,"fd-slider-active"),f(v,"fd-slider-disabled"),a.setAttribute("aria-disabled",!0),e.disabled=oi=!0,clearTimeout(ht),n||ot("disable")}function hu(n){if(!oi&&!n)return;di(l,0),t(l,"focus",fu),t(l,"blur",su),o?t(l,"keypress",yi):(t(l,"keydown",yi),t(l,"keypress",ou)),t(a,"touchstart",fi),t(a,"mousedown",fi),t(a,"mouseover",br),t(a,"mouseout",sr),u(v,"fd-slider-disabled"),a.setAttribute("aria-disabled",!1),e.disabled=oi=gt=!1,n||ot("enable")}function ku(){clearTimeout(ht),ri=vt=l=a=v=ht=null,ot("destroy"),ki=null}function ii(){wr();try{var t=a.offsetWidth,n=a.offsetHeight,r=l.offsetWidth,i=l.offsetHeight,o=vt.offsetHeight,s=vt.offsetWidth,u=b?n-i:t-r;ct=u/bi,ni=Math.max(et?er(tr(ut)):Math.abs((ut-tt)/nt)*ct,0),bt=Math.min(et?er(tr(it)):Math.abs((it-tt)/nt)*ct,Math.floor(b?n-i:t-r)),ru=t,dr=n,pt(nr?kt():d=="select"?e.selectedIndex:parseFloat(e.value),!1)}catch(f){}ot("redraw")}function ot(n){var r,i,u,t;if(wt){if(n.match(/^(blur|focus|change)$/i))if(typeof document.createEvent!="undefined")t=document.createEvent("HTMLEvents"),t.initEvent(n,!0,!0),e.dispatchEvent(t);else if(typeof document.createEventObject!="undefined")try{t=document.createEventObject(),e.fireEvent("on"+n.toLowerCase(),t)}catch(f){}}else if(ki.hasOwnProperty(n))for(r={userSet:ft,disabled:oi,elem:e,value:d=="select"?e.options[e.selectedIndex].value:e.value},i=0;u=ki[n][i];i++)u.call(e,r)}function fu(){return f(v,"fd-slider-focused"),h.onfocus&&(ft=!0,pt(kt())),c&&(t(window,"DOMMouseScroll",at),t(document,"mousewheel",at),o||t(window,"mousewheel",at)),ot("focus"),!0}function su(){u(v,"fd-slider-focused"),c&&(i(document,"mousewheel",at),i(window,"DOMMouseScroll",at),o||i(window,"mousewheel",at)),lt=!0,ot("blur")}function at(n){if(!lt)return;n=n||window.event;var t=0,i;n.wheelDelta?(t=n.wheelDelta/120,o&&window.opera.version()<9.2&&(t=-t)):n.detail&&(t=-n.detail/3),b&&(t=-t),t&&(i=kt(),i+=t<0?-nt:nt,ft=!0,pt(hi(i))),s(n)}function ou(n){return n=n||window.event,n.keyCode>=33&&n.keyCode<=40||!lt||n.keyCode==45||n.keyCode==46?k(n):!0}function yi(n){if(!lt)return!0;n=n||window.event;var t=n.keyCode!==null?n.keyCode:n.charCode,i;if(t<33||t>40&&t!=45&&t!=46)return!0;i=kt(),t==37||t==40||t==46||t==34?i-=n.ctrlKey||t==34?+li:+nt:t==39||t==38||t==45||t==33?i+=n.ctrlKey||t==33?+li:+nt:t==35?i=it:t==36&&(i=ut),ft=!0,pt(hi(i)),ot("update"),s(n)}function br(){f(v,"fd-slider-hover")}function sr(){u(v,"fd-slider-hover")}function fi(n){var u,r;n=n||window.event,s(n),n.target?u=n.target:n.srcElement&&(u=n.srcElement),u&&u.nodeType==3&&(u=u.parentNode);if(n.touches){if(n.targetTouches&&n.targetTouches.length!=1)return!1;n=n.touches[0],gt=!0}return clearTimeout(ht),ht=null,lt=!1,ft=!0,u.className.search("fd-slider-handle")!=-1?(rr=b?n.clientY:n.clientX,tu=parseInt(b?l.offsetTop:l.offsetLeft)||0,ci(n),gt?(t(document,"touchmove",ci),t(document,"touchend",vi),i(a,"mousedown",fi)):(t(document,"mousemove",ci),t(document,"mouseup",vi)),f(v,"fd-slider-active"),f(document.body,"fd-slider-drag-"+(b?"vertical":"horizontal")),ot("dragstart")):(wr(),r=0,n.pageX||n.pageY?r=b?n.pageY:n.pageX:(n.clientX||n.clientY)&&(r=b?n.clientY+document.body.scrollTop+document.documentElement.scrollTop:n.clientX+document.body.scrollLeft+document.documentElement.scrollLeft),r-=b?hr+Math.round(l.offsetHeight/2):iu+Math.round(l.offsetWidth/2),r=pi(r),pr=="tween"?(f(v,"fd-slider-active"),bu(r)):pr=="timed"?(f(v,"fd-slider-active"),t(document,gt?"touchend":"mouseup",cr),ui=r,yr()):ai(r)),!1}function cr(n){return n=n||window.event,s(n),i(document,gt?"touchend":"mouseup",cr),u(v,"fd-slider-active"),clearTimeout(ht),ht=null,lt=!0,!1}function vi(n){return n=n||window.event,s(n),gt?(i(document,"touchmove",ci),i(document,"touchend",vi)):(i(document,"mousemove",ci),i(document,"mouseup",vi)),lt=!0,u(document.body,"fd-slider-drag-"+(b?"vertical":"horizontal")),u(v,"fd-slider-active"),ot("dragend"),!1}function ci(n){n=n||window.event,s(n);if(n.touches){if(n.targetTouches&&n.targetTouches.length!=1)return!1;n=n.touches[0]}return ai(pi(tu+(b?n.clientY-rr:n.clientX-rr))),!1}function ei(n){var t=kt();ft=!0,t+=n*nt,pt(hi(t))}function wr(){var i=0,t=0,n=a;try{do i+=n.offsetLeft,t+=n.offsetTop;while(n=n.offsetParent)}catch(r){}iu=i,hr=t}function yr(){var n=parseInt(b?l.offsetTop:l.offsetLeft,10);n=Math.round(ui<n?Math.max(ui,Math.floor(n-ct)):Math.min(ui,Math.ceil(n+ct))),ai(pi(n)),n!=ui?ht=setTimeout(yr,bi>20?50:100):(lt=!0,u(v,"fd-slider-active"),ot("finalise"))}function bu(n){lt=!1,or=parseInt(n,10),fr=parseInt(b?l.offsetTop:l.offsetLeft,10),uu=or-fr,lu=20,ur=0,ht||(ht=setTimeout(gi,20))}function si(n){return isNaN(n)||n===""||typeof n=="undefined"?(ft=!1,yt):n<Math.min(ut,it)?(ft=!1,Math.min(ut,it)):n>Math.max(ut,it)?(ft=!1,Math.max(ut,it)):(ft=!0,n)}function kt(){return hi(d=="input"?parseFloat(e.value):e.selectedIndex)}function hi(n){return isNaN(n)||n===""||typeof n=="undefined"?yt:Math.min(Math.max(n,Math.min(ut,it)),Math.max(ut,it))}function ai(n){var t=hi(et?du(tf(n)):b?st-Math.round(n/ct)*nt:tt+Math.round(n/ct)*nt);l.style[b?"top":"left"]=(n||0)+"px",lr(),vr(d=="select"||nt==1?Math.round(t):t)}function pt(n,t){var r=!1,i;(typeof n=="undefined"||isNaN(n)||n==="")&&d=="input"&&!nr?(i=yt,r=!0,ft=!1):i=si(n),l.style[b?"top":"left"]=(et?er(tr(i)):b?Math.round((st-i)/nt*ct):Math.round((i-tt)/nt*ct))+"px",lr(),!0&&vr(r?"":i)}function pi(n){if(et)return Math.max(Math.min(bt,n),ni);var t=n%ct;return t&&t>=ct/2?n+=ct-t:n-=t,n<Math.min(Math.abs(ni),Math.abs(bt))?n=Math.min(Math.abs(ni),Math.abs(bt)):n>Math.max(Math.abs(ni),Math.abs(bt))&&(n=Math.max(Math.abs(ni),Math.abs(bt))),Math.min(Math.max(n,0),bt)}function du(n){var i=0,r=tt,u,t;for(t in et){if(!et.hasOwnProperty(t))continue;n<i||n>+t||(u=r+(n-i)*(+et[t]-r)/(+t-i)),i=+t,r=+et[t]}return u}function tr(n){var r=0,i=tt,u=0,t;for(t in et){if(!et.hasOwnProperty(t))continue;n<i||n>+et[t]||(u=r+(n-i)*(+t-r)/(+et[t]-i)),r=+t,i=+et[t]}return u}function er(n){return(a[b?"offsetHeight":"offsetWidth"]-l[b?"offsetHeight":"offsetWidth"])/100*n}function tf(n){return n/((a[b?"offsetHeight":"offsetWidth"]-a[l?"offsetHeight":"offsetWidth"])/100)}function vr(n){ot("update"),ft?u(v,"fd-slider-no-value"):f(v,"fd-slider-no-value");if(d=="select")try{n=parseInt(n,10);if(e.selectedIndex===n){dt();return}e.options[n].selected=!0}catch(t){}else{n===""||wi||(n=(tt+Math.round((+n-tt)/nt)*nt).toFixed(yu));if(e.value===n){dt();return}e.value=n}dt(),ot("change")}function ar(n,t){ut>it?(n=Math.min(tt,Math.max(n,t)),t=Math.max(st,Math.min(n,t)),ut=Math.max(n,t),it=Math.min(n,t)):(n=Math.max(tt,Math.min(n,t)),t=Math.min(st,Math.max(n,t)),ut=Math.min(n,t),it=Math.max(n,t)),yt<Math.min(ut,it)?yt=Math.min(ut,it):yt>Math.max(ut,it)&&(yt=Math.max(ut,it)),l.setAttribute("aria-valuemin",ut),l.setAttribute("aria-valuemax",it),si(d=="input"?parseFloat(e.value):e.selectedIndex),ii()}function lr(){if(y)return;b?ti.style.height=Math.max(1,vt.offsetHeight-l.offsetTop)+"px":ti.style.width=Math.max(1,l.offsetLeft)+"px"}function cu(){for(var t=!1,r=document.getElementsByTagName("label"),n,i=0;n=r[i];i++)if(n.htmlFor&&n.htmlFor==e.id||n.getAttribute("for")==e.id){t=n;break}return t&&!t.id&&(t.id=e.id+"_label"),t}function dt(){var n=d=="select"?e.options[e.selectedIndex].value:e.value,t=kr?kr(n):d=="select"?e.options[e.selectedIndex].text?e.options[e.selectedIndex].text:n:n;l.setAttribute("aria-valuenow",n),l.setAttribute("aria-valuetext",t)}function wu(){ft=!0,wi=gu,pt(d=="input"?parseFloat(e.value):e.selectedIndex),dt(),wi=!1}function pu(){d=="input"?e.value=e.defaultValue:e.selectedIndex=au,si(d=="select"?e.options[e.selectedIndex].value:e.value),ii(),dt()}function di(n,t){n.setAttribute("tabIndex",t),n.tabIndex=t}var e=n.inp,oi=!1,d=e.tagName.toLowerCase(),tt=+n.min,st=+n.max,ut=+n.min,it=+n.max,ir=Math.abs(st-tt),nt=d=="select"?1:+n.step,li=n.maxStep?+n.maxStep:nt*2,yu=n.precision||0,bi=Math.ceil(ir/nt),et=n.scale||!1,rf=!!n.hideInput,pr=n.animation||"",b=!!n.vertical,ki=n.callbacks||{},vu=n.classNames||"",wt=!!n.html5Shim,yt=st<tt?tt:tt+(st-tt)/2,au=d=="select"?e.selectedIndex:e.defaultValue||yt,nr=wt||!!n.forceValue,eu=wt&&b&&"inpHeight"in n?n.inpHeight:!1,kr=!wt&&n.ariaFormat?n.ariaFormat:!1,gu=!wt&&!(d=="select")&&"userSnap"in n?!!n.userSnap:!1,wi=!1,ht=null,lt=!0,ff=d=="select"?e.selectedIndex:e.value,dr=0,ru=0,or=0,fr=0,uu=0,lu=0,ur=0,iu=0,hr=0,bt=0,ni=0,tu=0,ui=0,rr=0,ct=0,ft=!1,gt=!1,a,v,ri,l,ti,vt,gi;return d=="input"&&nr&&!e.defaultValue&&(e.defaultValue=kt()),st<tt&&(nt=-Math.abs(nt),li=-Math.abs(li)),et&&(et[100]=st),gi=function(){ur++;var r=uu,n=20,t=ur,i=fr,f=Math.ceil(t==n?i+r:r*(-Math.pow(2,-10*t/n)+1)+i);ai(t==n?or:f),t!=n?(ot("move"),ht=setTimeout(gi,20)):(clearTimeout(ht),ht=null,lt=!0,u(v,"fd-slider-focused"),u(v,"fd-slider-active"),ot("finalise"))},(function(){if(wt||rf){f(e,"fd-form-element-hidden");try{e.type!="range"&&r(e,"type")=="range"&&document.defaultView.getComputedStyle(e,null).getPropertyValue("display")=="inline-block"&&(e.type="number")}catch(i){}}else t(e,"change",wu);wt&&(e.setAttribute("fd-range-enabled",1),e.stepUp=function(n){ei(n||1)},e.stepDown=function(n){ei(n||-1)},p&&t(e,typeof e.onpropertychange=="object"?"propertychange":"DOMAttrModified",nu)),a=document.createElement("span"),a.className="fd-slider"+(b?"-vertical ":" ")+vu,a.id="fd-slider-"+e.id,b&&eu&&(a.style.height=eu+"px"),v=document.createElement("span"),v.className="fd-slider-wrapper"+(wt?"":" fd-slider-no-value"),ri=document.createElement("span"),ri.className="fd-slider-inner",vt=document.createElement("span"),vt.className="fd-slider-bar",rt?l=document.createElement("span"):(l=document.createElement("a"),l.setAttribute("href","#"),t(l,"click",k)),di(l,0),l.className="fd-slider-handle",l.appendChild(document.createTextNode(String.fromCharCode(160))),v.appendChild(ri),y||(ti=document.createElement("span"),ti.className="fd-slider-range",v.appendChild(ti)),v.appendChild(vt),v.appendChild(l),a.appendChild(v),e.parentNode.insertBefore(a,e),o&&(l.unselectable="on",vt.unselectable="on",ri.unselectable="on",a.unselectable="on",v.unselectable="on",y||(ti.unselectable="on")),a.setAttribute("role","application"),l.setAttribute("role","slider"),l.setAttribute("aria-valuemin",d=="select"?e.options[0].value:tt),l.setAttribute("aria-valuemax",d=="select"?e.options[e.options.length-1].value:st);var n=cu();if(n){l.setAttribute("aria-labelledby",n.id),l.id="fd-slider-handle-"+e.id;/*@if(@_win32)n.setAttribute("htmlFor",l.id);@else@*/n.setAttribute("for",l.id);/*@end@*/}document.getElementById(w)&&l.setAttribute("aria-describedby",w),e.getAttribute("disabled")==!0||e.getAttribute("disabled")=="disabled"?gr(!0):hu(!0),h.onvalue&&(ft=!0,si(d=="input"?parseFloat(e.value):e.selectedIndex)),e.form&&t(e.form,"reset",pu),dt(),ot("create"),ii()})(),{onResize:function(){(a.offsetHeight!=dr||a.offsetWidth!=ru)&&ii()},destroy:function(){ku()},reset:function(){pt(d=="input"?parseFloat(e.value):e.selectedIndex)},stepUp:function(n){ei(Math.abs(n)||1)},stepDown:function(n){ei(-Math.abs(n)||-1)},increment:function(n){ei(n)},disable:function(){gr()},enable:function(){hu()},setRange:function(n,t){ar(n,t)},getValueSet:function(){return!!ft},setValueSet:function(n){nf(n)},rescan:function(){nu()},checkValue:function(){h.onvalue&&(ft=!0,si(d=="input"?parseFloat(e.value):e.selectedIndex)),dt(),ii()}}}var n={},lt=0,c=!0,rt=!0,w="fd-slider-describedby",h={onfocus:!0,onvalue:!0},y=!1,ft="jump",p=!1,o=Object.prototype.toString.call(window.opera)==="[object Opera]",v=/^([\-]{0,1}[0-9]+(\.[0-9]+){0,1})$/,b=/^([0-9]+(\.[0-9]+){0,1})$/,ot=function(n){if(typeof n!="string"||n==="")return{};try{if(typeof JSON=="object"&&typeof JSON.parse=="function")return JSON.parse(n);if(/mousewheelenabled|fullaria|describedby|norangebar|html5animation|varsetrules/.test(n.toLowerCase())){var t=Function(["var document,top,self,window,parent,Number,Date,Object,Function,","Array,String,Math,RegExp,Image,ActiveXObject;","return (",n.replace(/<\!--.+-->/gim,"").replace(/\bfunction\b/g,"function-"),");"].join(""));return t()}}catch(i){}return{err:"Could not parse the JSON object"}},it=function(n){if(typeof n!="object")return;for(var t in n){value=n[t];switch(t.toLowerCase()){case"mousewheelenabled":c=!!value;break;case"fullaria":rt=!!value;break;case"describedby":w=String(value);break;case"norangebar":y=!!value;break;case"html5animation":ft=String(value).search(/^(jump|tween|timed)$/i)!=-1?String(value).toLowerCase():"jump";break;case"watchattributes":p=!!value;break;case"varsetrules":"onfocus"in value&&(h.onfocus=!!value.onfocus),"onvalue"in value&&(h.onvalue=!!value.onvalue)}}},t=function(n,t,i){n.addEventListener?n.addEventListener(t,i,!0):n.attachEvent&&n.attachEvent("on"+t,i)},i=function(n,t,i){try{n.removeEventListener?n.removeEventListener(t,i,!0):n.detachEvent&&n.detachEvent("on"+t,i)}catch(r){}},k=function(n){n=n||window.event,n.stopPropagation&&(n.stopPropagation(),n.preventDefault());/*@cc_on@if(@_win32)n.cancelBubble=!0,n.returnValue=!1;@end@*/return!1},s=function(n){n=n||window.event;if(n.preventDefault){n.preventDefault();return}n.returnValue=!1},f=function(n,t){if(new RegExp("(^|\\s)"+t+"(\\s|$)").test(n.className))return;n.className+=(n.className?" ":"")+t},u=function(n,t){n.className=t?n.className.replace(new RegExp("(^|\\s)"+t+"(\\s|$)")," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""):""},ct=function(){var i={},t;for(t in n)i[t]=n[t].getValueSet();return i},st=function(t,i){n[t].setValueSet(!!i)},e=function(t){return!!(t in n&&n.hasOwnProperty(t))},vt=function(t){if(!t||!t.inp||!t.inp.tagName||t.inp.tagName.search(/^input|select/i)==-1)return!1;t.html5Shim=!1;if(t.inp.tagName.toLowerCase()=="select"){if(t.inp.options.length<2)return!1;t.min=0,t.max=t.inp.options.length-1,t.step=1,t.precision=0,t.scale=!1,t.forceValue=!0}else{if(String(t.inp.type).search(/^(text|range)$/i)==-1)return!1;t.min=t.min&&String(t.min).search(v)!=-1?+t.min:0,t.max=t.max&&String(t.max).search(v)!=-1?+t.max:100,t.step=t.step&&String(t.step).search(b)!=-1?t.step:1,t.precision=t.precision&&String(t.precision).search(/^[0-9]+$/)!=-1?t.precision:String(t.step).search(/\.([0-9]+)$/)!=-1?String(t.step).match(/\.([0-9]+)$/)[1].length:0,t.scale=t.scale||!1,t.forceValue="forceValue"in t?!!t.forceValue:!1,t.userSnap="userSnap"in t?!!t.userSnap:!1}return t.ariaFormat="ariaFormat"in t&&typeof t.ariaFormat=="function"?t.ariaFormat:!1,t.maxStep=t.maxStep&&String(t.maxStep).search(b)!=-1?+t.maxStep:+t.step*2,t.classNames=t.classNames||"",t.callbacks=t.callbacks||!1,a(t.inp.id),n[t.inp.id]=new ut(t),!0},r=function(n,t){return n.getAttribute(t)||""},l=function(){for(var e=document.getElementsByTagName("input"),i,u,t,f=0;t=e[f];f++)if(t.tagName.toLowerCase()=="input"&&r(t,"type")&&r(t,"type").toLowerCase()=="range"&&(r(t,"min")&&r(t,"min").search(v)!=-1||r(t,"max")&&r(t,"max").search(v)!=-1||r(t,"step")&&r(t,"step").search(/^(any|([0-9]+(\.[0-9]+){0,1}))$/i)!=-1)){if(t.id&&document.getElementById("fd-slider-"+t.id))continue;else t.id&&!document.getElementById("fd-slider-"+t.id)&&a(t.id);t.id||(t.id="fd-slider-form-elem-"+lt++),i={inp:t,callbacks:[],animation:ft,vertical:r(t,"data-fd-slider-vertical")?!0:t.offsetHeight>t.offsetWidth,classNames:r(t,"data-fd-slider-vertical"),html5Shim:!0},i.vertical&&!r(t,"data-fd-slider-vertical")&&(i.inpHeight=t.offsetHeight),u=g(t),i.min=u.min,i.max=u.max,i.step=u.step,i.precision=String(i.step).search(/\.([0-9]+)$/)!=-1?String(i.step).match(/\.([0-9]+)$/)[1].length:0,i.maxStep=i.step*2,a(i.inp.id),n[i.inp.id]=new ut(i)}return!0},g=function(n){return{min:+(r(n,"min")||0),max:+(r(n,"max")||100),step:+(r(n,"step").search(b)!=-1?n.getAttribute("step"):1)}},a=function(t){return t in n&&n.hasOwnProperty(t)?(n[t].destroy(),delete n[t],!0):!1},tt=function(){for(var i in n)n.hasOwnProperty(i)&&n[i].destroy();n=[]},at=function(){tt(),n=null},d=function(){for(var i in n)n.hasOwnProperty(i)&&n[i].onResize()},et=function(){for(var t in n)n.hasOwnProperty(t)&&n[t].rescan()},ht=function(){nt(),l()},nt=function(){i(window,"load",l)};t(window,"load",l),t(window,"load",function(){setTimeout(function(){var t;for(t in n)n[t].checkValue()},0)}),t(window,"resize",d),t(window,"unload",at),(function(){var t=document.getElementsByTagName("script"),n=ot(String(t[t.length-1].innerHTML).replace(/[\n\r\s\t]+/g," ").replace(/^\s+/,"").replace(/\s+$/,""));typeof n!="object"||"err"in n||it(n)})();/*@if(@_jscript_version<9)f(document.documentElement,"oldie");@end@*/return{rescanDocument:l,createSlider:function(n){return vt(n)},onDomReady:function(){ht()},destroyAll:function(){tt()},destroySlider:function(n){return a(n)},redrawAll:function(){d()},addEvent:t,removeEvent:i,stopEvent:k,increment:function(t,i){if(!e(t))return!1;n[t].increment(i)},stepUp:function(t,i){if(!e(t))return!1;n[t].stepUp(Math.abs(i)||1)},stepDown:function(t,i){if(!e(t))return!1;n[t].stepDown(-Math.abs(i)||-1)},setRange:function(t,i,r){if(!e(t))return!1;n[t].setRange(i,r)},updateSlider:function(t){if(!e(t))return!1;n[t].onResize(),n[t].reset()},disable:function(t){if(!e(t))return!1;n[t].disable()},enable:function(t){if(!e(t))return!1;n[t].enable()},getValueSet:function(){return ct()},setValueSet:function(n,t){if(!e(id))return!1;st(n,t)},setGlobalVariables:function(n){it(n)},removeOnload:function(){nt()},rescanAttributes:et}}()
@@ -0,0 +1,371 @@
1
+ "use strict;"
2
+
3
+ if (window) {
4
+ window.VT = (typeof VT === 'undefined' ? {} : window.VT);
5
+ } else {
6
+ var VT = {};
7
+ }
8
+
9
+ VT.Player = function(term) {
10
+ this.term = term;
11
+ this.data = null;
12
+ this.timing = null;
13
+ this.element = document.getElementById('player');
14
+ this.el = $(this.element);
15
+ this.speedup = 1;
16
+
17
+ this.currentFrame = 0;
18
+ this.calculateTermSize();
19
+ this.initSpeedControl();
20
+ this.initOverlay();
21
+ this.initTermContainer();
22
+ this.initHeader();
23
+ this.initProgress();
24
+ this.initControls();
25
+ this.initCmdline();
26
+ this.initExtraTools();
27
+ }
28
+
29
+ VT.Player.prototype.spinerOptions = {
30
+ lines: 12, // The number of lines to draw
31
+ length: 23, // The length of each line
32
+ width: 7, // The line thickness
33
+ radius: 40, // The radius of the inner circle
34
+ rotate: 44, // The rotation offset
35
+ color: '#fff', // #rgb or #rrggbb
36
+ speed: 0.7, // Rounds per second
37
+ trail: 50, // Afterglow percentage
38
+ shadow: false, // Whether to render a shadow
39
+ hwaccel: false, // Whether to use hardware acceleration
40
+ zIndex: 2e9 // The z-index (defaults to 2000000000)
41
+ }
42
+
43
+ VT.Player.prototype.initSpeedControl = function() {
44
+ var speed = jQuery('.speed');
45
+ var player = this;
46
+ fdSlider.createSlider({
47
+ inp: document.getElementsByClassName("speed")[0],
48
+ value: 2.5,
49
+ step:0.5,
50
+ maxStep:1,
51
+ min:1,
52
+ max:10,
53
+ animation: 'tween',
54
+ hideInput: true,
55
+ forceValue: true,
56
+ callbacks: {
57
+ update: [function (update) {
58
+ player.speedup = update.value;
59
+ }]
60
+ }
61
+ });
62
+ }
63
+
64
+ VT.Player.prototype.jumpTo = function(percent) {
65
+ var player = this;
66
+ var i;
67
+
68
+ this.term.reset();
69
+
70
+ this.setProgress(percent);
71
+ for (i = 0; i < percent; i++) {
72
+ if (this.framesByPercent[i]) {
73
+ this.framesByPercent[i].forEach(function(frameNumber) {
74
+ player.term.write(player.frames[frameNumber][1]);
75
+ player.currentFrame = frameNumber;
76
+ })
77
+ }
78
+ }
79
+ }
80
+
81
+ VT.Player.prototype.percentToFrameNumber = function(percent) {
82
+ return this.framesByPercent[percent];
83
+ }
84
+
85
+ VT.Player.prototype.initProgress = function() {
86
+ var player = this;
87
+ this.progress = this.el.find('.progress');
88
+ this.progressBar = this.progress.find('.bar');
89
+
90
+ this.progress.click(function(e) {
91
+ var pixPosition = e.pageX - this.offsetLeft;
92
+ var percentPix = $(this).width() / 100;
93
+ var percent = pixPosition / percentPix;
94
+ player.jumpTo(percent);
95
+ })
96
+
97
+ this.progress.prop('max', 100);
98
+ this.setProgress(0);
99
+ }
100
+
101
+ VT.Player.prototype.initControls = function() {
102
+ // this.controls = this.element.getElementsByClassName('controls')[0];
103
+ // this.controls.setAttribute("style", "width:" + this.termWidth + "px");
104
+ }
105
+
106
+ VT.Player.prototype.initCmdline = function() {
107
+ this.cmdline = this.element.getElementsByClassName('cmdline')[0];
108
+ this.cmdline.setAttribute("style", "width:" + (this.termWidth - 6) + "px");
109
+ this.cmdline.addEventListener('click', function(e) {
110
+ e.target.select()
111
+ }, true)
112
+ }
113
+
114
+ VT.Player.prototype.calculateTermSize = function() {
115
+ this.termWidth = (this.term.cols * 7);
116
+ this.termHeight = (this.term.rows * 13);
117
+ this.element.setAttribute("style", "width:" + this.termWidth + "px");
118
+ }
119
+
120
+ VT.Player.prototype.initHeader = function() {
121
+ this.header = this.element.getElementsByClassName('header')[0];
122
+ this.header.setAttribute("style", "width:" + this.termWidth + "px");
123
+ }
124
+
125
+ VT.Player.prototype.initTermContainer = function() {
126
+ var term = document.getElementById('term');
127
+ term.setAttribute("style", "width:" + this.termWidth + "px");
128
+ }
129
+
130
+ VT.Player.prototype.load = function(path) {
131
+ var player = this;
132
+
133
+ this.overlayLoading()
134
+
135
+ jQuery.get(path).success(function(resp){
136
+ player.record = resp;
137
+ player.setTiming(player.record.timing);
138
+ player.setData(player.record.typescript);
139
+ player.prepareFrames();
140
+ player.calculateTotalTime();
141
+ player.mapFrameToPercents();
142
+ player.enableButtons();
143
+ player.overlayHide();
144
+ }).error(function (resp) {
145
+ player.onError();
146
+ console.log("Error downloading record:", resp)
147
+ });
148
+ }
149
+
150
+ VT.Player.prototype.setTiming = function(data) {
151
+ var timing = [];
152
+ data.split("\n").forEach(function(line){
153
+ var timeBytes = line.split(" ");
154
+ timeBytes = [parseFloat(timeBytes[0]), parseInt(timeBytes[1])];
155
+ if (!isNaN(timeBytes[0]) && !isNaN(timeBytes[1])) {
156
+ timing.push(timeBytes);
157
+ }
158
+ })
159
+ this.timing = timing;
160
+ }
161
+
162
+ VT.Player.prototype.setData = function(data) {
163
+ var dArr = data.split("\n");
164
+ // drop first and last strings
165
+ this.data = dArr.slice(1, dArr.length - 2).join("\n");
166
+ this.data = "\r\n" + this.data + "\n";
167
+ }
168
+
169
+
170
+ VT.Player.prototype.calculateTotalTime = function() {
171
+ var totalTime = 0;
172
+ var onePercentTime;
173
+
174
+ // Calculating full time and time of 1%
175
+ this.frames.forEach(function(frame) {
176
+ totalTime += frame[0];
177
+ });
178
+ this.totalTime = totalTime;
179
+ this.onePercentTime = totalTime / 100;
180
+
181
+ // console.log('total time', this.totalTime);
182
+ // console.log('one percent time', this.onePercentTime);
183
+ }
184
+
185
+ VT.Player.prototype.mapFrameToPercents = function() {
186
+ // Moving all frames to object { percent: [ .. frame numbers .. ] }
187
+ var framesByPercent = {};
188
+ var player = this;
189
+ var frameNumber = 0;
190
+ var currentFrameAtPercent;
191
+ var currentTotalTime = 0;
192
+ this.frames.forEach(function(frame) {
193
+ currentTotalTime += frame[0];
194
+ currentFrameAtPercent = Math.floor(currentTotalTime / player.onePercentTime);
195
+ if (!framesByPercent[currentFrameAtPercent]) {
196
+ framesByPercent[currentFrameAtPercent] = [];
197
+ }
198
+ frame.push(currentFrameAtPercent);
199
+ framesByPercent[currentFrameAtPercent].push(frameNumber);
200
+ frameNumber += 1;
201
+ });
202
+ this.framesByPercent = framesByPercent;
203
+ }
204
+
205
+ VT.Player.prototype.prepareFrames = function(data) {
206
+ var frames = [];
207
+ var data = this.data;
208
+ var bOffset = 0;
209
+
210
+ this.timing.forEach(function(chunk) {
211
+ var bytes = data.slice(bOffset, bOffset += chunk[1]);
212
+ frames.push([chunk[0] * 1000, bytes]);
213
+ })
214
+
215
+ this.frames = frames;
216
+ }
217
+
218
+ VT.Player.prototype.enableButtons = function(data) {
219
+ var button;
220
+ var player = this;
221
+ this.buttons = this.element.getElementsByClassName('sc-button');
222
+ for (var i = 0; i < this.buttons.length; i++) {
223
+ button = this.buttons[i];
224
+ button.addEventListener('click', function(ev){
225
+ var action = ev.currentTarget.getAttribute('data-action');
226
+ if (action) player[action]();
227
+ }, true);
228
+ button.removeAttribute('disabled');
229
+ }
230
+ }
231
+
232
+ VT.Player.prototype.play = function() {
233
+ var player = this;
234
+ var button = jQuery('.action-toggle')
235
+ button.children('span').removeClass('glyphicon-play')
236
+ button.children('span').addClass('glyphicon-pause')
237
+ button.attr('data-action', 'pause');
238
+
239
+ player.overlayHide();
240
+
241
+ if (player.playing) return;
242
+ if (player.currentFrame == 0) player.term.reset();
243
+
244
+ player.playing = true;
245
+
246
+ function scheduleChunked(frames) {
247
+ var chunk = frames[player.currentFrame];
248
+ var debug = 0;
249
+ if (chunk && player.playing) {
250
+ player.term.write(chunk[1])
251
+ setTimeout(function() {
252
+ player.currentFrame += 1
253
+ player.setProgress(chunk[2]);
254
+ scheduleChunked(frames);
255
+ }, (chunk[0] / player.speedup));
256
+ } else {
257
+ if (!player.playing) {
258
+ // console.log('paused')
259
+ } else {
260
+ player.currentFrame = 0;
261
+ player.pause();
262
+ }
263
+ player.overlayShow();
264
+ }
265
+ }
266
+ scheduleChunked(player.frames);
267
+ }
268
+
269
+ VT.Player.prototype.pause = function() {
270
+ var button = jQuery('.action-toggle')
271
+ button.children('span').removeClass('glyphicon-pause')
272
+ button.children('span').addClass('glyphicon-play')
273
+ button.attr('data-action', 'play');
274
+ this.playing = false;
275
+ this.overlayShow();
276
+ }
277
+
278
+ VT.Player.prototype.toggle = function() {
279
+ this.playing ? this.pause() : this.play();
280
+ }
281
+
282
+ VT.Player.prototype.settings = function() {
283
+ this.cmdline.classList[this.cmdline.classList.contains('hidden') ? 'remove' : 'add']('hidden');
284
+ }
285
+
286
+ VT.Player.prototype.updateTimelinePosition = function(val) {
287
+ this.currentFrame = this.currentFrame + val;
288
+ // TODO: frame -> percent
289
+ // this.progressBar.css("width", ((100.0 / this.frames.length) * this.currentFrame) + '%' );
290
+ }
291
+
292
+ VT.Player.prototype.setProgress = function(val) {
293
+ // this.currentFrame = val; // FIXME percent -> frame
294
+ this.progress.prop('value', val);
295
+ this.progressBar.css("width", val + '%' );
296
+ }
297
+
298
+ VT.Player.prototype.initExtraTools = function() {
299
+ // Setup widths for comments and everything below terminal screen
300
+ $('.extra-tools, .comments, h2.comm, .comment-form, .embed-area, .embed-code')
301
+ .css('width', this.termWidth);
302
+ $('.comment-form .markItUpEditor').css('width', this.termWidth - 60);
303
+ $('.comment-form .markItUp').css('width', this.termWidth).css('border', 0);
304
+
305
+ // Embed and Share buttons
306
+ $('button.embed').click(function(ev) {
307
+ $('.embed-area').toggle().toggleClass('hidden');
308
+ });
309
+ }
310
+
311
+ VT.Player.prototype.initOverlay = function(content) {
312
+ var player = this
313
+ var termEl = this.el.find('#term')
314
+
315
+ this.overlay = $('<div/>')
316
+ this.el.append(this.overlay)
317
+
318
+ termEl.mouseleave(function(ev) {
319
+ console.log(ev)
320
+ if (!player.playing) {
321
+ player.overlayShow()
322
+ } else {
323
+ ev.stopPropagation()
324
+ }
325
+ })
326
+
327
+ this.overlay.mouseenter(function(ev) {
328
+ if (!player.playing) player.overlayHide()
329
+ })
330
+ }
331
+
332
+ VT.Player.prototype.overlayShow = function(content) {
333
+ var offsets = this.el.find('#term').offset()
334
+
335
+ this.overlay.removeClass('disabled').css({
336
+ position: 'absolute',
337
+ top: offsets.top + 'px',
338
+ left: offsets.left + 'px',
339
+ width: this.termWidth,
340
+ height: this.termHeight
341
+ })
342
+
343
+ this.overlay.attr('id', 'player-overlay')
344
+ .addClass('enabled')
345
+ .html(content).show()
346
+ }
347
+
348
+ VT.Player.prototype.overlayHide = function() {
349
+ this.overlay.removeClass('enabled').addClass('disabled')
350
+ .html('').css({width: 0, height: 0})
351
+ }
352
+
353
+ VT.Player.prototype.overlayLoading = function () {
354
+ var spinOptions = $.extend({
355
+ top: (player.termHeight / 2) - player.spinerOptions.radius * 2,
356
+ left: (player.termWidth / 2) - player.spinerOptions.radius * 2
357
+ }, player.spinerOptions)
358
+
359
+ // this.overlayShow($('<div>').spin(spinOptions))
360
+ }
361
+
362
+ VT.Player.prototype.onError = function() {
363
+ this.pause()
364
+ this.term.reset()
365
+ this.overlay.addClass('error')
366
+ this.overlayHide = function() {};
367
+ this.overlayShow("<br/><div class='img'>" +
368
+ "<img src='/assets/harakiri.png' alt='So sorry...'/></div>切腹" +
369
+ "<p>Something went wrong.<br/>" +
370
+ "Try commandline client instead!<br/>")
371
+ }