cms/app-client/app/components/transcript-component.js
changeset 247 7a5d729992b8
parent 246 5b7ae96768be
child 248 256272c33349
--- a/cms/app-client/app/components/transcript-component.js	Thu Jul 21 23:36:50 2016 +0200
+++ b/cms/app-client/app/components/transcript-component.js	Fri Jul 22 16:11:44 2016 +0200
@@ -7,25 +7,28 @@
     player: Ember.inject.service(),
 
     autoscroll: true,
-    autoscrollElement : Ember.$('.corpus-app-container'),
+    autoscrollElement : '.corpus-app-container',
+    timeout: null,
 
     itemObserver: Ember.observer('player.item', function () {
         this.set('autoscroll', true);
     }),
 
-    init: function() {
+    didUpdate: function() {
         var self = this;
-        this.get('autoscrollElement').bind('scroll', function() {
-            self.set('autoscroll', false);
-        });
-
-        this._super(...arguments);
+        if(this.get('autoscroll')) {
+            Ember.$(this.get('autoscrollElement')).animate({
+                scrollTop: Ember.$('.sentence.active').offset().top + Ember.$(this.get('autoscrollElement')).scrollTop() - Ember.$(this.get('autoscrollElement')).offset().top - 154
+            }, 150);
+        }
     },
 
-    didUpdate: function() {
-        if(this.get('autoscroll')) {
-            this.get('autoscrollElement').scrollTop((Ember.$('.sentence.active').offset().top + this.get('autoscrollElement').scrollTop()) - this.get('autoscrollElement').offset().top)
+    actions: {
+
+        play: function(progress) {
+            this.get('player').set('progress', progress);
         }
+
     }
 
 });