- function Dialogue(container) {
- this.container = container;
- this.timeToLines = [];
- _.each(this.container.children, function(c) {
- c.start = parseFloat(c.getAttribute('data-start'));
- c.end = parseFloat(c.getAttribute('data-end'));
- this.timeToLines.push(c);
- }, this);
- this.timeToLines.sort(function(a, b) {
- return a.start - b.start;
- });
- };
- Dialogue.prototype.show = function(position) {
- };
- Dialogue.prototype.hide = function() {
- if (this.lastLine) this.lastLine.classList.remove('showing');
- };
- Dialogue.prototype.update = function(position) {
- var currentLine;
- _.each(this.timeToLines, function(line) {
- if (position >= line.start && position <= line.end) {
- currentLine = line;
- }
- });
- if (currentLine != this.lastLine) {
- if (currentLine) {
- currentLine.classList.add('showing');
- }
- if (this.lastLine) {
- this.lastLine.classList.remove('showing');
- }
- }
- this.lastLine = currentLine;
- };
Recent Pastes