169 lines
6.4 KiB
HTML
169 lines
6.4 KiB
HTML
|
<html>
|
||
|
<head>
|
||
|
<!-- these 4 files always have to be included -->
|
||
|
<link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.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-1.10.3.full.min.js"></script>
|
||
|
|
||
|
<!-- these two file always have to be included -->
|
||
|
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
|
||
|
<script type="text/javascript" src="../../js/translate.js"></script>
|
||
|
<script type="text/javascript" src="../../js/adapter-settings.js"></script>
|
||
|
<script src="words.js"></script>
|
||
|
|
||
|
<!-- you have to define 2 functions in the global scope: -->
|
||
|
<script type="text/javascript">
|
||
|
var rooms = [];
|
||
|
var roomsSelect = "";
|
||
|
var devices = [];
|
||
|
var processed = 1000;
|
||
|
var isStarted = null;
|
||
|
|
||
|
|
||
|
// the function loadSettings has to exist ...
|
||
|
function load(settings, onChange) {
|
||
|
for (var key in settings) {
|
||
|
if ($('#' + key + '.value').attr('type') === 'checkbox') {
|
||
|
$('#' + key + '.value').prop('checked', settings[key]).on('change', function() {
|
||
|
onChange();
|
||
|
});
|
||
|
} else {
|
||
|
$('#' + key + '.value').val(settings[key]).on('change', function() {
|
||
|
changed = true;
|
||
|
$('#save').button("enable");
|
||
|
}).on('keyup', function() {
|
||
|
onChange();
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
onChange(false);
|
||
|
$('#test').button().click(test);
|
||
|
}
|
||
|
|
||
|
function test() {
|
||
|
//var newValue = JSON.stringify(getSettings());
|
||
|
if (!common.enabled) {
|
||
|
showMessage('Enable first the adapter to test notification.');
|
||
|
return;
|
||
|
}
|
||
|
if (changed) {
|
||
|
showMessage('First save the settings');
|
||
|
return;
|
||
|
}
|
||
|
sendTo('pushover.' + instance, 'send', 'This is test notification!');
|
||
|
showMessage('Check the log or your pushover app!');
|
||
|
}
|
||
|
|
||
|
function saveHelper(obj, id, value) {
|
||
|
var ids = id.split('_');
|
||
|
if (ids.length === 1) {
|
||
|
obj[id] = value;
|
||
|
} else if (ids.length === 2) {
|
||
|
if (!obj[ids[0]]) obj[ids[0]] = {};
|
||
|
obj[ids[0]][ids[1]] = value;
|
||
|
} else if (ids.length === 3) {
|
||
|
if (ids[2] == "pass") {
|
||
|
value = encrypt("Zgfr56gFe87jJOM", value);
|
||
|
}
|
||
|
|
||
|
if (!obj[ids[0]]) obj[ids[0]] = {};
|
||
|
if (!obj[ids[0]][ids[1]]) obj[ids[0]][ids[1]] = {};
|
||
|
obj[ids[0]][ids[1]][ids[2]] = value;
|
||
|
}
|
||
|
return obj;
|
||
|
}
|
||
|
|
||
|
function getSettings() {
|
||
|
var obj = {};
|
||
|
$('.value').each(function () {
|
||
|
var $this = $(this);
|
||
|
var id = $this.attr('id');
|
||
|
|
||
|
if ($this.attr('type') === 'checkbox') {
|
||
|
obj = saveHelper(obj, id, $this.prop('checked'))
|
||
|
} else {
|
||
|
obj = saveHelper(obj, id, $this.val())
|
||
|
}
|
||
|
});
|
||
|
return obj;
|
||
|
}
|
||
|
|
||
|
function save(callback) {
|
||
|
callback(getSettings());
|
||
|
}
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<!-- you have to put your config page in a div with id adapter-container -->
|
||
|
<div id="adapter-container">
|
||
|
|
||
|
<table><tr>
|
||
|
<td><img src="pushover.png"></td>
|
||
|
<td style="padding-top: 20px;padding-left: 10px"><h3 class="translate">Pushover adapter settings</h3></td>
|
||
|
</tr></table>
|
||
|
|
||
|
<h4 class="translate">Pushover settings</h4>
|
||
|
<table>
|
||
|
<tr>
|
||
|
<td class="translate">Group Key:</td>
|
||
|
<td><input id="user" type="text" size="50" class="value"/></td>
|
||
|
<td class="translate">Group Key of Delivery Group</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="translate">Token:</td>
|
||
|
<td><input id="token" type="text" size="50" class="value"/></td>
|
||
|
<td class="translate">API Token/Key of Application</td>
|
||
|
</tr>
|
||
|
<tr><td colspan="3"><br><h4 class="translate">Notification settings</h4></td></tr>
|
||
|
<tr>
|
||
|
<td class="translate">Title:</td>
|
||
|
<td><input id="title" type="text" size="50" class="value"/></td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="translate">Sound:</td>
|
||
|
<td><select id="sound" class="value">
|
||
|
<option value=""> default </option>
|
||
|
<option value="pushover"> pushover </option>
|
||
|
<option value="bike"> bike </option>
|
||
|
<option value="bugle"> bugle</option>
|
||
|
<option value="cashregister"> cashregister </option>
|
||
|
<option value="classical"> classical </option>
|
||
|
<option value="cosmic"> cosmic </option>
|
||
|
<option value="falling"> falling</option>
|
||
|
<option value="gamelan"> gamelan </option>
|
||
|
<option value="incoming"> incoming </option>
|
||
|
<option value="intermission"> intermission </option>
|
||
|
<option value="magic"> magic </option>
|
||
|
<option value="mechanical"> mechanical </option>
|
||
|
<option value="pianobar"> pianobar </option>
|
||
|
<option value="siren"> siren</option>
|
||
|
<option value="spacealarm"> spacealarm </option>
|
||
|
<option value="tugboat"> tugboat </option>
|
||
|
<option value="alien"> alien</option>
|
||
|
<option value="climb"> climb </option>
|
||
|
<option value="persistent"> persistent </option>
|
||
|
<option value="echo"> echo</option>
|
||
|
<option value="updown"> updown </option>
|
||
|
<option value="none"> none</option>
|
||
|
</select></td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td class="translate">Priority:</td>
|
||
|
<td><select id="priority" class="value">
|
||
|
<option value="-1" class="translate">quiet</option>
|
||
|
<option value="0" class="translate">default</option>
|
||
|
<option value="1" class="translate">high-priority</option>
|
||
|
<!--option value="2">require confirmation</option-->
|
||
|
</select></td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
<button id="test" class="translate">Test</button>
|
||
|
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|