UNPKG

node-red-contrib-smartnode

Version:

this project is a nodejs package for making the nodered support the Smart Device development. the pacakge require node-red enviroment.

68 lines (58 loc) 2.18 kB
<!-- Copyright 2015 Maker Collider Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 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. --> <script type="text/javascript"> RED.nodes.registerType('Clarifai', { category: 'Extra', color: '#E2D96E', defaults: { name: {value: "Clarifai", required: false}, image: {value: "static.jpg", required: false} }, inputs: 0, outputs: 1, icon: "light.png", label: function() { return this.name || "Clarifai"; }, oneditprepare: function() { loadFrame(); }, oneditsave: function() { var node = this; node.image = 'static.jpg'; } }); //load frame var host = window.location.host; var web_url = 'http://'+host.replace(/1880/, "3000"); function loadFrame(){ $('#frmUpload').attr('src',web_url); } </script> <script type="text/x-red" data-template-name="Clarifai"> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-image"><i class="fa fa-bookmark"></i> Image</label> <input type="text" id="node-input-image" placeholder="Image" value="static.jpg"> </div> <div class="form-row"> <label><i class="fa fa-bookmark"></i> Upload</label> <span style="position: absolute;padding-left:5px;width:350px;"> <iframe id="frmUpload" src="" frameborder="0" width="100%" height="30" scrolling="no" > </iframe> </span> </div> </script>