-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweekday-router.html
50 lines (44 loc) · 2.69 KB
/
weekday-router.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!-- First, the content of the edit dialog is defined. -->
<script type="text/x-red" data-template-name="weekday router">
<!-- data-template-name identifies the node type this is for -->
<!-- Each of the following divs creates a field in the edit dialog. -->
<!-- Generally, there should be an input for each property of the node. -->
<!-- The for and id attributes identify the corresponding property -->
<!-- (with the 'node-input-' prefix). -->
<!-- The available icon classes are defined Twitter Bootstrap glyphicons -->
<!-- By convention, most nodes have a 'name' property. The following div -->
<!-- provides the necessary field. Should always be the last option -->
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<!-- Next, some simple help text is provided for the node. -->
<script type="text/x-red" data-help-name="weekday router">
<p>Routes messages depending on weekday</p>
<p>This node will forward the input message to one of the seven outputs depending on the day of the week.</p>
<p>If the input message has a <strong>date</strong> parameter (msg.date) of type <em>Date</em>, then it will route based on that date instead of the system date (today).</p>
<p>The outputs are in order, starting with Sunday and ending with Saturday</p>
<!-- data-help-name identifies the node type this help is for -->
<!-- This content appears in the Info sidebar when a node is selected -->
<!-- The first <p> is used as the pop-up tool tip when hovering over a -->
<!-- node in the palette. -->
</script>
<!-- Finally, the node type is registered along with all of its properties -->
<!-- The example below shows a small subset of the properties that can be set-->
<script type="text/javascript">
RED.nodes.registerType('weekday router',{
category: 'hovis', // the palette category
defaults: { },
color: "#87A980",
inputs:1, // set the number of inputs - only 0 or 1
outputs:7, // set the number of outputs - 0 to n
// set the icon (held in icons dir below where you save the node)
label: function() { // sets the default label contents
return this.name||this.topic||"Weekday Router";
},
labelStyle: function() { // sets the class to apply to the label
return this.name?"node_label_italic":"";
}
});
</script>