From 14d259dcba2a75626385235656f4726cf7f099d2 Mon Sep 17 00:00:00 2001 From: RWensveen Date: Sat, 14 Jul 2018 21:42:45 +0200 Subject: [PATCH] add settings page to git --- settings/css/settings.css | 30 ++++++++++++++++++++++++++++++ settings/index.html | 21 +++++++++++++++++++++ settings/js/settings.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 settings/css/settings.css create mode 100644 settings/index.html create mode 100644 settings/js/settings.js diff --git a/settings/css/settings.css b/settings/css/settings.css new file mode 100644 index 0000000..5eff97f --- /dev/null +++ b/settings/css/settings.css @@ -0,0 +1,30 @@ +/* Input form fields */ + +.code { + font-family: monospace; +} + +.form_label { + width: 150px !important; + margin-right: 20px; + display: inherit; +} +.form_input { + width: 250px !important; + display: inherit; +} + +select { + padding: .5em .75em; + vertical-align: middle; + font-size: 12px; + font-family: inherit; + font-weight: inherit; + border: 1px solid #aaa; + border-radius: 2px; + width:270px !important; +} + +body{ + position: relative; +} diff --git a/settings/index.html b/settings/index.html new file mode 100644 index 0000000..24c6b45 --- /dev/null +++ b/settings/index.html @@ -0,0 +1,21 @@ + + + + + + + + + +

+
+

+ +
+
+

+ +
+

+ + diff --git a/settings/js/settings.js b/settings/js/settings.js new file mode 100644 index 0000000..6d0f527 --- /dev/null +++ b/settings/js/settings.js @@ -0,0 +1,28 @@ + +/* global $, __ */ +var HomeyObj; + +function onHomeyReady (Homey) { + HomeyObj = Homey; + + $('#debuglog').change(function () { saveDebugSettings() }) + $('#compatmode').change(function () { saveDebugSettings() }) + + HomeyObj.get('DebugSettings', function (error, currentSettings) { + if (error) return console.log(error) + + $('#compatmode').prop('checked', currentSettings['compat'] || false ) + $('#debuglog').prop('checked', currentSettings['logging'] || false ) + }) + + HomeyObj.ready() +} + +function saveDebugSettings () { + var currentSettings = { + 'compat' : $('#compatmode').prop('checked'), + 'logging' : $('#debuglog').prop('checked') + } + HomeyObj.set('DebugSettings', currentSettings ) + } +