You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 4 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <script type="text/javascript">
  2. RED.nodes.registerType('InjectUltimate', {
  3. category: 'boolean logic ultimate',
  4. color: '#ff8080',
  5. defaults: {
  6. name: {
  7. value: "Inject",
  8. },
  9. curVal: {
  10. value: true,
  11. }
  12. },
  13. inputs: 0,
  14. outputs: 3,
  15. outputLabels: ["True", "False", "Toggle"],
  16. icon: "inject.svg",
  17. button: {
  18. onclick: function () {
  19. // Called when the button is clicked
  20. if (this.changed) {
  21. return RED.notify(RED._("notification.warning", { message: RED._("notification.warnings.undeployedChanges") }), "warning");
  22. }
  23. var node = this;
  24. $.ajax({
  25. url: "InjectUltimate/" + this.id,
  26. type: "POST",
  27. success: function (resp) {
  28. RED.notify(node._("inject.success", { label: label }), { type: "success", id: "inject" });
  29. },
  30. error: function (jqXHR, textStatus, errorThrown) {
  31. if (jqXHR.status == 404) {
  32. RED.notify(node._("common.notification.error", { message: node._("common.notification.errors.not-deployed") }), "error");
  33. } else if (jqXHR.status == 500) {
  34. RED.notify(node._("common.notification.error", { message: node._("inject.errors.failed") }), "error");
  35. } else if (jqXHR.status == 0) {
  36. RED.notify(node._("common.notification.error", { message: node._("common.notification.errors.no-response") }), "error");
  37. } else {
  38. RED.notify(node._("common.notification.error", { message: node._("common.notification.errors.unexpected", { status: jqXHR.status, message: textStatus }) }), "error");
  39. }
  40. }
  41. });
  42. },
  43. enabled: function () {
  44. return !this.changed
  45. }
  46. },
  47. label:
  48. function () {
  49. return this.name || "Inject";
  50. },
  51. paletteLabel: function () {
  52. return "InjectUltimate";
  53. }
  54. });
  55. </script>
  56. <script type="text/x-red" data-template-name="InjectUltimate">
  57. <div class="form-row">
  58. <label for="node-input-name"><i class="icon-tag"></i> Name</label>
  59. <input type="text" id="node-input-name" placeholder="Name">
  60. </div>
  61. <div class="form-row">
  62. <label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
  63. <input type="text" id="node-input-topic" placeholder="Topic">
  64. </div>
  65. </script>
  66. <script type="text/x-red" data-help-name="InjectUltimate">
  67. <p>
  68. <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>
  69. and
  70. <a href="http://eepurl.com/gJm095" target="_blank">Subscribe to my channel</a> for news about my nodes.
  71. </p>
  72. <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/>
  73. The status indicator represents the output value.
  74. </p>
  75. <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>
  76. </script>