Skip to content

Commit 95fb03c

Browse files
committed
mobile styles, bugfixes
1 parent 98f17a1 commit 95fb03c

File tree

4 files changed

+30
-18
lines changed

4 files changed

+30
-18
lines changed

chat/css/style.css

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ form.login-form input[type=submit]{
105105
.message.content.current{
106106
float: right;
107107
text-align: right;
108-
margin: 5px 10px 5px 0;
108+
margin: 5px 10px 5px 10px;
109109
}
110110
.message.content.other{
111111
float: left;
@@ -116,15 +116,14 @@ form.login-form input[type=submit]{
116116
clear:both;
117117
}
118118
.message.content div{
119-
max-width: calc(100% - 30px);
119+
min-width: calc(100% - 43px);
120120
position: relative;
121121
display: inline-block;
122-
padding: 8px;
122+
padding: 8px 21px 8px 10px;
123123
text-align: left;
124124
border-radius: 10px;
125125
color: #fff;
126126
vertical-align: top;
127-
word-break: break-all;
128127
}
129128
.message.content.current div{
130129
box-shadow: inset 0 0 1px #007aff;
@@ -174,7 +173,7 @@ form.message-form .message-cont{
174173
left:10px;
175174
top:10px;
176175
bottom:50px;
177-
right:calc(150px + 10px + 10px + 10px);
176+
right:calc(20% + 10px + 10px + 10px);
178177
}
179178
form.message-form .message-cont textarea{
180179
width:calc(100% - 10px);
@@ -197,8 +196,8 @@ form.message-form button{
197196
position:absolute;
198197
top:10px;
199198
right:10px;
200-
bottom:10px;
201-
width:150px;
199+
bottom:48px;
200+
width:20%;
202201
border:1px solid #c5c5c9;
203202
border-radius:4px;
204203
font-size:130%;

chat/index.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
<html lang="en-US">
33
<head>
44
<meta charset="utf-8" />
5-
<title>Multiplayer Chat</title>
6-
5+
<title>Websocket Chat</title>
76
<link rel="stylesheet" type="text/css" href="css/style.css" />
8-
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
98
</head>
109
<body>
1110

@@ -21,7 +20,7 @@
2120
<div id="chat-room" class="chat-room">
2221

2322
<div class="header">
24-
<b>Websocket Multiplayer Chat</b>
23+
<b>Websocket Chat</b>
2524
<span id="current-user"></span>
2625
<a id="logout-btn" href="javascript:void(0);">logout</a>
2726
</div>
@@ -36,7 +35,7 @@
3635
<textarea
3736
type="text"
3837
maxlength="1048576"
39-
placeholder="Write text message, hit Ctrl + Enter to send"
38+
placeholder="(CTRL+ENTER to send message)"
4039
name="message"></textarea>
4140
</div>
4241
<div class="recepients">

chat/js/client.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ Class.Define('Chat', {
7070
user = this._loginForm.user.value,
7171
pass = this._loginForm.pass.value;
7272
if (user != '' && pass != '') {
73+
var pathName = location.pathname;
74+
var lastSlashPos = pathName.lastIndexOf('/');
75+
if (lastSlashPos > -1)
76+
pathName = pathName.substr(0, lastSlashPos + 1);
7377
Ajax.load({
74-
url: location.origin + location.pathname + 'data/?login-submit',
78+
url: location.origin + pathName + 'data/?login-submit',
7579
method: 'post',
7680
data: {
7781
user: user,

server.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
var WebDevServer = require("web-dev-server");
22
var devServerInstance = (new WebDevServer())
3-
.SetDocumentRoot(__dirname) // required
4-
.SetPort(8000) // optional, 8000 by default
5-
// .SetDomain('localhost') // optional, localhost by default
6-
// .SetDevelopment(false) // optional, true by default to display Errors and directory content
7-
.Run();
3+
.SetDocumentRoot(__dirname) // required
4+
//.SetPort(8000) // optional, 8000 by default
5+
//.SetDomain('localhost') // optional, 'localhost' by default
6+
.SetSessionMaxAge(60 * 60 * 24) // optional, 1 hour by default, seconds
7+
.SetSessionHash('SGS2e+9x5$as%SD_AS6s.aHS96s') // optional, session id hash salt
8+
.SetDevelopment(true) // optional, true by default to display Errors and directory content
9+
.AddHandler(function (req, res, e, cb) { // optional, to prepend any execution before `web-dev-server` module execution
10+
if (req.url == '/health') {
11+
res.writeHead(200);
12+
res.end('1');
13+
e.preventDefault(); // do not anything else in `web-dev-server` module for this request
14+
}
15+
cb();
16+
})
17+
.Run();

0 commit comments

Comments
 (0)