src/js/widgets/segmentsWidget.js
author veltr
Tue, 20 Mar 2012 21:17:48 +0100
branchpopcorn-port
changeset 835 a8af9da7c622
parent 834 573c7ca752e0
child 836 526f91f5253e
permissions -rw-r--r--
Integrated trace manager
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); });
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    11
  
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    12
  this.checkOption("cinecast_version");
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    13
  this.defaultColors = ["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"]
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
139
ba2b3c15bd47 fixing prototype bug.
hamidouk
parents: 132
diff changeset
    16
IriSP.SegmentsWidget.prototype = new IriSP.Widget();
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    17
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    18
IriSP.SegmentsWidget.prototype.draw = function() {
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    19
148
5e877acd85ca added a function to handle search messages.
hamidouk
parents: 139
diff changeset
    20
  var self = this;
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
    21
  var annotations = this._serializer._data.annotations;
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    22
334
e20f97514d44 move the styling of a segment from the templates to the css.
hamidouk
parents: 321
diff changeset
    23
  this.selector.addClass("Ldt-SegmentsWidget");
229
808768eb5930 rewriting the slider-port to not use jquery ui slider.
hamidouk
parents: 223
diff changeset
    24
  this.selector.append(Mustache.to_html(IriSP.overlay_marker_template));
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    25
  
829
ae16691d183d Corrected segments widget, added excludePattern option to tagcloud widget
veltr
parents: 827
diff changeset
    26
  this.positionMarker = this.selector.find(".Ldt-SegmentPositionMarker");
217
ec3e6d34462c fixed css positioning bug.
hamidouk
parents: 214
diff changeset
    27
  
214
50c4609e50f4 WIP - added a div that should move over the widget.
hamidouk
parents: 212
diff changeset
    28
  this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.positionUpdater));
835
a8af9da7c622 Integrated trace manager
veltr
parents: 834
diff changeset
    29
  var duration = this._serializer.getDuration();
a8af9da7c622 Integrated trace manager
veltr
parents: 834
diff changeset
    30
  
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    31
  if (this.cinecast_version) {
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    32
      var segments_annotations = IriSP.underscore.filter(
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    33
          this._serializer._data.annotations,
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    34
          function(_a) {
835
a8af9da7c622 Integrated trace manager
veltr
parents: 834
diff changeset
    35
              return _a.type == "cinecast:MovieExtract";
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    36
          }
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    37
      );
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    38
  }
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    39
  else {
104
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
    40
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    41
      var view_type = this._serializer.getChapitrage();
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    42
      if (typeof(view_type) === "undefined") {
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    43
        view_type = this._serializer.getNonTweetIds()[0];  
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    44
      }
514
f5865a99be69 WIP - first version of the rounding algorithm.
hamidouk
parents: 509
diff changeset
    45
    
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    46
      
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    47
      var i = 0;
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    48
      
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    49
      var segments_annotations = [];
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    50
      
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    51
      for (i = 0; i < annotations.length; i++) {
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    52
        var annotation = annotations[i];
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    53
    
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    54
        /* filter the annotations whose type is not the one we want */
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    55
        if (view_type != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    56
              && annotation.meta["id-ref"] != view_type) {
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    57
            continue;
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    58
        }
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    59
    
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    60
        segments_annotations.push(annotation);
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    61
      }
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    62
}    
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    63
    var _w = this.selector.width();
515
54324c5d82ab got a more or less correct (+- 1px) version of the segmentsWidget.
hamidouk
parents: 514
diff changeset
    64
  var lastSegment = IriSP.underscore.max(segments_annotations, function(annotation) { return annotation.end; });
514
f5865a99be69 WIP - first version of the rounding algorithm.
hamidouk
parents: 509
diff changeset
    65
  
