[CCSDK-28] populated the seed code for dgbuilder
[ccsdk/distribution.git] / dgbuilder / core_nodes / parsers / 70-HTML.html
1 <!--
2   Copyright 2014 IBM Corp.
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8   http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15 -->
16
17 <script type="text/x-red" data-template-name="html">
18     <div class="form-row">
19         <label for="node-input-tag"><i class="fa fa-filter"></i> Select</label>
20         <input type="text" id="node-input-tag" placeholder="h1">
21     </div>
22     <div class="form-row">
23         <label for="node-input-ret"><i class="fa fa-sign-out"></i> Output</label>
24         <select id="node-input-ret" style="width:73% !important">
25             <option value="html">the html content of the elements</option>
26             <option value="text">only the text content of the elements</option>
27             <!-- <option value="attr">an object of any attributes</option> -->
28             <!-- <option value="val">return the value from a form element</option> -->
29         </select>
30     </div>
31     <div class="form-row">
32         <label for="node-input-as">&nbsp;</label>
33         <select id="node-input-as" style="width:73% !important">
34             <option value="single">as a single message containing an array</option>
35             <option value="multi">as multiple messages, one for each element</option>
36         </select>
37     </div>
38     <br/>
39     <div class="form-row">
40         <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
41         <input type="text" id="node-input-name" placeholder="Name">
42     </div>
43     <div class="form-tips">Tip: The <b>Select</b> value is a <a href="http://api.jquery.com/category/selectors/" target="_new"><i><u>jQuery</u></i></a> style selector.</div>
44 </script>
45
46 <script type="text/x-red" data-help-name="html">
47     <p>Extracts elements from an html document held in <b>msg.payload</b> using a selector.</p>
48     <p>The selector uses the <a href="http://api.jquery.com/category/selectors/" target="_new">jQuery syntax</a>.</p>
49     <p>The result is either a single message with a payload containing an array of the matched elements, or multiple
50        messages that each contain a matched element.</p>
51 </script>
52
53 <script type="text/javascript">
54     RED.nodes.registerType('html',{
55         category: 'function',
56         color:"#DEBD5C",
57         defaults: {
58             tag: {value:""},
59             ret: {value:"html"},
60             as: {value:"single"},
61             name: {value:""}
62         },
63         inputs:1,
64         outputs:1,
65         icon: "jq.png",
66         label: function() {
67             return this.name||this.tag||"html";
68         },
69         labelStyle: function() {
70             return this.name?"node_label_italic":"";
71         }
72     });
73 </script>