src/widgets/Segments.js
changeset 996 c472984db275
parent 994 d18d6b9e1078
child 1013 392ddcd212d7
--- a/src/widgets/Segments.js	Wed Apr 03 15:40:58 2013 +0200
+++ b/src/widgets/Segments.js	Wed Apr 03 15:44:17 2013 +0200
@@ -22,7 +22,7 @@
     + '<div class="Ldt-Segments-Tooltip"></div>';
 
 IriSP.Widgets.Segments.prototype.annotationTemplate =
-    '<div class="Ldt-Segments-Segment Ldt-TraceMe" draggable="true" trace-info="segment-id:{{id}}, media-id:{{media_id}}, from:{{from}}, to:{{to}}" segment-text="{{text}}"'
+    '<div class="Ldt-Segments-Segment Ldt-TraceMe" trace-info="segment-id:{{id}}, media-id:{{media_id}}, from:{{from}}, to:{{to}}" segment-text="{{text}}"'
     + 'style="top:{{top}}px; height:{{height}}px; left:{{left}}px; width:{{width}}px; background:{{medcolor}}" data-base-color="{{color}}" data-low-color="{{lowcolor}}" data-medium-color="{{medcolor}}"></div>'
 
 
@@ -98,18 +98,15 @@
             .click(function() {
                 _annotation.trigger("click");
             })
-            .on("dragstart", function(e) {
-	    	var url = (typeof _annotation.url !== "undefined" 
-	                ? _annotation.url
-	                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id));
-	        	e.originalEvent.dataTransfer.setData("text/x-iri-title",_annotation.title);
-	        	e.originalEvent.dataTransfer.setData("text/x-iri-description",_annotation.description);
-	        	e.originalEvent.dataTransfer.setData("text/x-iri-uri",url);
-	        	if (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail) {
-	        		e.originalEvent.dataTransfer.setData("text/x-iri-image",_annotation.thumbnail);
-	        	}
-	        })
-            .appendTo(list_$)
+            .appendTo(list_$);
+        IriSP.attachDndData(_el, {
+        	title: _annotation.title,
+        	description: _annotation.description,
+        	uri: (typeof _annotation.url !== "undefined" 
+                ? _annotation.url
+                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id)),
+            image: _annotation.thumbnail
+        });
         _annotation.on("select", function() {
             _this.$segments.each(function() {
                 var _segment = IriSP.jQuery(this);