f5865a99be69 WIP - first version of the rounding algorithm.
hamidouk
parents: 509
diff changeset
    66
  for (i = 0; i < segments_annotations.length; i++) {
f5865a99be69 WIP - first version of the rounding algorithm.
hamidouk
parents: 509
diff changeset
    67
  
515
54324c5d82ab got a more or less correct (+- 1px) version of the segmentsWidget.
hamidouk
parents: 514
diff changeset
    68
    var annotation = segments_annotations[i];
835
a8af9da7c622 Integrated trace manager
veltr
parents: 834
diff changeset
    69
    var begin = (+ annotation.begin);
a8af9da7c622 Integrated trace manager
veltr
parents: 834
diff changeset
    70
    var end = (+ annotation.end);
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    71
    var id = annotation.id;
515
54324c5d82ab got a more or less correct (+- 1px) version of the segmentsWidget.
hamidouk
parents: 514
diff changeset
    72
        
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    73
    var startPixel = Math.floor(_w * (begin / duration));
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
    74
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    75
    var endPixel = Math.floor(_w * (end / duration));
516
fe8c9f4791cb added a pixel to the last segment. Made search play nice with the borders.
hamidouk
parents: 515
diff changeset
    76
    if (annotation.id !== lastSegment.id) 
fe8c9f4791cb added a pixel to the last segment. Made search play nice with the borders.
hamidouk
parents: 515
diff changeset
    77
      var pxWidth = endPixel - startPixel -1;
fe8c9f4791cb added a pixel to the last segment. Made search play nice with the borders.
hamidouk
parents: 515
diff changeset
    78
    else
fe8c9f4791cb added a pixel to the last segment. Made search play nice with the borders.
hamidouk
parents: 515
diff changeset
    79
      /* the last segment has no segment following it */
fe8c9f4791cb added a pixel to the last segment. Made search play nice with the borders.
hamidouk
parents: 515
diff changeset
    80
      var pxWidth = endPixel - startPixel;
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    81
    
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    82
    var divTitle = this.cinecast_version
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    83
        ? annotation.content.data
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    84
        : IriSP.clean_substr(annotation.content.title + " -<br>" + annotation.content.description, 0, 132) + "...";
473
1a09ab7e7163 fixed display bugs in segmentsWidget
hamidouk
parents: 464
diff changeset
    85
    
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    86
    var hexa_color = typeof(annotation.content.color) !== "undefined"
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    87
        ? '#' + IriSP.DEC_HEXA_COLOR(annotation.content.color)
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    88
        : typeof(annotation.color) !== "undefined"
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    89
            ? '#' + IriSP.DEC_HEXA_COLOR(annotation.color)
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    90
            : this.defaultColors[i % this.defaultColors.length];
479
24308670f1bb fixed the display of colors.
hamidouk
parents: 477
diff changeset
    91
637
d6f477188c0a disable changing the default color of a segment.
hamidouk
parents: 593
diff changeset
    92
    /*
473
1a09ab7e7163 fixed display bugs in segmentsWidget
hamidouk
parents: 464
diff changeset
    93
    if (hexa_color === "FFCC00")
1a09ab7e7163 fixed display bugs in segmentsWidget
hamidouk
parents: 464
diff changeset
    94
      hexa_color = "333";
637
d6f477188c0a disable changing the default color of a segment.
hamidouk
parents: 593
diff changeset
    95
    */
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    96
    if (hexa_color.length == 5)
479
24308670f1bb fixed the display of colors.
hamidouk
parents: 477
diff changeset
    97
      hexa_color = hexa_color + '00';
473
1a09ab7e7163 fixed display bugs in segmentsWidget
hamidouk
parents: 464
diff changeset
    98
    
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
    99
    
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
   100
    var annotationTemplate = Mustache.to_html(IriSP.annotation_template,
514
f5865a99be69 WIP - first version of the rounding algorithm.
hamidouk
parents: 509
diff changeset
   101
        {"divTitle" : divTitle, "id" : id, "startPixel" : startPixel,
f5865a99be69 WIP - first version of the rounding algorithm.
hamidouk
parents: 509
diff changeset
   102
        "pxWidth" : pxWidth, "hexa_color" : hexa_color,
100
dbd302a995f5 added a new widget and the tests which come with it.
hamidouk
parents:
diff changeset
   103
        "seekPlace" : Math.round(begin/1000)});
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   104
515
54324c5d82ab got a more or less correct (+- 1px) version of the segmentsWidget.
hamidouk
parents: 514
diff changeset
   105
        
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   106
    this.selector.append(annotationTemplate);
515
54324c5d82ab got a more or less correct (+- 1px) version of the segmentsWidget.
hamidouk
parents: 514
diff changeset
   107
    
516
fe8c9f4791cb added a pixel to the last segment. Made search play nice with the borders.
hamidouk
parents: 515
diff changeset
   108
    /* add a special class to the last segment and change its border */
515
54324c5d82ab got a more or less correct (+- 1px) version of the segmentsWidget.
hamidouk
parents: 514
diff changeset
   109
    if (annotation.id === lastSegment.id) {
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   110
        IriSP.jqId(id).addClass("Ldt-lastSegment").css("border-color", hexa_color);  
515
54324c5d82ab got a more or less correct (+- 1px) version of the segmentsWidget.
hamidouk
parents: 514
diff changeset
   111
    }
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   112
   }
