src/widgets/Segments.js
changeset 996 c472984db275
parent 994 d18d6b9e1078
child 1013 392ddcd212d7
equal deleted inserted replaced
995:37a4566bb7ee 996:c472984db275
    20     '<div class="Ldt-Segments-List"></div>'
    20     '<div class="Ldt-Segments-List"></div>'
    21     + '<div class="Ldt-Segments-Position"></div>'
    21     + '<div class="Ldt-Segments-Position"></div>'
    22     + '<div class="Ldt-Segments-Tooltip"></div>';
    22     + '<div class="Ldt-Segments-Tooltip"></div>';
    23 
    23 
    24 IriSP.Widgets.Segments.prototype.annotationTemplate =
    24 IriSP.Widgets.Segments.prototype.annotationTemplate =
    25     '<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}}"'
    25     '<div class="Ldt-Segments-Segment Ldt-TraceMe" trace-info="segment-id:{{id}}, media-id:{{media_id}}, from:{{from}}, to:{{to}}" segment-text="{{text}}"'
    26     + '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>'
    26     + '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>'
    27 
    27 
    28 
    28 
    29 IriSP.Widgets.Segments.prototype.draw = function() {
    29 IriSP.Widgets.Segments.prototype.draw = function() {
    30     this.onMediaEvent("timeupdate", "onTimeupdate");
    30     this.onMediaEvent("timeupdate", "onTimeupdate");
    96                 _annotation.trigger("unselect");
    96                 _annotation.trigger("unselect");
    97             })
    97             })
    98             .click(function() {
    98             .click(function() {
    99                 _annotation.trigger("click");
    99                 _annotation.trigger("click");
   100             })
   100             })
   101             .on("dragstart", function(e) {
   101             .appendTo(list_$);
   102 	    	var url = (typeof _annotation.url !== "undefined" 
   102         IriSP.attachDndData(_el, {
   103 	                ? _annotation.url
   103         	title: _annotation.title,
   104 	                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id));
   104         	description: _annotation.description,
   105 	        	e.originalEvent.dataTransfer.setData("text/x-iri-title",_annotation.title);
   105         	uri: (typeof _annotation.url !== "undefined" 
   106 	        	e.originalEvent.dataTransfer.setData("text/x-iri-description",_annotation.description);
   106                 ? _annotation.url
   107 	        	e.originalEvent.dataTransfer.setData("text/x-iri-uri",url);
   107                 : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id)),
   108 	        	if (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail) {
   108             image: _annotation.thumbnail
   109 	        		e.originalEvent.dataTransfer.setData("text/x-iri-image",_annotation.thumbnail);
   109         });
   110 	        	}
       
   111 	        })
       
   112             .appendTo(list_$)
       
   113         _annotation.on("select", function() {
   110         _annotation.on("select", function() {
   114             _this.$segments.each(function() {
   111             _this.$segments.each(function() {
   115                 var _segment = IriSP.jQuery(this);
   112                 var _segment = IriSP.jQuery(this);
   116                 _segment.css({
   113                 _segment.css({
   117                     background: _segment.hasClass("found") ? _this.faded_found_color : _segment.attr("data-low-color")
   114                     background: _segment.hasClass("found") ? _this.faded_found_color : _segment.attr("data-low-color")