Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
ce4528b6
Commit
ce4528b6
authored
Jun 20, 2012
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some bugs around the proper ordering of chatboxes.
parent
6acd6a49
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
collective.xmpp.chat.js
collective.xmpp.chat.js
+18
-12
No files found.
collective.xmpp.chat.js
View file @
ce4528b6
...
...
@@ -2,6 +2,7 @@ var xmppchat = (function ($, console) {
var
obj
=
{};
obj
.
chats
=
[];
obj
.
chat_focus
=
[];
obj
.
chatbox_width
=
205
;
obj
.
sanitizePath
=
function
(
call
)
{
return
xmppchat
.
base_url
+
call
;
...
...
@@ -26,7 +27,8 @@ var xmppchat = (function ($, console) {
};
obj
.
positionNewChat
=
function
(
chatbox
)
{
var
open_chats
=
0
;
var
open_chats
=
0
,
offset
;
for
(
var
i
=
0
;
i
<
xmppchat
.
chats
.
length
;
i
++
)
{
if
(
$
(
"
#
"
+
xmppchat
.
hash
(
xmppchat
.
chats
[
i
])).
css
(
'
display
'
)
!=
'
none
'
)
{
open_chats
++
;
...
...
@@ -36,8 +38,8 @@ var xmppchat = (function ($, console) {
chatbox
.
css
(
'
right
'
,
'
15px
'
);
}
else
{
width
=
(
open_chats
)
*
(
225
+
7
)
+
15
;
chatbox
.
css
(
'
right
'
,
width
+
'
px
'
);
offset
=
(
open_chats
)
*
(
this
.
chatbox_width
+
7
)
+
15
;
chatbox
.
css
(
'
right
'
,
offset
+
'
px
'
);
}
};
...
...
@@ -146,11 +148,15 @@ var xmppchat = (function ($, console) {
if
(
chat_content
.
length
>
0
)
{
chat_content
.
scrollTop
(
chat_content
[
0
].
scrollHeight
);
}
if
(
!
(
jid
in
this
.
oc
(
this
.
chats
)))
{
// Initially the chat status box won't be in this.chats.
this
.
chats
.
push
(
jid
);
}
return
;
}
chatbox
=
this
.
createChatBox
(
jid
);
this
.
positionNewChat
(
chatbox
);
this
.
chats
.
push
(
chat_
id
);
this
.
chats
.
push
(
j
id
);
this
.
handleChatEvents
(
chat_id
);
chatbox
.
show
();
chat_content
=
chatbox
.
find
(
'
.chat-content
'
);
...
...
@@ -167,7 +173,8 @@ var xmppchat = (function ($, console) {
};
obj
.
reorderChats
=
function
()
{
var
index
=
0
;
var
index
=
0
,
offset
;
for
(
var
i
=
0
;
i
<
this
.
chats
.
length
;
i
++
)
{
var
chatbox
=
$
(
"
#
"
+
this
.
hash
(
this
.
chats
[
i
]));
if
(
chatbox
.
css
(
'
display
'
)
!=
'
none
'
)
{
...
...
@@ -175,15 +182,15 @@ var xmppchat = (function ($, console) {
chatbox
.
css
(
'
right
'
,
'
15px
'
);
}
else
{
width
=
(
index
)
*
(
225
+
7
)
+
15
;
chatbox
.
css
(
'
right
'
,
width
+
'
px
'
);
offset
=
(
index
)
*
(
this
.
chatbox_width
+
7
)
+
15
;
chatbox
.
css
(
'
right
'
,
offset
+
'
px
'
);
}
index
++
;
}
}
};
obj
.
addChatToCookie
=
function
(
chat_
id
)
{
obj
.
addChatToCookie
=
function
(
j
id
)
{
var
cookie
=
jQuery
.
cookie
(
'
chats-open-
'
+
xmppchat
.
username
),
new_cookie
,
open_chats
=
[];
...
...
@@ -191,14 +198,13 @@ var xmppchat = (function ($, console) {
if
(
cookie
)
{
open_chats
=
cookie
.
split
(
'
|
'
);
}
if
(
!
(
chat_
id
in
this
.
oc
(
open_chats
)))
{
if
(
!
(
j
id
in
this
.
oc
(
open_chats
)))
{
// Update the cookie if this new chat is not yet in it.
open_chats
.
push
(
chat_
id
);
open_chats
.
push
(
j
id
);
new_cookie
=
open_chats
.
join
(
'
|
'
);
jQuery
.
cookie
(
'
chats-open-
'
+
xmppchat
.
username
,
new_cookie
,
{
path
:
'
/
'
});
console
.
log
(
'
updated cookie =
'
+
new_cookie
+
'
\n
'
);
}
this
.
chats
.
push
(
chat_id
);
};
obj
.
receiveMessage
=
function
(
event
)
{
...
...
@@ -264,7 +270,7 @@ var xmppchat = (function ($, console) {
else
{
jQuery
.
cookie
(
'
chats-open-
'
+
xmppchat
.
username
,
null
,
{
path
:
'
/
'
});
}
this
.
chats
.
pop
(
chat_
id
);
this
.
chats
.
pop
(
j
id
);
};
obj
.
keyPressed
=
function
(
event
,
textarea
,
audience
,
chat_id
,
chat_type
)
{
...
...
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