src/js/utils.js
changeset 996 c472984db275
parent 988 eefd336335f9
child 998 9521347ede1d
equal deleted inserted replaced
995:37a4566bb7ee 996:c472984db275
   105 IriSP.log = function() {
   105 IriSP.log = function() {
   106     if (typeof console !== "undefined" && typeof IriSP.logging !== "undefined" && IriSP.logging) {
   106     if (typeof console !== "undefined" && typeof IriSP.logging !== "undefined" && IriSP.logging) {
   107         console.log.apply(console, arguments);
   107         console.log.apply(console, arguments);
   108     }
   108     }
   109 }
   109 }
       
   110 
       
   111 IriSP.attachDndData = function(jqSel, data) {
       
   112 	jqSel.attr("draggable", "true").on("dragstart", function(_event) {
       
   113 		var d = (typeof data === "function" ? data.call(this) : data);
       
   114 		try {
       
   115 			IriSP._(d).each(function(v, k) {
       
   116 				if (v) {
       
   117 					_event.originalEvent.dataTransfer.setData("text/x-iri-" + k, v);
       
   118 				}
       
   119 			});
       
   120 		} catch(err) {
       
   121 			_event.originalEvent.dataTransfer.setData("Text", JSON.stringify(d));
       
   122 		}
       
   123 	});
       
   124 }