Initial commit
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
@@ -0,0 +1,163 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
|
||||
<script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
|
||||
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="../../lib/js/jquery-ui.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../../js/translate.js"></script>
|
||||
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
|
||||
<script type="text/javascript" src="words.js"></script>
|
||||
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
td.line{
|
||||
border-top:1px solid black;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
'use strict';
|
||||
var keys = [];
|
||||
|
||||
function load(settings, onChange) {
|
||||
if (!settings) return;
|
||||
|
||||
if (!settings.keys) {
|
||||
settings.keys = [];
|
||||
}
|
||||
|
||||
fillSelectIPs('#bind', settings.bind, false, true);
|
||||
|
||||
$('.value').each(function () {
|
||||
var key = $(this).attr('id');
|
||||
var $value = $('#' + key + '.value');
|
||||
if ($value.attr('type') === 'checkbox') {
|
||||
$value.prop('checked', settings[key]).change(function() {
|
||||
onChange();
|
||||
});
|
||||
} else {
|
||||
$value.val(settings[key]).change(function() {
|
||||
onChange();
|
||||
}).keyup(function() {
|
||||
onChange();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#search').button({
|
||||
label: _('Search'),
|
||||
icons: {
|
||||
primary: ' ui-icon-refresh'
|
||||
}
|
||||
}).click(function () {
|
||||
$('#search').button('disable');
|
||||
sendTo(null, 'browse', {port: parseInt($('#port').val(), 10), bind: $('#bind').val()}, function (list) {
|
||||
$('#search').button('enable');
|
||||
keys = table2values('values');
|
||||
if (list && list.length) {
|
||||
var changed = false;
|
||||
for (var i = 0; i < list.length; list++) {
|
||||
var found = false;
|
||||
for (var k = 0; k < keys.length; k++) {
|
||||
if (keys[k].ip.trim() === list[i]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
keys.push({ip: list[i], key: ''});
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (keys.length > 1) {
|
||||
for (var kk = keys.length - 1; kk >= 0; kk--) {
|
||||
if (!keys[kk].ip && !keys[kk].key) {
|
||||
keys.splice(kk, 1);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (changed) {
|
||||
onChange();
|
||||
values2table('values', keys, onChange);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
keys = settings.keys || [];
|
||||
|
||||
values2table('values', keys, onChange);
|
||||
|
||||
getIsAdapterAlive(function (isAlive) {
|
||||
if (isAlive || common.enabled) {
|
||||
$('#search').button('enable');
|
||||
} else {
|
||||
$('#search').button('disable');
|
||||
}
|
||||
});
|
||||
|
||||
onChange(false);
|
||||
}
|
||||
|
||||
function save(callback) {
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
obj.interval = parseInt(obj.interval, 10) || 0;
|
||||
if (obj.interval > 9000) obj.interval = 9000;
|
||||
|
||||
// Get edited table
|
||||
obj.keys = table2values('values');
|
||||
|
||||
callback(obj);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="adapter-container">
|
||||
<table><tr>
|
||||
<td><img src="mihome.png" width="128"/></td>
|
||||
<td><h3 class="translate">MiHome Smarthome settings</h3></td>
|
||||
</tr></table>
|
||||
<table>
|
||||
<tr><td><label class="translate" for="bind">yunkong2 IP:</label></td><td class="admin-icon"></td><td><select id="bind" class="value"></select></td></tr>
|
||||
<tr><td><label class="translate" for="port">yunkong2 Port:</label></td><td class="admin-icon"></td><td><input class="value" id="port" size="5" maxlength="5"/></td></tr>
|
||||
<tr><td><label class="translate" for="key">Default Gateway Key:</label></td><td class="admin-icon"></td><td><input class="value" id="key" /></td></tr>
|
||||
<tr><td><label class="translate" for="interval">Double key interval (ms):</label></td><td class="admin-icon"></td><td><input class="value" type="number" max="9000" min="0" id="interval" /></td></tr>
|
||||
</table>
|
||||
<h4 class="translate">Gateway keys</h4>
|
||||
<div id="values" style="width: 100%; height: calc(100% - 280px)">
|
||||
<button class="table-button-add" style="margin-left: 10px; height: 2em; margin-right: 32px; margin-bottom: 3px; display: inline"></button><button id="search" style="display: inline;margin-bottom: 3px;"></button>
|
||||
<div style="width: 100%; height: calc(100% - 30px); overflow: auto;">
|
||||
<table class="table-values" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-name="_index" style="width: 40px" class="translate"></th>
|
||||
<th data-name="ip" style="width: 120px" data-style="width: 120px" class="translate">IP Address</th>
|
||||
<th data-name="key" style="width: 100%; text-align: left;" data-style="width: 100%" class="translate">Key</th>
|
||||
<th data-buttons="delete" style="width: 40px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,214 @@
|
||||
<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-1.11.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="../../js/tableEditor.js"></script>
|
||||
<script type="text/javascript" src="words.js"></script>
|
||||
|
||||
<style>
|
||||
.m th {
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
'use strict';
|
||||
var keys = [];
|
||||
|
||||
function load(settings, onChange) {
|
||||
if (!settings) return;
|
||||
|
||||
if (!settings.keys) {
|
||||
settings.keys = [];
|
||||
}
|
||||
if (settings.heartbeatTimeout === undefined) {
|
||||
settings.heartbeatTimeout = 20000;
|
||||
}
|
||||
if (settings.restartInterval === undefined) {
|
||||
settings.restartInterval = 30000;
|
||||
}
|
||||
|
||||
fillSelectIPs('#bind', settings.bind, false, true, function () {
|
||||
$('#bind').select();
|
||||
});
|
||||
|
||||
$('.value').each(function () {
|
||||
var key = $(this).attr('id');
|
||||
var $value = $('#' + key + '.value');
|
||||
if ($value.attr('type') === 'checkbox') {
|
||||
$value.prop('checked', settings[key]).on('change', function() {
|
||||
onChange();
|
||||
});
|
||||
} else {
|
||||
$value.val(settings[key]).on('change', function() {
|
||||
onChange();
|
||||
}).keyup(function() {
|
||||
onChange();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#search')/*.button({
|
||||
label: _('Search'),
|
||||
icons: {
|
||||
primary: ' ui-icon-refresh'
|
||||
}
|
||||
})*/.click(function () {
|
||||
$('#search').addClass('disabled');
|
||||
sendTo(null, 'browse', {port: parseInt($('#port').val(), 10), bind: $('#bind').val()}, function (list) {
|
||||
$('#search').removeClass('disabled');
|
||||
keys = table2values('values');
|
||||
if (list && list.length) {
|
||||
var changed = false;
|
||||
for (var i = 0; i < list.length; list++) {
|
||||
var found = false;
|
||||
for (var k = 0; k < keys.length; k++) {
|
||||
if (keys[k].ip.trim() === list[i]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
keys.push({ip: list[i], key: ''});
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (keys.length > 1) {
|
||||
for (var kk = keys.length - 1; kk >= 0; kk--) {
|
||||
if (!keys[kk].ip && !keys[kk].key) {
|
||||
keys.splice(kk, 1);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (changed) {
|
||||
onChange();
|
||||
values2table('values', keys, {onChange: onChange});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
keys = settings.keys || [];
|
||||
|
||||
values2table('values', keys, {onChange: onChange});
|
||||
|
||||
getIsAdapterAlive(function (isAlive) {
|
||||
if (isAlive || common.enabled) {
|
||||
$('#search').removeClass('disabled');
|
||||
} else {
|
||||
$('#search').addClass('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
onChange(false);
|
||||
}
|
||||
|
||||
function save(callback) {
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
obj.interval = parseInt(obj.interval, 10) || 0;
|
||||
if (obj.interval > 9000) obj.interval = 9000;
|
||||
|
||||
// Get edited table
|
||||
obj.keys = table2values('values');
|
||||
|
||||
callback(obj);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="adapter-container m">
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<ul class="tabs">
|
||||
<li class="tab col s2"><a href="#tab-main" class="translate active">Main settings</a></li>
|
||||
<li class="tab col s2"><a href="#tab-keys" class="translate">Gateway keys</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="tab-main" class="col s12 page">
|
||||
<div class="row">
|
||||
<div class="col s12 m4 l2">
|
||||
<img src="mihome.png" class="logo">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12 m8 l5">
|
||||
<select class="value" id="bind"></select>
|
||||
<label class="translate" for="bind">yunkong2 IP:</label>
|
||||
</div>
|
||||
<div class="col s12 m4 l1">
|
||||
<input class="value" id="port" min="0" max="65565" maxlength="5" type="number"/>
|
||||
<label class="translate" for="port">yunkong2 Port:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12 m8 l5">
|
||||
<input class="value" id="heartbeatTimeout" min="0" max="120000" type="number"/>
|
||||
<label class="translate" for="heartbeatTimeout">heartbeatTimeout</label>
|
||||
</div>
|
||||
<div class="col s12 m4 l1">
|
||||
<input class="value" id="restartInterval" min="1000" max="120000" type="number"/>
|
||||
<label class="translate" for="restartInterval">restartInterval</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12 m8 l5">
|
||||
<input class="value" id="key" />
|
||||
<label class="translate" for="key">Default Gateway Key:</label>
|
||||
</div>
|
||||
<div class="col s12 m4 l1">
|
||||
<input class="value" id="interval" min="0" max="9000" maxlength="4" type="number"/>
|
||||
<label class="translate" for="interval">Double key interval (ms):</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-keys" class="col s12 page">
|
||||
<div id="values">
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<a class="btn-floating waves-effect waves-light table-button-add"><i class="material-icons">add</i></a>
|
||||
<a class="waves-effect waves-light btn" id="search"><i class="material-icons">search</i><span class="translate">Search</span></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<table class="table-values" style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-name="_index" style="width: 40px" class="translate"></th>
|
||||
<th data-name="ip" style="width: 120px" data-style="width: 120px" class="translate">IP Address</th>
|
||||
<th data-name="key" style="width: 100%; text-align: left;" data-style="width: 100%" class="translate">Key</th>
|
||||
<th data-buttons="delete" style="width: 40px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 7.1 KiB |
@@ -0,0 +1,32 @@
|
||||
/*global systemDictionary:true */
|
||||
'use strict';
|
||||
|
||||
systemDictionary = {
|
||||
"Gateway Key:": { "en": "Gateway Key:", "de": "Gateway Schlussel:", "ru": "Gateway ключ:", "pt": "Chave do Gateway:", "nl": "Gateway-sleutel:", "fr": "Clé de la passerelle:", "it": "Chiave di accesso:", "es": "Clave de acceso:", "pl": "Klucz bramki:"},
|
||||
"Listen on all IPs": { "en": "Listen on all IPs", "de": "Auf allen IP Adressen hören", "ru": "Слушать на всех адресах", "pt": "Ouça todos os IPs", "nl": "Luister op alle IP's", "fr": "Écoutez sur toutes les adresses IP", "it": "Ascolta su tutti gli IP", "es": "Escuchar en todas las direcciones IP", "pl": "Posłuchaj na wszystkich IP"},
|
||||
"MiHome Smarthome settings": { "en": "MiHome Smarthome settings", "de": "MiHome Smarthome settings", "ru": "MiHome Smarthome settings", "pt": "Configurações de MiHome Smarthome", "nl": "MiHome Smarthome-instellingen", "fr": "MiHome Smarthome paramètres", "it": "Impostazioni MiHome Smarthome", "es": "Ajustes MiHome Smarthome", "pl": "Ustawienia MiHome Smarthome"},
|
||||
"yunkong2 IP:": { "en": "yunkong2 IP:", "de": "yunkong2 IP:", "ru": "yunkong2 IP:", "pt": "yunkong2 IP:", "nl": "yunkong2 IP:", "fr": "yunkong2 IP:", "it": "IP yunkong2:", "es": "yunkong2 IP:", "pl": "IP yunkong2:"},
|
||||
"yunkong2 Port:": { "en": "yunkong2 Port:", "de": "yunkong2 Port:", "ru": "yunkong2 порт:", "pt": "yunkong2 Port:", "nl": "yunkong2 Port:", "fr": "yunkong2 Port:", "it": "porta yunkong2:", "es": "Puerto yunkong2:", "pl": "Port yunkong2:"},
|
||||
"heartbeatTimeout": {
|
||||
"en": "Heartbeat timeout (ms)",
|
||||
"de": "Heartbeat-Timeout (ms)",
|
||||
"ru": "Тайм-аут сердечного ритма (мс)",
|
||||
"pt": "Tempo limite de pulsação (ms)",
|
||||
"nl": "Heartbeat time-out (ms)",
|
||||
"fr": "Délai d'attente de pulsation (ms)",
|
||||
"it": "Timeout heartbeat (ms)",
|
||||
"es": "Tiempo de latido del corazón (ms)",
|
||||
"pl": "Limit czasu bicia serca (ms)"
|
||||
},
|
||||
"restartInterval": {
|
||||
"en": "Re-connection interval (ms)",
|
||||
"de": "Re-Verbindungsintervall (ms)",
|
||||
"ru": "Интервал повторного подключения (мс)",
|
||||
"pt": "Intervalo de reconexão (ms)",
|
||||
"nl": "Re-connection interval (ms)",
|
||||
"fr": "Intervalle de reconnexion (ms)",
|
||||
"it": "Intervallo di ricollegamento (ms)",
|
||||
"es": "Intervalo de reconexión (ms)",
|
||||
"pl": "Interwał ponownego połączenia (ms)"
|
||||
}
|
||||
};
|
||||