iobroker.telegram-menu 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,6 +33,14 @@ You can create different groups with separate menus, and then assign users to th
33
33
  Placeholder for the next version (at the beginning of the line):
34
34
  ### **WORK IN PROGRESS**
35
35
  -->
36
+ ### 0.8.0 (2023-10-22)
37
+
38
+ - text blocks created as a selection list, including the selection of the ID
39
+ - text in submenus is now editable in the textfield in the navigation
40
+ - set ID by open a menu
41
+ - get status
42
+ - small fixes
43
+
36
44
  ### 0.7.2 (2023-10-15)
37
45
 
38
46
  - submenu Number fixed
@@ -88,3 +88,6 @@ li.tab:has(.active) {
88
88
  background-color: #575757;
89
89
  border-color: #2a2a2a;
90
90
  }
91
+ #newText {
92
+ border-top: 3px solid white;
93
+ }
@@ -96,6 +96,15 @@ h1 {
96
96
  top: 100px !important;
97
97
  z-index: 100;
98
98
  }
99
+ #dialog-add-textToInput {
100
+ min-width: 400px !important;
101
+ width: 70% !important;
102
+ height: 90% !important;
103
+ max-height: 90% !important;
104
+ overflow: visible !important;
105
+ top: 0px !important;
106
+ z-index: 100;
107
+ }
99
108
  #dialog-confirm div.modal-content {
100
109
  width: 100% !important;
101
110
  }
@@ -229,3 +238,42 @@ p[data-name="newline_checkbox"] {
229
238
  .warning {
230
239
  text-align: center;
231
240
  }
241
+ /* Btn add Text to Input */
242
+ .add-text {
243
+ display: inline-block;
244
+ width: calc(100% - 26px) !important;
245
+ margin: 0 1px !important;
246
+ }
247
+ .add-Text ~ a {
248
+ display: inline-block;
249
+ width: 20px;
250
+ margin: 0 1px 0 3px;
251
+ }
252
+ .add-text ~ a i {
253
+ font-size: 1.2rem;
254
+ margin: 1px 0 0 0;
255
+ color: white;
256
+ }
257
+ /* Popup add Text to input field */
258
+ #editedTextRow {
259
+ position: relative;
260
+ bottom: -40px;
261
+ }
262
+ .btn-addText {
263
+ margin: 0.3rem;
264
+ }
265
+ #dialog-add-textToInput .info-text {
266
+ font-size: 0.8rem;
267
+ }
268
+ #link-github {
269
+ font-size: 1rem;
270
+ margin: 0.9rem;
271
+ text-decoration: underline;
272
+ }
273
+ .getId {
274
+ width: 95% !important;
275
+ }
276
+ .getId ~ a {
277
+ width: 5%;
278
+ display: inline-block !important;
279
+ }
@@ -12,6 +12,7 @@
12
12
  <script type="text/javascript" src="./js/component.js"></script>
13
13
  <script type="text/javascript" src="./js/emit.js"></script>
14
14
  <script type="text/javascript" src="./js/global.js"></script>
15
+ <script type="text/javascript" src="./js/helper.js"></script>
15
16
  <script type="text/javascript" src="../../js/translate.js"></script>
16
17
  <script type="text/javascript" src="../../lib/js/materialize.js"></script>
17
18
  <script type="text/javascript" src="../../js/adapter-settings.js"></script>
@@ -227,10 +228,8 @@
227
228
  _onChange()
228
229
  $("#dialog-confirm").hide()
229
230
  })
230
- // Confirm Dialog Btn Abort
231
- $("#dialog-confirm a.btn-close").on("click", function () {
232
- $("#dialog-confirm").hide()
233
- })
231
+
232
+
234
233
  // ----------------------------------------//
235
234
  // Popup Edit Menu //
236
235
  //-----------------------------------------//
@@ -264,10 +263,6 @@
264
263
  $("#dialog-change-groupname").hide()
265
264
  _onChange()
266
265
  })
267
- // Abort Edit Username
268
- $("#dialog-change-groupname .btn-close").click(function () {
269
- $("#dialog-change-groupname").hide()
270
- })
271
266
 
272
267
  // ----------------------------------------//
273
268
  // Navigation //
