src/widgets/Polemic.js
changeset 996 c472984db275
parent 994 d18d6b9e1078
child 1004 cf0f2339169e
equal deleted inserted replaced
995:37a4566bb7ee 996:c472984db275
   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" draggable="true" trace-info="annotation-id:{{id}}, media-id:{{media_id}}, polemic:{{polemic}}, time:{{time}}" polemic-color="{{color}}"'
   116                     '<div class="Ldt-Polemic-TweetDiv Ldt-TraceMe" 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                 }).on("dragstart", function(e) {
   137                 });
   138 			    	var url = (typeof _annotation.url !== "undefined" 
   138                 IriSP.attachDndData(_el, {
   139 			                ? _annotation.url
   139                 	title: _annotation.title,
   140 			                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id));
   140                 	description: _annotation.description,
   141 			        	e.originalEvent.dataTransfer.setData("text/x-iri-title",_annotation.title);
   141                 	image: _annotation.thumbnail,
   142 			        	e.originalEvent.dataTransfer.setData("text/x-iri-description",_annotation.description);
   142                 	uri: (typeof _annotation.url !== "undefined" 
   143 			        	e.originalEvent.dataTransfer.setData("text/x-iri-uri",url);
   143 		                ? _annotation.url
   144 			        	if (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail) {
   144 		                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id))
   145 			        		e.originalEvent.dataTransfer.setData("text/x-iri-image",_annotation.thumbnail);
   145                 });
   146 			        	}
       
   147 			        });
       
   148                 _annotation.on("select", function() {
   146                 _annotation.on("select", function() {
   149                     if (_this.tooltip) {
   147                     if (_this.tooltip) {
   150                         _this.tooltip.show(
   148                         _this.tooltip.show(
   151                             + Math.floor(_elx + (_this.element_width - 1) / 2),
   149                             + Math.floor(_elx + (_this.element_width - 1) / 2),
   152                             + _ely,
   150                             + _ely,