This repository was archived by the owner on Jan 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex_m.html
302 lines (286 loc) · 16.3 KB
/
index_m.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<html>
<head>
<!-- these 4 files always have to be included -->
<link rel="stylesheet" type="text/css" href="../../lib/css/materialize.css">
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
<script type="text/javascript" src="../../lib/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<!-- these files always have to be included -->
<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../lib/js/materialize.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
<script type="text/javascript" src="words.js"></script>
<style>
.m .col .select-wrapper+label {
top: -26px;
}
.m span{
font-size: 0.9em;
}
</style>
<!-- you have to define 2 functions in the global scope: -->
<script type="text/javascript">
// Create secrect for encrypted password storage
var secret;
function encrypt(key, value) {
var result = '';
for (var i = 0; i < value.length; ++i) {
result += String.fromCharCode(key[i % key.length].charCodeAt(0) ^ value.charCodeAt(i));
}
return result;
}
function decrypt(key, value) {
var result = '';
for (var i = 0; i < value.length; ++i) {
result += String.fromCharCode(key[i % key.length].charCodeAt(0) ^ value.charCodeAt(i));
}
return result;
}
function loadHelper(settings, onChange) {
if (!settings)
return;
$('.value').each(function () {
var $key = $(this);
var id = $key.attr('id');
if ($key.attr('type') === 'checkbox') {
// do not call onChange direct, because onChange could expect some arguments
$key.prop('checked', settings[id]).on('change', function () {
onChange();
});
} else if ($key.attr('type') === 'checkbox') {
settings[id] = decrypt(secret, settings[id]);
} else {
// do not call onChange direct, because onChange could expect some arguments
$key.val(settings[id]).on('change', function () {
onChange();
}).on('keyup', function () {
onChange();
});
}
});
onChange(false);
M.updateTextFields(); // function Materialize.updateTextFields(); to reinitialize all the Materialize labels on the page if you are dynamically adding inputs.
M.Range.init($('input[type=range]'));
}
// the function loadSettings has to exist ...
// This will be called by the admin adapter when the settings page loads
function load(settings, onChange) {
// example: select elements with id=key and class=value and insert value
if (!settings)
return;
socket.emit('getObject', 'system.config', function (err, obj) {
secret = (obj.native ? obj.native.secret : '') || 'ZAgr56F5e87jJoM';
loadHelper(settings, onChange);
});
onChange(false);
}
// ... and the function save has to exist.
// you have to make sure the callback is called with the settings object as first param!
function save(callback) {
// example: select elements with class=value and build settings object
var obj = {};
$('.value').each(function () {
var $this = $(this);
if ($this.attr('type') === 'checkbox') {
obj[$this.attr('id')] = $this.prop('checked');
} else if ($this.attr('type') === 'password') {
value = encrypt(secret, $this.val());
} else {
obj[$this.attr('id')] = $this.val();
}
});
callback(obj);
}
</script>
</head>
<body>
<!-- you have to put your config page in a div with id adapter-container -->
<div class="m adapter-container">
<div class="row">
<!-- Forms are the standard way to receive user inputted data.
Learn more http://materializecss.com/forms.html-->
<div class="row">
<div class="input-field col s3">
<img src="info.png" class="logo">
</div>
</div>
<div class="row">
<div class="input-field col m12 l2">
<input class="value" id="clock" type="checkbox" />
<label for="clock" class="translate">Hide clock</label>
<span class="translate"></span>
</div>
<div class="input-field col m6 l2">
<input class="value" id="adapter_request" type="checkbox" />
<label for="adapter_request" class="translate">Show adapter requests</label>
<span class="translate"></span>
</div>
<div class="input-field col m6 l3">
<input class="value" id="adapter_request_closed" type="checkbox" />
<label for="adapter_request_closed" class="translate">Show adapter requests closed at startup</label>
<span class="translate"></span>
</div>
<div class="input-field col m6 l2">
<input class="value" id="adapter_issue" type="checkbox" />
<label for="adapter_issue" class="translate">Show known errors</label>
<span class="translate"></span>
</div>
<div class="input-field col m6 l3">
<input class="value" id="adapter_issue_closed" type="checkbox" />
<label for="adapter_issue_closed" class="translate">Known errors closed at startup</label>
<span class="translate"></span>
</div>
</div>
<div class="row">
<div class="input-field col m6 l4">
<input class="value" id="news" type="checkbox" />
<label for="news" class="translate">Show ioBroker news</label>
<span class="translate"></span>
</div>
<div class="input-field col m6 l4">
<input class="value" id="forum" type="checkbox" />
<label for="forum" class="translate">Show forum news</label>
<span class="translate"></span>
</div>
<div class="input-field col m12 l4">
<input class="value" id="feednami" type="password" />
<label for="feednami" class="translate">Feednami API Key</label>
<span class="translate">To read news or forum, you need a free API Key if your ioBroker installation can be reached via a hostname, such as iobroker: 8081 or something similar. For IP access it is not needed.</span>
<span><a href="https://toolkit.sekando.com/docs/en/setup/hostnames" target="_blank" class="translate">Click here to register</a></span>
</div>
</div>
<div class="row">
<div class="input-field col m4">
<input class="value" id="documentation" type="checkbox" />
<label for="documentation" class="translate">Show documentations</label>
<span class="translate"></span>
</div>
<div class="input-field col m8">
<select class="value" multiple id="doc_langs">
<option class="translate" value="" disabled selected>Select the desired languages for the documentations</option>
<option class="translate" value="de">German</option>
<option class="translate" value="en">English</option>
<option class="translate" value="es">Spanish</option>
<option class="translate" value="fr">French</option>
<option class="translate" value="it">Italian</option>
<option class="translate" value="nl">Dutch</option>
<option class="translate" value="pl">Polish</option>
<option class="translate" value="pt">Portuguese</option>
<option class="translate" value="ru">Russian</option>
<option class="translate" value="zh-cn">Chinese</option>
</select>
<label class="translate">Documentation languages</label>
</div>
</div>
<div class="row">
<div class="input-field col m12 l4">
<input class="value" id="new_adapters" type="checkbox" />
<label for="new_adapters" class="translate">Search for new adapters</label>
<span class="translate">only for experts</span>
</div>
<div class="input-field col m4 l3">
<select class="value" id="new_adapters_sort" >
<option class="translate" value="name">name</option>
<option class="translate" value="create">creation date</option>
<option class="translate" value="update">last update</option>
</select>
<label for="new_adapters_sort" class="translate">Sort adapters by</label>
<span class="translate"></span>
</div>
<div class="input-field col m4 l2">
<input class="value" id="new_adapters_order" type="checkbox" />
<label for="new_adapters_order" class="translate">reverse order</label>
<span class="translate"></span>
</div>
<div class="input-field col m4 l3">
<input class="value" id="new_adapters_closed" type="checkbox" />
<label for="new_adapters_closed" class="translate">New adapters closed at startup</label>
<span class="translate"></span>
</div>
</div>
<div class="row">
<div class="input-field col s12 l4">
<input class="value" id="github_token" type="password" />
<label for="github_token" class="translate">GitHub personal access token</label>
<span class="translate">To create messages about adapters or adapter requests, you need a Github account and a token with repo access.</span>
<span><a href="https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line" target="_blank" class="translate">How to generate a token</a></span>
</div>
<div class="input-field col s3 l2">
<input class="value" id="hide_github_myIssues" type="checkbox" />
<label for="hide_github_myIssues" class="translate">Hide my issues button</label>
<span class="translate"></span>
</div>
<div class="input-field col s3 l2">
<input class="value" id="hide_github_myWatched" type="checkbox" />
<label for="hide_github_myWatched" class="translate">Hide watched repos button</label>
<span class="translate"></span>
</div>
<div class="input-field col s3 l2">
<input class="value" id="hide_github_myStarred" type="checkbox" />
<label for="hide_github_myStarred" class="translate">Hide starred repos button</label>
<span class="translate"></span>
</div>
<div class="input-field col s3 l2">
<input class="value" id="hide_github_myAssigned" type="checkbox" />
<label for="hide_github_myAssigned" class="translate">Hide assigned issues button</label>
<span class="translate"></span>
</div>
</div>
<div class="row">
<div class="input-field col s12">
<input class="value" id="noCurrentSysData" type="checkbox" />
<label for="noCurrentSysData" class="translate">Don't load current system data</label>
<span class="translate"></span>
</div>
<div class="col m4 l2">
<p class="range-field">
<input class="value" id="cpuSpeed" type="range" min="0" max="10" />
</p>
<label for="cpuSpeed" class="translate">Load CPU data every x seconds</label>
<span class="translate"></span>
</div>
<div class="col m4 l2">
<p class="range-field">
<input class="value" id="memSpeed" type="range" min="0" max="10" />
</p>
<label for="memSpeed" class="translate">Load memory data every x seconds</label>
<span class="translate"></span>
</div>
<div class="col m4 l2">
<p class="range-field">
<input class="value" id="diskSpeed" type="range" min="0" max="10" />
</p>
<label for="diskSpeed" class="translate">Load disk data every x seconds</label>
<span class="translate"></span>
</div>
<div class="col m4 l2">
<p class="range-field">
<input class="value" id="batterySpeed" type="range" min="0" max="10" />
</p>
<label for="batterySpeed" class="translate">Load battery data every x seconds</label>
<span class="translate"></span>
</div>
<div class="col m4 l2">
<p class="range-field">
<input class="value" id="networkSpeed" type="range" min="0" max="10" />
</p>
<label for="networkSpeed" class="translate">Load network data every x seconds</label>
<span class="translate"></span>
</div>
<div class="col m4 l2">
<p class="range-field">
<input class="value" id="allProcessesUsers" type="range" min="0" max="10" />
</p>
<label for="allProcessesUsers" class="translate">Load process and user data every x seconds</label>
<span class="translate"></span>
</div>
</div>
<div class="row">
<div class="col s12">
<p class="translate">on save adapter restarts with new config immediately</p>
</div>
</div>
</div>
</div>
</body>
</html>