1
0

finished functionaity and added basic style

This commit is contained in:
Lukas Bachschwell 2016-03-08 12:49:28 +01:00
parent 5f58d8834c
commit 2ac350b87c

View File

@ -1,46 +1,19 @@
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="UTF-8"> <meta charset="UTF-8">
<html> <html>
<head> <head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<style> <!--<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />-->
body { <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
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/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.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 src="/socket.io/socket.io.js">
<script> </script>
<script>
const toDisplay = 5; //define the number of messages to show const toDisplay = 5; //define the number of messages to show
var iosocket;
var iosocket;
var currentMessageCount = 0; var currentMessageCount = 0;
//var onOff = false;
var toggleVal = 0;
@ -55,13 +28,14 @@
}); });
iosocket.on('newMessage', function(time,number,message) { iosocket.on('newMessage', function(time,number,message) {
var censoredNumber = number.substring(0,3) + "********" +number.substring(number.length - 3, number.length);
var mainTable = document.getElementById("mainTable"); var mainTable = document.getElementById("mainTable");
var newRow = mainTable.insertRow(mainTable.rows.length); var newRow = mainTable.insertRow(mainTable.rows.length);
var dateCell = newRow.insertCell(0); var dateCell = newRow.insertCell(0);
var numberCell = newRow.insertCell(1); var numberCell = newRow.insertCell(1);
var textCell = newRow.insertCell(2); var textCell = newRow.insertCell(2);
dateCell.innerHTML = time; dateCell.innerHTML = time;
numberCell.innerHTML = number; numberCell.innerHTML = censoredNumber;
textCell.innerHTML = message; textCell.innerHTML = message;
currentMessageCount++; currentMessageCount++;
if(currentMessageCount > toDisplay) if(currentMessageCount > toDisplay)
@ -83,32 +57,33 @@
window.onload = function() { window.onload = function() {
initSocketIO(); initSocketIO();
iosocket.emit('getLastMessages',toDisplay); iosocket.emit('getLastMessages',toDisplay);
}; };
$(document).ready(function() { $(document).ready(function() {
//request last messages from server $('#check').click(function() {
$('#check').click(function() {
toggleVal += 1;
toggleVal %= 2;
iosocket.emit('sendAT',toggleVal); iosocket.emit('sendAT',toggleVal);
}); });
}); });
</script> </script>
</head> </head>
<body> <body>
<div style="text-align:center;"> <div style="text-align:center;" >
<h2>Data from Sim900</h2> <h1 style="color:#000066;">SMS Message Board</h1>
<hr>
<table id="mainTable" border="1" align="center"> <br>
<h3>Send an SMS with a message to <span style="color:#3399ff;">+43 681 2033 4015</span></h3>
<br>
<table id="mainTable" border="1" align="center" class="table table-striped">
<tr> <tr>
<td>Uhrzeit</td><td>Nummer</td><td>Nachricht</td> <td><h4>Uhrzeit</h4></td><td><h4>Nummer</h4></td><td><h4>Nachricht</h4></td>
</tr> </tr>
</table> </table>
<h3>Send an SMS with a message to <span style="color:#3399ff;">+43 681 2033 4015</span></h3>
<br> <br>
<br> <div style="display:none" id="btnHolder">
<h2>Debug functions</h2> <h2>Debug functions</h2>
<div id="btnHolder">
<input type="checkbox" id="check" value="toggle"/><label for="check">Send AT</label> <input type="checkbox" id="check" value="toggle"/><label for="check">Send AT</label>
</div> </div>
</body> </body>