src/widgets/Polemic.js
changeset 993 a7efd386872a
parent 990 6a90c96f0b4c
child 994 d18d6b9e1078
equal deleted inserted replaced
992:566b590aaf8f 993:a7efd386872a
   111             
   111             
   112             var _x = 0;
   112             var _x = 0;
   113             
   113             
   114             function displayAnnotation(_elx, _ely, _pol, _col, _annotation) {
   114             function displayAnnotation(_elx, _ely, _pol, _col, _annotation) {
   115                 var _html = Mustache.to_html(
   115                 var _html = Mustache.to_html(
   116                     '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}, polemic:{{polemic}}, time:{{time}}" polemic-color="{{color}}"'
   116                     '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" draggable="true" trace-info="annotation-id:{{id}}, media-id:{{media_id}}, polemic:{{polemic}}, time:{{time}}" polemic-color="{{color}}"'
   117                     + ' tweet-title="{{title}}" annotation-id="{{id}}" style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>',
   117                     + ' tweet-title="{{title}}" annotation-id="{{id}}" style="width: {{width}}px; height: {{height}}px; top: {{top}}px; left: {{left}}px; background: {{color}}"></div>',
   118                 {
   118                 {
   119                     id: _annotation.id,
   119                     id: _annotation.id,
   120                     media_id: _this.source.currentMedia.id,
   120                     media_id: _this.source.currentMedia.id,
   121                     polemic: _pol,
   121                     polemic: _pol,
   132                     _annotation.trigger("select");
   132                     _annotation.trigger("select");
   133                 }).mouseout(function() {
   133                 }).mouseout(function() {
   134                     _annotation.trigger("unselect");
   134                     _annotation.trigger("unselect");
   135                 }).click(function() {
   135                 }).click(function() {
   136                     _annotation.trigger("click");
   136                     _annotation.trigger("click");
   137                 });
   137                 }).on("dragstart", function(e) {
       
   138 			    	var url = (typeof _annotation.url !== "undefined" 
       
   139 			                ? _annotation.url
       
   140 			                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id));
       
   141 			        	e.originalEvent.dataTransfer.setData("text/x-iri-title",_annotation.title);
       
   142 			        	e.originalEvent.dataTransfer.setData("text/x-iri-description",_annotation.description);
       
   143 			        	e.originalEvent.dataTransfer.setData("text/x-iri-uri",url);
       
   144 			        });
   138                 _annotation.on("select", function() {
   145                 _annotation.on("select", function() {
   139                     if (_this.tooltip) {
   146                     if (_this.tooltip) {
   140                         _this.tooltip.show(
   147                         _this.tooltip.show(
   141                             + Math.floor(_elx + (_this.element_width - 1) / 2),
   148                             + Math.floor(_elx + (_this.element_width - 1) / 2),
   142                             + _ely,
   149                             + _ely,