add new switches

This commit is contained in:
Wolfgang Hottgenroth
2015-06-10 17:21:59 +02:00
parent 19628552ee
commit eed7bc8d26
2 changed files with 5 additions and 1 deletions

View File

@ -15,6 +15,9 @@ switchMapping = {
'oven': { 'index': 1, 'label': 'Herd' },
'laundry': { 'index': 2, 'label': 'Waschkueche' },
'kitchen': { 'index': 0, 'label': 'Kueche' },
'lightbasem': { 'index': 3, 'label': 'Licht Keller' },
'light1flr': { 'index': 4, 'label': 'Licht EG' },
'light2flr': { 'index': 5, 'label': 'Licht OG' },
}

View File

@ -11,8 +11,9 @@
async: false
});
var switchMapping = $.getJSON('/switchMapping').responseJSON;
var sortedKeys = Object.keys(switchMapping).sort(function(a,b){return switchMapping[a]['index'] - switchMapping[b]['index']});
var firstListItem = $("li:first", "#switchlist");
for (var key in switchMapping) {
for (var key in sortedKeys) {
var newListItem = firstListItem.clone()
var href = newListItem.children('a')
href.attr('id', key);