web/res/metadataplayer/AnnotationsList.js
changeset 792 66ae5723b2de
parent 778 525f00c2d6ac
child 828 6030bef81a51
--- a/web/res/metadataplayer/AnnotationsList.js	Thu Feb 14 16:21:16 2013 +0100
+++ b/web/res/metadataplayer/AnnotationsList.js	Thu Feb 28 11:37:18 2013 +0100
@@ -65,15 +65,15 @@
 IriSP.Widgets.AnnotationsList.prototype.annotationTemplate = 
     '<li class="Ldt-AnnotationsList-li Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}" style="{{specific_style}}">'
     + '<div class="Ldt-AnnotationsList-ThumbContainer">'
-    + '<a href="{{url}}">'
+    + '<a href="{{url}}" draggable="true">'
     + '<img class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />'
     + '</a>'
     + '</div>'
     + '<div class="Ldt-AnnotationsList-Duration">{{begin}} - {{end}}</div>'
-    + '<h3 class="Ldt-AnnotationsList-Title">'
-    + '<a href="{{url}}">{{{title}}}</a>'
+    + '<h3 class="Ldt-AnnotationsList-Title" draggable="true">'
+    + '<a href="{{url}}">{{{htitle}}}</a>'
     + '</h3>'
-    + '<p class="Ldt-AnnotationsList-Description">{{{description}}}</p>'
+    + '<p class="Ldt-AnnotationsList-Description">{{{hdescription}}}</p>'
     + '{{#tags.length}}'
     + '<ul class="Ldt-AnnotationsList-Tags">'
     + '{{#tags}}'
@@ -180,11 +180,12 @@
                             annotationType : _annotation.annotationType.id
                         }
                     )
-                    : '#id=' + _annotation.id
+                    : document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id
                     )
             );
             var _title = (_annotation.title || "").replace(_annotation.description,''),
-                _description = _annotation.description;
+                _description = _annotation.description,
+                _thumbnail = (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail);
             if (!_annotation.title) {
                 _title = _annotation.creator;
             }
@@ -202,11 +203,11 @@
             var _data = {
                 id : _annotation.id,
                 media_id : _annotation.getMedia().id,
-                title : IriSP.textFieldHtml(_title),
-                description : IriSP.textFieldHtml(_description),
+                htitle : IriSP.textFieldHtml(_title),
+                hdescription : IriSP.textFieldHtml(_description),
                 begin : _annotation.begin.toString(),
                 end : _annotation.end.toString(),
-                thumbnail : typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail,
+                thumbnail : _thumbnail,
                 url : _url,
                 tags : _annotation.getTagTexts(),
                 specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : ""),
@@ -229,6 +230,14 @@
                     _annotation.trigger("unselect");
                 })
                 .appendTo(_this.list_$);
+            _el.find("[draggable]").on("dragstart", function(e) {
+	        	e.originalEvent.dataTransfer.setData("text/x-iri-title",_title);
+	        	e.originalEvent.dataTransfer.setData("text/x-iri-description",_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);
+	        	}
+	        });
             _el.on("remove", function() {
                 _annotation.off("select", _onselect);
                 _annotation.off("unselect", _onunselect);