771
0a5194b39ffb highlight an annotation when mediafragment tells us so.
hamidouk
parents: 687
diff changeset
   113
    // react to mediafragment messages.
0a5194b39ffb highlight an annotation when mediafragment tells us so.
hamidouk
parents: 687
diff changeset
   114
    this._Popcorn.listen("IriSP.Mediafragment.showAnnotation", 
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   115
        function(id, divTitle) {
771
0a5194b39ffb highlight an annotation when mediafragment tells us so.
hamidouk
parents: 687
diff changeset
   116
        
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   117
            var divObject = IriSP.jqId(id);
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   118
            if (divObject.length) {
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   119
            divObject.fadeTo(0,1);
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   120
            var offset_x = divObject.position().left + divObject.outerWidth() / 2;
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   121
            self.TooltipWidget.show(divObject.attr("title"), IriSP.jQuery(this).css("background-color"), offset_x, 0);
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   122
            IriSP.jQuery(document).one("mousemove", function() { divObject.fadeTo(0,.5);
771
0a5194b39ffb highlight an annotation when mediafragment tells us so.
hamidouk
parents: 687
diff changeset
   123
                                                                self.TooltipWidget.hide(); });
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   124
        }
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   125
      });
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   126
      
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   127
    this.selector.find(".Ldt-iri-chapter")
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   128
        .fadeTo(0, .5)
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   129
        .click(function() {
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   130
            self._Popcorn.trigger("IriSP.SegmentsWidget.click", this.id);
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   131
            self._Popcorn.currentTime(IriSP.jQuery(this).attr("data-seek"));
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   132
        })
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   133
        .mouseover( function(event) {
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   134
            var divObject = IriSP.jQuery(this);
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   135
            divObject.fadeTo(0,1);
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   136
            var offset_x = divObject.position().left + divObject.outerWidth() / 2;
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   137
            self.TooltipWidget.show(divObject.attr("title"), IriSP.jQuery(this).css("background-color"), offset_x, 0);
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   138
        })
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   139
        .mouseout(function(){
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   140
            IriSP.jQuery(this).fadeTo(0,.5);
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   141
            self.TooltipWidget.hide();
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   142
        });
104
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
   143
};
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
   144
154
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   145
/* restores the view after a search */
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   146
IriSP.SegmentsWidget.prototype.clear = function() {
834
573c7ca752e0 Adapted Stackgraph for Cinecast
veltr
parents: 829
diff changeset
   147
  this.selector.children(".Ldt-iri-chapter").fadeTo(0,.5);
154
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   148
};
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   149
104
d571e9020092 fixed the segments widget.
hamidouk
parents: 100
diff changeset
   150
