v1.51.11 : enhance mdp V01.51.11
authorcavaliet
Thu, 07 Nov 2013 13:38:04 +0100
changeset 1253 95fbb10db87e
parent 1252 1d75a98a57b8
child 1254 e216b8db05cc
v1.51.11 : enhance mdp
src/ldt/ldt/__init__.py
src/ldt/ldt/static/ldt/metadataplayer/MultiSegments.js
src/ldt/ldt/static/ldt/metadataplayer/Polemic.js
src/ldt/ldt/static/ldt/metadataplayer/Tooltip.js
--- a/src/ldt/ldt/__init__.py	Thu Oct 31 17:03:25 2013 +0100
+++ b/src/ldt/ldt/__init__.py	Thu Nov 07 13:38:04 2013 +0100
@@ -1,6 +1,6 @@
 __all__ = ["VERSION", "get_version", "__version__"]
 
-VERSION = (1, 51, 10, "final", 0)
+VERSION = (1, 51, 11, "final", 0)
 
 
 def get_version():
--- a/src/ldt/ldt/static/ldt/metadataplayer/MultiSegments.js	Thu Oct 31 17:03:25 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/MultiSegments.js	Thu Nov 07 13:38:04 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/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js	Thu Oct 31 17:03:25 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js	Thu Nov 07 13:38:04 2013 +0100
@@ -146,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/src/ldt/ldt/static/ldt/metadataplayer/Tooltip.js	Thu Oct 31 17:03:25 2013 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tooltip.js	Thu Nov 07 13:38:04 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();
     }