src/js/widgets/segmentsWidget.js
author hamidouk
Thu, 01 Dec 2011 17:04:14 +0100
branchpopcorn-port
changeset 380 4b74494bd129
parent 355 d8df77c40676
child 392 ef4e6b0fec17
child 397 eb54152c2cfa
permissions -rw-r--r--
fixed highlighting factor. Removed printf.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
     1
IriSP.SegmentsWidget = function(Popcorn, config, Serializer) {
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
     2
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
     3
  var self = this;
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
     4
  IriSP.Widget.call(this, Popcorn, config, Serializer);
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
     5
  this.oldSearchMatches = [];
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
     6
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
     7
  // event handlers
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
     8
  this._Popcorn.listen("IriSP.search", function(searchString) { self.searchHandler.call(self, searchString); });
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
     9
  this._Popcorn.listen("IriSP.search.closed", function() { self.searchFieldClosedHandler.call(self); });
154
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
    10
  this._Popcorn.listen("IriSP.search.cleared", function() { self.searchFieldClearedHandler.call(self); });
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    11
};
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    12
139
ba2b3c15bd47 fixing prototype bug.
hamidouk
parents: 132
diff changeset
    13
IriSP.SegmentsWidget.prototype = new IriSP.Widget();
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    14
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    15
IriSP.SegmentsWidget.prototype.draw = function() {
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    16
148
5e877acd85ca added a function to handle search messages.
hamidouk
parents: 139
diff changeset
    17
  var self = this;
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    18
  var annotations = this._serializer._data.annotations;
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    19
334
e20f97514d44 move the styling of a segment from the templates to the css.
hamidouk
parents: 321
diff changeset
    20
  this.selector.addClass("Ldt-SegmentsWidget");
e20f97514d44 move the styling of a segment from the templates to the css.
hamidouk
parents: 321
diff changeset
    21
300
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    22
  /* in case we have different types of annotations, we want to display only the first type */
303
cb091d204ba9 added a more restrictive test to check for the annotation type.
hamidouk
parents: 300
diff changeset
    23
  /* the next two lines are a bit verbose because for some test data, _serializer.data.view is either
cb091d204ba9 added a more restrictive test to check for the annotation type.
hamidouk
parents: 300
diff changeset
    24
     null or undefined.
cb091d204ba9 added a more restrictive test to check for the annotation type.
hamidouk
parents: 300
diff changeset
    25
  */
cb091d204ba9 added a more restrictive test to check for the annotation type.
hamidouk
parents: 300
diff changeset
    26
  var view;
cb091d204ba9 added a more restrictive test to check for the annotation type.
hamidouk
parents: 300
diff changeset
    27
cb091d204ba9 added a more restrictive test to check for the annotation type.
hamidouk
parents: 300
diff changeset
    28
  if (typeof(this._serializer._data.views) !== "undefined" && this._serializer._data.views !== null)
cb091d204ba9 added a more restrictive test to check for the annotation type.
hamidouk
parents: 300
diff changeset
    29
     view = this._serializer._data.views[0];
cb091d204ba9 added a more restrictive test to check for the annotation type.
hamidouk
parents: 300
diff changeset
    30
300
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    31
  var view_type = "";
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    32
303
cb091d204ba9 added a more restrictive test to check for the annotation type.
hamidouk
parents: 300
diff changeset
    33
  if(typeof(view) !== "undefined" && typeof(view.annotation_types) !== "undefined" && view.annotation_types.length > 1) {
300
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    34
          view_type = view.annotation_types[0];
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    35
  }
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    36
 
229
808768eb5930 rewriting the slider-port to not use jquery ui slider.
hamidouk
parents: 223
diff changeset
    37
  this.selector.append(Mustache.to_html(IriSP.overlay_marker_template));
220
6498b89eabcd changed the widget to use a template for the segment marker.
hamidouk
parents: 218
diff changeset
    38
  
217
ec3e6d34462c fixed css positioning bug.
hamidouk
parents: 214
diff changeset
    39
  this.positionMarker = this.selector.children(":first");
ec3e6d34462c fixed css positioning bug.
hamidouk
parents: 214
diff changeset
    40
  
214
50c4609e50f4 WIP - added a div that should move over the widget.
hamidouk
parents: 212
diff changeset
    41
  this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.positionUpdater));
212
3a6e4089eef0 fixed teh segments display bug and another bug related to float positioning.
hamidouk
parents: 210
diff changeset
    42
  
3a6e4089eef0 fixed teh segments display bug and another bug related to float positioning.
hamidouk
parents: 210
diff changeset
    43
  
104
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
    44
  var i = 0;
212
3a6e4089eef0 fixed teh segments display bug and another bug related to float positioning.
hamidouk
parents: 210
diff changeset
    45
  var totalWidth = this.selector.width();
