iobroker.telegram-menu 0.7.1 → 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 +15 -0
- package/admin/css/color.css +3 -0
- package/admin/css/style.css +48 -0
- package/admin/index_m.html +117 -17
- package/admin/js/component.js +18 -7
- package/admin/js/emit.js +9 -6
- package/admin/js/global.js +5 -1
- package/admin/js/helper.js +61 -0
- package/admin/js/main.js +3 -1
- package/io-package.json +27 -27
- package/lib/js/action.js +14 -7
- package/lib/js/getstate.js +21 -8
- package/lib/js/global.js +11 -1
- package/lib/js/setstate.js +38 -7
- package/lib/js/subMenu.js +206 -147
- package/lib/js/telegram.js +6 -4
- package/lib/js/utilities.js +57 -0
- package/main.js +94 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,6 +33,21 @@ 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
|
+
|
|
44
|
+
### 0.7.2 (2023-10-15)
|
|
45
|
+
|
|
46
|
+
- submenu Number fixed
|
|
47
|
+
- text is lost when editing #63
|
|
48
|
+
- convert milliseconds value to a local time specification
|
|
49
|
+
- setstate and get result of another state with text adjusted
|
|
50
|
+
|
|
36
51
|
### 0.7.1 (2023-10-02)
|
|
37
52
|
|
|
38
53
|
- bugfix, Error read UserListTypeError: Cannot read properties of undefined
|
package/admin/css/color.css
CHANGED
package/admin/css/style.css
CHANGED
|
@@ -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
|
+
}
|
package/admin/index_m.html
CHANGED
|
@@ -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
|
-
|
|
231
|
-
|
|
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
|
|
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
|
-
|
|
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"
|
|
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">
|
|
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 -->
|
package/admin/js/component.js
CHANGED
|
@@ -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
|
@@ -26,6 +26,7 @@ function getUsersFromTelegram(socket, _this, telegramInstance) {
|
|
|
26
26
|
*/
|
|
27
27
|
// @ts-ignore
|
|
28
28
|
function getAllTelegramInstances(socket, _this) {
|
|
29
|
+
console.log("getAllTelegramInstances");
|
|
29
30
|
const id = [];
|
|
30
31
|
try {
|
|
31
32
|
socket.emit(
|
|
@@ -36,13 +37,14 @@ function getAllTelegramInstances(socket, _this) {
|
|
|
36
37
|
function (err, doc) {
|
|
37
38
|
if (!err && doc.rows.length) {
|
|
38
39
|
for (let i = 0; i < doc.rows.length; i++) {
|
|
40
|
+
// console.log(doc.rows[i]);
|
|
39
41
|
if (
|
|
40
|
-
doc.rows[i].value &&
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
(doc.rows[i].value &&
|
|
43
|
+
doc.rows[i].value.common &&
|
|
44
|
+
doc.rows[i].value.common.titleLang &&
|
|
45
|
+
doc.rows[i].value.common.titleLang.en &&
|
|
46
|
+
doc.rows[i].value.common.titleLang.en == "Telegram") ||
|
|
47
|
+
doc.rows[i].value.common.title == "Telegram"
|
|
46
48
|
) {
|
|
47
49
|
id.push(doc.rows[i].id.replace(/^system\.adapter\./, ""));
|
|
48
50
|
}
|
|
@@ -51,6 +53,7 @@ function getAllTelegramInstances(socket, _this) {
|
|
|
51
53
|
// @ts-ignore
|
|
52
54
|
$("#select_instance").append(newSelectInstanceRow(id));
|
|
53
55
|
});
|
|
56
|
+
console.log("Instancen: " + id);
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
} else if (err) _this.log.debug("Error all Telegram Users: " + JSON.stringify(err));
|
package/admin/js/global.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*global $, */
|
|
2
|
-
/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "isInputFieldEmpty|countOccurrences|deleteDoubleEntrysInArray|"}]*/
|
|
2
|
+
/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "isInputFieldEmpty|countOccurrences|deleteDoubleEntrysInArray|replaceAll|isInputFieldEmty|sortArray"}]*/
|
|
3
3
|
/**
|
|
4
4
|
* Counts how often an element is present in the array
|
|
5
5
|
* @param {[]} arr The array which should be checked
|
|
@@ -57,3 +57,7 @@ function sortArray(arr) {
|
|
|
57
57
|
});
|
|
58
58
|
return arr;
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
function replaceAll(text, searchValue, replaceValue) {
|
|
62
|
+
return text.replace(new RegExp(searchValue, "g"), replaceValue);
|
|
63
|
+
}
|
|
@@ -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/admin/js/main.js
CHANGED
|
@@ -535,6 +535,7 @@ function insertEditValues(action, $this) {
|
|
|
535
535
|
if (action == "get") {
|
|
536
536
|
newline = valuesToArray($this, "p[data-name='newline_checkbox']");
|
|
537
537
|
texts = valuesToArray($this, "p[data-name='text']");
|
|
538
|
+
console.log(texts);
|
|
538
539
|
}
|
|
539
540
|
if (action == "pic") {
|
|
540
541
|
picSendDelay = valuesToArray($this, "p[data-name='picSendDelay']");
|
|
@@ -605,7 +606,8 @@ function valuesToArray($this, selector) {
|
|
|
605
606
|
.siblings()
|
|
606
607
|
.find(selector)
|
|
607
608
|
.each(function () {
|
|
608
|
-
|
|
609
|
+
// #63 - Bugfix
|
|
610
|
+
val.push($(this).html().trim() != "-" ? $(this).html().replaceAll('"', "'") : "");
|
|
609
611
|
});
|
|
610
612
|
return val;
|
|
611
613
|
}
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "telegram-menu",
|
|
4
|
-
"version": "0.
|
|
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
|
+
},
|
|
19
|
+
"0.7.2": {
|
|
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",
|
|
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",
|
|
22
|
+
"ru": "подменю Номер фиксированный\nтекст теряется при редактировании #63\nконвертировать миллисекундное значение в местную спецификацию времени\nsetstate и получить результат другого государства с текстом скорректирован",
|
|
23
|
+
"pt": "submenu Número fixo\ntexto é perdido ao editar #63\nconverter valor de milissegundos para uma especificação de tempo local\nsetstate e obter resultado de outro estado com texto ajustado",
|
|
24
|
+
"nl": "submenu Nummer gerepareerd\nsms is verloren als editing 63\nverbergt milliseconden waarde voor een plaatselijke tijd specifiek\nvertaling:",
|
|
25
|
+
"fr": "sous-menu Nombre fixe\ntexte est perdu lors de l'édition #63\nconvertir la valeur millisecondes à une spécification locale\nsetstate and get result of another state with text adjusted",
|
|
26
|
+
"it": "sottomenu Numero fisso\ntesto si perde quando si modifica #63\nconvertire il valore di millisecondi in una specifica dell'ora locale\nsetstate e ottenere il risultato di un altro stato con testo regolato",
|
|
27
|
+
"es": "submenú Número fijo\ntexto se pierde cuando se edita #63\nconvertir el valor de milisegundos a una especificación de tiempo local\nsetstate y obtener resultado de otro estado con texto ajustado",
|
|
28
|
+
"pl": "submenu liczba stała\ntekst został utracony podczas edycji #63\nwartość zwrotu milisekund do specyfikacji czasu lokalnego\nzbiór i dostaniemy rezultat innego stanu z tekstem dostosowywanym",
|
|
29
|
+
"uk": "субмену Номер фіксований\nтекст втрачено при редагування #63\nконвертувати значення мілісекундів в локальну специфікацію часу\nsetstate і отримати результат іншої держави з текстом",
|
|
30
|
+
"zh-cn": "分项 固定人数\n编辑第63号\n当地时间的具体化肥价值\na. 一国和另一国由于经调整案文"
|
|
31
|
+
},
|
|
6
32
|
"0.7.1": {
|
|
7
33
|
"en": "bugfix, Error read UserListTypeError: Cannot read properties of undefined",
|
|
8
34
|
"de": "bugfix, Fehler lesen UserListType Fehler: Nicht zu lesen Eigenschaften von undefiniert",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "chat Id w UI\nwykorzystywanie nie jest wyświetlane, gdy edytacja się poprawnie",
|
|
68
94
|
"uk": "увійти Id в УІ\nтригер не відображається при монтажі, фіксованому",
|
|
69
95
|
"zh-cn": "混乱 Id\n在编辑、固定固定的固定编辑时,没有出现引擎。"
|
|
70
|
-
},
|
|
71
|
-
"0.6.7": {
|
|
72
|
-
"en": "fixed, send menu with error",
|
|
73
|
-
"de": "fest, menü mit fehler senden",
|
|
74
|
-
"ru": "фиксированное, отправить меню с ошибкой",
|
|
75
|
-
"pt": "fixo, enviar menu com erro",
|
|
76
|
-
"nl": "vertaling:",
|
|
77
|
-
"fr": "fixe, envoyer le menu avec erreur",
|
|
78
|
-
"it": "fisso, inviare menu con errore",
|
|
79
|
-
"es": "fijo, enviar menú con error",
|
|
80
|
-
"pl": "zastosowano menu z błędem",
|
|
81
|
-
"uk": "виправлено, відправте меню з помилкою",
|
|
82
|
-
"zh-cn": "a. 固定状态,向男子发出错误的通知"
|
|
83
|
-
},
|
|
84
|
-
"0.6.6": {
|
|
85
|
-
"en": "add info-big.png",
|
|
86
|
-
"de": "info-big.png",
|
|
87
|
-
"ru": "добавить info-big.png",
|
|
88
|
-
"pt": "adicionar info-big.png",
|
|
89
|
-
"nl": "voeg info-big toe",
|
|
90
|
-
"fr": "ajouter info-big.png",
|
|
91
|
-
"it": "aggiungere info-big.png",
|
|
92
|
-
"es": "añadir info-big.png",
|
|
93
|
-
"pl": "info-big.png",
|
|
94
|
-
"uk": "javascript licenses api веб-сайт go1.13.8",
|
|
95
|
-
"zh-cn": "增 编"
|
|
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 };
|
|
@@ -29,8 +30,9 @@ function calcValue(_this, textToSend, val) {
|
|
|
29
30
|
*/
|
|
30
31
|
function exchangeValue(textToSend, stateVal, _this) {
|
|
31
32
|
const startindex = textToSend.indexOf("change{");
|
|
32
|
-
|
|
33
|
+
let match = textToSend.substring(startindex + "change".length + 1, textToSend.indexOf("}", startindex));
|
|
33
34
|
let objChangeValue;
|
|
35
|
+
match = match.replaceAll("'", '"');
|
|
34
36
|
if (Utils.isJSON("{" + match + "}")) objChangeValue = JSON.parse("{" + match + "}");
|
|
35
37
|
else {
|
|
36
38
|
_this.log.error(`There is a error in your input: ` + JSON.stringify(Utils.replaceAll(match, '"', "'")));
|
|
@@ -67,7 +69,8 @@ async function editArrayButtons(val, _this) {
|
|
|
67
69
|
});
|
|
68
70
|
return val;
|
|
69
71
|
} catch (err) {
|
|
70
|
-
_this.log.error("Error EditArray: " + err);
|
|
72
|
+
_this.log.error("Error EditArray: " + JSON.stringify(err.message));
|
|
73
|
+
_this.log.error(JSON.stringify(err.stack));
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
// ID by Selctor Auswerten
|
|
@@ -141,13 +144,15 @@ const idBySelector = async (
|
|
|
141
144
|
);
|
|
142
145
|
})
|
|
143
146
|
.catch((e) => {
|
|
144
|
-
_this.log.
|
|
147
|
+
_this.log.error("Error Promise: " + JSON.stringify(e.message));
|
|
148
|
+
_this.log.error(JSON.stringify(e.stack));
|
|
145
149
|
});
|
|
146
150
|
}
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
} catch (error) {
|
|
150
|
-
_this.log.error("Error " + JSON.stringify(error));
|
|
154
|
+
_this.log.error("Error " + JSON.stringify(error.message));
|
|
155
|
+
_this.log.error(JSON.stringify(error.stack));
|
|
151
156
|
}
|
|
152
157
|
};
|
|
153
158
|
|
|
@@ -170,7 +175,8 @@ async function generateNewObjectStructure(_this, val) {
|
|
|
170
175
|
});
|
|
171
176
|
return obj;
|
|
172
177
|
} catch (err) {
|
|
173
|
-
_this.log.error("Error GenerateNewObjectStructure " + err);
|
|
178
|
+
_this.log.error("Error GenerateNewObjectStructure " + JSON.stringify(err.message));
|
|
179
|
+
_this.log.error(JSON.stringify(err.stack));
|
|
174
180
|
}
|
|
175
181
|
}
|
|
176
182
|
|
|
@@ -236,7 +242,8 @@ function generateActions(_this, action, userObject) {
|
|
|
236
242
|
});
|
|
237
243
|
return { obj: userObject, ids: listOfSetStateIds };
|
|
238
244
|
} catch (err) {
|
|
239
|
-
|
|
245
|
+
_this.log.error("Error generateActions" + JSON.stringify(err.message));
|
|
246
|
+
_this.log.error(JSON.stringify(err.stack));
|
|
240
247
|
}
|
|
241
248
|
}
|
|
242
249
|
|