Initial commit
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<script type="text/javascript">
|
||||
//jQuery.extend(true, vis.binds, {
|
||||
vis.binds.debug = {
|
||||
history: function (el, id) {
|
||||
localData.uiState.bind('_' + id+".Value", function( e, newVal, oldVal ) {
|
||||
var timestamp = localData.uiState["_" + id + '.Timestamp'];
|
||||
var ack = localData.uiState['_' + id + '.Ack'];
|
||||
var type = typeof newVal;
|
||||
|
||||
var row = "<tr><td width='70px'>"+type+"</td><td style='padding-right: 18px'>"+JSON.stringify(newVal)+"</td><td width='100px'>"+timestamp+"</td><td width='40px'>"+ack+"</td></tr>";
|
||||
jQuery(el).parent().find(".debugHistoryTable tr:first").after(row);
|
||||
});
|
||||
}
|
||||
};
|
||||
//});
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/ejs" id="tplJqhm" class="dashui-tpl" data-dashui-set="dev" data-dashui-name="Debug uiState" data-dashui-attrs="">
|
||||
<div class="dashui-widget <%== this.data.attr('class') %>" id="<%= this.data.attr("wid") %>" style="border:1px solid black; background-color:#333; color: #eee; font-family: courier; font-size:11px; padding: 4px; max-height:600px;">
|
||||
<div class="dashui-widget-body" style="overflow-y: scroll; overflow-x: hidden;">
|
||||
<h3 style="margin-bottom:0px;">localData.uiState = {</h3>
|
||||
<table style="white-space: nowrap;">
|
||||
<% localData.uiState.each(function(i, obj) { %>
|
||||
<tr><td>"<%= obj %>":</td><td colspan="2"><%= JSON.stringify(localData.uiState.attr(obj/*.replace(/\./g, "\\.")*/)) %>,</td></tr>
|
||||
<% }) %>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/ejs" id="tplDebugUiStateSingle" class="dashui-tpl" data-dashui-set="dev" data-dashui-name="Debug uiState[id]" data-dashui-attrs="hm_id">
|
||||
<div class="dashui-widget <%== this.data.attr('class') %>" id="<%= this.data.attr("wid") %>" style="border:1px solid black; background-color:#333; color: #eee; font-family: courier; font-size:11px; padding: 4px; height:20px;width:960px">
|
||||
<div class="dashui-widget-body" style="overflow-y: scroll; overflow-x: hidden;">
|
||||
<% var obj = "_" + this.data.attr("hm_id") %>
|
||||
<table style="white-space: nowrap;">
|
||||
<tr><td>localData.uiState.<%= obj %> = </td><td colspan="2"><%= JSON.stringify({Value:localData.uiState.attr(obj+".Value"),Timestamp:localData.uiState.attr(obj+".Timestamp"),Certain:localData.uiState.attr(obj+".Certain"),LastChange:localData.uiState.attr(obj+".LastChange")}) %></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/ejs" id="tplDebugUiStateHistory" class="dashui-tpl" data-dashui-set="dev" data-dashui-name="Debug uiState[id] History" data-dashui-attrs="hm_id">
|
||||
<div class="dashui-widget <%== this.data.attr('class') %>" id="<%= this.data.attr("wid") %>" style="border:1px solid black; background-color:#333; color: #eee; font-family: courier; font-size:11px; padding: 4px; height:320px;width:480px">
|
||||
<div class="dashui-widget-body" style="overflow-y: scroll; overflow-x: hidden;">
|
||||
<% var obj = "_" + this.data.attr("hm_id") %>
|
||||
<%= this.data.attr('hm_id') %>
|
||||
<table class="debugHistoryTable" style="white-space: nowrap;">
|
||||
<tr style="font-weight:bold;"><td widtd='70px'>typeof</td><td style='padding-right: 18px'>Value</td><td widtd='100px'>Timestamp</td><td widtd='40px'>Ack</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div <%= (el) -> vis.binds.debug.history(el, data.attr('hm_id')) %>></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/ejs" id="tplDebugSetState" class="dashui-tpl" data-dashui-set="dev" data-dashui-name="Debug setState" data-dashui-attrs="">
|
||||
<div class="dashui-widget <%== this.data.attr('class') %>" id="<%= this.data.attr("wid") %>" style="border:1px solid black; background-color:#333; color: #eee; font-family: courier; font-size:11px; padding: 4px; max-height:400px;">
|
||||
<div class="dashui-widget-body" style="overflow-y: scroll; overflow-x: hidden;">
|
||||
<h3 style="margin-bottom:0px;">localData.setState = {</h3>
|
||||
<table>
|
||||
<% localData.setState.each(function(i, obj) { %>
|
||||
<% if (obj != 'nothing_selected') { %>
|
||||
<tr><td>"<%= obj %>":{</td><td>"Value":"<%= localData.setState.attr(obj + ".Value") %>",</td><td>"Timestamp":"<%= localData.setState.attr(obj + ".Timestamp") %>"}</td></tr>
|
||||
<% } %>
|
||||
<% }) %>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
@@ -0,0 +1,89 @@
|
||||
<style type="text/css">
|
||||
tr.homematic-servicemessage {
|
||||
height: 34px;
|
||||
}
|
||||
tr.homematic-servicemessage td {
|
||||
padding-right: 12px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
servConn.getStringtable(function (res) {
|
||||
// TODO - bind relies on this is already done. Reliable?
|
||||
localData.homematicStringtable = res;
|
||||
});
|
||||
|
||||
vis.binds.homematic = {
|
||||
serviceMessages: function (el) {
|
||||
|
||||
function appendRow(el, id, name, msg, ts, oper) {
|
||||
|
||||
if (oper == 7) {
|
||||
// Meldung kann bestätigt werden
|
||||
var button = '<button stlye="display:none;" data-hm-alarm="'+id+'" id="'+el.attr('id')+'_'+id+'">bestätigen</button>';
|
||||
} else {
|
||||
var button = "";
|
||||
}
|
||||
|
||||
el.append('<tr class="homematic-servicemessage">' +
|
||||
'<td class="homematic-servicemessage-device">'+name+'</td>' +
|
||||
'<td class="homematic-servicemessage-text">'+msg+'</td>' +
|
||||
'<td class="homematic-servicemessage-ts">'+ts+'</td>' +
|
||||
'<td class="homematic-servicemessage-button">'+button+'</td></tr>')
|
||||
.find('#'+el.attr('id')+'_'+id)
|
||||
.button({
|
||||
icons: {
|
||||
primary: "ui-icon-check"
|
||||
},
|
||||
text: false
|
||||
}).click(function () {
|
||||
//alert("receipt "+jQuery(this).attr('data-hm-alarm'));
|
||||
servConn.alarmReceipt(parseInt(jQuery(this).attr('data-hm-alarm'), 10));
|
||||
jQuery(this).parent().parent().remove();
|
||||
}).show();
|
||||
|
||||
}
|
||||
|
||||
function buildServiceMessageTable() {
|
||||
var $this = jQuery(el).prev().find("table.homematic-servicemessages");
|
||||
$this.html("<tbody></tbody>");
|
||||
|
||||
var ALDPs = localData.metaIndex.ALDP;
|
||||
for (var i = 0; i < ALDPs.length; i++) {
|
||||
|
||||
if (localData.uiState['_' + ALDPs[i] + '.Value'] == 1) {
|
||||
var metaAlarm = localData.metaObjects[ALDPs[i]];
|
||||
var metaTrigger = localData.metaObjects[metaAlarm.AlTriggerDP];
|
||||
var metaDevice = localData.metaObjects[localData.metaObjects[metaTrigger.Parent].Parent];
|
||||
var msg = metaAlarm.Name.split(".");
|
||||
msg = msg[1];
|
||||
|
||||
if (localData.homematicStringtable.MAINTENANCE && localData.homematicStringtable.MAINTENANCE[msg] && localData.homematicStringtable.MAINTENANCE[msg].text) {
|
||||
msg = localData.homematicStringtable.MAINTENANCE[msg].text;
|
||||
}
|
||||
|
||||
appendRow($this, ALDPs[i], metaDevice.Name, msg, localData.uiState['_' + ALDPs[i] + '.Timestamp'], metaAlarm.Operations);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildServiceMessageTable();
|
||||
|
||||
localData.uiState.bind('_41.Value', function (e, newVal, oldVal) {
|
||||
if (newVal != oldVal) setTimeout(buildServiceMessageTable, 5000);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/ejs" id="tplHmServiceMsgs" class="dashui-tpl" data-dashui-set="homematic" data-dashui-name="homematic - service messages" data-dashui-attrs="">
|
||||
<div class="dashui-widget <%== this.data.attr('class') %>" style="top:0px; left: 0px; width: 360px; height: 200px;font-family: Verdana,Arial,sans-serif;font-size: 13px;" id="<%= this.data.attr('wid') %>">
|
||||
<div class="dashui-widget-body">
|
||||
<table class="homematic-servicemessages" id="msgs_<%= this.data.attr('wid') %>"></table>
|
||||
</div>
|
||||
</div>
|
||||
<div <%= (el) -> vis.binds.homematic.serviceMessages(el) %> />
|
||||
</script>
|
||||
@@ -0,0 +1,138 @@
|
||||
<script type="text/javascript">
|
||||
//jQuery.extend(true, vis.binds, {
|
||||
vis.binds.special = {
|
||||
soundOnClickInitialized: false,
|
||||
soundOnClick: function (el, url) {
|
||||
if (vis.editMode) {
|
||||
$(el).parent().parent().show();
|
||||
return;
|
||||
}
|
||||
if (vis.binds.special.soundOnClickInitialized) {
|
||||
return;
|
||||
}
|
||||
vis.binds.special.soundOnClickInitialized = true;
|
||||
$('body')
|
||||
.append('<audio id="sound_on_click" src="' + url + '"></audio>')
|
||||
.click(function (e) {
|
||||
var node = e.target;
|
||||
|
||||
for (var i = 0; i < 4 && node.parentNode; node = node.parentNode, i++) {
|
||||
//console.log(node);
|
||||
if (node.nodeName === 'BODY') return;
|
||||
var $node = $(node);
|
||||
if ($node.attr('id') === 'vis_container') return;
|
||||
if ($node.hasClass('dashui-view')) return;
|
||||
if ($node.hasClass('ui-dialog')) return;
|
||||
|
||||
var events = $._data(node, "events");
|
||||
|
||||
if (events && events.click || node.nodeName == "INPUT" || node.nodeName == "SELECT" || node.nodeName == "BUTTON") {
|
||||
//console.log("has click event!");
|
||||
document.getElementById('sound_on_click').play();
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
preRenderView: function(el, view, delay) {
|
||||
if (vis.editMode) {
|
||||
jQuery(el).parent().parent().show();
|
||||
} else {
|
||||
if (parseInt(delay, 10) > 0) {
|
||||
setTimeout(function (_v) {
|
||||
vis.renderView(_v, _v, true);
|
||||
}, delay, view);
|
||||
} else {
|
||||
vis.renderView(view, view, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
instance: function(el) {
|
||||
if (vis.editMode) {
|
||||
jQuery(el).parent().parent().show();
|
||||
}
|
||||
vis.initInstance();
|
||||
},
|
||||
unfocusInitialized: false,
|
||||
unfocusTimer: null,
|
||||
unfocus: function(el) {
|
||||
if (vis.binds.special.unfocusInitialized) {
|
||||
return;
|
||||
} else {
|
||||
vis.binds.special.unfocusInitialized = true;
|
||||
}
|
||||
if (vis.editMode) {
|
||||
jQuery(el).parent().parent().show();
|
||||
}
|
||||
|
||||
function removeFocus(that) {
|
||||
var $this = jQuery(that);
|
||||
if ($this.is("textarea")) {
|
||||
return;
|
||||
}
|
||||
if ($this.is("input") && ($this.attr("type") == "text" || $this.attr("type") == "number" || $this.attr("type") == "password")) {
|
||||
return;
|
||||
}
|
||||
if (vis.binds.special.unfocusTimer) {
|
||||
clearTimeout(vis.binds.special.unfocusTimer);
|
||||
}
|
||||
vis.binds.special.unfocusTimer = setTimeout(function (_this) {
|
||||
// TODO - Funktioniert nicht mit Android/Webkit :-(
|
||||
_this.trigger("blur");
|
||||
}, 100, $this);
|
||||
|
||||
}
|
||||
|
||||
jQuery("*").mouseup(function() {
|
||||
removeFocus(this);
|
||||
});
|
||||
jQuery("*").on('touchend', function() {
|
||||
removeFocus(this);
|
||||
});
|
||||
jQuery("*").on('touchcancel', function() {
|
||||
removeFocus(this);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
//});
|
||||
|
||||
</script>
|
||||
<script type="text/ejs" id="tplPreRenderView" class="dashui-tpl" data-dashui-set="special" data-dashui-name="special - pre-render view" data-dashui-attrs="prerender">
|
||||
<div class="dashui-widget <%== this.data.attr('class') %>" style="display:none; width: 320px; height: 20px; background-color: #333; color: #eee; border: 2px dashed red; opacity:0.8;" id="<%= this.data.attr('wid') %>">
|
||||
<div class="dashui-widget-body">
|
||||
<b>pre-render view: <%= this.data.attr('prerender') %></b>
|
||||
<div <%= (el) -> vis.binds.special.preRenderView(el, data.attr('prerender')) %>></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/ejs" id="tplInitInstance" class="dashui-tpl" data-dashui-set="special" data-dashui-name="special - create Instance" data-dashui-attrs="">
|
||||
<div class="dashui-widget <%== this.data.attr('class') %>" style="display:none; width: 320px; height: 20px; background-color: #333; color: #eee; border: 2px dashed red; opacity:0.8;" id="<%= this.data.attr('wid') %>">
|
||||
<div class="dashui-widget-body">
|
||||
<b>Instance</b>
|
||||
<div <%= (el) -> vis.binds.special.instance(el) %>></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/ejs" id="tplUnFocus" class="dashui-tpl" data-dashui-set="special" data-dashui-name="special - remove Focus" data-dashui-attrs="">
|
||||
<div class="dashui-widget <%== this.data.attr('class') %>" style="display:none; width: 320px; height: 20px; background-color: #333; color: #eee; border: 2px dashed red; opacity:0.8;" id="<%= this.data.attr('wid') %>">
|
||||
<div class="dashui-widget-body">
|
||||
<b>Remove Focus</b>
|
||||
<div <%= (el) -> vis.binds.special.unfocus(el) %>></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/ejs" id="tplSoundOnClick" class="dashui-tpl" data-dashui-set="special" data-dashui-name="special - Sound onClick" data-dashui-attrs="url">
|
||||
<div class="dashui-widget <%== this.data.attr('class') %>" style="display:none; width: 320px; height: 20px; background-color: #333; color: #eee; border: 2px dashed red; opacity:0.8;" id="<%= this.data.attr('wid') %>">
|
||||
<div class="dashui-widget-body">
|
||||
<b>Sound onClick: <%= this.data.attr('url') %></b>
|
||||
<div <%= (el) -> vis.binds.special.soundOnClick(el, data.attr('url')) %>></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
@@ -0,0 +1,19 @@
|
||||
<script type="text/javascript">
|
||||
vis.binds.weather = {
|
||||
yr: function (el, url) {
|
||||
|
||||
},
|
||||
wunderground: function (el) {
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<script type="text/ejs" id="tplYrBasic" class="vis-tpl"
|
||||
data-vis-set="weather"
|
||||
data-vis-name="yr.no basic forecast"
|
||||
data-vis-attrs="url">
|
||||
<div class="vis-widget <%== this.data.attr('class') %>" style="width: 200px; height: 130px;" id="<%= this.data.attr('wid') %>">
|
||||
<div class="vis-widget-body" <%= (el) -> vis.binds.weather.yr(el, data.attr('url')) %> />
|
||||
</div>
|
||||
</script>
|
||||
Reference in New Issue
Block a user