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
7d58d856
Commit
7d58d856
authored
Feb 28, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save chat box's toggle state between page loads.
parent
8294162f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
27 deletions
+32
-27
converse.js
converse.js
+25
-23
src/templates/chatbox.html
src/templates/chatbox.html
+7
-4
No files found.
converse.js
View file @
7d58d856
...
...
@@ -629,10 +629,11 @@
this
.
messages
=
new
converse
.
Messages
();
this
.
messages
.
localStorage
=
new
Backbone
.
LocalStorage
(
hex_sha1
(
'
converse.messages
'
+
this
.
get
(
'
jid
'
)
+
converse
.
bare_jid
));
this
.
s
et
({
this
.
s
ave
({
'
user_id
'
:
Strophe
.
getNodeFromJid
(
this
.
get
(
'
jid
'
)),
'
box_id
'
:
hex_sha1
(
this
.
get
(
'
jid
'
)),
'
otr_status
'
:
this
.
get
(
'
otr_status
'
)
||
UNENCRYPTED
'
otr_status
'
:
this
.
get
(
'
otr_status
'
)
||
UNENCRYPTED
,
'
minimized
'
:
this
.
get
(
'
minimized
'
)
||
false
});
}
},
...
...
@@ -840,7 +841,7 @@
events
:
{
'
click .close-chatbox-button
'
:
'
closeChat
'
,
'
click .toggle-chatbox-button
'
:
'
toggleChat
'
,
'
click .toggle-chatbox-button
'
:
'
toggleChat
Box
'
,
'
keypress textarea.chat-textarea
'
:
'
keyPressed
'
,
'
click .toggle-smiley
'
:
'
toggleEmoticonMenu
'
,
'
click .toggle-smiley ul li
'
:
'
insertEmoticon
'
,
...
...
@@ -880,21 +881,6 @@
}
},
initDragResize
:
function
()
{
this
.
min_height
=
150
;
this
.
prev_pageY
=
0
;
// To store last known mouse position
this
.
original_height
=
this
.
$el
.
children
(
'
.box-flyout
'
).
height
();
if
(
converse
.
connection
)
{
this
.
height
=
this
.
model
.
get
(
'
height
'
);
if
(
this
.
height
)
{
this
.
setChatBoxHeight
(
this
.
height
);
}
else
{
this
.
height
=
this
.
original_height
;
this
.
model
.
save
({
'
height
'
:
this
.
height
});
}
}
},
render
:
function
()
{
this
.
$el
.
attr
(
'
id
'
,
this
.
model
.
get
(
'
box_id
'
))
.
html
(
...
...
@@ -913,6 +899,21 @@
return
this
;
},
initDragResize
:
function
()
{
this
.
min_height
=
150
;
this
.
prev_pageY
=
0
;
// To store last known mouse position
this
.
original_height
=
this
.
$el
.
children
(
'
.box-flyout
'
).
height
();
if
(
converse
.
connection
)
{
this
.
height
=
this
.
model
.
get
(
'
height
'
);
if
(
this
.
height
)
{
this
.
setChatBoxHeight
(
this
.
height
);
}
else
{
this
.
height
=
this
.
original_height
;
this
.
model
.
save
({
'
height
'
:
this
.
height
});
}
}
},
showStatusNotification
:
function
(
message
,
replace
)
{
var
$chat_content
=
this
.
$el
.
find
(
'
.chat-content
'
);
$chat_content
.
find
(
'
div.chat-event
'
).
remove
().
end
()
...
...
@@ -1125,7 +1126,9 @@
},
setChatBoxHeight
:
function
(
height
)
{
this
.
$el
.
children
(
'
.box-flyout
'
)[
0
].
style
.
height
=
height
+
'
px
'
;
if
(
!
this
.
model
.
get
(
'
minimized
'
))
{
this
.
$el
.
children
(
'
.box-flyout
'
)[
0
].
style
.
height
=
height
+
'
px
'
;
}
},
resizeChatBox
:
function
(
ev
)
{
...
...
@@ -1295,11 +1298,10 @@
}
},
toggleChat
:
function
(
ev
)
{
//
FIXME
: Restore chat box to original resized height.
toggleChat
Box
:
function
(
ev
)
{
//
TODO
: Restore chat box to original resized height.
// Requires that we save the custom height.
this
.
$el
.
children
(
'
.box-flyout
'
).
attr
(
'
style
'
,
''
);
this
.
saveToggleState
();
this
.
$el
.
find
(
'
div.chat-body
'
).
slideToggle
(
'
fast
'
);
var
$target
=
$
(
ev
.
target
);
...
...
@@ -1877,7 +1879,7 @@
className
:
'
chatroom
'
,
events
:
{
'
click .close-chatbox-button
'
:
'
closeChat
'
,
'
click .toggle-chatbox-button
'
:
'
toggleChat
'
,
'
click .toggle-chatbox-button
'
:
'
toggleChat
Box
'
,
'
click .configure-chatroom-button
'
:
'
configureChatRoom
'
,
'
click .toggle-smiley
'
:
'
toggleEmoticonMenu
'
,
'
click .toggle-smiley ul li
'
:
'
insertEmoticon
'
,
...
...
src/templates/chatbox.html
View file @
7d58d856
<div
class=
"box-flyout"
>
<div
class=
"box-flyout
{[ if (minimized) { ]} minimized {[ } ]}
"
>
<div
class=
"dragresize dragresize-tm"
></div>
<div
class=
"chat-head chat-head-chatbox"
>
<a
class=
"close-chatbox-button icon-close"
></a>
<a
class=
"toggle-chatbox-button icon-minus"
></a>
<a
class=
"toggle-chatbox-button
{[ if (minimized) { ]} icon-plus {[ } ]}
{[ if (!minimized) { ]} icon-minus {[ } ]}
"
></a>
<div
class=
"chat-title"
>
{[ if (url) { ]}
<a
href=
"{{url}}"
target=
"_blank"
class=
"user"
>
...
...
@@ -14,7 +17,7 @@
</div>
<p
class=
"user-custom-message"
><p/>
</div>
<div
class=
"chat-body"
>
<div
class=
"chat-body"
{[
if
(
minimized
)
{
]}
style=
"display:none"
{[
}
]}
>
<div
class=
"chat-content"
></div>
<form
class=
"sendXMPPMessage"
action=
""
method=
"post"
>
{[ if (show_toolbar) { ]}
...
...
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