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
169 lines (159 loc) · 8.43 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
<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">
// the function loadSettings has to exist ...
function load(settings, onChange) {
// example: select elements with id=key and class=value and insert value
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 {
// 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.
}
// ... 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 {
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 s4">
<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 s4">
<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 s4">
<input class="value" id="forum" type="checkbox" />
<label for="forum" class="translate">Show forum news</label>
<span class="translate"></span>
</div>
</div>
<div class="row">
<div class="input-field col s4">
<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 s4">
<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 s4">
</div>
</div>
<div class="row">
<div class="input-field col s6">
<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 s6">
<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 s6">
<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 s4">
<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 s2">
<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>
<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>