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

add examples for HTML node

This commit is contained in:
Hiroyasu Nishiyama 2020-11-03 17:32:53 +09:00
parent 725c962236
commit bc82ca2106
4 changed files with 431 additions and 0 deletions

View File

@ -0,0 +1,94 @@
[
{
"id": "8c5224a6.201b88",
"type": "inject",
"z": "4b63452d.672afc",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 220,
"y": 180,
"wires": [
[
"d6c67e51.0d709"
]
]
},
{
"id": "d6c67e51.0d709",
"type": "template",
"z": "4b63452d.672afc",
"name": "HTML text",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "plain",
"template": "<html>\n <head>\n <title>List of Fruits</title>\n </head>\n <body>\n <ul>\n <li class=\"Item\">Apple</li>\n <li class=\"Item\">Orange</li>\n <li class=\"Item\">Banana</li>\n </ul>\n </body>\n</html>\n",
"output": "str",
"x": 390,
"y": 180,
"wires": [
[
"599a1155.61a5c"
]
]
},
{
"id": "b0d5cd89.338df",
"type": "comment",
"z": "4b63452d.672afc",
"name": "Extract array of HTML element by CSS selector",
"info": "HTML node can be used to extract elements in HTML document as an array using CSS selector.",
"x": 280,
"y": 120,
"wires": []
},
{
"id": "599a1155.61a5c",
"type": "html",
"z": "4b63452d.672afc",
"name": "",
"property": "payload",
"outproperty": "payload",
"tag": ".Item",
"ret": "html",
"as": "single",
"x": 550,
"y": 180,
"wires": [
[
"942b23d1.cce09"
]
]
},
{
"id": "942b23d1.cce09",
"type": "debug",
"z": "4b63452d.672afc",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 710,
"y": 180,
"wires": []
}
]

View File

@ -0,0 +1,94 @@
[
{
"id": "a44973e8.6319b",
"type": "inject",
"z": "4b63452d.672afc",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 220,
"y": 360,
"wires": [
[
"de1b012e.96ec3"
]
]
},
{
"id": "de1b012e.96ec3",
"type": "template",
"z": "4b63452d.672afc",
"name": "HTML text",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "plain",
"template": "<html>\n <head>\n <title>List of Fruits</title>\n </head>\n <body>\n <ul>\n <li class=\"Item\">Apple</li>\n <li class=\"Item\">Orange</li>\n <li class=\"Item\">Banana</li>\n </ul>\n </body>\n</html>\n",
"output": "str",
"x": 390,
"y": 360,
"wires": [
[
"cee70712.6f3538"
]
]
},
{
"id": "99e32bc7.c8e508",
"type": "comment",
"z": "4b63452d.672afc",
"name": "Extract sequence of HTML element by CSS selector",
"info": "HTML node can be used to extract elements in HTML document as a messege sequence using CSS selector.",
"x": 290,
"y": 300,
"wires": []
},
{
"id": "cee70712.6f3538",
"type": "html",
"z": "4b63452d.672afc",
"name": "",
"property": "payload",
"outproperty": "payload",
"tag": ".Item",
"ret": "html",
"as": "multi",
"x": 550,
"y": 360,
"wires": [
[
"17f25482.d4b56b"
]
]
},
{
"id": "17f25482.d4b56b",
"type": "debug",
"z": "4b63452d.672afc",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 710,
"y": 360,
"wires": []
}
]

View File

@ -0,0 +1,121 @@
[
{
"id": "653ce9aa.b6a1c8",
"type": "inject",
"z": "4b63452d.672afc",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 220,
"y": 560,
"wires": [
[
"52a16f7f.447d8"
]
]
},
{
"id": "52a16f7f.447d8",
"type": "template",
"z": "4b63452d.672afc",
"name": "HTML text",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "plain",
"template": "<html>\n <head>\n <title>List of Fruits</title>\n </head>\n <body>\n <ul>\n <li class=\"Item\">Apple</li>\n <li class=\"Item\">Orange</li>\n <li class=\"Item\">Banana</li>\n </ul>\n </body>\n</html>\n",
"output": "str",
"x": 390,
"y": 560,
"wires": [
[
"a52319c3.89b008"
]
]
},
{
"id": "8bc35379.31d99",
"type": "comment",
"z": "4b63452d.672afc",
"name": "Extract array of HTML element by CSS selector specified in message",
"info": "CSS selector for HTML node can be specified by `select` property of input message.",
"x": 350,
"y": 500,
"wires": []
},
{
"id": "9c49de8a.bad25",
"type": "html",
"z": "4b63452d.672afc",
"name": "",
"property": "payload",
"outproperty": "payload",
"tag": "",
"ret": "html",
"as": "single",
"x": 730,
"y": 560,
"wires": [
[
"d4f4b987.278a68"
]
]
},
{
"id": "d4f4b987.278a68",
"type": "debug",
"z": "4b63452d.672afc",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 890,
"y": 560,
"wires": []
},
{
"id": "a52319c3.89b008",
"type": "change",
"z": "4b63452d.672afc",
"name": "",
"rules": [
{
"t": "set",
"p": "select",
"pt": "msg",
"to": ".Item",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 560,
"y": 560,
"wires": [
[
"9c49de8a.bad25"
]
]
}
]

View File

@ -0,0 +1,122 @@
[
{
"id": "66cff4ee.f2761c",
"type": "inject",
"z": "4b63452d.672afc",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 220,
"y": 760,
"wires": [
[
"2baaf6bf.0a02ca"
]
]
},
{
"id": "2baaf6bf.0a02ca",
"type": "template",
"z": "4b63452d.672afc",
"name": "HTML text",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "plain",
"template": "<html>\n <head>\n <title>List of Fruits</title>\n </head>\n <body>\n <ul>\n <li class=\"Item\">Apple</li>\n <li class=\"Item\">Orange</li>\n <li class=\"Item\">Banana</li>\n </ul>\n </body>\n</html>\n",
"output": "str",
"x": 390,
"y": 760,
"wires": [
[
"bbb22e6b.0fa25"
]
]
},
{
"id": "a57d35d0.8aa538",
"type": "comment",
"z": "4b63452d.672afc",
"name": "Join extracedt sequence of HTML element using join node",
"info": "Message sequence extracted by HTML node can be combined using join node.",
"x": 310,
"y": 700,
"wires": []
},
{
"id": "bbb22e6b.0fa25",
"type": "html",
"z": "4b63452d.672afc",
"name": "",
"property": "payload",
"outproperty": "payload",
"tag": ".Item",
"ret": "html",
"as": "multi",
"x": 550,
"y": 760,
"wires": [
[
"bd01ca4.966ad38"
]
]
},
{
"id": "4d2616a8.84de88",
"type": "debug",
"z": "4b63452d.672afc",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 850,
"y": 760,
"wires": []
},
{
"id": "bd01ca4.966ad38",
"type": "join",
"z": "4b63452d.672afc",
"name": "",
"mode": "custom",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 690,
"y": 760,
"wires": [
[
"4d2616a8.84de88"
]
]
}
]