@@ -345,12 +340,31 @@
345
340
  // ----------------------------------------//
346
341
  // Dialog get ID Iobroker //
347
342
  //-----------------------------------------//
348
-
343
+ //ANCHOR - Dialog get ID Iobroker in Action
349
344
  $(".adapter-container").on("click", ".btn_getID", function () {
350
- let $element = $(this).parent().prev().children("input")
345
+ let $element
346
+ let replaceStringWhitIdOrAddIt = false
347
+ if ($(this).prev().hasClass("getId")) {
348
+ $element = $(this).prev()
349
+ replaceStringWhitIdOrAddIt = true
350
+ } else {
351
+ $element = $(this).parent().prev().children("input")
352
+
353
+ }
351
354
  showSelectIdDialog($element.val(), function (newID) {
352
- $element.val(newID)
355
+ if (replaceStringWhitIdOrAddIt) {
356
+ if ($element.val().includes("id':'")) {
357
+ const startindex = $element.val().indexOf("id':'") + 5
358
+ const endindex = $element.val().indexOf("'", startindex)
359
+ const elementToChange = $element.val().substring(startindex, endindex)
360
+
361
+ $element.val($element.val().replace(elementToChange, newID))
362
+ }
363
+ else $element.val($element.val() + newID)
364
+ }
365
+ else $element.val(newID)
353
366
  })
367
+
354
368
  });
355
369
 
356
370
  // ----------------------------------------//
@@ -436,7 +450,10 @@
436
450
  // ----------------------------------------//
437
451
  // Global //
438
452
  //-----------------------------------------//
439
-
453
+ // btn-close
454
+ $(".btn-close").on("click", function () {
455
+ $(this).parent().parent().hide()
456
+ })
440
457
 
441
458
 
442
459
 
@@ -644,6 +661,37 @@
644
661
  getNewValues(socket, this, $(this).val(), usersInMenus, menus)
645
662
  _onChange()
646
663
  })
664
+
665
+ // ----------------------------------------//
666
+ // Popup add Text //
667
+ //-----------------------------------------//
668
+ //TODO - Add Text
669
+ let $htmlElement;
670
+ $(".adapter-container").on("click", (".add-text ~ a"), function () {
671
+ $("#dialog-add-textToInput").show()
672
+ $("#dialog-add-textToInput table").show()
673
+ $("#dialog-add-textToInput tbody").empty()
674
+ const inputGroup = $(this).data("name")
675
+
676
+ if (inputGroup === "navText" || inputGroup === "setText") {
677
+ $("#newText").addClass("getId")
678
+ } else $("#newText").removeClass("getId")
679
+ $htmlElement = $(this).prev()
680
+ helperText[inputGroup].forEach(element => {
681
+ $("#dialog-add-textToInput tbody").append(addTextToInputField(element))
682
+ });
683
+ $("#newText").val($($htmlElement).val())
684
+ })
685
+ $(".adapter-container").on("click", (".btn-addText"), function () {
686
+ $("#newText").val($("#newText").val() + " " + $(this).parent().prevAll(".data-text").children().html())
687
+ // $($htmlElement).val($("#newText").val())
688
+ })
689
+ $(".btn-setText").on("click", function () {
690
+ $($htmlElement).val($("#newText").val().trim())
691
+ $(this).parent().parent().hide()
692
+ _onChange()
693
+ })
694
+
647
695
  })
648
696
 
649
697
  </script>
@@ -736,8 +784,10 @@
736
784
  type="text" value="">
737
785
  </td>
738
786
  <td>
739
- <input class="returnText resetInput " spellcheck="false" type="text"
740
- value="">
787
+ <input class="returnText resetInput add-text " spellcheck="false"
788
+ type="text" value=""><a data-name="setText"
789
+ class="waves-effect waves-light blue"><i
790
+ class="material-icons">add_circle</i></a>
741
791
  </td>
742
792
  <td>
743
793
  <input type="checkbox" class="filled-in confirm_checkbox resetCheckbox" />
@@ -778,8 +828,10 @@
778
828
  <td><a class="btn-floating btn-small waves-effect waves-light blue btn_getID"
779
829
  title="Get ID"><i class="material-icons">edit</i></a></td>
780
830
  <td>
