1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #294 from hindessm/trivial-whitespace-fixes

Trivial whitespace fixes
This commit is contained in:
Nick O'Leary 2014-07-23 23:03:37 +01:00
commit 16a5aa7368
4 changed files with 74 additions and 74 deletions

View File

@ -150,7 +150,7 @@
return Number( value );
}
var p = value.split(":");
var offset = new Date().getTimezoneOffset();
var offset = new Date().getTimezoneOffset();
return (((Number(p[0])+1)*60)+Number(p[1])+offset)*60*1000;
}
return value;

View File

@ -17,36 +17,36 @@
var RED = require(process.env.NODE_RED_HOME+"/red/red");
function HttpGet(n) {
RED.nodes.createNode(this,n);
this.baseurl = n.baseurl || "";
this.append = n.append || "";
var node = this;
if (this.baseurl.substring(0,5) === "https") { var http = require("https"); }
else { var http = require("http"); }
this.on("input", function(msg) {
msg._payload = msg.payload;
//util.log("[httpget] "+this.baseurl+msg.payload+this.append);
http.get(this.baseurl+msg.payload+this.append, function(res) {
node.log("Http response: " + res.statusCode);
msg.rc = res.statusCode;
msg.payload = "";
if ((msg.rc != 200) && (msg.rc != 404)) {
node.send(msg);
}
res.setEncoding('utf8');
res.on('data', function(chunk) {
msg.payload += chunk;
});
res.on('end', function() {
node.send(msg);
});
}).on('error', function(e) {
//node.error(e);
msg.rc = 503;
msg.payload = e;
node.send(msg);
});
});
RED.nodes.createNode(this,n);
this.baseurl = n.baseurl || "";
this.append = n.append || "";
var node = this;
if (this.baseurl.substring(0,5) === "https") { var http = require("https"); }
else { var http = require("http"); }
this.on("input", function(msg) {
msg._payload = msg.payload;
//util.log("[httpget] "+this.baseurl+msg.payload+this.append);
http.get(this.baseurl+msg.payload+this.append, function(res) {
node.log("Http response: " + res.statusCode);
msg.rc = res.statusCode;
msg.payload = "";
if ((msg.rc != 200) && (msg.rc != 404)) {
node.send(msg);
}
res.setEncoding('utf8');
res.on('data', function(chunk) {
msg.payload += chunk;
});
res.on('end', function() {
node.send(msg);
});
}).on('error', function(e) {
//node.error(e);
msg.rc = 503;
msg.payload = e;
node.send(msg);
});
});
}
RED.nodes.registerType("httpget",HttpGet);

View File

@ -75,12 +75,12 @@ module.exports = function(RED) {
} else {
fs.readFile(filename,options,function(err,data) {
if (err) {
node.warn(err);
node.warn(err);
msg.error = err;
} else {
msg.filename = filename;
msg.payload = data;
}
}
node.send(msg);
});
}

View File

@ -12,39 +12,39 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
**/
RED.palette = function() {
RED.palette = function() {
var exclusion = ['config','unknown','deprecated'];
var core = ['input', 'output', 'function', 'social', 'storage', 'analysis', 'advanced'];
function createCategoryContainer(category){
$("#palette-container").append('\
<div class="palette-category">\
<div id="header-'+category+'" class="palette-header"><i class="expanded icon-chevron-down"></i><span>'+category+'</span></div>\
<div class="palette-content" id="palette-base-category-'+category+'">\
<div id="palette-'+category+'-input"></div>\
<div id="palette-'+category+'-output"></div>\
<div id="palette-'+category+'-function"></div>\
</div>\
</div>');
}
core.forEach(createCategoryContainer);
var exclusion = ['config','unknown','deprecated'];
var core = ['input', 'output', 'function', 'social', 'storage', 'analysis', 'advanced'];
function createCategoryContainer(category){
$("#palette-container").append('\
<div class="palette-category">\
<div id="header-'+category+'" class="palette-header"><i class="expanded icon-chevron-down"></i><span>'+category+'</span></div>\
<div class="palette-content" id="palette-base-category-'+category+'">\
<div id="palette-'+category+'-input"></div>\
<div id="palette-'+category+'-output"></div>\
<div id="palette-'+category+'-function"></div>\
</div>\
</div>');
}
core.forEach(createCategoryContainer);
function addNodeType(nt,def) {
if (exclusion.indexOf(def.category)===-1) {
var category = def.category.split("-");
if (exclusion.indexOf(def.category)===-1) {
var category = def.category.split("-");
var d = document.createElement("div");
d.id = "pn_"+nt;
d.type = nt;
var label = /^(.*?)([ -]in|[ -]out)?$/.exec(nt)[1];
var label = /^(.*?)([ -]in|[ -]out)?$/.exec(nt)[1];
d.innerHTML = '<div class="palette_label">'+label+"</div>";
d.className="palette_node";
@ -70,15 +70,15 @@ RED.palette = function() {
port.className = "palette_port";
d.appendChild(port);
}
if($("#palette-base-category-"+category[0]).length == 0){
createCategoryContainer(category[0]);
}
if($("#palette-"+def.category).length == 0){
$("#palette-base-category-"+category[0]).append('\
<div id="palette-'+def.category+'"></div>');
}
if($("#palette-base-category-"+category[0]).length == 0){
createCategoryContainer(category[0]);
}
if($("#palette-"+def.category).length == 0){
$("#palette-base-category-"+category[0]).append('\
<div id="palette-'+def.category+'"></div>');
}
$("#palette-"+def.category).append(d);
d.onmousedown = function(e) { e.preventDefault(); }
@ -102,13 +102,13 @@ RED.palette = function() {
revert: true,
revertDuration: 50
});
$("#header-"+category[0]).off('click').on('click', function(e) {
$(this).next().slideToggle();
$(this).children("i").toggleClass("expanded");
});
}
$("#header-"+category[0]).off('click').on('click', function(e) {
$(this).next().slideToggle();
$(this).children("i").toggleClass("expanded");
});
}
}
function filterChange() {