web/lib/metadataplayer/Polemic.js
changeset 51 418a12ee972f
parent 0 7f8907368bd5
--- a/web/lib/metadataplayer/Polemic.js	Wed Nov 06 19:21:12 2013 +0100
+++ b/web/lib/metadataplayer/Polemic.js	Thu Nov 07 13:35:41 2013 +0100
@@ -67,13 +67,12 @@
         
     this.$zone.append(this.$elapsed);
     
+    // we don't filter with null duration anymore
     var _slices = [],
         _slice_count = Math.floor( this.width / this.element_width ),
         _duration = this.source.getDuration(),
         _max = 0,
-        _list = this.getWidgetAnnotations().filter(function(_a) {
-            return !_a.getDuration().milliseconds;
-        }),
+        _list = this.getWidgetAnnotations(),
         _this = this;
     
     for (var _i = 0; _i < _slice_count; _i++) {
@@ -147,13 +146,21 @@
 		                ? _annotation.url
 		                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id))
                 });
+            	// test if annotation has several colors.
+            	var colAr = [];
+            	for (var _j = 0; _j < _this.polemics.length; _j++) {
+            		if( IriSP.Model.regexpFromTextOrArray( _this.polemics[_j].keywords ).test( _annotation.title ) ){
+            			colAr.push(_this.polemics[_j].color);
+            		}
+                }
+            	// display annotation
                 _annotation.on("select", function() {
                     if (_this.tooltip) {
                         _this.tooltip.show(
                             + Math.floor(_elx + (_this.element_width - 1) / 2),
                             + _ely,
                             _annotation.title,
-                            _col
+                            ( (colAr.length>1) ? colAr : _col )
                         );
                     }
                     _this.$tweets.each(function() {