2
1
mirror of https://github.com/s00500/nodeMessageBoard.git synced 2024-11-23 21:40:54 +00:00

Added static serving of Jquery bootstrap and others

This commit is contained in:
Lukas Bachschwell 2016-03-15 11:22:03 +01:00
parent 4aeef6c8db
commit 51fc9442eb
8 changed files with 16691 additions and 14 deletions

7
app.js
View File

@ -7,7 +7,10 @@ var debug = false;
var handle = {} var handle = {}
handle["/"] = requestHandlers.sendInterface; handle["/"] = requestHandlers.sendInterface;
handle["/interface"] = requestHandlers.sendInterface; handle["/interface"] = requestHandlers.sendInterface;
handle["/sprite/emoji.css"] = requestHandlers.sendCss; handle["/sprite/emoji.css"] = requestHandlers.sendEmojiCss;
handle["/sprite/emoji.png"] = requestHandlers.sendPng; handle["/sprite/emoji.png"] = requestHandlers.sendEmojiPng;
handle["/js/jquery-1.12.1.min"] = requestHandlers.sendJquery;
handle["/js/jquery-ui.js"] = requestHandlers.sendJqueryUI;
handle["/css/bootstrap.min.css"] = requestHandlers.sendBootstrap;
server.start(router.route,handle,debug); server.start(router.route,handle,debug);

View File

@ -2,13 +2,12 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<html> <html>
<head> <head>
<link rel='stylesheet' href='sprite/emoji.css' >
<title>SMS Board</title> <title>SMS Board</title>
<!--<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />--> <link rel='stylesheet' href='sprite/emoji.css' >
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> <link rel="stylesheet" href="/css/bootstrap.min.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script> <script src="/js/jquery-1.12.1.min"></script>
<script src="http://code.jquery.com/ui/1.9.2/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>

21
db.json
View File

@ -321,6 +321,27 @@
"time": "17:23:55", "time": "17:23:55",
"message": "Elektronik-Labor :D", "message": "Elektronik-Labor :D",
"color": 0 "color": 0
},
{
"numberString": "+CMT: \"002B0034003300360039003900310038003100300039003200340030\",\"\",\"16/03/15,10:44:11+04\"\r",
"number": "+4369918109240",
"time": "10:44:11",
"message": "Penis :-)) :-P ",
"color": 1
},
{
"numberString": "+CMT: \"002B0034003300360039003900310030003000380038003800380036\",\"\",\"16/03/15,10:44:44+04\"\r",
"number": "+4369910088886",
"time": "10:44:44",
"message": "😄",
"color": 2
},
{
"numberString": "+CMT: \"002B0034003300360039003900310038003100300039003200340030\",\"\",\"16/03/15,10:53:47+04\"\r",
"number": "+4369918109240",
"time": "10:53:47",
"message": "😀😓😭",
"color": 3
} }
] ]
} }

View File

@ -12,19 +12,45 @@ function sendInterface(response) {
response.end(html); response.end(html);
} }
function sendCss(response) { function sendEmojiCss(response) {
console.log("Request handler 'css' was called."); console.log("Request handler 'Emojicss' was called.");
response.writeHead(200, {"Content-Type": "text/css"}); response.writeHead(200, {"Content-Type": "text/css"});
var html = fs.readFileSync(__dirname + "/served/emoji.css") var html = fs.readFileSync(__dirname + "/served/emoji.css")
response.end(html); response.end(html);
} }
function sendPng(response) {
console.log("Request handler 'png' was called."); function sendEmojiPng(response) {
console.log("Request handler 'Emojipng' was called.");
response.writeHead(200, {"Content-Type": "image/png"}); response.writeHead(200, {"Content-Type": "image/png"});
var html = fs.readFileSync(__dirname + "/served/emoji.png") var html = fs.readFileSync(__dirname + "/served/emoji.png")
response.end(html); response.end(html);
} }
exports.sendPng = sendPng; function sendBootstrap(response) {
exports.sendCss = sendCss; console.log("Request handler 'css' was called.");
response.writeHead(200, {"Content-Type": "text/css"});
var html = fs.readFileSync(__dirname + "/served/bootstrap.min.css")
response.end(html);
}
function sendJquery(response) {
console.log("Request handler 'jquery' was called.");
response.writeHead(200, {"Content-Type": "application/javascript"});
var html = fs.readFileSync(__dirname + "/served/jquery-1.12.1.min.js")
response.end(html);
}
function sendJqueryUI(response) {
console.log("Request handler 'jqueryUI' was called.");
response.writeHead(200, {"Content-Type": "application/javascript"});
var html = fs.readFileSync(__dirname + "/served/jquery-ui.js")
response.end(html);
}
exports.sendBootstrap = sendBootstrap;
exports.sendJqueryUI = sendJqueryUI;
exports.sendJquery = sendJquery;
exports.sendEmojiPng = sendEmojiPng;
exports.sendEmojiCss = sendEmojiCss;
exports.sendInterface = sendInterface; exports.sendInterface = sendInterface;

6
served/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

5
served/jquery-1.12.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

16617
served/jquery-ui.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -127,7 +127,7 @@ function serialListener(debug)
var messageRecieved = ucs2Parse(data); var messageRecieved = ucs2Parse(data);
db('messages').push({ numberString: numberStringRecieved,number: numberRecieved, time: timeRecieved, message: messageRecieved,color: color }); db('messages').push({ numberString: numberStringRecieved,number: numberRecieved, time: timeRecieved, message: messageRecieved,color: color });
//add a new message to the board directly //add a new message to the board directly
socketServer.emit('newMessage', timeRecieved, numberRecieved, messageRecieved,color); socketServer.emit('newMessage', timeRecieved, numberRecieved, convert(messageRecieved),color);
numberStringRecieved = null; numberStringRecieved = null;
numberRecieved = null; numberRecieved = null;
timeRecieved = null; timeRecieved = null;