|
- <script type="text/javascript">
- RED.nodes.registerType('InjectUltimate', {
- category: 'boolean logic ultimate',
- color: '#ff8080',
- defaults: {
- name: {
- value: "Inject",
- },
- 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 || "Inject";
- },
- paletteLabel: function () {
- return "InjectUltimate";
- }
- });
- </script>
-
- <script type="text/x-red" data-template-name="InjectUltimate">
- <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>
- <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>
- and
- <a href="http://eepurl.com/gJm095" target="_blank">Subscribe to my channel</a> for news about my nodes.
- </p>
-
- <p>This node sends TRUE on output 1, FALSE on putput 2 and a TOGGLED value (true/false) on output 3, on every click of the button.<br/>
- The status indicator represents the output value.
- </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>
|