Node-Red configuration
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <script type="text/javascript">
  2. RED.nodes.registerType('ui_link',{
  3. category: 'config',
  4. color: 'rgb( 63, 173, 181)',
  5. defaults: {
  6. name: {value: 'Google'},
  7. link: {value: 'https://www.google.com'},
  8. icon: {value: 'open_in_browser'},
  9. target: {value: 'newtab', validate :function() { return true; }},
  10. order: {value: 0},
  11. className: {value: ''}
  12. },
  13. inputs:0,
  14. outputs:0,
  15. hasUsers: false,
  16. align: "right",
  17. icon: "ui_link.png",
  18. paletteLabel: 'link',
  19. label: function() { return this.name || 'link'; },
  20. labelStyle: function() { return this.name?"node_label_italic":""; },
  21. oneditprepare: function() {
  22. document.getElementById('node-config-input-target-opentab').checked = (this.target === 'newtab');
  23. document.getElementById('node-config-input-target-openiframe').checked = (this.target === 'iframe');
  24. document.getElementById('node-config-input-target-openthis').checked = (this.target === 'thistab');
  25. },
  26. oneditsave : function () {
  27. var t = 'iframe';
  28. if (document.getElementById('node-config-input-target-opentab').checked) { t = 'newtab'; }
  29. if (document.getElementById('node-config-input-target-openthis').checked) { t = 'thistab'; }
  30. this.target = t;
  31. },
  32. onadd: function() {
  33. //console.log("PING");
  34. }
  35. });
  36. </script>
  37. <script type="text/html" data-template-name="ui_link">
  38. <div class="form-row">
  39. <label for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="ui_link.label.name"></span></label>
  40. <input type="text" id="node-config-input-name">
  41. </div>
  42. <div class="form-row">
  43. <label for="node-input-className"><i class="fa fa-code"></i> <span data-i18n="ui_link.label.className"></label>
  44. <input type="text" id="node-input-className" data-i18n="[placeholder]ui_link.label.classNamePlaceholder"/>
  45. </div>
  46. <div class="form-row">
  47. <label for="node-config-input-link"><i class="fa fa-link"></i> <span data-i18n="ui_link.label.link"></span></label>
  48. <input type="text" id="node-config-input-link">
  49. </div>
  50. <div class="form-row">
  51. <label for="node-config-input-icon"><i class="fa fa-image"></i> <span data-i18n="ui_link.label.icon"></span></label>
  52. <input type="text" id="node-config-input-icon">
  53. </div>
  54. <div class="form-row">
  55. <label><i class="fa fa-link"></i> <span data-i18n="ui_link.label.open-in"></span></label>
  56. <input type="radio" id="node-config-input-target-opentab" name="open-link-method" style="width:20px; margin-top:0px; margin-bottom:5px" checked>
  57. <label for="node-config-input-target-opentab" data-i18n="ui_link.label.new-tab"></label><br/>
  58. <input type="radio" id="node-config-input-target-openthis" name="open-link-method" style="width:20px; margin-left:104px; margin-top:0px; margin-bottom:5px">
  59. <label for="node-config-input-target-openthis" data-i18n="ui_link.label.this-tab"></label><br/>
  60. <input type="radio" id="node-config-input-target-openiframe" name="open-link-method" style="width:20px; margin-left:104px; margin-top:0px; margin-bottom:5px">
  61. <label for="node-config-input-target-openiframe" data-i18n="ui_link.label.iframe"></label>
  62. </div>
  63. <div class="form-tips" data-i18n="[html]ui_link.tip"></div>
  64. </script>