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
6acd6a49
Commit
6acd6a49
authored
Jun 20, 2012
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all code around minimizing chats. Not such a useful feature.
parent
1c5d6d8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
65 deletions
+9
-65
collective.xmpp.chat.js
collective.xmpp.chat.js
+9
-65
No files found.
collective.xmpp.chat.js
View file @
6acd6a49
...
...
@@ -25,14 +25,6 @@ var xmppchat = (function ($, console) {
return
o
;
};
obj
.
getMinimizedChats
=
function
()
{
var
cookie
=
$
.
cookie
(
'
chats_minimized_
'
+
xmppchat
.
username
);
if
(
cookie
)
{
return
cookie
.
split
(
/
\|
/
);
}
return
[];
};
obj
.
positionNewChat
=
function
(
chatbox
)
{
var
open_chats
=
0
;
for
(
var
i
=
0
;
i
<
xmppchat
.
chats
.
length
;
i
++
)
{
...
...
@@ -133,12 +125,11 @@ var xmppchat = (function ($, console) {
return
$
(
'
#
'
+
chat_id
);
};
obj
.
createChat
=
function
(
jid
,
minimize
)
{
obj
.
createChat
=
function
(
jid
)
{
if
(
typeof
(
jid
)
===
undefined
)
{
return
;
}
var
cookie
=
$
.
cookie
(
'
chats-open-
'
+
this
.
username
),
chat_content
,
var
chat_content
,
chatbox
,
chat_id
=
this
.
hash
(
jid
);
this
.
addChatToCookie
(
jid
);
...
...
@@ -152,20 +143,14 @@ var xmppchat = (function ($, console) {
}
chatbox
.
find
(
"
.chat-textarea
"
).
focus
();
chat_content
=
chatbox
.
find
(
'
.chat-content
'
);
chat_content
.
scrollTop
(
chat_content
[
0
].
scrollHeight
);
if
(
chat_content
.
length
>
0
)
{
chat_content
.
scrollTop
(
chat_content
[
0
].
scrollHeight
);
}
return
;
}
chatbox
=
this
.
createChatBox
(
jid
);
this
.
positionNewChat
(
chatbox
);
this
.
chats
.
push
(
chat_id
);
if
(
minimize
==
1
)
{
// Minimize the chat if it's in the minimized_chats cookie
var
minimized_chats
=
this
.
getMinimizedChats
();
if
(
chat_id
in
this
.
oc
(
minimized_chats
))
{
chatbox
.
find
(
'
.chat-content
'
).
css
(
'
display
'
,
'
none
'
);
chatbox
.
find
(
'
.chat-input
'
).
css
(
'
display
'
,
'
none
'
);
}
}
this
.
handleChatEvents
(
chat_id
);
chatbox
.
show
();
chat_content
=
chatbox
.
find
(
'
.chat-content
'
);
...
...
@@ -252,14 +237,7 @@ var xmppchat = (function ($, console) {
'
</div>
'
;
}
chat_content
.
append
(
message_html
);
if
(
chat_content
.
css
(
'
display
'
)
==
'
none
'
)
{
// The chatbox is minimized, so we change it's header color to alert
// the user.
chat
.
find
(
'
.chat-head
'
).
addClass
(
'
chat-head-minimized-with-messages
'
);
}
chat_content
.
scrollTop
(
chat_content
[
0
].
scrollHeight
);
jarnxmpp
.
UI
.
msg_counter
+=
1
;
jarnxmpp
.
UI
.
updateMsgCounter
();
});
...
...
@@ -289,41 +267,6 @@ var xmppchat = (function ($, console) {
this
.
chats
.
pop
(
chat_id
);
};
obj
.
toggleChat
=
function
(
jid
)
{
/* Minimize or maximize a chat box and record it in a cookie so that we
* remember the configuration after page loads.
*/
var
chat_id
=
this
.
hash
(
jid
),
minimized_chats
=
xmppchat
.
getMinimizedChats
(),
new_cookie
;
if
(
jQuery
(
'
#
'
+
chat_id
+
'
.chat-content
'
).
css
(
'
display
'
)
==
'
none
'
)
{
// Chat will be maximized
new_cookie
=
[];
for
(
var
i
=
0
;
i
<
minimized_chats
.
length
;
i
++
)
{
if
(
minimized_chats
[
i
]
!=
chat_id
)
{
new_cookie
.
push
(
minimized_chats
[
i
]);
}
}
jQuery
.
cookie
(
'
chats_minimized_
'
+
xmppchat
.
username
,
new_cookie
.
join
(
'
|
'
));
var
chat_content
=
jQuery
(
'
#
'
+
chat_id
+
'
.chat-content
'
);
chat_content
.
css
(
'
display
'
,
'
block
'
);
chat_content
.
scrollTop
(
chat_content
[
0
].
scrollHeight
);
jQuery
(
'
#
'
+
chat_id
+
'
.chat-head
'
).
removeClass
(
'
chat-head-minimized-with-messages
'
);
jQuery
(
'
#
'
+
chat_id
+
'
.chat-input
'
).
css
(
'
display
'
,
'
block
'
);
}
else
{
// Chat will be minimized
if
(
!
(
chat_id
in
xmppchat
.
oc
(
minimized_chats
)))
{
new_cookie
=
chat_id
;
new_cookie
+=
'
|
'
+
minimized_chats
.
join
(
'
|
'
);
jQuery
.
cookie
(
'
chats_minimized_
'
+
xmppchat
.
username
,
new_cookie
);
}
jQuery
(
'
#
'
+
chat_id
+
'
.chat-content
'
).
css
(
'
display
'
,
'
none
'
);
jQuery
(
'
#
'
+
chat_id
+
'
.chat-input
'
).
css
(
'
display
'
,
'
none
'
);
}
};
obj
.
keyPressed
=
function
(
event
,
textarea
,
audience
,
chat_id
,
chat_type
)
{
if
(
event
.
keyCode
==
13
&&
!
event
.
shiftKey
)
{
var
textbox
=
jQuery
(
textarea
);
...
...
@@ -377,9 +320,10 @@ $(document).bind('jarnxmpp.message', function (event) {
});
$
(
document
).
bind
(
'
jarnxmpp.connected
'
,
function
()
{
var
chatdata
=
jQuery
(
'
span#babble-client-chatdata
'
);
var
cookie
=
jQuery
.
cookie
(
'
chats-open-
'
+
chatdata
.
attr
(
'
username
'
));
var
open_chats
=
[],
chat_id
;
var
chatdata
=
jQuery
(
'
span#babble-client-chatdata
'
),
cookie
=
jQuery
.
cookie
(
'
chats-open-
'
+
chatdata
.
attr
(
'
username
'
)),
open_chats
=
[],
chat_id
;
xmppchat
.
username
=
chatdata
.
attr
(
'
username
'
);
xmppchat
.
base_url
=
chatdata
.
attr
(
'
base_url
'
);
...
...
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