Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nginx-push-stream-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
nginx-push-stream-module
Commits
203c5751
Commit
203c5751
authored
Dec 26, 2010
by
Wandenberg Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed the way that messages are appended in textarea
parent
f8675232
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
32 deletions
+34
-32
chat.html
misc/examples/chat.html
+34
-32
No files found.
misc/examples/chat.html
View file @
203c5751
...
...
@@ -7,8 +7,8 @@
</head>
<body>
<form
action=
"/pub"
method=
"POST"
>
<p>
<span
style=
"display: block; float: left; width: 55px;"
>
satus:
</span>
<p>
<span
style=
"display: block; float: left; width: 55px;"
>
satus:
</span>
<span
class=
"online"
style=
"display:none; color:green"
>
online
</span>
<span
class=
"offline"
style=
"display:block; color:red"
>
offline
</span>
</p>
...
...
@@ -42,25 +42,27 @@
};
function
_manageEvent
(
eventMessage
)
{
if
(
eventMessage
!=
''
)
{
var
values
=
$
.
parseJSON
(
eventMessage
);
var
line
=
values
.
nick
+
'
:
'
+
values
.
text
;
if
(
$
(
"
#chat
"
).
val
()
==
''
)
{
$
(
"
#chat
"
).
val
(
line
);
}
else
{
$
(
"
#chat
"
).
val
(
line
+
'
\n
'
+
$
(
"
#chat
"
).
val
());
}
}
var
chat
=
$
(
"
#chat
"
);
if
(
eventMessage
!=
''
)
{
var
values
=
$
.
parseJSON
(
eventMessage
);
var
line
=
values
.
nick
+
'
:
'
+
values
.
text
;
if
(
chat
.
val
()
==
''
)
{
chat
.
val
(
line
);
}
else
{
chat
.
val
(
chat
.
val
()
+
'
\n
'
+
line
);
}
}
chat
.
scrollTop
(
chat
[
0
].
scrollHeight
-
chat
.
height
());
};
function
_statuschanged
()
{
if
(
PushStream
.
status
==
5
)
{
$
(
"
.offline
"
).
hide
();
$
(
"
.online
"
).
show
();
}
else
{
$
(
"
.online
"
).
hide
();
$
(
"
.offline
"
).
show
();
}
if
(
PushStream
.
status
==
5
)
{
$
(
"
.offline
"
).
hide
();
$
(
"
.online
"
).
show
();
}
else
{
$
(
"
.online
"
).
hide
();
$
(
"
.offline
"
).
show
();
}
};
$
(
"
#room
"
).
change
(
function
(){
...
...
@@ -68,30 +70,30 @@
PushStream
.
disconnect
();
}
$
(
"
#chat
"
).
val
(
''
);
PushStream
.
joinChannel
(
$
(
"
#room
"
).
val
(),
1
0
);
PushStream
.
connect
();
PushStream
.
joinChannel
(
$
(
"
#room
"
).
val
(),
0
);
PushStream
.
connect
();
});
$
(
"
#sendButton
"
).
click
(
function
(){
if
((
$
(
"
#nick
"
).
val
()
!=
""
)
&&
(
$
(
"
#message
"
).
val
()
!=
""
)
&&
(
$
(
"
#room
"
).
val
()
!=
""
))
{
$
.
post
(
'
/pub?id=
'
+
$
(
"
#room
"
).
val
(),
'
{"nick":"
'
+
$
(
"
#nick
"
).
val
()
+
'
", "text":"
'
+
$
(
"
#message
"
).
val
()
+
'
"}
'
,
onSendText
);
}
else
{
alert
(
"
nick, room and text are required
"
);
}
if
((
$
(
"
#nick
"
).
val
()
!=
""
)
&&
(
$
(
"
#message
"
).
val
()
!=
""
)
&&
(
$
(
"
#room
"
).
val
()
!=
""
))
{
$
.
post
(
'
/pub?id=
'
+
$
(
"
#room
"
).
val
(),
'
{"nick":"
'
+
$
(
"
#nick
"
).
val
()
+
'
", "text":"
'
+
$
(
"
#message
"
).
val
()
+
'
"}
'
,
onSendText
);
}
else
{
alert
(
"
nick, room and text are required
"
);
}
return
false
;
});
var
now
=
new
Date
();
var
_hostId
=
(
now
.
getTime
()
+
""
+
(
Math
.
random
()
*
10000
)).
replace
(
'
.
'
,
''
);
var
_hostId
=
(
now
.
getTime
()
+
""
+
(
Math
.
random
()
*
10000
)).
replace
(
'
.
'
,
''
);
PushStream
.
host
=
window
.
location
.
hostname
;
PushStream
.
port
=
window
.
location
.
port
;
PushStream
.
hostid
=
_hostId
;
PushStream
.
registerEventCallback
(
"
process
"
,
_manageEvent
);
PushStream
.
registerEventCallback
(
"
statuschanged
"
,
_statuschanged
);
PushStream
.
joinChannel
(
$
(
"
#room
"
).
val
(),
1
0
);
PushStream
.
connect
();
PushStream
.
port
=
window
.
location
.
port
;
PushStream
.
hostid
=
_hostId
;
PushStream
.
registerEventCallback
(
"
process
"
,
_manageEvent
);
PushStream
.
registerEventCallback
(
"
statuschanged
"
,
_statuschanged
);
PushStream
.
joinChannel
(
$
(
"
#room
"
).
val
(),
0
);
PushStream
.
connect
();
});
// ]]>
</script>
...
...
Write
Preview
Markdown
is supported
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