5 classNames: ['transcript-component'], |
5 classNames: ['transcript-component'], |
6 |
6 |
7 player: Ember.inject.service(), |
7 player: Ember.inject.service(), |
8 |
8 |
9 autoscroll: true, |
9 autoscroll: true, |
10 autoscrollElement : Ember.$('.corpus-app-container'), |
10 autoscrollElement : '.corpus-app-container', |
|
11 timeout: null, |
11 |
12 |
12 itemObserver: Ember.observer('player.item', function () { |
13 itemObserver: Ember.observer('player.item', function () { |
13 this.set('autoscroll', true); |
14 this.set('autoscroll', true); |
14 }), |
15 }), |
15 |
16 |
16 init: function() { |
17 didUpdate: function() { |
17 var self = this; |
18 var self = this; |
18 this.get('autoscrollElement').bind('scroll', function() { |
19 if(this.get('autoscroll')) { |
19 self.set('autoscroll', false); |
20 Ember.$(this.get('autoscrollElement')).animate({ |
20 }); |
21 scrollTop: Ember.$('.sentence.active').offset().top + Ember.$(this.get('autoscrollElement')).scrollTop() - Ember.$(this.get('autoscrollElement')).offset().top - 154 |
21 |
22 }, 150); |
22 this._super(...arguments); |
23 } |
23 }, |
24 }, |
24 |
25 |
25 didUpdate: function() { |
26 actions: { |
26 if(this.get('autoscroll')) { |
27 |
27 this.get('autoscrollElement').scrollTop((Ember.$('.sentence.active').offset().top + this.get('autoscrollElement').scrollTop()) - this.get('autoscrollElement').offset().top) |
28 play: function(progress) { |
|
29 this.get('player').set('progress', progress); |
28 } |
30 } |
|
31 |
29 } |
32 } |
30 |
33 |
31 }); |
34 }); |