forked from dsjoerg/ggtracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfadey.js
More file actions
35 lines (32 loc) · 1.14 KB
/
fadey.js
File metadata and controls
35 lines (32 loc) · 1.14 KB
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
// from http://jsfiddle.net/xzachtli/K4Kx8/1/
// which was found from https://github.com/angular/angular.js/wiki/JSFiddle-Examples
gg.directive('fadey', function() {
return {
restrict: 'A',
link: function(scope, elm, attrs) {
var duration = parseInt(attrs.fadey);
if (isNaN(duration)) {
duration = 500;
}
elm = jQuery(elm);
// one of these two lines causes a massive browser brain freeze when uploading
// ~700 replays at once. forget it!
//
// elm.hide();
// elm.fadeIn(duration)
scope.destroy = function(complete) {
elm.fadeOut(duration, function() {
if (complete) {
complete.apply(scope);
}
});
};
scope.$watch('replay.state', function(state) {
// console.log("watcher", state, scope);
if (isFinalState(state)) {
scope.clearItem(scope.replay)
}
});
}
};
});