3a6e4089eef0 fixed teh segments display bug and another bug related to float positioning.
hamidouk
parents: 210
diff changeset
    46
  var onePxPercent = 100 / totalWidth; /* the value of a pixel, in percents */
300
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    47
 
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    48
  for (i = 0; i < annotations.length; i++) {
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    49
    var annotation = annotations[i];
104
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
    50
300
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    51
    /* filter the annotations whose type is not the one we want */
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    52
    if (view_type != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    53
          && annotation.meta["id-ref"] != view_type) {
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    54
        continue;
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    55
    }
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
    56
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    57
    var begin = Math.round((+ annotation.begin) / 1000);
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    58
    var end = Math.round((+ annotation.end) / 1000);
104
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
    59
    var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    60
    var id = annotation.id;
222
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    61
    var startPourcent 	= IriSP.timeToPourcent(begin, duration);
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    62
    
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    63
    /* some sort of collapsing occurs, so we only have to substract one pixel to each box instead of
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    64
       two
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    65
    */
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    66
    var endPourcent 	= IriSP.timeToPourcent(end, duration) - startPourcent - onePxPercent * 1;
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    67
    
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    68
    /* on the other hand, we have to substract one pixel from the first box because it's the only
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    69
       one to have to effective 1px margins */
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    70
    if (i == 0) {
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    71
222
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    72
      endPourcent -= onePxPercent;
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    73
    }
0f86664b470d fixed a margin problem.
hamidouk
parents: 220
diff changeset
    74
    
223
f14172bdea28 fixed annoying search clear display bug.
hamidouk
parents: 222
diff changeset
    75
    var divTitle = annotation.content.title.substr(0,55);
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    76
    var color = annotation.content.color
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    77
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    78
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    79
    var annotationTemplate = Mustache.to_html(IriSP.annotation_template,
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    80
        {"divTitle" : divTitle, "id" : id, "startPourcent" : startPourcent,
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    81
        "endPourcent" : endPourcent, "hexa_color" : IriSP.DEC_HEXA_COLOR(color),
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    82
        "seekPlace" : Math.round(begin/1000)});
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    83
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    84
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    85
    this.selector.append(annotationTemplate);
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    86
336
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
    87
//    IriSP.jQuery("#" + id).tooltip({ effect: 'slide'});
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    88
212
3a6e4089eef0 fixed teh segments display bug and another bug related to float positioning.
hamidouk
parents: 210
diff changeset
    89
    IriSP.jQuery("#" + id).fadeTo(0, 0.3);
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    90
336
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
    91
    IriSP.jQuery("#" + id).mouseover(
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
    92
    /* we wrap the handler in another function because js's scoping
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
    93
       rules are function-based - otherwise, the internal vars like
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
    94
       divTitle are preserved but they are looked-up from the draw
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
    95
       method scope, so after that the loop is run, so they're not
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
    96
       preserved */
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
    97
    (function(divTitle) { 
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
    98
     return function(event) {
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
    99
          IriSP.jQuery(this).animate({opacity: 0.6}, 5);
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
   100
          var offset = IriSP.jQuery(this).offset();
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
   101
          var correction = IriSP.jQuery(this).outerWidth() / 2;
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
   102
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
   103
          var offset_x = offset.left + correction - 106;
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
   104
          if (offset_x < 0)
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
   105
            offset_x = 0;
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
   106
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
   107
          self.TooltipWidget.show(divTitle, color, offset_x, event.pageY - 160);
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
   108
    } })(divTitle)).mouseout(function(){
334
e20f97514d44 move the styling of a segment from the templates to the css.
hamidouk
parents: 321
diff changeset
   109
      IriSP.jQuery(this).animate({opacity: 0.3}, 5);
336
8da13562cfea segmentsWidget now uses the TooltipWidget instead of the jQuerytools tooltip.
hamidouk
parents: 334
diff changeset
   110
      self.TooltipWidget.hide();
104
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
   111
    });
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   112
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   113
    IriSP.jQuery("#" + id).click(function(_this, annotation) {
104
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
   114
                                    return function() { _this.clickHandler(annotation)};
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
   115
                                 }(this, annotation));
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   116
  }
104
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
   117
};
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
   118
154
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   119
/* restores the view after a search */
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   120
IriSP.SegmentsWidget.prototype.clear = function() {
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   121
  // reinit the fields
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   122
  for (var id in this.oldSearchMatches) {
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   123
154
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   124
      IriSP.jQuery("#"+id).dequeue();
353
21f3a1d501eb changed the way the segmentsWidget highlights the matching segments.
hamidouk
parents: 336
diff changeset
   125
			IriSP.jQuery("#"+id).css('border','none');
223
f14172bdea28 fixed annoying search clear display bug.
hamidouk
parents: 222
diff changeset
   126
			IriSP.jQuery("#"+id).animate({opacity:0.3}, 100);
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   127
  }
154
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   128
};
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   129
104
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
   130
IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) {
313
7df805ebb75e fixed some rounding errrors in segmentsWidget.js and animated the arrow and added
hamidouk
parents: 304
diff changeset
   131
  var begin = (+ annotation.begin) / 1000;
7df805ebb75e fixed some rounding errrors in segmentsWidget.js and animated the arrow and added
hamidouk
parents: 304
diff changeset
   132
  this._Popcorn.currentTime(Math.floor(begin));
108
62da43e72e30 broke the serializers across multiple files. added a newline to the end of
hamidouk
parents: 104
diff changeset
   133
};
148
5e877acd85ca added a function to handle search messages.
hamidouk
parents: 139
diff changeset
   134
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   135
IriSP.SegmentsWidget.prototype.searchHandler = function(searchString) {
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   136
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   137
  if (searchString == "")
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   138
    return;
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   139
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   140
  var matches = this._serializer.searchOccurences(searchString);
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   141
355
d8df77c40676 fixed search field coloring.
hamidouk
parents: 353
diff changeset
   142
  if (IriSP.countProperties(matches) > 0) {
d8df77c40676 fixed search field coloring.
hamidouk
parents: 353
diff changeset
   143
    this._Popcorn.trigger("IriSP.SegmentsWidget.matchFound");
d8df77c40676 fixed search field coloring.
hamidouk
parents: 353
diff changeset
   144
  } else {
d8df77c40676 fixed search field coloring.
hamidouk
parents: 353
diff changeset
   145
    this._Popcorn.trigger("IriSP.SegmentsWidget.noMatchFound");
d8df77c40676 fixed search field coloring.
hamidouk
parents: 353
diff changeset
   146
  }
d8df77c40676 fixed search field coloring.
hamidouk
parents: 353
diff changeset
   147
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   148
  for (var id in matches) {
380
4b74494bd129 fixed highlighting factor. Removed printf.
hamidouk
parents: 355
diff changeset
   149
    var factor = 0.5 + matches[id] * 0.2;
223
f14172bdea28 fixed annoying search clear display bug.
hamidouk
parents: 222
diff changeset
   150
    this.selector.find("#"+id).dequeue();
353
21f3a1d501eb changed the way the segmentsWidget highlights the matching segments.
hamidouk
parents: 336
diff changeset
   151
    this.selector.find("#"+id).css('border','1px red');
21f3a1d501eb changed the way the segmentsWidget highlights the matching segments.
hamidouk
parents: 336
diff changeset
   152
    this.selector.find("#"+id).animate({opacity:factor}, 200);
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   153
  }
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   154
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   155
  // clean up the blocks that were in the previous search
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   156
  // but who aren't in the current one.
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   157
  for (var id in this.oldSearchMatches) {
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   158
    if (!matches.hasOwnProperty(id)) {
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   159
        IriSP.jQuery("#"+id).dequeue();
223
f14172bdea28 fixed annoying search clear display bug.
hamidouk
parents: 222
diff changeset
   160
				IriSP.jQuery("#"+id).animate({opacity:0.3}, 200);
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   161
    }
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   162
  }
223
f14172bdea28 fixed annoying search clear display bug.
hamidouk
parents: 222
diff changeset
   163
  
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   164
  this.oldSearchMatches = matches;
148
5e877acd85ca added a function to handle search messages.
hamidouk
parents: 139
diff changeset
   165
};
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   166
154
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   167
IriSP.SegmentsWidget.prototype.searchFieldClearedHandler = function() {
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   168
  this.clear();
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   169
};
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   170
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   171
IriSP.SegmentsWidget.prototype.searchFieldClosedHandler = function() {
154
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   172
  this.clear();
214
50c4609e50f4 WIP - added a div that should move over the widget.
hamidouk
parents: 212
diff changeset
   173
};
50c4609e50f4 WIP - added a div that should move over the widget.
hamidouk
parents: 212
diff changeset
   174
50c4609e50f4 WIP - added a div that should move over the widget.
hamidouk
parents: 212
diff changeset
   175
IriSP.SegmentsWidget.prototype.positionUpdater = function() {  
50c4609e50f4 WIP - added a div that should move over the widget.
hamidouk
parents: 212
diff changeset
   176
  var duration = this._serializer.currentMedia().meta["dc:duration"] / 1000;
50c4609e50f4 WIP - added a div that should move over the widget.
hamidouk
parents: 212
diff changeset
   177
  var time = this._Popcorn.currentTime();
217
ec3e6d34462c fixed css positioning bug.
hamidouk
parents: 214
diff changeset
   178
  var position 	= ((time / duration) * 100).toFixed(2);
ec3e6d34462c fixed css positioning bug.
hamidouk
parents: 214
diff changeset
   179
ec3e6d34462c fixed css positioning bug.
hamidouk
parents: 214
diff changeset
   180
  this.positionMarker.css("left", position + "%");  
300
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
   181
};