Browse Source

Add GUI documentation URLs

dds
PaulStoffregen 10 years ago
parent
commit
029bbe268f
4 changed files with 26 additions and 5 deletions
  1. +17
    -2
      gui/red/main.js
  2. +5
    -1
      gui/red/nodes.js
  3. +3
    -2
      gui/red/ui/palette.js
  4. +1
    -0
      gui/red/ui/view.js

+ 17
- 2
gui/red/main.js View File

@@ -157,10 +157,19 @@ var RED = (function() {
]
});

// from http://css-tricks.com/snippets/javascript/get-url-variables/
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}

function loadNodes() {
console.log("loadNodes");
$.get('list.html', function(data) {
console.log("loadNodes complete");
$("body").append(data);
$(".palette-spinner").hide();
$(".palette-scroll").show();
@@ -171,6 +180,12 @@ var RED = (function() {
$("#btn-deploy").removeClass("disabled").addClass("btn-danger");
}, 1500);
$('#btn-deploy').click(function() { save(); });
// if the query string has ?info=className, populate info tab
var info = getQueryVariable("info");
if (info) {
$("#tab-info").html('<div class="node-help">'
+($("script[data-help-name|='"+info+"']").html()||"")+"</div>");
}
}, "html");
}


+ 5
- 1
gui/red/nodes.js View File

@@ -71,7 +71,10 @@ RED.nodes = (function() {
function getType(type) {
return node_defs[type];
}

function selectNode(name) {
window.history.pushState(null, null, window.location.protocol + "//"
+ window.location.host + window.location.pathname + '?info=' + name);
}
function addNode(n) {
if (n._def.category == "config") {
configNodes[n.id] = n;
@@ -453,6 +456,7 @@ RED.nodes = (function() {
registerType: registerType,
getType: getType,
convertNode: convertNode,
selectNode: selectNode,
add: addNode,
addLink: addLink,
remove: removeNode,

+ 3
- 2
gui/red/ui/palette.js View File

@@ -98,8 +98,9 @@ RED.palette = (function() {
content: $(($("script[data-help-name|='"+nt+"']").html()||"<h2>empty</h2><p>no information available</p>").trim())[2] // TODO: how to use jQuery to always select the first <p> within the html?
});
$(d).click(function() {
var help = '<div class="node-help">'+($("script[data-help-name|='"+d.type+"']").html()||"")+"</div>";
$("#tab-info").html(help);
RED.nodes.selectNode(d.type);
var help = '<div class="node-help">'+($("script[data-help-name|='"+d.type+"']").html()||"")+"</div>";
$("#tab-info").html(help);
});
$(d).draggable({
helper: 'clone',

+ 1
- 0
gui/red/ui/view.js View File

@@ -675,6 +675,7 @@ RED.view = (function() {
}
if (moving_set.length == 1) {
RED.sidebar.info.refresh(moving_set[0].n);
RED.nodes.selectNode(moving_set[0].n.type);
} else {
RED.sidebar.info.clear();
}

Loading…
Cancel
Save