rhet-butler 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +6 -14
- data/default-configuration/assets/fonts.googleapis.com/css/family=Arimo:700|Droid Sans Mono|Cinzel Decorative:700,900|Slackey,subset=latin,latin-ext +30 -0
- data/default-configuration/assets/fonts.gstatic.com/s/arimo/v12/P5sBzZCDf9_T_1Wi4TRNrZc.ttf +0 -0
- data/default-configuration/assets/fonts.gstatic.com/s/cinzeldecorative/v7/daaHSScvJGqLYhG8nNt8KPPswUAPniZQa9lESTQ.ttf +0 -0
- data/default-configuration/assets/fonts.gstatic.com/s/cinzeldecorative/v7/daaHSScvJGqLYhG8nNt8KPPswUAPniZoadlESTQ.ttf +0 -0
- data/default-configuration/assets/fonts.gstatic.com/s/droidsansmono/v10/6NUO8FuJNQ2MbkrZ5-J8lKFrp7pRef2u.ttf +0 -0
- data/default-configuration/assets/fonts.gstatic.com/s/slackey/v9/N0bV2SdQO-5yM0-dGlNQIQ.ttf +0 -0
- data/default-configuration/assets/javascript/presenter.js +317 -0
- data/default-configuration/assets/javascript/rhet-butler/child-step.js +13 -0
- data/default-configuration/assets/javascript/rhet-butler/step.js +197 -0
- data/default-configuration/assets/javascript/rhet-butler/steps/group.js +50 -0
- data/default-configuration/assets/javascript/rhet-butler/steps/item.js +60 -0
- data/default-configuration/assets/javascript/rhet-butler/steps/root.js +41 -0
- data/default-configuration/assets/javascript/rhet-butler/steps/slide.js +96 -0
- data/default-configuration/assets/javascript/rhet-butler/transition-states.js +173 -0
- data/default-configuration/assets/javascript/rhet-butler/transition-station.js +133 -0
- data/default-configuration/assets/javascript/rhet-butler/transition-stations.js +107 -0
- data/default-configuration/assets/javascript/rhet-butler/tree-builder.js +103 -0
- data/default-configuration/assets/javascript/utils.js +78 -0
- data/default-configuration/assets/stylesheets/font.sass +5 -9
- data/default-configuration/common/templates/presentation.html.erb +5 -5
- data/lib/rhet-butler/file-loading.rb +1 -1
- data/lib/rhet-butler/stasis/transform-queue.rb +2 -0
- data/spec/command-line.rb +1 -0
- data/spec/configuration.rb +27 -0
- data/spec/javascripts/fixtures/long-animation-group-1.html +19 -0
- data/spec/javascripts/fixtures/long-transition-group-1.html +10 -0
- data/spec/javascripts/fixtures/looped-animation-group-1.html +20 -0
- data/spec/javascripts/fixtures/quiet_console.js +2 -0
- data/spec/javascripts/fixtures/test-presentation.html +49 -0
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/helpers/jasmine-jquery.js +841 -0
- data/spec/javascripts/helpers/jj-fixture-path.js +3 -0
- data/spec/javascripts/helpers/jquery-3.4.0.min.js +2 -0
- data/spec/javascripts/present_spec.js +728 -0
- data/spec/javascripts/support/jasmine.yml +148 -0
- data/spec/javascripts/support/jasmine_helper.rb +23 -0
- data/spec/javascripts/support/run.html.erb +22 -0
- data/spec/javascripts/utils_spec.js +7 -0
- data/spec/main-app.rb +18 -0
- data/spec/messaging.rb +32 -0
- data/spec/presentation-view.rb +4 -4
- data/spec/resource-localizer.rb +37 -0
- data/spec/sass-functions.rb +25 -0
- data/spec/slide-loader.rb +1 -1
- data/spec/slide-rendering.rb +58 -0
- data/spec/static-generator.rb +54 -0
- metadata +211 -178
- data/default-configuration/assets/javascript/rhet-present.js +0 -855
- data/default-configuration/assets/javascript/rhet-present.min.js +0 -55
- data/default-configuration/assets/stylesheets/animate/attention/._pulse.scss.swp +0 -0
- data/default-configuration/assets/themes.googleusercontent.com/static/fonts/arimo/v5/K-bXE71xZHgbUS_UdQjugvesZW2xOQ-xsNqO47m55DA.ttf +0 -0
- data/default-configuration/assets/themes.googleusercontent.com/static/fonts/cinzeldecorative/v1/pXhIVnhFtL_B9Vb1wq2F9wIh9oxuYcmvOvyh_107lQs.ttf +0 -0
- data/default-configuration/assets/themes.googleusercontent.com/static/fonts/cinzeldecorative/v1/pXhIVnhFtL_B9Vb1wq2F9zCUrkmwPfdnoTjOU_kXqBI.ttf +0 -0
- data/default-configuration/assets/themes.googleusercontent.com/static/fonts/droidsansmono/v4/ns-m2xQYezAtqh7ai59hJYW_AySPyikQrZReizgrnuw.ttf +0 -0
- data/default-configuration/assets/themes.googleusercontent.com/static/fonts/slackey/v3/bJZDrYrGx8atJRHR9DVdqg.ttf +0 -0
- data/default-configuration/skels/slides.yaml +0 -7
@@ -0,0 +1,50 @@
|
|
1
|
+
import ChildStep from "../child-step.js";
|
2
|
+
|
3
|
+
export default class extends ChildStep {
|
4
|
+
constructor(parent, element, indexes){
|
5
|
+
super(parent, element, indexes);
|
6
|
+
}
|
7
|
+
|
8
|
+
addNextStep(step){
|
9
|
+
step.addPrevGroup(this);
|
10
|
+
}
|
11
|
+
|
12
|
+
addPrevStep(step){
|
13
|
+
step.addNextGroup(this);
|
14
|
+
}
|
15
|
+
|
16
|
+
addNextSlide(slide){
|
17
|
+
this.debugAssoc("gns", slide)
|
18
|
+
|
19
|
+
this.nextSlide = slide;
|
20
|
+
if(this.lastSlide){
|
21
|
+
this.lastSlide.addNextSlide(slide);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
addPrevSlide(slide){
|
26
|
+
this.debugAssoc("gps", slide)
|
27
|
+
if(!this.lastSlide){
|
28
|
+
this.lastSlide = slide;
|
29
|
+
}
|
30
|
+
if(!this.lastItem){
|
31
|
+
this.lastItem = slide.lastChild();
|
32
|
+
}
|
33
|
+
this.prevSlide = slide;
|
34
|
+
this.prevItem = slide.lastChild();
|
35
|
+
}
|
36
|
+
|
37
|
+
addNextGroup(group){
|
38
|
+
this.debugAssoc("gng", group)
|
39
|
+
//
|
40
|
+
}
|
41
|
+
|
42
|
+
addPrevGroup(group){
|
43
|
+
this.debugAssoc("gpg", group)
|
44
|
+
|
45
|
+
this.prevSlide = group.lastSlide;
|
46
|
+
|
47
|
+
this.lastSlide = group.lastSlide;
|
48
|
+
this.lastItem = group.lastItem;
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import ChildStep from "../child-step.js";
|
2
|
+
|
3
|
+
export default class extends ChildStep {
|
4
|
+
constructor(parent, element, indexes, cue){
|
5
|
+
super(parent, element, indexes);
|
6
|
+
this._cue = cue;
|
7
|
+
}
|
8
|
+
|
9
|
+
cue(){
|
10
|
+
return this._cue;
|
11
|
+
}
|
12
|
+
|
13
|
+
addChild(step){
|
14
|
+
this.parent.addChild(step);
|
15
|
+
}
|
16
|
+
|
17
|
+
joinParent(parent){
|
18
|
+
parent.lastItem = this;
|
19
|
+
}
|
20
|
+
|
21
|
+
addNextStep(step){
|
22
|
+
step.addPrevItem(this);
|
23
|
+
}
|
24
|
+
|
25
|
+
addPrevStep(step){
|
26
|
+
step.addNextItem(this);
|
27
|
+
}
|
28
|
+
|
29
|
+
addNextItem(item){
|
30
|
+
this.debugAssoc("ini", item)
|
31
|
+
this.nextItem = item;
|
32
|
+
}
|
33
|
+
|
34
|
+
addPrevItem(item){
|
35
|
+
this.debugAssoc("ipi", item)
|
36
|
+
this.prevItem = item;
|
37
|
+
}
|
38
|
+
|
39
|
+
beginDeparture(){
|
40
|
+
this.parent.addClass("prev-" + this.cue());
|
41
|
+
this.parent.removeClass(/^current-cue-.*/);
|
42
|
+
this.parent.beginDeparture();
|
43
|
+
}
|
44
|
+
|
45
|
+
completeDeparture(){
|
46
|
+
this.parent.removeClass("prev-" + this.cue());
|
47
|
+
this.parent.completeDeparture();
|
48
|
+
}
|
49
|
+
|
50
|
+
beginArrival(){
|
51
|
+
this.parent.addClass("next-" + this.cue());
|
52
|
+
this.parent.beginArrival();
|
53
|
+
}
|
54
|
+
|
55
|
+
completeArrival(){
|
56
|
+
this.parent.removeClass("next-" + this.cue());
|
57
|
+
this.parent.addClass("current-" + this.cue());
|
58
|
+
this.parent.completeArrival();
|
59
|
+
}
|
60
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import Step from "../step.js";
|
2
|
+
|
3
|
+
export default class extends Step {
|
4
|
+
constructor(element, indexes){
|
5
|
+
super(element, indexes)
|
6
|
+
}
|
7
|
+
|
8
|
+
propagateDescendant(newChild){
|
9
|
+
}
|
10
|
+
|
11
|
+
addNextStep(step){
|
12
|
+
step.addPrevRoot(this);
|
13
|
+
}
|
14
|
+
|
15
|
+
addPrevStep(step){
|
16
|
+
step.addNextRoot(this);
|
17
|
+
}
|
18
|
+
|
19
|
+
beginTransition(stationList){
|
20
|
+
this.addClass("moving");
|
21
|
+
this.addClass(stationList.startElemId());
|
22
|
+
this.addClass(stationList.endElemId());
|
23
|
+
stationList.direction.forEach(function(dirPart){
|
24
|
+
this.addClass(dirPart);
|
25
|
+
}, this);
|
26
|
+
}
|
27
|
+
|
28
|
+
completeTransition(stationList){
|
29
|
+
this.removeClass("moving");
|
30
|
+
this.removeClass(stationList.startElemId());
|
31
|
+
this.removeClass(stationList.endElemId());
|
32
|
+
stationList.direction.forEach(function(dirPart){
|
33
|
+
this.removeClass(dirPart);
|
34
|
+
}, this);
|
35
|
+
}
|
36
|
+
|
37
|
+
beginArrival(){ }
|
38
|
+
completeArrival(){ }
|
39
|
+
beginDeparture(){ }
|
40
|
+
completeDeparture(){ }
|
41
|
+
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
import ChildStep from '../child-step.js';
|
2
|
+
|
3
|
+
export default class extends ChildStep {
|
4
|
+
constructor(parent, element, indexes){
|
5
|
+
super(parent, element, indexes);
|
6
|
+
this.items = [];
|
7
|
+
}
|
8
|
+
|
9
|
+
addChild(newChild){
|
10
|
+
if(this.items.some(item => newChild.cue() == item.cue() )){
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
this.items.push(newChild);
|
14
|
+
}
|
15
|
+
|
16
|
+
joinParent(parent){
|
17
|
+
parent.lastSlide = this;
|
18
|
+
if (parent.firstSlide == null) {
|
19
|
+
parent.firstSlide = this;
|
20
|
+
parent.firstItem = this;
|
21
|
+
if(parent.prevSlide != null){
|
22
|
+
parent.prevSlide.addNextSlide(this);
|
23
|
+
this.addPrevSlide(parent.prevSlide);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
treeFinished(){
|
29
|
+
var cueRegex = /^cue-(\d+)/;
|
30
|
+
if(this.items.length == 0){
|
31
|
+
return;
|
32
|
+
};
|
33
|
+
|
34
|
+
this.items = this.items.sort(function(left, right){
|
35
|
+
var leftNum = parseInt(cueRegex.exec(left.cue())[1], 10);
|
36
|
+
var rightNum = parseInt(cueRegex.exec(right.cue())[1], 10);
|
37
|
+
if(leftNum == rightNum){
|
38
|
+
if(left.cue() < right.cue()){
|
39
|
+
return -1
|
40
|
+
} else {
|
41
|
+
return 1
|
42
|
+
}
|
43
|
+
} else if(leftNum < rightNum) {
|
44
|
+
return -1
|
45
|
+
} else {
|
46
|
+
return 1;
|
47
|
+
}
|
48
|
+
});
|
49
|
+
|
50
|
+
this.items[0].prevItem = this;
|
51
|
+
this.nextItem = this.items[0];
|
52
|
+
|
53
|
+
var itemIndex = Math.max.apply(undefined, this.items.map(function(item){return item.indexes.item}));
|
54
|
+
this.items.forEach(function(item){
|
55
|
+
item.indexes.item = itemIndex;
|
56
|
+
itemIndex++;
|
57
|
+
});
|
58
|
+
|
59
|
+
for(let newChild of this.items) {
|
60
|
+
newChild.prevSlide = this.prevSlide;
|
61
|
+
super.addChild(newChild);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
addNextStep(step){
|
66
|
+
step.addPrevSlide(this);
|
67
|
+
}
|
68
|
+
|
69
|
+
addPrevStep(step){
|
70
|
+
step.addNextSlide(this);
|
71
|
+
}
|
72
|
+
|
73
|
+
addPrevGroup(group){
|
74
|
+
this.debugAssoc("spg", group)
|
75
|
+
if(group.lastSlide){
|
76
|
+
this.addPrevSlide(group.lastSlide)
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
addNextSlide(slide){
|
81
|
+
this.debugAssoc("sns", slide)
|
82
|
+
|
83
|
+
this.nextSlide = slide;
|
84
|
+
this.children.forEach(function(item){ item.nextSlide = slide; })
|
85
|
+
this.lastChild().nextItem = slide;
|
86
|
+
}
|
87
|
+
|
88
|
+
addPrevSlide(slide){
|
89
|
+
this.debugAssoc("sps", slide)
|
90
|
+
this.prevSlide = slide;
|
91
|
+
this.children.forEach(function(item){
|
92
|
+
item.prevSlide = slide;
|
93
|
+
})
|
94
|
+
this.prevItem = slide.lastChild();
|
95
|
+
}
|
96
|
+
}
|
@@ -0,0 +1,173 @@
|
|
1
|
+
let states = {
|
2
|
+
preparing: {},
|
3
|
+
uphill: {},
|
4
|
+
downhill: {},
|
5
|
+
cancelled: {},
|
6
|
+
arrived: {}
|
7
|
+
};
|
8
|
+
|
9
|
+
export default states;
|
10
|
+
|
11
|
+
for(name in states){
|
12
|
+
// states[name] should throw a buncha not-implemented or wrong-state
|
13
|
+
states[name].enter = function(){ };
|
14
|
+
|
15
|
+
states[name].start = function(){
|
16
|
+
//raise exception?
|
17
|
+
};
|
18
|
+
|
19
|
+
states[name].cancel = function(){
|
20
|
+
this.changeState("cancelled");
|
21
|
+
};
|
22
|
+
|
23
|
+
states[name].forceFinish = function(){
|
24
|
+
console.log("Force Finish");
|
25
|
+
|
26
|
+
};
|
27
|
+
|
28
|
+
states[name].finish = function(){
|
29
|
+
//
|
30
|
+
};
|
31
|
+
|
32
|
+
states[name].currentLeg = function(){
|
33
|
+
return [];
|
34
|
+
};
|
35
|
+
|
36
|
+
states[name].enterState = function(){ };
|
37
|
+
|
38
|
+
states[name].resumeStep = function(){
|
39
|
+
return this.firstStep;
|
40
|
+
};
|
41
|
+
|
42
|
+
states[name].currentStation = function(){
|
43
|
+
return null;
|
44
|
+
};
|
45
|
+
|
46
|
+
states[name].advanceStation = function(){ };
|
47
|
+
|
48
|
+
states[name].nextStation = function(){
|
49
|
+
this.currentStation().visit();
|
50
|
+
if(this.currentStation().checkIn){
|
51
|
+
return this.advanceStation();
|
52
|
+
} else {
|
53
|
+
var stationList = this;
|
54
|
+
var targetStation = this.currentStation();
|
55
|
+
this.currentStation().setArriveHandler( function(event){ stationList.arriveListener(targetStation, event); });
|
56
|
+
return false;
|
57
|
+
}
|
58
|
+
};
|
59
|
+
}
|
60
|
+
|
61
|
+
states.preparing.enterState = function(){
|
62
|
+
this.eachStation(function(station){ station.prepare(); })
|
63
|
+
};
|
64
|
+
|
65
|
+
states.preparing.start = function(){
|
66
|
+
this.changeState("uphill");
|
67
|
+
this.elementArrived(this.currentStep);
|
68
|
+
//Events + class changes
|
69
|
+
};
|
70
|
+
|
71
|
+
states.preparing.forceFinish = function(){
|
72
|
+
this.eachStation(function(station){ station.visited() });
|
73
|
+
this.changeState("arrived");
|
74
|
+
}
|
75
|
+
|
76
|
+
states.uphill.enterState = function(){
|
77
|
+
this.currentStep = this.uphill[0].step;
|
78
|
+
|
79
|
+
this.presenter.rootStep.beginTransition(this);
|
80
|
+
|
81
|
+
this.firstStep.beginDeparture();
|
82
|
+
this.lastStep.beginArrival();
|
83
|
+
};
|
84
|
+
|
85
|
+
states.uphill.finish = function(){
|
86
|
+
this.changeState("downhill");
|
87
|
+
};
|
88
|
+
|
89
|
+
states.uphill.currentLeg = function(){
|
90
|
+
return this.uphill;
|
91
|
+
};
|
92
|
+
|
93
|
+
states.uphill.currentStation = function(){
|
94
|
+
return this.uphill[this.uphillIndex];
|
95
|
+
};
|
96
|
+
|
97
|
+
states.uphill.advanceStation = function(){
|
98
|
+
this.uphillIndex++;
|
99
|
+
if(this.uphillIndex < this.uphill.length){
|
100
|
+
this.currentStep = this.currentStation().step;
|
101
|
+
} else {
|
102
|
+
this.changeState("downhill");
|
103
|
+
}
|
104
|
+
return true
|
105
|
+
};
|
106
|
+
|
107
|
+
states.downhill.currentLeg = function(){
|
108
|
+
return this.downhill;
|
109
|
+
};
|
110
|
+
|
111
|
+
states.downhill.enterState = function(){
|
112
|
+
this.currentStep = this.downhill[0].step;
|
113
|
+
};
|
114
|
+
|
115
|
+
states.downhill.currentStation = function(){
|
116
|
+
return this.downhill[this.downhillIndex];
|
117
|
+
};
|
118
|
+
|
119
|
+
states.downhill.advanceStation = function(){
|
120
|
+
this.downhillIndex++;
|
121
|
+
if(this.downhillIndex < this.downhill.length){
|
122
|
+
this.currentStep = this.currentStation().step;
|
123
|
+
return true;
|
124
|
+
} else {
|
125
|
+
this.changeState("arrived");
|
126
|
+
return false;
|
127
|
+
}
|
128
|
+
};
|
129
|
+
|
130
|
+
states.downhill.finish = function(){
|
131
|
+
this.changeState("arrived");
|
132
|
+
};
|
133
|
+
|
134
|
+
states.downhill.resumeStep = function(){
|
135
|
+
return this.lastStep;
|
136
|
+
};
|
137
|
+
|
138
|
+
states.cancelled.enterState = function(){
|
139
|
+
this.eachStation(function(station){
|
140
|
+
if(station.step == this.currentStep){ return; };
|
141
|
+
station.complete()
|
142
|
+
}, this)
|
143
|
+
|
144
|
+
this.presenter.rootStep.completeTransition(this);
|
145
|
+
|
146
|
+
this.firstStep.completeDeparture();
|
147
|
+
this.lastStep.cancelArrival();
|
148
|
+
};
|
149
|
+
|
150
|
+
states.arrived.enterState = function(){
|
151
|
+
this.eachStation(function(station){ station.complete() })
|
152
|
+
|
153
|
+
this.currentStep = this.lastStep;
|
154
|
+
|
155
|
+
this.presenter.rootStep.completeTransition(this);
|
156
|
+
|
157
|
+
this.firstStep.completeDeparture();
|
158
|
+
this.lastStep.completeArrival();
|
159
|
+
|
160
|
+
this.presenter.completeTransition();
|
161
|
+
};
|
162
|
+
|
163
|
+
states.arrived.resumeStep = function(){
|
164
|
+
return this.lastStep;
|
165
|
+
};
|
166
|
+
|
167
|
+
states.arrived.nextStation = function(){
|
168
|
+
return false;
|
169
|
+
};
|
170
|
+
|
171
|
+
states.arrived.cancel = function(){
|
172
|
+
return false;
|
173
|
+
};
|
@@ -0,0 +1,133 @@
|
|
1
|
+
import {pfx} from '../utils.js';
|
2
|
+
|
3
|
+
var motionStyles = [
|
4
|
+
"transition-duration",
|
5
|
+
"animation-name",
|
6
|
+
"animation-iteration-count",
|
7
|
+
"animation-play-state"
|
8
|
+
];
|
9
|
+
|
10
|
+
var motionCompleteEvents = []
|
11
|
+
|
12
|
+
;(function(){
|
13
|
+
var events = ["TransitionEnd", "AnimationEnd"];
|
14
|
+
var prefixes = ["webkit", "o", "MS", ""];
|
15
|
+
prefixes.forEach(function(prefix){
|
16
|
+
events.forEach(function(event){
|
17
|
+
motionCompleteEvents.push(prefix + event);
|
18
|
+
motionCompleteEvents.push(prefix + event.toLowerCase());
|
19
|
+
});
|
20
|
+
});
|
21
|
+
})();
|
22
|
+
|
23
|
+
export default class {
|
24
|
+
constructor(step){
|
25
|
+
this.step = step;
|
26
|
+
this.checkIn = false;
|
27
|
+
this.eventListener = null;
|
28
|
+
}
|
29
|
+
|
30
|
+
visit(){
|
31
|
+
var beforeStyles, afterStyles;
|
32
|
+
|
33
|
+
if(this.checkIn){ return true; }
|
34
|
+
|
35
|
+
beforeStyles = this.getMotionStyles();
|
36
|
+
|
37
|
+
this.step.addClass("am-at");
|
38
|
+
this.step.removeClass("to-come");
|
39
|
+
afterStyles = this.getMotionStyles();
|
40
|
+
|
41
|
+
this.checkIn = true;
|
42
|
+
for(name in afterStyles){
|
43
|
+
if(beforeStyles[name] != afterStyles[name]){
|
44
|
+
this.checkIn = false; };
|
45
|
+
}
|
46
|
+
|
47
|
+
if(!this.elementHasMotion()){ this.visited(); };
|
48
|
+
|
49
|
+
if(this.checkIn){ this.step.removeClass("am-at"); };
|
50
|
+
|
51
|
+
return this.checkIn;
|
52
|
+
}
|
53
|
+
|
54
|
+
setArriveHandler(funk){
|
55
|
+
this.removeListener();
|
56
|
+
this.eventListener = funk;
|
57
|
+
this.attachListener();
|
58
|
+
}
|
59
|
+
|
60
|
+
visited(){
|
61
|
+
this.step.removeClass("to-come");
|
62
|
+
this.step.addClass("has-gone");
|
63
|
+
this.checkIn = true;
|
64
|
+
}
|
65
|
+
|
66
|
+
prepare(){
|
67
|
+
this.step.addClass("to-come");
|
68
|
+
this.attachListener();
|
69
|
+
}
|
70
|
+
|
71
|
+
complete(){
|
72
|
+
this.step.removeClass("to-come");
|
73
|
+
this.step.removeClass("has-gone");
|
74
|
+
this.step.removeClass("am-at");
|
75
|
+
this.removeListener();
|
76
|
+
}
|
77
|
+
|
78
|
+
|
79
|
+
getMotionStyles(){
|
80
|
+
var style = window.getComputedStyle(document.getElementById(this.step.element.id));
|
81
|
+
var result = {}
|
82
|
+
motionStyles.map(function(styleName){
|
83
|
+
result[styleName] = style.getPropertyValue(pfx(styleName));
|
84
|
+
});
|
85
|
+
return result;
|
86
|
+
}
|
87
|
+
|
88
|
+
elementHasMotion(){
|
89
|
+
var style = this.getMotionStyles();
|
90
|
+
var durations = []
|
91
|
+
var states, counts;
|
92
|
+
|
93
|
+
if(style["transition-duration"]){
|
94
|
+
durations = style["transition-duration"].split(/\s*,\s*/); //there's a non-zero one
|
95
|
+
}
|
96
|
+
if(!durations.every(function(duration){ return (duration == "0s") })){
|
97
|
+
return true;
|
98
|
+
}
|
99
|
+
|
100
|
+
if(style["animation-name"] == null || style['animation-name'] == 'none'){
|
101
|
+
return false
|
102
|
+
};
|
103
|
+
|
104
|
+
states = style["animation-play-state"].split(/\s*,\s*/);
|
105
|
+
counts = style["animation-iteration-count"].split(/\s*,\s*/);
|
106
|
+
|
107
|
+
if(states.length < counts.length){
|
108
|
+
states = states.concat(states);
|
109
|
+
} else {
|
110
|
+
counts = counts.concat(counts);
|
111
|
+
}
|
112
|
+
|
113
|
+
return (states.some(function(state, index){
|
114
|
+
return (state != "paused" && counts[index] != "infinite")
|
115
|
+
}));
|
116
|
+
}
|
117
|
+
|
118
|
+
attachListener(){
|
119
|
+
if(this.eventListener){
|
120
|
+
motionCompleteEvents.forEach(function(eventName){
|
121
|
+
this.step.element.addEventListener(eventName, this.eventListener, true);
|
122
|
+
}, this)
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
removeListener(){
|
127
|
+
if(this.eventListener){
|
128
|
+
motionCompleteEvents.forEach(function(eventName){
|
129
|
+
this.step.element.removeEventListener(eventName, this.eventListener, true);
|
130
|
+
}, this)
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|