equal
deleted
inserted
replaced
1 /* utils.js - various utils that don't belong anywhere else */ |
1 /* utils.js - various utils that don't belong anywhere else */ |
2 |
2 |
3 IriSP.jqEscape = function(_text) { |
3 IriSP.jqEscape = function(_text) { |
4 return _text.replace(/(:|\.)/g,'\\$1'); |
4 return _text.replace(/(:|\.)/g,'\\$1'); |
5 } |
5 }; |
6 |
6 |
7 IriSP.getLib = function(lib) { |
7 IriSP.getLib = function(lib) { |
8 if (IriSP.libFiles.useCdn && typeof IriSP.libFiles.cdn[lib] == "string") { |
8 if (IriSP.libFiles.useCdn && typeof IriSP.libFiles.cdn[lib] == "string") { |
9 return IriSP.libFiles.cdn[lib]; |
9 return IriSP.libFiles.cdn[lib]; |
10 } |
10 } |
25 type : "text/css", |
25 type : "text/css", |
26 href : _cssFile |
26 href : _cssFile |
27 }).appendTo('head'); |
27 }).appendTo('head'); |
28 IriSP._cssCache.push(_cssFile); |
28 IriSP._cssCache.push(_cssFile); |
29 } |
29 } |
30 } |
30 }; |
31 |
31 |
32 IriSP.textFieldHtml = function(_text, _regexp, _extend) { |
32 IriSP.textFieldHtml = function(_text, _regexp, _extend) { |
33 var list = [], |
33 var list = [], |
34 positions = [], |
34 positions = [], |
35 text = _text.replace(/(^\s+|\s+$)/g,''); |
35 text = _text.replace(/(^\s+|\s+$)/g,''); |
98 |
98 |
99 res += text.substring(lastIndex); |
99 res += text.substring(lastIndex); |
100 |
100 |
101 return res; |
101 return res; |
102 |
102 |
103 } |
103 }; |
104 |
104 |
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 |
110 |
111 IriSP.attachDndData = function(jqSel, data) { |
111 IriSP.attachDndData = function(jqSel, data) { |
112 jqSel.attr("draggable", "true").on("dragstart", function(_event) { |
112 jqSel.attr("draggable", "true").on("dragstart", function(_event) { |
113 var d = (typeof data === "function" ? data.call(this) : data); |
113 var d = (typeof data === "function" ? data.call(this) : data); |
114 try { |
114 try { |
119 }); |
119 }); |
120 } catch(err) { |
120 } catch(err) { |
121 _event.originalEvent.dataTransfer.setData("Text", JSON.stringify(d)); |
121 _event.originalEvent.dataTransfer.setData("Text", JSON.stringify(d)); |
122 } |
122 } |
123 }); |
123 }); |
124 } |
124 }; |