UNPKG

node-red-contrib-boolean-logic-ultimate

Version:

A set of Node-RED enhanced boolean logic node, flow interruption node, blinker node, invert node, filter node, with persisten values after reboot and more.

89 lines (82 loc) 3.6 kB
<script type="text/javascript"> RED.nodes.registerType('InjectUltimate', { category: 'common', color: '#ff8080', defaults: { name: { value: "Inject", }, topic: { value: "1", }, curVal: { value: true, } }, inputs: 0, outputs: 3, outputLabels: ["True", "False", "Toggle"], icon: "inject.svg", button: { onclick: function () { // Called when the button is clicked if (this.changed) { return RED.notify(RED._("notification.warning", { message: RED._("notification.warnings.undeployedChanges") }), "warning"); } var node = this; $.ajax({ url: "InjectUltimate/" + this.id, type: "POST", success: function (resp) { RED.notify(node._("inject.success", { label: label }), { type: "success", id: "inject" }); }, error: function (jqXHR, textStatus, errorThrown) { if (jqXHR.status == 404) { RED.notify(node._("common.notification.error", { message: node._("common.notification.errors.not-deployed") }), "error"); } else if (jqXHR.status == 500) { RED.notify(node._("common.notification.error", { message: node._("inject.errors.failed") }), "error"); } else if (jqXHR.status == 0) { RED.notify(node._("common.notification.error", { message: node._("common.notification.errors.no-response") }), "error"); } else { RED.notify(node._("common.notification.error", { message: node._("common.notification.errors.unexpected", { status: jqXHR.status, message: textStatus }) }), "error"); } } }); }, enabled: function () { return !this.changed } }, label: function () { return this.name + " " + this.topic; }, paletteLabel: function () { return "InjectUltimate"; } }); </script> <script type="text/x-red" data-template-name="InjectUltimate"> <div class="form-row"> <b>Inject Ultimate</b>&nbsp&nbsp&nbsp&nbsp<span style="color:red"><i class="fa fa-question-circle"></i>&nbsp<a target="_blank" href="https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate"><u>Help online</u></a></span> <br/> <br/> </div> <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> <div class="form-row"> <label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label> <input type="text" id="node-input-topic" placeholder="Topic"> </div> </script> <script type="text/x-red" data-help-name="InjectUltimate"> <p> SEE THE README FOR HELP CONFIGURING THE NODE </p> <p> <a href="https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate" target="_blank">Click here to learn how to configure the node.</a> </p> <a href="https://www.paypal.me/techtoday" target="_blank"><img src='https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square' width='30%'></a> </script>