781
- <input class="get_text resetInput checkValue" spellcheck="false"
782
- type="text">
831
+ <input class="get_text resetInput checkValue add-text" spellcheck="false"
832
+ type="text"><a data-name="getText"
833
+ class="waves-effect waves-light blue"><i
834
+ class="material-icons">add_circle</i></a>
783
835
  </td>
784
836
  <td><label>
785
837
  <input type="checkbox" class="filled-in newline_checkbox" checked />
@@ -1048,7 +1100,55 @@
1048
1100
  <a class="modal-action modal-close waves-effect waves-green btn btn-set"><i
1049
1101
  class="large material-icons left">check</i><span class="translate">Ok</span></a>
1050
1102
  <a class="modal-action modal-close waves-effect waves-green btn btn-close"><i
1051
- class="large material-icons left ">close</i><span class="translate">Cancel</span></a>
1103
+ class="large material-icons left ">close</i><span class="translate">Close</span></a>
1104
+ </div>
1105
+ </div>
1106
+ <!-- //!SECTION -->
1107
+ <!-- //SECTION - Popup Add Text to Input Field -->
1108
+ <div id="dialog-add-textToInput" class="modal modal-fixed-footer">
1109
+ <div class="modal-content ">
1110
+ <div class="row">
1111
+ <div class="col12">
1112
+ <h5 class="translate center-align">Add text to input field!</h5>
1113
+ <a id="link-github" href="https://github.com/MiRo1310/ioBroker.telegram-menu/tree/main"
1114
+ target="_blank">Weitere
1115
+ Information!</a><br>
1116
+ </div>
1117
+ </div>
1118
+ <div class="row">
1119
+ <div class="col s12">
1120
+
1121
+ <table>
1122
+ <thead>
1123
+ <tr>
1124
+ <th style="width: 50%;">
1125
+ <p>Text</p>
1126
+ </th>
1127
+ <th>
1128
+ <p>Info</p>
1129
+ </th>
1130
+ <th style="width: 3%;"></th>
1131
+ </tr>
1132
+ </thead>
1133
+ <tbody class="table-lines table-values">
1134
+ </tbody>
1135
+ </table>
1136
+ </div>
1137
+ </div>
1138
+ <div class="row" id="editedTextRow">
1139
+ <div class="col12">
1140
+ <input id="newText" class="getId" spellcheck="false" type="text" class="validate"><a
1141
+ class="btn-floating btn-small waves-effect waves-light blue btn_getID" title="Get ID"
1142
+ style="display: none;"><i class="material-icons">edit</i></a>
1143
+ <label for="newText">Editable Text</label>
1144
+ </div>
1145
+ </div>
1146
+ </div>
1147
+ <div class="modal-footer">
1148
+ <a class="modal-action modal-close waves-effect waves-green btn btn-setText"><i
1149
+ class="large material-icons left">check</i><span class="translate">Ok</span></a>
1150
+ <a class="modal-action modal-close waves-effect waves-green btn btn-close"><i
1151
+ class="large material-icons left ">close</i><span class="translate">Close</span></a>
1052
1152
  </div>
1053
1153
  </div>
1054
1154
  <!-- //!SECTION -->
