@gregoriusrippenstein/node-red-contrib-introspection 0.6.12 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugins/sidebar.html +30 -21
package/package.json
CHANGED
package/plugins/sidebar.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
function setupTreelist(){var e=collectOrphans();if(0==e.length){RED.notify("No Orphans Found",{type:"warning",timeout:2e3});try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){}}else{try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){$("#node-input-orphan-target-container-div").css({width:"100%",height:"calc(100%)"}).treeList({multi:!1}).on("treelistitemmouseover",function(e,t){}).on("treelistitemmouseout",function(e,t){}).on("treelistselect",function(e,t){t.node&&(RED.workspaces.show(t.node.z,!1,!1,!0),RED.view.reveal(t.node.id,!0),RED.view.redraw())}).on("treelistconfirm",function(e,t){var n;t.node&&(n=t.node.id,setTimeout(()=>{var e=RED.nodes.node(n);e&&(RED.view.reveal(e.id),RED.view.select(e.id),RED.editor.edit(e)),n==RED.workspaces.active()&&RED.workspaces.edit()},50))}),$("#node-input-orphan-target-filter").show();var n=$("#node-input-orphan-target-filter").searchBox({style:"compact",delay:300,change:function(){var e,t=$(this).val().trim().toLowerCase();""===t?($("#node-input-orphan-target-container-div").treeList("filter",null),n.searchBox("count","")):(e=$("#node-input-orphan-target-container-div").treeList("filter",function(e){return-1<e.label.toLowerCase().indexOf(t)||-1<e.node.type.toLowerCase().indexOf(t)}),n.searchBox("count",e+" / "+$("#node-input-orphan-target-container-div").treeList("data").length))}})}$("#node-input-orphan-target-container-div").treeList("data",e.sort((e,t)=>e.node.z>t.node.z))}}function collectOrphans(){const t=new Set;var n=[],i=(RED.nodes.eachLink(e=>{t.add(e.source),t.add(e.target)}),RED.nodes.eachNode(e=>{t.has(e)||n.push(e)}),[]),r={};return n.forEach(function(e){var t=RED.nodes.getType(e.type);if(t){var n=t.label,n=("function"==typeof n?n.call(e):n)||"",o=e.type;if(0===o.indexOf("subflow:"))return}t&&n||(n=e.type),r[e.id]={node:e,label:n,sublabel:o,selected:!1,checkbox:!1},i.push(r[e.id])}),i}
|
|
8
8
|
|
|
9
|
-
function nr_intro_generate_svg_3_1(r){return e=>{try{handleSvgObject($($("svg[width=8000]")[0]),e)}catch(t){var n="Error Generating SVG: "+JSON.stringify(t);r.notify(n,{type:"error"}),e('<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="1000" height="1000" viewBox="0 0 1000 1000" pointer-events="all" style="cursor: crosshair; touch-action: none;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><style>.small { font: bold 20px sans-serif; fill: red;}</style><text x="10" y="30" class="small">'+n+"</text></svg>")}}}function nr_intro_generate_svg_3_0(r){return e=>{try{handleSvgObject($($("svg")[0]),e)}catch(t){var n="Error Generating SVG: "+JSON.stringify(t);r.notify(n,{type:"error"}),e('<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="1000" height="1000" viewBox="0 0 1000 1000" pointer-events="all" style="cursor: crosshair; touch-action: none;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><style>.small { font: bold 20px sans-serif; fill: red;}</style><text x="10" y="30" class="small">'+n+"</text></svg>")}}}function handleSvgObject(o,e){var
|
|
9
|
+
function nr_intro_generate_svg_3_1(r,t){return e=>{try{handleSvgObject($($("svg[width=8000]")[0]),e,t)}catch(t){var n="Error Generating SVG: "+JSON.stringify(t);r.notify(n,{type:"error"}),e('<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="1000" height="1000" viewBox="0 0 1000 1000" pointer-events="all" style="cursor: crosshair; touch-action: none;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><style>.small { font: bold 20px sans-serif; fill: red;}</style><text x="10" y="30" class="small">'+n+"</text></svg>")}}}function nr_intro_generate_svg_3_0(r,t){return e=>{try{handleSvgObject($($("svg")[0]),e,t)}catch(t){var n="Error Generating SVG: "+JSON.stringify(t);r.notify(n,{type:"error"}),e('<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="1000" height="1000" viewBox="0 0 1000 1000" pointer-events="all" style="cursor: crosshair; touch-action: none;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><style>.small { font: bold 20px sans-serif; fill: red;}</style><text x="10" y="30" class="small">'+n+"</text></svg>")}}}function handleSvgObject(o,e,t){var n=o.clone();n.find("foreignObject").remove(),n.find("svg.__screenshot").remove();function a(t,e){for(var n=0;n<t.length;n++){var s=t.item(n),i=e[n];["stroke-width","fill-opacity","stroke-opacity","opacity","stroke-dasharray"].forEach(function(t){s.setAttribute(t,$(i).attr(t)||$(i).css(t))}),["fill","stroke"].forEach(function(t){var e,n,r=(e=$(i).attr(t)||$(i).css(t))&&null!==e&&"none"!=e?(n=e.match(/^#(.)(.)(.)$/))?"#"+n[1]+n[1]+n[2]+n[2]+n[3]+n[3]:(n=e.match(/^#......$/))?e:null===(n=e.match(/^rgb\(([0-9]+),\s+([0-9]+),\s+([0-9]+)/))?(r=e.match(/^rgba\(([0-9]+),\s+([0-9]+),\s+([0-9]+),\s+([0-9]+)/))?{clr:"#"+("0"+parseInt(r[1],10).toString(16)).slice(-2)+("0"+parseInt(r[2],10).toString(16)).slice(-2)+("0"+parseInt(r[3],10).toString(16)).slice(-2),opa:r[4]}:(console.log("Screenshot node: returned unknown color: "+e),e):"#"+("0"+parseInt(n[1],10).toString(16)).slice(-2)+("0"+parseInt(n[2],10).toString(16)).slice(-2)+("0"+parseInt(n[3],10).toString(16)).slice(-2):"none";"object"==typeof r?(s.setAttribute(t+"-opacity",r.opa),s.setAttribute(t,r.clr)):s.setAttribute(t,r)}),$(i).hasClass("hide")&&("g"==s.tagName&&s.setAttribute("opacity","0"),s.setAttribute("visibility","hidden"))}}var r='<?xml version="1.0" standalone="no"?>\r\n<svg '+('width="'+o.attr("width")+'" height="'+o.attr("height")+'"')+' pointer-events="all" style="cursor: crosshair; touch-action: none;" xmlns="http://www.w3.org/2000/svg" class="__screenshot" xmlns:xlink="http://www.w3.org/1999/xlink">\r\n',n=n.html(),l=(new DOMParser).parseFromString(r+n+"\r\n</svg>","image/svg+xml"),s=t=>t,i=(t.rmidsandclasses&&(s=e=>(["g","rect","line","path","circle","image","text"].forEach(t=>{$(e.getElementsByTagName(t)).each((t,e)=>{e.setAttribute("class",""),e.setAttribute("id","")})}),e)),["g","rect","line","path","circle","image"].forEach(function(t){a(l.getElementsByTagName(t),o.find(t))}),["text"].forEach(function(t){a(l.getElementsByTagName(t),o.find(t));for(var e=l.getElementsByTagName(t),n=o.find(t),r=0;r<e.length;r++){var s=e.item(r),i=n[r];["font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","text-anchor","dominant-baseline"].forEach(function(t){s.setAttribute(t,$(i).attr(t)||$(i).css(t))})}}),l.getElementsByTagName("image")),g={},c=(n,r,s)=>{var i=n.getAttribute("xlink:href"),o=i.substr(-4,4).toLowerCase(),a={".jpg":"jpeg",jpeg:"jpeg",".png":"png",".svg":"svg+xml"};if(g[i])return n.setAttribute("xlink:href","data:image/"+a[o]+";base64,"+g[i]),s(r-1);switch(o){case".jpg":case"jpeg":case".png":var l=new XMLHttpRequest;l.open("GET",i,!0),l.responseType="arraybuffer";l.onload=function(t){var e=l.response;e&&(e=(t=>{for(var e="",n=new Uint8Array(t),r=n.byteLength,s=0;s<r;s++)e+=String.fromCharCode(n[s]);return window.btoa(e)})(e),g[i]=e,n.setAttribute("xlink:href","data:image/"+a[o]+";base64,"+e)),s(r-1)},l.send(null);break;case".svg":$.get(i,function(t){var e=new XMLSerializer,e=btoa(e.serializeToString(t));g[i]=e,n.setAttribute("xlink:href","data:image/svg+xml;base64,"+e),s(r-1)})}},h=t=>{t<0?e((new XMLSerializer).serializeToString(s(l))):c(i.item(t),t,h)};0<i.length?c(i.item(i.length-1),i.length-1,h):e((new XMLSerializer).serializeToString(s(l)))}function generatorFunctionForVersion(t,e){var n,r=t.settings.version.split("."),s=r[0],r=r[1];if("3"==s){if("0"==r)return nr_intro_generate_svg_3_0(t,e);if("1"==r)return nr_intro_generate_svg_3_1(t,e)}return n=t,t=>{var e="Node-RED version ("+n.settings.version+") not supported";n.notify(e,{type:"error"}),t&&t('<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg width="1000" height="1000" viewBox="0 0 1000 1000" pointer-events="all" style="cursor: crosshair; touch-action: none;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><style>.small { font: bold 20px sans-serif; fill: red;}</style><text x="10" y="30" class="small">'+e+"</text></svg>")}}function addPanZoom(){var t=d3.select("#node-input-screenshot-svgcontainer svg"),e=(t.html("<g>"+t.html()+"</g>"),t.select("g")),n=d3.behavior.zoom().scaleExtent([.2,100]).on("zoom",function(t){e.attr({transform:"translate("+n.translate()+") scale("+n.scale()+")"})});t.call(n)}
|
|
10
10
|
|
|
11
11
|
function setupTreelistInfoness(){var e=collectUndocumentedNodes();if(0==e.length){RED.notify("All nodes documented",{type:"success",timeout:2e3});try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){}}else{try{$("#node-input-orphan-target-container-div").treeList("empty")}catch(e){$("#node-input-orphan-target-container-div").css({width:"100%",height:"calc(100%)"}).treeList({multi:!1}).on("treelistitemmouseover",function(e,t){}).on("treelistitemmouseout",function(e,t){}).on("treelistselect",function(e,t){t.node&&(RED.workspaces.show(t.node.z,!1,!1,!0),RED.view.reveal(t.node.id,!0),RED.view.redraw())}).on("treelistconfirm",function(e,t){var i;t.node&&(i=t.node.id,setTimeout(()=>{var e=RED.nodes.node(i);e&&(RED.view.reveal(e.id),RED.view.select(e.id),RED.editor.edit(e,"editor-tab-description")),i==RED.workspaces.active()&&RED.workspaces.edit()},50))}),$("#node-input-orphan-target-filter").show();var i=$("#node-input-orphan-target-filter").searchBox({style:"compact",delay:300,change:function(){var e,t=$(this).val().trim().toLowerCase();""===t?($("#node-input-orphan-target-container-div").treeList("filter",null),i.searchBox("count","")):(e=$("#node-input-orphan-target-container-div").treeList("filter",function(e){return-1<e.label.toLowerCase().indexOf(t)||-1<e.node.type.toLowerCase().indexOf(t)}),i.searchBox("count",e+" / "+$("#node-input-orphan-target-container-div").treeList("data").length))}})}$("#node-input-orphan-target-container-div").treeList("data",e.sort((e,t)=>e.node.z>t.node.z))}}function collectUndocumentedNodes(){let t=[];RED.nodes.eachNode(e=>{if($("#"+e.id).find(".red-ui-info-available-indicator").remove(),e.info&&e.info.trim()){var i=document.createElementNS("http://www.w3.org/2000/svg","g"),n=(i.setAttribute("class","red-ui-info-available-indicator"),document.createElementNS("http://www.w3.org/2000/svg","circle"));n.setAttribute("cx","5"),n.setAttribute("cy","5"),n.setAttribute("r","5"),n.setAttribute("fill","yellow"),n.setAttribute("id","infoclk-"+e.id),n.setAttribute("style","cursor: pointer;"),i.append(n),$(i).insertBefore($("#"+e.id).find(".red-ui-flow-node-changed"));let t=e.id;$("#infoclk-"+e.id).on("click",e=>{e&&e.preventDefault();e=RED.nodes.node(t);RED.editor.edit(e,"editor-tab-description"),RED.sidebar.show("info")})}else e.z==RED.workspaces.active()&&t.push(e)});var o=[],r={};return t.forEach(function(e){var t=RED.nodes.getType(e.type);if(t){var i,n=t.label,n=("function"==typeof n?n.call(e):n)||"";if(0===(i=e.type).indexOf("subflow:"))return}t&&n||(n=e.type),r[e.id]={node:e,label:n,sublabel:i,selected:!1,checkbox:!1},o.push(r[e.id])}),o}
|
|
12
12
|
|
|
@@ -107,7 +107,10 @@
|
|
|
107
107
|
}
|
|
108
108
|
);
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
let opts = {
|
|
111
|
+
rmidsandclasses: $('#node-input-screenshot-remove-classes-and-ids').is('checked')
|
|
112
|
+
}
|
|
113
|
+
generatorFunctionForVersion(RED, opts)( (svgdata) => {
|
|
111
114
|
$('#node-input-screenshot-svgcontainer').html(svgdata);
|
|
112
115
|
globalRefToSvgData = svgdata;
|
|
113
116
|
setTimeout(() => {
|
|
@@ -242,29 +245,34 @@
|
|
|
242
245
|
<div class="col-100">
|
|
243
246
|
|
|
244
247
|
<div class="form-row" style="margin-left: 10px; margin-top: 30px;">
|
|
245
|
-
|
|
248
|
+
<button type="button" id="node-screenshot-capture-btn"
|
|
249
|
+
class="red-ui-button red-ui-button-large"><i class="fa fa-camera"></i> Capture</button>
|
|
250
|
+
|
|
251
|
+
<label for="node-input-screenshot-remove-classes-and-ids" class="ml-30" style="width: 200px">
|
|
252
|
+
<span>Remove Classes and Ids?</span>
|
|
253
|
+
</label>
|
|
254
|
+
<input type="checkbox" checked=checked id="node-input-screenshot-remove-classes-and-ids"
|
|
255
|
+
style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
246
256
|
</div>
|
|
247
257
|
|
|
248
258
|
<div class="form-row" style="margin-left: 10px; margin-top: 30px;">
|
|
249
|
-
|
|
250
|
-
class="red-ui-button red-ui-button-large"><i class="fa fa-camera"></i> Capture</button>
|
|
251
|
-
|
|
252
|
-
<button type="button" id="node-screenshot-download-svg" style="margin-left: 30px;"
|
|
253
|
-
class="red-ui-button red-ui-button-large"><i class="fa fa-download"></i> Download</button>
|
|
254
|
-
<button type="button" id="node-screenshot-copy-to-clipboard-svg"
|
|
255
|
-
class="red-ui-button red-ui-button-large"><i class="fa fa-clipboard"></i> Copy to Clipboard</button>
|
|
259
|
+
Step 1: Capture a screen shot, Step 2: download it, copy it or post off.
|
|
256
260
|
</div>
|
|
257
261
|
|
|
262
|
+
|
|
258
263
|
<div class="form-row"
|
|
259
264
|
style="min-height: 300px; height: 450px; overflow: hidden; margin-left: 10px; margin-right: 15px; border: 1px rgb(196, 196, 196) solid; border-radius: 5px;">
|
|
260
265
|
<div id="node-input-screenshot-svgcontainer"></div>
|
|
261
266
|
</div>
|
|
262
267
|
|
|
263
268
|
<div class="form-row" style="margin-left: 10px; margin-top: 30px;">
|
|
264
|
-
<
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
269
|
+
<button type="button" id="node-screenshot-download-svg"
|
|
270
|
+
class="red-ui-button red-ui-button-large"><i class="fa fa-download"></i> Download</button>
|
|
271
|
+
<button type="button" id="node-screenshot-copy-to-clipboard-svg"
|
|
272
|
+
class="red-ui-button red-ui-button-large"><i class="fa fa-clipboard"></i> Copy to Clipboard</button>
|
|
273
|
+
</div>
|
|
274
|
+
|
|
275
|
+
<div class="form-row" style="margin-left: 10px; margin-top: 30px;">
|
|
268
276
|
<input type="text" id="node-input-svgpost-endpoint" placeholder="/screenshot" style="width: 40% !important;">
|
|
269
277
|
<button type="button" id="node-screenshot-post-svg-to-endpoint"
|
|
270
278
|
class="red-ui-button red-ui-button-large"><i class="fa fa-send-o"></i> Post to Endpoint</button>
|
|
@@ -429,17 +437,18 @@
|
|
|
429
437
|
|
|
430
438
|
<div class="form-row">
|
|
431
439
|
<label for="node-input-obfuscate-add-license-text" class="w-30">
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
440
|
+
<i class="fa fa-gavel"></i>
|
|
441
|
+
<span>Replace info with license?</span>
|
|
442
|
+
</label>
|
|
435
443
|
<input type="checkbox" id="node-input-obfuscate-add-license-text" style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
436
444
|
</div>
|
|
437
|
-
|
|
445
|
+
|
|
438
446
|
<div id="node-input-obfuscate-add-license-text-row" class="form-row" style="margin-left: 10px; display: none;">
|
|
439
447
|
<label for="node-input-obfuscate-append-license-text">
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
<input type="checkbox" id="node-input-obfuscate-append-license-text" style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
448
|
+
<span>Append to info?</span>
|
|
449
|
+
</label>
|
|
450
|
+
<input type="checkbox" id="node-input-obfuscate-append-license-text" style="display:inline-block; width:15px; vertical-align:baseline;">
|
|
451
|
+
<textarea id="node-input-obfuscate-license-text" placeholder="License Text"></textarea>
|
|
443
452
|
</div>
|
|
444
453
|
|
|
445
454
|
<div class="form-row">
|