diff --git a/templates/news.html b/templates/news.html index c7155a2..65f3a55 100644 --- a/templates/news.html +++ b/templates/news.html @@ -3,7 +3,7 @@
-

News

+

News

@@ -90,51 +101,88 @@ $(document).ready(function() { var updateSwitches_block_{{count}}=[]; var updateDimmers_block_{{count}}=[]; var updateSetpoints_block_{{count}}=[]; + var updateSetpoint_sliders_block_{{count}}=[]; {% for k, v in blockArray[count]["switches"].iteritems() %} - {% if v[2] %} - $('#s_title_{{ count }}').html("{{ v[2] }}"); + {% if v[0] %} + $('#s_title_{{ count }}').html("{{ v[0] }}"); {% endif %} - {% if v[1] == "switch" %} - $('input[id="switch_{{v[0]}}_block_{{count}}"]').on('switchChange.bootstrapSwitch', function(event, state) { - changeSwitch(this, {{v[0]}}); + {% if v[2] == "switch" %} + $('input[id="switch_{{v[1]}}_block_{{count}}"]').on('switchChange.bootstrapSwitch', function(event, state) { + changeSwitch(this, {{v[1]}}); }); - updateSwitches_block_{{count}}.push("{{v[0]}}"); - {% elif (v[1] == "pushon") %} - $('button[id="push_{{v[0]}}_block_{{count}}"]').click(function(e) { + updateSwitches_block_{{count}}.push("{{v[1]}}"); + {% elif (v[2] == "pushon") %} + $('button[id="push_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changePush({{v[0]}}, 'on'); + changePush({{v[1]}}, 'on'); }); - {% elif (v[1] == "pushoff") %} - $('button[id="push_{{v[0]}}_block_{{count}}"]').click(function(e) { + {% elif (v[2] == "pushoff") %} + $('button[id="push_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changePush({{v[0]}}, 'off'); + changePush({{v[1]}}, 'off'); }); - {% elif (v[1] == "group") or (v[1] == "scene") %} - $('button[id="groupon_{{v[0]}}_block_{{count}}"]').click(function(e) { + {% elif (v[2] == "group") or (v[2] == "scene") %} + $('button[id="groupon_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changeScene({{v[0]}}, 'on'); + changeScene({{v[1]}}, 'on'); }); - $('button[id="groupoff_{{v[0]}}_block_{{count}}"]').click(function(e) { + $('button[id="groupoff_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changeScene({{v[0]}}, 'off'); + changeScene({{v[1]}}, 'off'); }); - $('button[id="scene_{{v[0]}}_block_{{count}}"]').click(function(e) { + $('button[id="scene_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changeScene({{v[0]}}, 'on'); + changeScene({{v[1]}}, 'on'); }); - {% elif (v[1] == "setpoint") %} - updateSetpoints_block_{{count}}.push("{{v[0]}}"); - {% elif (v[1] == "dimmer" or v[1] == "rgb") %} - updateDimmers_block_{{count}}.push("{{v[0]}}"); + {% elif (v[2] == "selector") %} + url = '/api?type=devices&rid=' + {{v[1]}}; + requestAPI(flask_server + url, function(d) { + r = JSON.parse(d); + btns = r['result'][0]['LevelNames'].split('|'); + if (r['result'][0]['LevelOffHidden'] == true) { + btns.shift(); + } + $.each(btns, function (i, lvlname) { + activebtn = r['result'][0]['Level'] + if (i != '0') { + i = i + '0'; + } + if (activebtn == i) { + btnClass = 'btn btn-primary btn-responsive'; + } else { + btnClass = 'btn btn-responsive'; + } + bid = 'selector_{{v[1]}}_block_{{count}}_index_'; + b = ''; + $('#selector_body_{{v[1]}}_block_{{count}}').append(b); + $('#' + 'selector_{{v[1]}}_block_{{count}}_index_' + i).click(function(e) { + e.preventDefault(); + }); + }); + }); + {% elif (v[2] == "setpoint") %} + updateSetpoints_block_{{count}}.push("{{v[1]}}"); + {% elif (v[2] == "setpoint_slider") %} + updateSetpoint_sliders_block_{{count}}.push(["{{v[1]}}", "{{v[3]}}", "{{v[4]}}"]); + {% elif (v[2] == "dimmer" or v[2] == "rgb") %} + $('#Adim_{{v[1]}}_block_{{count}}').click(function(e) { + e.preventDefault(); + changeDimmer('dim_{{v[1]}}_block_{{count}}_track', {{v[1]}}); + }); + updateDimmers_block_{{count}}.push("{{v[1]}}"); {% endif %} {% endfor %} refreshSwitches(updateSwitches_block_{{count}}, {{count}}); refreshSetpoints(updateSetpoints_block_{{count}}, {{count}}); dimmerSlider(updateDimmers_block_{{count}}, {{count}}); + setpointSlider(updateSetpoint_sliders_block_{{count}}, {{count}}); + setInterval(refreshSwitches, 9000, updateSwitches_block_{{count}}, {{count}}); setInterval(dimmerSlider, 9000, updateDimmers_block_{{count}}, {{count}}); + setInterval(setpointSlider, 9000, updateSetpoint_sliders_block_{{count}}, {{count}}); setInterval(refreshSetpoints, 9000, updateSetpoints_block_{{count}}, {{count}}); + }); diff --git a/templates/top_tiles.html b/templates/top_tiles.html index 0e370cf..b829e36 100644 --- a/templates/top_tiles.html +++ b/templates/top_tiles.html @@ -4,8 +4,8 @@
- {{k}} -
{{v[2]}}
+ {{k}} +
{% endfor %} @@ -14,15 +14,29 @@ $(document).ready(function() { var updateDivs_block_{{count}}=[]; var tilesPreviousArray_{{count}}=[]; + var updateDivsType_block_{{count}} = []; + var updateDivsUnits_block_{{count}} = []; {% for k, v in blockArray[count]["top_tiles"].iteritems() %} - updateDivs_block_{{count}}.push("{{v[0]}}"); + updateDivs_block_{{count}}.push("{{v[1]}}"); + {% if v[3]|length > 3 %} + updateDivsType_block_{{count}}.push("{{v[3]}}"); + {% else %} + updateDivsType_block_{{count}}.push("Data"); + {% endif %} + {% if v[4] %} + updateDivsUnits_block_{{count}}.push("{{v[4]}}"); + {% else %} + updateDivsUnits_block_{{count}}.push(undefined); + {% endif %} {% endfor %} - tilesPreviousArray_{{count}} = refreshTopTiles(updateDivs_block_{{count}}, "top_tiles_block_{{count}}_", tilesPreviousArray_{{count}}); + + tilesPreviousArray_{{count}} = refreshTopTiles(updateDivs_block_{{count}}, "top_tiles_block_{{count}}_", tilesPreviousArray_{{count}}, updateDivsType_block_{{count}}, updateDivsUnits_block_{{count}}); + tilesPreviousArray_{{count}} = setInterval(refreshTopTiles, 9000, updateDivs_block_{{count}}, "top_tiles_block_{{count}}_", tilesPreviousArray_{{count}}, updateDivsType_block_{{count}}, updateDivsUnits_block_{{count}}); + var counter = 0; for (var i in updateDivs_block_{{count}}) { - $("#top_tiles_block_{{count}}_" + updateDivs_block_{{count}}[i]).removeClass("loading"); + $("#top_tiles_block_{{count}}_" + updateDivs_block_{{count}}[i] + "_" + updateDivsType_block_{{count}}[counter]).removeClass("loading"); + counter += 1; } - tilesPreviousArray_{{count}} = setInterval(refreshTopTiles, 9000, updateDivs_block_{{count}}, "top_tiles_block_{{count}}_", tilesPreviousArray_{{count}}); }); - diff --git a/templates/tvgids.html b/templates/tvgids.html deleted file mode 100644 index a9a20fd..0000000 --- a/templates/tvgids.html +++ /dev/null @@ -1,17 +0,0 @@ -
-
-
-

TV-Gids

- - -
-
-
- -
- -
-