@@ -21,8 +21,8 @@ function navElement(user) {
21
21
  <tbody id="${user}"name="${user}" data-name="nav" data-nosave="true" class="user_${user} table_switch_user table_entry value table-lines table-values visibilityArrowBtn" style="display:none">
22
22
  <tr class="startRow">
23
23
  <td><input type="text" data-name="call" spellcheck="false" class="isString nav-call translateV startside" value="Startside" ></td>
24
- <td><input type="text" data-name="value" spellcheck="false" class="isString nav-value " value="Licht, Steckdose && Iobroker, Heizung"></td>
25
- <td><input type="text" data-name="text" spellcheck="false" class="isString nav-text" value="Wähle eine Aktion"></td>
24
+ <td><input type="text" data-name="value" spellcheck="false" class="isString nav-value add-text" value="Licht, Steckdose && Iobroker, Heizung"><a data-name="nav" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
25
+ <td><input type="text" data-name="text" spellcheck="false" class="isString nav-text add-text" value="Wähle eine Aktion"><a data-name="navText" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
26
26
  <td></td>
27
27
  <td></td>
28
28
  <td></td>
@@ -50,8 +50,8 @@ function newTableRow_Nav(activuser, users, array) {
50
50
  return /*html*/ `
51
51
  <tr>
52
52
  <td><input type="text" data-name="call" spellcheck="false" class="isString nav-call" value="${call}"></td>
53
- <td><input type="text" data-name="value" spellcheck="false" class="isString nav-value" value="${value}"></td>
54
- <td><input type="text" data-name="text" spellcheck="false" class="isString nav-text" value="${text}"></td>
53
+ <td><input type="text" data-name="value" spellcheck="false" class="isString nav-value add-text" value="${value}"><a data-name="nav" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
54
+ <td><input type="text" data-name="text" spellcheck="false" class="isString nav-text add-text" value="${text}"><a data-name="navText" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
55
55
  <td><a class="deleteRow btn-floating btn-small waves-effect waves-light red"><i class="material-icons">delete</i></a></td>
56
56
  <td><a class="btn-floating btn-small waves-effect waves-light blue btn_down"><i class="material-icons" name="down">arrow_downward</i></a></td>
57
57
  <td><a class="btn-floating btn-small waves-effect waves-light blue btn_up"><i class="material-icons" name="up">arrow_upward</i></a></td>
@@ -85,7 +85,7 @@ function createSelectTrigger(list) {
85
85
  return element;
86
86
  }
87
87
  //SECTION - Save
88
- // Row in Action Popup
88
+ // Since Second Row in Action Popup
89
89
  function newTrInAction(val, array, rows) {
90
90
  if (!array) {
91
91
  array = ["", "", "checked", "", "", 5000, `grafana${rows + 1}.png`, "", ""];
@@ -94,7 +94,7 @@ function newTrInAction(val, array, rows) {
94
94
  return /*html*/ `<tr class="onResetDelete">
95
95
  <td> <input class="get_id checkValue" spellcheck="false" value="${array[0]}" type="text"></td>
96
96
  <td><a class="btn-floating btn-small waves-effect waves-light blue btn_getID" title="Get ID"><i class="material-icons">edit</i></a></td>
97
- <td><input class="get_text" spellcheck="false" type="text" value="${array[1]}"></td>
97
+ <td><input class="get_text add-text" spellcheck="false" type="text" value="${array[1]}"><a data-name="getText" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
98
98
  <td><label><input type="checkbox" class="filled-in newline_checkbox" ${array[2]} /><span></span></label></td>
99
99
  <td><a class="deleteRow btn-floating btn-small waves-effect waves-light red" ><i class="material-icons">delete</i></a></td>
100
100
  <td><a class="btn-floating btn-small waves-effect waves-light blue btn_down"><i class="material-icons" name="down">arrow_downward</i></a></td>
@@ -105,7 +105,7 @@ function newTrInAction(val, array, rows) {
105
105
  <td> <input class="set_id checkValue" spellcheck="false" type="text" value="${array[0]}"></td>
106
106
  <td><a class="btn-floating btn-small waves-effect waves-light blue btn_getID" title="Get ID"><i class="material-icons">edit</i></a></td>
107
107
  <td><input class="set_value checkValueSwitch" spellcheck="false" type="text" value="${array[3]}"></td>
108
- <td><input class="returnText resetInput " spellcheck="false" type="text" value="${array[8]}"></td>
108
+ <td><input class="returnText resetInput add-text" spellcheck="false" type="text" value="${array[8]}"><a data-name="setText" class="waves-effect waves-light blue"><i class="material-icons">add_circle</i></a></td>
109
109
  <td><label><input type="checkbox" class="filled-in confirm_checkbox" ${array[7]}/><span></span></label></td>
110
110
  <td><label><input type="checkbox" class="filled-in switch_checkbox" ${array[4]}/><span></span></label></td>
111
111
  <td><a class="deleteRow btn-floating btn-small waves-effect waves-light red"><i class="material-icons">delete</i></a></td>
@@ -271,3 +271,14 @@ function insertVal(result, entry) {
271
271
  function newSelectInstanceRow(id) {
272
272
  return `<option value="${id}">${id}</option>`;
273
273
  }
274
+
275
+ function addTextToInputField(element) {
276
+ let btn = "";
277
+ if (element.text != "")
278
+ btn = /*html*/ `<a class="btn-floating btn-small waves-effect waves-light blue btn-addText"><i class="material-icons">add</i></a>`;
279
+ return /*html*/ `<tr>
280
+ <td class="data-text"><p >${element.text}</p></td>
281
+ <td><p class="info-text">${element.info}</p></td>
282
+ <td>${btn}</td>
283
+ </tr>`;
284
+ }
package/admin/js/emit.js CHANGED
@@ -37,7 +37,7 @@ function getAllTelegramInstances(socket, _this) {
37
37
  function (err, doc) {
38
38
  if (!err && doc.rows.length) {
39
39
  for (let i = 0; i < doc.rows.length; i++) {
40
- console.log(doc.rows[i]);
40
+ // console.log(doc.rows[i]);
41
41
  if (
42
42
  (doc.rows[i].value &&
43
43
  doc.rows[i].value.common &&
@@ -0,0 +1,61 @@
1
+ /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "helperText"}]*/
2
+
3
+ const globalText = {
4
+ text1: "TRIGGER durch einen eindeutigen Wert ersetzen.",
5
+ textID: "Um eine ID einzufügen, einfach erst den Block einfügen, ID auswählen diese wird dann automatisch an der passenden Stelle eingefügt, auch wenn die ID geändert werden soll. Wenn der Code den Block nicht erkennt, wird die ID am Ende angehängt.",
6
+ };
7
+ const helperText = {
8
+ nav: [
9
+ {
10
+ text: "menu:percent10:TRIGGER:",
11
+ info:
12
+ "<strong>Submenu Prozent</strong><br> 10 kann ersetzt werden und gibt die Schrittweite an 0%, 10%, 20%...! " +
13
+ globalText.text1 +
14
+ " Dieser wird in Aktion unter SetState genutzt. Die gewünschte ID eintragen. Unter Wert ein ! einfügen",
15
+ },
16
+ {
17
+ text: "menu:number0-6-1-UNIT:TRIGGER:",
18
+ info:
19
+ "<strong>Submenu Number</strong><br> Die Zahlen können komplett ausgetauscht werden. 0-6 gibt die Spanne an, und 1 die Schrittweite, UNIT wird durch eine Einheit ersetzt, kann aber auch leer bleiben. " +
20
+ globalText.text1,
21
+ },
22
+ {
23
+ text: "menu:switch-ein.true-aus.false:TRIGGER:",
24
+ info:
25
+ "<strong>Submenu Switch</strong><br> Generiert zwei Buttons, in diesem Fall ein und aus mit den jeweiligen Werten true und false. " +
26
+ globalText.text1,
27
+ },
28
+ { text: "menu:back", info: "Beim Betätigen springt man in das vorherige Menu zurück." },
29
+ ],
30
+ navText: [
31
+ {
32
+ text: "{status:'id':'ID'}",
33
+ info: "Fragt den Wert der ID ab, und wird dann durch den Wert ersetzt, so kann Text runtherum geschrieben werden.",
34
+ },
35
+ {
36
+ text: "{set:'id':'ID',val,ack}",
37
+ info: "Setzt den Wert der ID auf den val, mit ack(bestätigt)",
38
+ },
39
+ { text: "", info: globalText.textID },
40
+ ],
41
+ getText: [
42
+ { text: "{math:/10}", info: "Rechnet den Wert um, /10 kann ersetzt werden" },
43
+ { text: "{time}", info: "Wandelt einen Unix-Zeitstempel zu einer lokalen Zeit um" },
44
+ { text: "{common.name}", info: "Gibt den Namen des Datenpunkts aus" },
45
+ { text: "&&", info: "Platzhalter für das Value" },
46
+ ],
47
+ setText: [
48
+ { text: "{novalue}", info: "Das Value wird im Rückgabetext nicht angegeben" },
49
+ { text: "ack:true", info: "Bestätigt den Wert" },
50
+ {
51
+ text: 'change{"true":"an","false":"aus"}',
52
+ info: "Ändert den Wert in dem RückgabeText, in diesem Fall von true zu an und false zu aus",
53
+ },
54
+ { text: "&&", info: "Platzhalter für das Value" },
55
+ {
56
+ text: "{'id':'ID','text':'Wert wurde gesetzt:'}",
57
+ info: "Wenn man die Änderung eines anderen Datenpunkts mitgeteilt bekommmen möchte nachdem man den Datenpunkt im ID Input Feld gesetzt hat. Die Änderung wird nur dann mit geteilt wenn diese mit ack:true gesetzt wird. Es muss zwingend ein Text ausserhalb der {} angegeben werden, ansonsten wird dieser automatisch hinzugefügt.",
58
+ },
59
+ { text: "", info: globalText.textID },
60
+ ],
61
+ };
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "telegram-menu",
4
- "version": "0.7.2",
4
+ "version": "0.8.0",
5
5
  "news": {
6
+ "0.8.0": {
7
+ "en": "text blocks created as a selection list, including the selection of the ID\ntext in submenus is now editable in the textfield in the navigation\nset ID by open a menu\nget status\nsmall fixes",
8
+ "de": "als Auswahlliste erstellte Textblöcke, einschließlich der Auswahl der ID\ntext in untermenü ist nun im textfeld in der navigation editierbar\niD durch Menü öffnen\nstatus\nkleine fixierungen",
9
+ "ru": "текстовые блоки, созданные как список отбора, включая подбор ID\nтекст в подменю теперь редактируем в текстовом поле в навигации\nустановите ID, откройте меню\nполучить статус\nнебольшие исправления",
10
+ "pt": "blocos de texto criados como uma lista de seleção, incluindo a seleção do ID\ntexto no submenus agora é editável no campo de texto na navegação\nset ID por abrir um menu\nobter status\npequenas correções",
11
+ "nl": "vertaling:\nsms in submenus is nu editabel in het sms in de navigatie\niD van een menukaart\nsta op\nkleine fixes",
12
+ "fr": "blocs texte créés comme liste de sélection, y compris la sélection de l'ID\ntext in submenus is now editable in the textfield in the navigation\nset ID by open a menu\nobtenir le statut\npetites corrections",
13
+ "it": "blocchi di testo creati come elenco di selezione, inclusa la selezione dell'ID\ntesto in submenus è ora modificabile nel campo di testo nella navigazione\nset ID per aprire un menu\nottenere stato\npiccole correzioni",
14
+ "es": "bloques de texto creados como lista de selección, incluyendo la selección del ID\ntexto en submenú es ahora editable en el campo de texto en la navegación\nestablecer ID por abrir un menú\nobtener el estado\npequeños accesorios",
15
+ "pl": "bloki tekstowe tworzone jako lista wyborcza, w tym wybór ID\ntekst w podmenu jest obecnie edytowany w polu tekstowym w nawigacji\nzademonstrowany przez otwarte menu\nmieć status\ndrobne rozwiązanie",
16
+ "uk": "текстові блоки, створені в списку вибору, включаючи вибір ID\nтекст в підменю тепер редагований в текстовому полі на навігацію\nвстановіть ID за допомогою меню\nотримати статус\nмаленькі кріплення",
17
+ "zh-cn": "选择名单,包括选择裁研所的案文\n导航场案文现在可归入。\n开 门\n身份\n小型配件"
18
+ },
6
19
  "0.7.2": {
7
20
  "en": "submenu Number fixed\ntext is lost when editing #63\nconvert milliseconds value to a local time specification\nsetstate and get result of another state with text adjusted",
8
21
  "de": "unterpositionen Anzahl fest\ntext wird beim editieren von #63 verloren\nmillisekunden-wert in eine lokale zeitvorgabe umwandeln\nsetstate und erhalten ergebnis eines anderen staates mit text angepasst",
@@ -80,19 +93,6 @@
80
93
  "pl": "chat Id w UI\nwykorzystywanie nie jest wyświetlane, gdy edytacja się poprawnie",
81
94
  "uk": "увійти Id в УІ\nтригер не відображається при монтажі, фіксованому",
82
95
  "zh-cn": "混乱 Id\n在编辑、固定固定的固定编辑时,没有出现引擎。"
83
- },
84
- "0.6.7": {
85
- "en": "fixed, send menu with error",
86
- "de": "fest, menü mit fehler senden",
87
- "ru": "фиксированное, отправить меню с ошибкой",
88
- "pt": "fixo, enviar menu com erro",
89
- "nl": "vertaling:",
90
- "fr": "fixe, envoyer le menu avec erreur",
91
- "it": "fisso, inviare menu con errore",
92
- "es": "fijo, enviar menú con error",
93
- "pl": "zastosowano menu z błędem",
94
- "uk": "виправлено, відправте меню з помилкою",
95
- "zh-cn": "a. 固定状态,向男子发出错误的通知"
96
96
  }
97
97
  },
98
98
  "titleLang": {
package/lib/js/action.js CHANGED
@@ -14,7 +14,8 @@ function calcValue(_this, textToSend, val) {
14
14
  try {
15
15
  val = eval(val + mathvalue);
16
16
  } catch (e) {
17
- _this.log.error("Error Eval" + JSON.stringify(e));
17
+ _this.log.error("Error Eval" + JSON.stringify(e.message));
18
+ _this.log.error(JSON.stringify(e.stack));
18
19
  }
19
20
  textToSend = textToSend.replace(substring, "");
20
21
  return { textToSend: textToSend, val: val };
@@ -68,7 +69,8 @@ async function editArrayButtons(val, _this) {
68
69
  });
69
70
  return val;
70
71
  } catch (err) {
71
- _this.log.error("Error EditArray: " + err);
72
+ _this.log.error("Error EditArray: " + JSON.stringify(err.message));
73
+ _this.log.error(JSON.stringify(err.stack));
72
74
  }
73
75
  }
74
76
  // ID by Selctor Auswerten
@@ -101,33 +103,29 @@ const idBySelector = async (
101
103
  enums = result["enum.functions"][`enum.functions.${functions}`].common.members;
102
104
  if (enums) {
103
105
  const promises = enums.map(async (id) => {
104
- try {
105
- const value = await _this.getForeignStateAsync(id);
106
- if (value && value.val) {
107
- _this.log.debug("Value " + JSON.stringify(value.val));
108
- _this.log.debug("text " + JSON.stringify(text));
109
- let newtext = text;
110
- let name;
111
- if (text.includes("{common.name}")) {
112
- _this.log.debug("test ");
113
- name = await _this.getForeignObjectAsync(id);
114
- _this.log.debug("Name " + JSON.stringify(name));
115
- // _this.log.debug("Name " + JSON.stringify(await _this.getForeignObjectAsync(id)));
116
- if (name && name.common.name)
117
- newtext = newtext.replace("{common.name}", name.common.name);
118
- }
119
- if (text.includes("&amp;&amp;")) text2Send += newtext.replace("&amp;&amp;", value.val);
120
- else {
121
- text2Send += newtext;
122
- text2Send += " " + value.val;
123
- }
106
+ const value = await _this.getForeignStateAsync(id);
107
+ if (value && value.val) {
108
+ _this.log.debug("Value " + JSON.stringify(value.val));
109
+ _this.log.debug("text " + JSON.stringify(text));
110
+ let newtext = text;
111
+ let name;
112
+ if (text.includes("{common.name}")) {
113
+ _this.log.debug("test ");
114
+ name = await _this.getForeignObjectAsync(id);
115
+ _this.log.debug("Name " + JSON.stringify(name));
116
+ // _this.log.debug("Name " + JSON.stringify(await _this.getForeignObjectAsync(id)));
117
+ if (name && name.common.name)
118
+ newtext = newtext.replace("{common.name}", name.common.name);
119
+ }
120
+ if (text.includes("&amp;&amp;")) text2Send += newtext.replace("&amp;&amp;", value.val);
121
+ else {
122
+ text2Send += newtext;
123
+ text2Send += " " + value.val;
124
124
  }
125
- if (newline == "true") text2Send += "\n";
126
- else text2Send += " ";
127
- _this.log.debug("text2send " + JSON.stringify(text2Send));
128
- } catch (e) {
129
- _this.log.error("Error idBySelector: " + JSON.stringify(e));
130
125
  }
126
+ if (newline == "true") text2Send += "\n";
127
+ else text2Send += " ";
128
+ _this.log.debug("text2send " + JSON.stringify(text2Send));
131
129
  });
132
130
  Promise.all(promises)
133
131
  .then(() => {
@@ -146,13 +144,15 @@ const idBySelector = async (
146
144
  );
147
145
  })
148
146
  .catch((e) => {
149
- _this.log.debug("Error " + JSON.stringify(e));
147
+ _this.log.error("Error Promise: " + JSON.stringify(e.message));
148
+ _this.log.error(JSON.stringify(e.stack));
150
149
  });
151
150
  }
152
151
  }
153
152
  }
154
153
  } catch (error) {
155
- _this.log.error("Error " + JSON.stringify(error));
154
+ _this.log.error("Error " + JSON.stringify(error.message));
155
+ _this.log.error(JSON.stringify(error.stack));
156
156
  }
157
157
  };
158
158
 
@@ -175,7 +175,8 @@ async function generateNewObjectStructure(_this, val) {
175
175
  });
176
176
  return obj;
177
177
  } catch (err) {
178
- _this.log.error("Error GenerateNewObjectStructure " + err);
178
+ _this.log.error("Error GenerateNewObjectStructure " + JSON.stringify(err.message));
179
+ _this.log.error(JSON.stringify(err.stack));
179
180
  }
180
181
  }
181
182
 
@@ -241,7 +242,8 @@ function generateActions(_this, action, userObject) {
241
242
  });
242
243
  return { obj: userObject, ids: listOfSetStateIds };
243
244
  } catch (err) {
244
- console.log("Error generateActions: " + err);
245
+ _this.log.error("Error generateActions" + JSON.stringify(err.message));
246
+ _this.log.error(JSON.stringify(err.stack));
245
247
  }
246
248
  }
