UNPKG

grunig-nodes

Version:

Grünig Nodes Library

58 lines (50 loc) 1.59 kB
<script type="text/javascript"> RED.nodes.registerType('G-Remote', { category: 'Grunig', color: 'rgb(176, 223, 227)', defaults: { name: { value: ""}, }, description: "Test", inputs:1, outputs:3, icon: "feed.svg", label: function() { return this.name || "G-Remote"; }, oneditprepare: function() { // Diese Funktion wird ausgeführt, wenn das Formular zum Bearbeiten des Knotens geladen wird // Verweis auf das aktuelle Knotenobjekt var node = this; node.dirty = true; // Eingabefeld für den Namen var nameInput = $("#node-config-input-name"); nameInput.val(node.name); // Änderungsereignis für den Namen nameInput.on("change", function() { node.name = nameInput.val(); RED.nodes.dirty(true); RED.nodes.node(node.id).changed = true; }); } }); </script> <!-- Styles --> <style> div.form-row label { width: 180px; display: contents; } div.form-row input { width: 60%; } .form-row { margin-bottom: 10px; } </style> <script type="text/html" data-template-name="G-Remote"> <div class="form-row"> <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label> <input type="text" id="node-config-input-name" placeholder="Name"> </div> </script>