IriSP.SegmentsWidget.prototype.clickHandler = function(annotation) {
464
dd543fb9d38a trigger a signal when a segment is clicked.
hamidouk
parents: 418
diff changeset
   151
  this._Popcorn.trigger("IriSP.SegmentsWidget.click", annotation.id);
313
7df805ebb75e fixed some rounding errrors in segmentsWidget.js and animated the arrow and added
hamidouk
parents: 304
diff changeset
   152
  var begin = (+ annotation.begin) / 1000;
392
ef4e6b0fec17 fixed elusive bug.
hamidouk
parents: 380
diff changeset
   153
  this._Popcorn.currentTime(Math.round(begin));
108
62da43e72e30 broke the serializers across multiple files. added a newline to the end of
hamidouk
parents: 104
diff changeset
   154
};
148
5e877acd85ca added a function to handle search messages.
hamidouk
parents: 139
diff changeset
   155
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   156
IriSP.SegmentsWidget.prototype.searchHandler = function(searchString) {
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   157
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   158
  if (searchString == "")
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   159
    return;
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   160
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   161
  var matches = this._serializer.searchOccurences(searchString);
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   162
355
d8df77c40676 fixed search field coloring.
hamidouk
parents: 353
diff changeset
   163
  if (IriSP.countProperties(matches) > 0) {
398
d1883378b822 renamed search signal.
hamidouk
parents: 397
diff changeset
   164
    this._Popcorn.trigger("IriSP.search.matchFound");
355
d8df77c40676 fixed search field coloring.
hamidouk
parents: 353
diff changeset
   165
  } else {
398
d1883378b822 renamed search signal.
hamidouk
parents: 397
diff changeset
   166
    this._Popcorn.trigger("IriSP.search.noMatchFound");
355
d8df77c40676 fixed search field coloring.
hamidouk
parents: 353
diff changeset
   167
  }
d8df77c40676 fixed search field coloring.
hamidouk
parents: 353
diff changeset
   168
397
eb54152c2cfa fixed search to follow samuel's directives.
hamidouk
parents: 380
diff changeset
   169
  // un-highlight all the blocks
eb54152c2cfa fixed search to follow samuel's directives.
hamidouk
parents: 380
diff changeset
   170
  this.selector.children(".Ldt-iri-chapter").css("opacity", 0.1);
eb54152c2cfa fixed search to follow samuel's directives.
hamidouk
parents: 380
diff changeset
   171
 
eb54152c2cfa fixed search to follow samuel's directives.
hamidouk
parents: 380
diff changeset
   172
  // then highlight the ones with matches.
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   173
  for (var id in matches) {
380
4b74494bd129 fixed highlighting factor. Removed printf.
hamidouk
parents: 355
diff changeset
   174
    var factor = 0.5 + matches[id] * 0.2;
223
f14172bdea28 fixed annoying search clear display bug.
hamidouk
parents: 222
diff changeset
   175
    this.selector.find("#"+id).dequeue();
353
21f3a1d501eb changed the way the segmentsWidget highlights the matching segments.
hamidouk
parents: 336
diff changeset
   176
    this.selector.find("#"+id).animate({opacity:factor}, 200);
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   177
  }
164
d335ee5533c5 cosmetic changes.
hamidouk
parents: 157
diff changeset
   178
397
eb54152c2cfa fixed search to follow samuel's directives.
hamidouk
parents: 380
diff changeset
   179
 
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   180
  this.oldSearchMatches = matches;
148
5e877acd85ca added a function to handle search messages.
hamidouk
parents: 139
diff changeset
   181
};
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   182
154
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   183
IriSP.SegmentsWidget.prototype.searchFieldClearedHandler = function() {
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   184
  this.clear();
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   185
};
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   186
152
5950ab2855a8 added a comment.
hamidouk
parents: 148
diff changeset
   187
IriSP.SegmentsWidget.prototype.searchFieldClosedHandler = function() {
154
6e115a094858 another tweak to the searchBox : the visualization is cleared when the searchbox
hamidouk
parents: 152
diff changeset
   188
  this.clear();
214
50c4609e50f4 WIP - added a div that should move over the widget.
hamidouk
parents: 212
diff changeset
   189
};
50c4609e50f4 WIP - added a div that should move over the widget.
hamidouk
parents: 212
diff changeset
   190
50c4609e50f4 WIP - added a div that should move over the widget.
hamidouk
parents: 212
diff changeset
   191
IriSP.SegmentsWidget.prototype.positionUpdater = function() {  
835
a8af9da7c622 Integrated trace manager
veltr
parents: 834
diff changeset
   192
  var duration = this._serializer.getDuration() / 1000;
214
50c4609e50f4 WIP - added a div that should move over the widget.
hamidouk
parents: 212
diff changeset
   193
  var time = this._Popcorn.currentTime();
483
0bb36c79836c fixed positioning bug.
hamidouk
parents: 479
diff changeset
   194
  //var position 	= ((time / duration) * 100).toFixed(2);
217
ec3e6d34462c fixed css positioning bug.
hamidouk
parents: 214
diff changeset
   195
  var position 	= ((time / duration) * 100).toFixed(2);
ec3e6d34462c fixed css positioning bug.
hamidouk
parents: 214
diff changeset
   196
ec3e6d34462c fixed css positioning bug.
hamidouk
parents: 214
diff changeset
   197
  this.positionMarker.css("left", position + "%");  
300
a50aea26ec89 fixed annotation bug in the segmentswidget - we were displaying every annotation,
hamidouk
parents: 229
diff changeset
   198
};
771
0a5194b39ffb highlight an annotation when mediafragment tells us so.
hamidouk
parents: 687
diff changeset
   199
0a5194b39ffb highlight an annotation when mediafragment tells us so.
hamidouk
parents: 687
diff changeset
   200
IriSP.SegmentsWidget.prototype.showAnnotation = function() {
0a5194b39ffb highlight an annotation when mediafragment tells us so.
hamidouk
parents: 687
diff changeset
   201
0a5194b39ffb highlight an annotation when mediafragment tells us so.
hamidouk
parents: 687
diff changeset
   202
};