Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
05062be8
Commit
05062be8
authored
Sep 23, 2012
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for issue 257
parent
ba6c01e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
main.js
examples/html/main.js
+11
-4
No files found.
examples/html/main.js
View file @
05062be8
...
...
@@ -16,6 +16,11 @@ chat.normalizeText = function(text) {
};
chat
.
refresh
=
function
(
data
)
{
if
(
data
===
undefined
)
{
return
;
}
$
.
each
(
data
,
function
(
index
,
entry
)
{
var
row
=
$
(
'<div>'
).
addClass
(
'message-row'
).
appendTo
(
'#mml'
);
var
timestamp
=
(
new
Date
(
entry
.
timestamp
*
1000
)).
toLocaleTimeString
();
...
...
@@ -42,7 +47,7 @@ chat.refresh = function(data) {
}
};
chat
.
getMessages
=
function
()
{
chat
.
getMessages
=
function
(
enter_loop
)
{
$
.
ajax
({
dataType
:
'jsonp'
,
url
:
chat
.
backendUrl
+
'/ajax/get_messages'
,
...
...
@@ -51,7 +56,9 @@ chat.getMessages = function() {
error
:
function
()
{
},
});
window
.
setTimeout
(
chat
.
getMessages
,
chat
.
getMessagesIntervalMs
);
if
(
enter_loop
)
{
window
.
setTimeout
(
'chat.getMessages(true)'
,
chat
.
getMessagesIntervalMs
);
}
};
chat
.
handleMenuItemClick
=
function
(
ev
)
{
...
...
@@ -81,7 +88,7 @@ chat.handleMessageInput = function(ev) {
success
:
function
(
ev
)
{
input
.
value
=
''
;
input
.
disabled
=
false
;
chat
.
getMessages
();
chat
.
getMessages
(
false
);
},
error
:
function
(
ev
)
{
chat
.
showError
(
'Error sending message'
);
...
...
@@ -93,7 +100,7 @@ chat.handleMessageInput = function(ev) {
$
(
document
).
ready
(
function
()
{
$
(
'.menu-item'
).
click
(
chat
.
handleMenuItemClick
);
$
(
'.message-input'
).
keypress
(
chat
.
handleMessageInput
);
chat
.
getMessages
();
chat
.
getMessages
(
true
);
});
// vim:ts=2:sw=2:et
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