Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DoNaTio s.r.o.
PiPo
Commits
2d6cfa42
Commit
2d6cfa42
authored
Dec 04, 2014
by
DoNaTio s.r.o.
Browse files
disconnect button
parent
016548b8
Changes
6
Hide whitespace changes
Inline
Side-by-side
.idea/misc.xml
View file @
2d6cfa42
...
...
@@ -17,24 +17,6 @@
</entry>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
/>
<component
name=
"SvnConfiguration"
maxAnnotateRevisions=
"500"
myUseAcceleration=
"nothing"
myAutoUpdateAfterCommit=
"false"
cleanupOnStartRun=
"false"
SSL_PROTOCOLS=
"sslv3"
>
<option
name=
"USER"
value=
""
/>
<option
name=
"PASSWORD"
value=
""
/>
<option
name=
"mySSHConnectionTimeout"
value=
"30000"
/>
<option
name=
"mySSHReadTimeout"
value=
"30000"
/>
<option
name=
"LAST_MERGED_REVISION"
/>
<option
name=
"MERGE_DRY_RUN"
value=
"false"
/>
<option
name=
"MERGE_DIFF_USE_ANCESTRY"
value=
"true"
/>
<option
name=
"UPDATE_LOCK_ON_DEMAND"
value=
"false"
/>
<option
name=
"IGNORE_SPACES_IN_MERGE"
value=
"false"
/>
<option
name=
"CHECK_NESTED_FOR_QUICK_MERGE"
value=
"false"
/>
<option
name=
"IGNORE_SPACES_IN_ANNOTATE"
value=
"true"
/>
<option
name=
"SHOW_MERGE_SOURCES_IN_ANNOTATE"
value=
"true"
/>
<option
name=
"FORCE_UPDATE"
value=
"false"
/>
<option
name=
"IGNORE_EXTERNALS"
value=
"false"
/>
<configuration
useDefault=
"false"
>
$USER_HOME$/.subversion
</configuration>
<myIsUseDefaultProxy>
false
</myIsUseDefaultProxy>
</component>
<component
name=
"masterDetails"
>
<states>
<state
key=
"ScopeChooserConfigurable.UI"
>
...
...
index.js
View file @
2d6cfa42
...
...
@@ -56,7 +56,8 @@ io.on('connection', function (socket) {
});
// when the user disconnects.. perform this
socket
.
on
(
'
disconnect
'
,
function
()
{
socket
.
on
(
'
disconnectUser
'
,
function
(
data
)
{
console
.
log
(
data
);
//// remove the username from global usernames list
//if (addedUser) {
// delete usernames[socket.username];
...
...
public/ball.js
0 → 100644
View file @
2d6cfa42
/**
* Ball
* @type {{x: number, y: number, r: number, c: string, vx: number, vy: number, draw: Function}}
*/
module
.
exports
=
{
x
:
50
,
y
:
50
,
r
:
5
,
c
:
"
white
"
,
vx
:
4
,
vy
:
8
,
ctx
,
init
:
function
(){
var
canvas
=
document
.
getElementById
(
'
table
'
);
ctx
=
canvas
.
getContext
(
'
2d
'
);
ctx
.
beginPath
();
ctx
.
arc
(
100
,
10
,
2
,
0
,
Math
.
PI
*
2
,
true
);
ctx
.
closePath
();
ctx
.
fill
();
},
// Function for drawing ball on canvas
draw
:
function
()
{
ctx
.
beginPath
();
ctx
.
fillStyle
=
this
.
c
;
ctx
.
arc
(
this
.
x
,
this
.
y
,
this
.
r
,
0
,
Math
.
PI
*
2
,
false
);
ctx
.
fill
();
}
};
\ No newline at end of file
public/index.html
View file @
2d6cfa42
<!doctype html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
PiPo
</title>
<link
rel=
"stylesheet"
href=
"style.css"
>
<meta
charset=
"UTF-8"
>
<title>
PiPo
</title>
<link
rel=
"stylesheet"
href=
"style.css"
>
</head>
<body>
...
...
@@ -15,22 +15,26 @@
<div
class=
"racket racket5"
></div>
<div
class=
"racket racket6"
></div>
</div>
<ul
class=
"pages"
>
<ul
class=
"pages"
>
<li
class=
"chat page"
>
<div
class=
"chatArea"
>
<ul
class=
"messages"
></ul>
</div>
<div
class=
"chatArea"
>
<a
class=
"disconnectBtn"
href=
"#"
>
Logout
</a>
<ul
class=
"messages"
></ul>
<canvas
id=
"table"
></canvas>
</div>
</li>
<li
class=
"login page"
>
<div
class=
"form"
>
<h3
class=
"title"
>
What's your nickname?
</h3>
<input
class=
"usernameInput"
type=
"text"
maxlength=
"14"
/>
</div>
<div
class=
"form"
>
<h3
class=
"title"
>
What's your nickname?
</h3>
<input
class=
"usernameInput"
type=
"text"
maxlength=
"14"
/>
</div>
</li>
</ul>
</ul>
<script
src=
"https://code.jquery.com/jquery-1.10.2.min.js"
></script>
<script
src=
"/socket.io/socket.io.js"
></script>
<script
src=
"/main.js"
></script>
<script
src=
"https://code.jquery.com/jquery-1.10.2.min.js"
></script>
<script
src=
"/socket.io/socket.io.js"
></script>
<script
src=
"/main.js"
></script>
</body>
</html>
\ No newline at end of file
public/main.js
View file @
2d6cfa42
...
...
@@ -64,8 +64,6 @@ $(function () {
});
$
(
document
).
mousemove
(
function
(
event
){
//console.log('user');
//console.log(user);
var
d
=
{
id
:
user
.
id
,
x
:
event
.
pageX
,
...
...
@@ -91,8 +89,6 @@ $(function () {
socket
.
on
(
'
show racket
'
,
function
(
data
){
//console.log(data);
//var racket = JSON.parse(data.playersCollection);
drawRacket
(
data
);
})
// Whenever the server emits 'user joined', log it in the chat body
...
...
@@ -108,7 +104,15 @@ $(function () {
});
function
drawRacket
(
data
){
var
id
=
data
.
id
;
$
(
'
div.racket
'
+
id
).
css
({
left
:
data
.
x
,
top
:
data
.
y
});
$
(
'
div.racket
'
+
data
.
id
).
css
({
left
:
data
.
x
+
20
,
top
:
data
.
y
+
20
});
}
$
(
'
.disconnectBtn
'
).
click
(
function
(){
socket
.
emit
(
'
disconnectUser
'
,
user
);
});
});
public/style.css
View file @
2d6cfa42
...
...
@@ -155,6 +155,7 @@ ul {
top
:
0
;
width
:
30px
;
height
:
30px
;
z-index
:
99999
;
}
.racket1
{
background
:
url(images/racket.png)
no-repeat
;
}
.racket2
{
background
:
url(images/racket-green.png)
no-repeat
;
}
...
...
@@ -162,3 +163,6 @@ ul {
.racket4
{
background
:
url(images/azure.png)
no-repeat
;
}
.racket5
{
background
:
pink
;
}
.racket6
{
background
:
gray
;
}
#table
{
width
:
800px
;
height
:
400px
;
background-color
:
green
;}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment