cms/app-client/app/components/transcript-annotation-component.js
author ymh <ymh.work@gmail.com>
Fri, 02 Dec 2016 03:30:51 +0100
changeset 455 a8bed1c7df8e
parent 454 710a2ae08a74
child 456 3a32d2f57429
permissions -rw-r--r--
move the transcript highlight and autoscroll logic to the base component
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
454
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
import Ember from 'ember';
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
export default Ember.Component.extend({
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
455
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
     5
  // classNameBindings: ['isPlaying:active'],
454
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
  hasPlayer: Ember.computed.bool('player'),
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
  begin: Ember.computed.readOnly('annotation.begin'),
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
  end: Ember.computed.readOnly('annotation.end'),
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
  title: Ember.computed.readOnly('annotation.title'),
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
  original: Ember.computed.readOnly('annotation.original'),
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
  speaker: Ember.computed.readOnly('annotation.speaker'),
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
  showSpeaker: Ember.computed.readOnly('annotation.showSpeaker'),
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
  literal: Ember.computed.readOnly('annotation.literal'),
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
  translation: Ember.computed.readOnly('annotation.translation'),
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
455
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
    18
  // isPlaying: Ember.computed("hasPlayer","player.progress", "begin", "end", function() {
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
    19
  //   var progress = this.get('player.progress');
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
    20
  //   return this.get('hasPlayer') && progress && (progress >= this.get('begin')) && (progress < this.get('end'));
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
    21
  // }),
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
    22
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
    23
  didInsertElement: function() {
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
    24
    if(this.get('hasPlayer') && this.get('intervals')) {
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
    25
      this.get('intervals').add(this.get('begin'), this.get('end'), this.get('elementId'), this.$());
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
    26
    }
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
    27
  },
a8bed1c7df8e move the transcript highlight and autoscroll logic to the base component
ymh <ymh.work@gmail.com>
parents: 454
diff changeset
    28
454
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
710a2ae08a74 rework transcript component to correct various bugs
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
});