forked from lbsadmin/nodeMessageBoard
First edit for better readability
This commit is contained in:
parent
9c0c30c5c2
commit
d131979c5d
96
board.html
96
board.html
@ -1,46 +1,38 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<meta charset="UTF-8">
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
<title>SMS Board</title>
|
<title>SMS Board</title>
|
||||||
<link rel='stylesheet' href='sprite/emoji.css' >
|
<link rel='stylesheet' href='sprite/emoji.css' >
|
||||||
<link rel="stylesheet" href="/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="/css/bootstrap.min.css" />
|
||||||
<script src="/js/jquery-1.12.1.min"></script>
|
<script src="/js/jquery-1.12.1.min"></script>
|
||||||
<script src="/js/jquery-ui.js"></script>
|
<script src="/js/jquery-ui.js"></script>
|
||||||
<script src="/socket.io/socket.io.js">
|
<script src="/socket.io/socket.io.js"></script>
|
||||||
</script>
|
<style>
|
||||||
<style>
|
/* Sticky footer styles
|
||||||
/* Sticky footer styles
|
-------------------------------------------------- */
|
||||||
-------------------------------------------------- */
|
html, body {
|
||||||
|
|
||||||
html,
|
|
||||||
body {
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
/* The html and body elements cannot have any padding or margin. */
|
/* The html and body elements cannot have any padding or margin. */
|
||||||
}
|
}
|
||||||
|
/* Wrapper for page content to push down footer */
|
||||||
/* Wrapper for page content to push down footer */
|
#wrap {
|
||||||
#wrap {
|
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
/* Negative indent footer by its height */
|
/* Negative indent footer by its height */
|
||||||
margin: 0 auto -60px;
|
margin: 0 auto -60px;
|
||||||
/* Pad bottom by footer height */
|
/* Pad bottom by footer height */
|
||||||
padding: 0 0 60px;
|
padding: 0 0 60px;
|
||||||
}
|
}
|
||||||
|
/* Set the fixed height of the footer here */
|
||||||
/* Set the fixed height of the footer here */
|
#footer {
|
||||||
#footer {
|
|
||||||
height: 100px;
|
height: 100px;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<script>
|
||||||
|
|
||||||
<script>
|
|
||||||
const toDisplay = 4; //define the number of messages to show
|
const toDisplay = 4; //define the number of messages to show
|
||||||
var iosocket;
|
var iosocket;
|
||||||
var currentMessageCount = 0;
|
var currentMessageCount = 0;
|
||||||
@ -67,19 +59,13 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initSocketIO() {
|
||||||
function initSocketIO()
|
|
||||||
{
|
|
||||||
iosocket = io.connect();
|
iosocket = io.connect();
|
||||||
|
|
||||||
iosocket.on('clientrefresh', function() {
|
iosocket.on('clientrefresh', function() {
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
iosocket.on('connect', function() {
|
iosocket.on('connect', function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
iosocket.on('debugMessage', function(message) {
|
iosocket.on('debugMessage', function(message) {
|
||||||
alert(message);
|
alert(message);
|
||||||
});
|
});
|
||||||
@ -89,43 +75,39 @@ body {
|
|||||||
$( "span.number" ).html(mynumber);
|
$( "span.number" ).html(mynumber);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
iosocket.on('newMessage', function(time,number,message,color) {
|
iosocket.on('newMessage', function(time,number,message,color) {
|
||||||
var censoredNumber = number.substring(0,3) + "********" +number.substring(number.length - 3, number.length);
|
var censoredNumber = number.substring(0,3) + "********" +number.substring(number.length - 3, number.length);
|
||||||
var messages = document.getElementById('messagesBody');
|
var messages = document.getElementById('messagesBody');
|
||||||
newDiv = document.createElement('div');
|
var newDiv = document.createElement('div');
|
||||||
var newH1 = document.createElement('h1');
|
var newH1 = document.createElement('h1');
|
||||||
var newP = document.createElement('p');
|
var newP = document.createElement('p');
|
||||||
|
|
||||||
newH1.innerHTML = message;
|
newH1.innerHTML = message;
|
||||||
newP.innerHTML = "by "+censoredNumber+" at "+time;
|
newP.innerHTML = "by " + censoredNumber + " at " + time;
|
||||||
newDiv.style.backgroundColor = getColor(color); //need this on both for some browsers (especially safari) to recognize...
|
newDiv.style.backgroundColor = getColor(color); //need this on both for some browsers (especially safari) to recognize...
|
||||||
newDiv.style="background-color:"+getColor(color)+" !important; padding:10px 0; margin:10px 0;";
|
newDiv.style = "background-color:" + getColor(color) + " !important; padding:10px 0; margin:10px 0;";
|
||||||
newDiv.className="jumbotron";
|
newDiv.className = "jumbotron";
|
||||||
newDiv.appendChild(newH1);
|
newDiv.appendChild(newH1);
|
||||||
newDiv.appendChild(newP);
|
newDiv.appendChild(newP);
|
||||||
|
|
||||||
currentMessageCount++;
|
currentMessageCount++;
|
||||||
if(currentMessageCount > toDisplay)
|
|
||||||
{
|
if(currentMessageCount > toDisplay) {
|
||||||
//Remove the top div
|
//Remove the top div
|
||||||
$('#messagesBody').find('div').first().slideUp(function() {
|
$('#messagesBody').find('div').first().slideUp(function() {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
document.getElementById('messagesBody').appendChild(newDiv);
|
document.getElementById('messagesBody').appendChild(newDiv);
|
||||||
});
|
});
|
||||||
currentMessageCount--;
|
currentMessageCount--;
|
||||||
}else{
|
} else {
|
||||||
document.getElementById('messagesBody').appendChild(newDiv);
|
document.getElementById('messagesBody').appendChild(newDiv);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
|
function initButton() {
|
||||||
function initButton()
|
|
||||||
{
|
|
||||||
$("#check").button();
|
$("#check").button();
|
||||||
}
|
};
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
initSocketIO();
|
initSocketIO();
|
||||||
@ -133,25 +115,19 @@ body {
|
|||||||
iosocket.emit('getConfig');
|
iosocket.emit('getConfig');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#check').click(function() {
|
$('#check').click(function() {
|
||||||
iosocket.emit('sendAT',toggleVal);
|
iosocket.emit('sendAT',toggleVal);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
</script>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body style="/*background-color: #D4D4D4;*/">
|
<body style="/*background-color: #D4D4D4;*/">
|
||||||
<div style="text-align:center;" >
|
<div style="text-align:center;" >
|
||||||
|
|
||||||
<h2>Send an SMS with a message to <span class="number" style="color:#3399ff;"></span></h2>
|
<h2>Send an SMS with a message to <span class="number" style="color:#3399ff;"></span></h2>
|
||||||
<div id="wrap">
|
<div id="wrap">
|
||||||
<div id="messagesBody">
|
<div id="messagesBody"></div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<div style="display:none;" id="btnHolder">
|
<div style="display:none;" id="btnHolder">
|
||||||
@ -159,10 +135,10 @@ body {
|
|||||||
<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 id="debugOut"> </div>
|
<div id="debugOut"> </div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div id="footer">
|
<div id="footer">
|
||||||
<h2>Send an SMS with a message to <span class="number" style="color:#3399ff;"></span></h2>
|
<h2>Send an SMS with a message to <span class="number" style="color:#3399ff;"></span></h2>
|
||||||
</div>
|
</div>
|
||||||
-->
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
37
clear.html
37
clear.html
@ -1,37 +1,27 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<meta charset="UTF-8">
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Clear Board</title>
|
<meta charset="UTF-8">
|
||||||
|
<title>Clear Board</title>
|
||||||
<link rel='stylesheet' href='sprite/emoji.css' >
|
<link rel='stylesheet' href='sprite/emoji.css' >
|
||||||
<link rel="stylesheet" href="/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="/css/bootstrap.min.css" />
|
||||||
<script src="/js/jquery-1.12.1.min"></script>
|
<script src="/js/jquery-1.12.1.min"></script>
|
||||||
<script src="/js/jquery-ui.js"></script>
|
<script src="/js/jquery-ui.js"></script>
|
||||||
<script src="/socket.io/socket.io.js"></script>
|
<script src="/socket.io/socket.io.js"></script>
|
||||||
|
<script>
|
||||||
<script>
|
|
||||||
var iosocket;
|
var iosocket;
|
||||||
|
function initSocketIO() {
|
||||||
function initSocketIO()
|
|
||||||
{
|
|
||||||
iosocket = io.connect();
|
iosocket = io.connect();
|
||||||
iosocket.on('connect', function() {
|
iosocket.on('connect', function() {
|
||||||
|
|
||||||
iosocket.on('debugMessage', function(message) {
|
iosocket.on('debugMessage', function(message) {
|
||||||
alert(message);
|
alert(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
initSocketIO();
|
initSocketIO();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#clear').click(function() {
|
$('#clear').click(function() {
|
||||||
var number = $('#number').val();
|
var number = $('#number').val();
|
||||||
@ -42,22 +32,23 @@
|
|||||||
iosocket.emit('refreshClients');
|
iosocket.emit('refreshClients');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div style="text-align:center;" >
|
<div style="text-align:center;" >
|
||||||
<div id="wrap">
|
<div id="wrap">
|
||||||
<div id="btnHolder">
|
<div id="btnHolder">
|
||||||
<h2>Functions</h2>
|
<h2>Functions</h2>
|
||||||
<input type="number" id="number" value="1" min="1"/><label for="number">Number</label><br>
|
<input type="number" id="number" value="1" min="1"/>
|
||||||
|
<label for="number">Number</label>
|
||||||
|
<br>
|
||||||
<input type="button" id="clear" value="clear"/>
|
<input type="button" id="clear" value="clear"/>
|
||||||
<br>
|
<br>
|
||||||
<input type="button" id="refresh" value="refresh"/>
|
<input type="button" id="refresh" value="refresh"/>
|
||||||
<div id="debugOut"> </div>
|
<div id="debugOut"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
58
demo.html
58
demo.html
@ -1,44 +1,35 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=320, initial-scale=1">
|
<meta name="viewport" content="width=320, initial-scale=1">
|
||||||
<title>Chat</title>
|
<title>Chat</title>
|
||||||
<script src="/js/jquery-1.12.1.min"></script>
|
<script src="/js/jquery-1.12.1.min"></script>
|
||||||
<script src="/js/jquery-ui.js"></script>
|
<script src="/js/jquery-ui.js"></script>
|
||||||
<script src="/socket.io/socket.io.js"></script>
|
<script src="/socket.io/socket.io.js"></script>
|
||||||
</head>
|
<script type="text/javascript">
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
var iosocket;
|
var iosocket;
|
||||||
|
|
||||||
function initSocketIO()
|
function initSocketIO() {
|
||||||
{
|
|
||||||
iosocket = io.connect();
|
iosocket = io.connect();
|
||||||
|
|
||||||
iosocket.on('connect', function() {
|
iosocket.on('connect', function() {
|
||||||
createSystemMessage('[Connected]');
|
createSystemMessage('[Connected]');
|
||||||
console.log("connect");
|
console.log("connect");
|
||||||
|
|
||||||
|
|
||||||
iosocket.on('debugMessage', function(message) {
|
iosocket.on('debugMessage', function(message) {
|
||||||
alert(message);
|
alert(message);
|
||||||
});
|
});
|
||||||
iosocket.on('disconnect', function() {
|
iosocket.on('disconnect', function() {
|
||||||
createSystemMessage('[Disconnected]');
|
createSystemMessage('[Disconnected]');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
initSocketIO();
|
initSocketIO();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function createSystemMessage(message) {
|
function createSystemMessage(message) {
|
||||||
var message = document.createTextNode(message);
|
var message = document.createTextNode(message);
|
||||||
|
|
||||||
@ -68,7 +59,6 @@
|
|||||||
chat.appendChild(messageBox);
|
chat.appendChild(messageBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function sendMessage() {
|
function sendMessage() {
|
||||||
var user = document.getElementById('user');
|
var user = document.getElementById('user');
|
||||||
var message = document.getElementById('message');
|
var message = document.getElementById('message');
|
||||||
@ -87,28 +77,9 @@
|
|||||||
if (( e.keyCode == 13 )&&(e.shiftKey === false)) {
|
if (( e.keyCode == 13 )&&(e.shiftKey === false)) {
|
||||||
sendMessage();
|
sendMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
</script>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="wrapper">
|
|
||||||
<div id="chat_box" class="content"></div>
|
|
||||||
|
|
||||||
<div id="footer">
|
|
||||||
<div class="content">
|
|
||||||
<input type="text" id="number" value="+4301234567890" />
|
|
||||||
<input type="text" id="message" onkeypress="return submitEnter(event)" placeholder="Enter a Test Message! (Or emoji!, google if if you don't know how)" />
|
|
||||||
<input type="button" id="send_btn" value="Send" onclick="sendMessage()">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
* {
|
* {
|
||||||
font-family: "Arial";
|
font-family: "Arial";
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
@ -217,4 +188,19 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="wrapper">
|
||||||
|
<div id="chat_box" class="content"></div>
|
||||||
|
|
||||||
|
<div id="footer">
|
||||||
|
<div class="content">
|
||||||
|
<input type="text" id="number" value="+4301234567890" />
|
||||||
|
<input type="text" id="message" onkeypress="return submitEnter(event)" placeholder="Enter a Test Message! (Or emoji!, google if if you don't know how)" />
|
||||||
|
<input type="button" id="send_btn" value="Send" onclick="sendMessage()">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user