mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Update notify node to pick up renamed node-red icon image
This commit is contained in:
parent
4b3db1e780
commit
5782a4ee85
@ -26,10 +26,10 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="notify">
|
<script type="text/x-red" data-help-name="notify">
|
||||||
<p>Uses Growl to provide a desktop popup containing the <b>msg.payload</b>. Only useful on the local machine.</p>
|
<p>Uses Growl to provide a desktop popup containing the <b>msg.payload</b>. Only useful on the local machine.</p>
|
||||||
<p>Optionally uses <b>msg.topic</b> as the title.</p>
|
<p>Optionally uses <b>msg.topic</b> as the title.</p>
|
||||||
<p>Uses Growl so should work cross platform but will need pre-reqs installed... see <i><a href="https://npmjs.org/package/growl" target="_new">this link.</a></i></p>
|
<p>Uses Growl so should work cross platform but will need pre-reqs installed... see <i><a href="https://npmjs.org/package/growl" target="_new">this link.</a></i></p>
|
||||||
<p>If installing on Windows you MUST read the install instructions ... especially the bit about adding growlnotify to your path... or it WON'T work.</p>
|
<p>If installing on Windows you MUST read the install instructions ... especially the bit about adding growlnotify to your path... or it WILL NOT work.</p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -16,24 +16,24 @@
|
|||||||
|
|
||||||
var RED = require(process.env.NODE_RED_HOME+"/red/red");
|
var RED = require(process.env.NODE_RED_HOME+"/red/red");
|
||||||
var growl = require('growl');
|
var growl = require('growl');
|
||||||
var imagefile = process.env.NODE_RED_HOME+"/public/mqtt-node-red.png";
|
var imagefile = process.env.NODE_RED_HOME+"/public/node-red.png";
|
||||||
|
|
||||||
function NotifyNode(n) {
|
function NotifyNode(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.title = n.title;
|
this.title = n.title;
|
||||||
var node = this;
|
var node = this;
|
||||||
this.on("input",function(msg) {
|
this.on("input",function(msg) {
|
||||||
var titl = this.title||msg.topic;
|
var titl = this.title || msg.topic;
|
||||||
if (typeof(msg.payload) == 'object') {
|
if (typeof(msg.payload) == 'object') {
|
||||||
msg.payload = JSON.stringify(msg.payload);
|
msg.payload = JSON.stringify(msg.payload);
|
||||||
}
|
}
|
||||||
if (typeof(titl) != 'undefined') {
|
if (typeof(titl) != 'undefined') {
|
||||||
growl(msg.payload, { title: titl, image: imagefile });
|
growl(msg.payload, { title: titl, image: imagefile });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
growl(msg.payload, { image: imagefile });
|
growl(msg.payload, { image: imagefile });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
RED.nodes.registerType("notify",NotifyNode);
|
RED.nodes.registerType("notify",NotifyNode);
|
||||||
|
Loading…
Reference in New Issue
Block a user