247
249
 
@@ -97,8 +97,10 @@ function getstate(_this, part, userToSend, telegramInstance, one_time_keyboard,
97
97
  });
98
98
  }
99
99
  } catch (error) {
100
- _this.log.error("Error Getdata: " + JSON.stringify(error));
100
+ _this.log.error("Error Getdata: " + JSON.stringify(error.message));
101
+ _this.log.error(JSON.stringify(error.stack));
101
102
  }
102
103
  });
103
104
  }
105
+
104
106
  module.exports = { getstate };
package/lib/js/global.js CHANGED
@@ -30,5 +30,15 @@ function isJSON(_string) {
30
30
  return false;
31
31
  }
32
32
  }
33
+ /**
34
+ * Finds the first index of the searchValue
35
+ * @param {string} text Text to search in
36
+ * @param {string} searchValue Value to search for
37
+ * @returns Index of the first occurrence of searchValue
38
+ */
39
+
40
+ function startIndex(text, searchValue) {
41
+ return text.indexOf(searchValue);
42
+ }
33
43
 
34
- module.exports = { deleteDoubleEntrysInArray, replaceAll, isJSON };
44
+ module.exports = { deleteDoubleEntrysInArray, replaceAll, isJSON, startIndex };
@@ -74,7 +74,8 @@ function setstate(
74
74
  });
75
75
  _this.log.debug("setStateIds" + JSON.stringify(setStateIds));
76
76
  } catch (e) {
77
- _this.log.error("Error parsing returnObj: " + JSON.stringify(e));
77
+ _this.log.error("Error parsing returnObj: " + JSON.stringify(e.message));
78
+ _this.log.error(JSON.stringify(e.stack));
78
79
  }
79
80
  }
80
81
  if (element.toggle) {
@@ -85,7 +86,8 @@ function setstate(
85
86
  if (val) _this.setForeignStateAsync(element.id, !val.val, ack);
86
87
  })
87
88
  .catch((e) => {
88
- console.log(e);
89
+ _this.log.error(JSON.stringify(e.message));
90
+ _this.log.error(JSON.stringify(e.stack));
89
91
  });
90
92
  } else {
91
93
  let valueToSet;
@@ -97,7 +99,8 @@ function setstate(
97
99
  );
98
100
  return setStateIds;
99
101
  } catch (error) {
100
- _this.log.error("Error Switch" + JSON.stringify(error));
102
+ _this.log.error("Error Switch" + JSON.stringify(error.message));
103
+ _this.log.error(JSON.stringify(error.stack));
101
104
  }
102
105
  }
103
106