web/lib/metadataplayer/Polemic.js
changeset 51 418a12ee972f
parent 0 7f8907368bd5
equal deleted inserted replaced
50:73ade123e5c1 51:418a12ee972f
    65             height: "100%"
    65             height: "100%"
    66         });
    66         });
    67         
    67         
    68     this.$zone.append(this.$elapsed);
    68     this.$zone.append(this.$elapsed);
    69     
    69     
       
    70     // we don't filter with null duration anymore
    70     var _slices = [],
    71     var _slices = [],
    71         _slice_count = Math.floor( this.width / this.element_width ),
    72         _slice_count = Math.floor( this.width / this.element_width ),
    72         _duration = this.source.getDuration(),
    73         _duration = this.source.getDuration(),
    73         _max = 0,
    74         _max = 0,
    74         _list = this.getWidgetAnnotations().filter(function(_a) {
    75         _list = this.getWidgetAnnotations(),
    75             return !_a.getDuration().milliseconds;
       
    76         }),
       
    77         _this = this;
    76         _this = this;
    78     
    77     
    79     for (var _i = 0; _i < _slice_count; _i++) {
    78     for (var _i = 0; _i < _slice_count; _i++) {
    80         var _begin = new IriSP.Model.Time( _i * _duration / _slice_count ),
    79         var _begin = new IriSP.Model.Time( _i * _duration / _slice_count ),
    81             _end = new IriSP.Model.Time( ( _i + 1 ) * _duration / _slice_count ),
    80             _end = new IriSP.Model.Time( ( _i + 1 ) * _duration / _slice_count ),
   145                 	image: _annotation.thumbnail,
   144                 	image: _annotation.thumbnail,
   146                 	uri: (typeof _annotation.url !== "undefined" 
   145                 	uri: (typeof _annotation.url !== "undefined" 
   147 		                ? _annotation.url
   146 		                ? _annotation.url
   148 		                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id))
   147 		                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id))
   149                 });
   148                 });
       
   149             	// test if annotation has several colors.
       
   150             	var colAr = [];
       
   151             	for (var _j = 0; _j < _this.polemics.length; _j++) {
       
   152             		if( IriSP.Model.regexpFromTextOrArray( _this.polemics[_j].keywords ).test( _annotation.title ) ){
       
   153             			colAr.push(_this.polemics[_j].color);
       
   154             		}
       
   155                 }
       
   156             	// display annotation
   150                 _annotation.on("select", function() {
   157                 _annotation.on("select", function() {
   151                     if (_this.tooltip) {
   158                     if (_this.tooltip) {
   152                         _this.tooltip.show(
   159                         _this.tooltip.show(
   153                             + Math.floor(_elx + (_this.element_width - 1) / 2),
   160                             + Math.floor(_elx + (_this.element_width - 1) / 2),
   154                             + _ely,
   161                             + _ely,
   155                             _annotation.title,
   162                             _annotation.title,
   156                             _col
   163                             ( (colAr.length>1) ? colAr : _col )
   157                         );
   164                         );
   158                     }
   165                     }
   159                     _this.$tweets.each(function() {
   166                     _this.$tweets.each(function() {
   160                         var _e = IriSP.jQuery(this);
   167                         var _e = IriSP.jQuery(this);
   161                         _e.css(
   168                         _e.css(