2
1
mirror of https://github.com/s00500/nodeMessageBoard.git synced 2024-12-22 08:10:49 +00:00
nodeMessageBoard/board.html
2016-03-07 21:48:50 +01:00

114 lines
2.3 KiB
HTML

<!DOCTYPE html>
<meta charset="UTF-8">
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<style>
body {
margin: 0px;
padding: 0px;
}
#rData{
float:left;
margin-left:100px;
margin-right:auto;
width:470px;
}
#sData{
float: left;
margin-left:100px;
margin-right:auto;
width:470px;
}
h2{
text-align:center;
}
#myCanvas {
border: 2px dashed grey;
}
#btnHolder, #sliderTxt{
text-align:center;
}
</style>
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
var iosocket;
var pollOneH = 0;
var poll1;
var text;
var potValue;
var prevPotValue;
//var onOff = false;
var toggleVal = 0;
function initSocketIO()
{
iosocket = io.connect();
iosocket.on('onconnection', function(value) {
pollOneH = value.pollOneValue/2; // recieve start poll value from server
initButton();
// recieve changed values by other client from server
iosocket.on('updateData', function(recievedData) {
pollOneH = recievedData.pollOneValue/2; // recieve start poll value from server
});
iosocket.on('newMessage', function(message) {
var date = new Date();
var mainTable = document.getElementById("mainTable");
var newRow = mainTable.insertRow(mainTable.rows.length);
var dateCell = newRow.insertCell(0);
var textCell = newRow.insertCell(1);
dateCell.innerHTML = date.toLocaleString();
textCell.innerHTML = message;
});
});
}
function initButton()
{
$( "#check" ).button();
}
window.onload = function() {
initSocketIO();
};
$(document).ready(function() {
$('#check').click(function() {
toggleVal += 1;
toggleVal %= 2;
iosocket.emit('sendAT',toggleVal);
});
});
</script>
</head>
<body>
<div id="rData">
<h2>Data from Sim900</h2>
<table id="mainTable" border="1">
<tr>
<td>Uhrzeit</td><td>Nachricht</td>
</tr>
</table>
</div>
<div id="sData">
<h2>Debug functions</h2>
<div id="btnHolder">
<input type="checkbox" id="check" value="toggle"/><label for="check">Toggle LED</label>
</div>
<p id="sliderTxt">LED Dimmer</p>
<div id="slider"></div>
</div>
</body>
</html>