modif mdp
authorcavaliet
Thu, 07 Nov 2013 13:35:41 +0100
changeset 51 418a12ee972f
parent 50 73ade123e5c1
child 52 6c7371c8917a
modif mdp
web/lib/metadataplayer/MultiSegments.js
web/lib/metadataplayer/Polemic.js
web/lib/metadataplayer/Tooltip.js
--- a/web/lib/metadataplayer/MultiSegments.js	Wed Nov 06 19:21:12 2013 +0100
+++ b/web/lib/metadataplayer/MultiSegments.js	Thu Nov 07 13:35:41 2013 +0100
@@ -6,7 +6,7 @@
 
 IriSP.Widgets.MultiSegments.prototype.defaults = {
     annotation_show_arrow: true,
-    annotation_start_minimized: true,
+    annotation_start_minimized: false,
     annotation_show_annotation_type: true,
     show_all: false
 };
--- 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() {
--- a/web/lib/metadataplayer/Tooltip.js	Wed Nov 06 19:21:12 2013 +0100
+++ b/web/lib/metadataplayer/Tooltip.js	Thu Nov 07 13:35:41 2013 +0100
@@ -41,7 +41,21 @@
 IriSP.Widgets.Tooltip.prototype.show = function(x, y, text, color) {
     
     if (typeof color !== "undefined") {
-        this.$.find(".Ldt-Tooltip-Color").show().css("background-color", color);
+    	// one color or array of colors
+    	if (typeof color === "string") {
+    		this.$.find(".Ldt-Tooltip-Color").html("");
+    		this.$.find(".Ldt-Tooltip-Color").show().css("background-color", color);
+    		this.$.find(".Ldt-Tooltip-Color").show().css("height", "");
+    	}
+    	else{
+    		var d = this.$.find(".Ldt-Tooltip-Color");
+    		d.html("");
+    		d.show();
+    		for(var i=0; i<color.length; i++){
+    			d.append('<div style="float: left; height: 10px; width: 10px; background-color: ' + color[i] + '">')
+    		}
+    		this.$.find(".Ldt-Tooltip-Color").css("height", (color.length * 10) + "px");
+    	}
     } else {
         this.$.find(".Ldt-Tooltip-Color").hide();
     }