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
8f601e8c
Commit
8f601e8c
authored
Mar 28, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Found more stuff in core that should go to converse-minimize
parent
ed4b9a85
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
56 deletions
+84
-56
src/converse-chatview.js
src/converse-chatview.js
+17
-54
src/converse-minimize.js
src/converse-minimize.js
+67
-2
No files found.
src/converse-chatview.js
View file @
8f601e8c
...
...
@@ -64,7 +64,6 @@
events
:
{
'
click .close-chatbox-button
'
:
'
close
'
,
'
click .toggle-chatbox-button
'
:
'
minimize
'
,
'
keypress textarea.chat-textarea
'
:
'
keyPressed
'
,
'
click .toggle-smiley
'
:
'
toggleEmoticonMenu
'
,
'
click .toggle-smiley ul li
'
:
'
insertEmoticon
'
,
...
...
@@ -84,7 +83,6 @@
this
.
model
.
on
(
'
change:chat_state
'
,
this
.
sendChatState
,
this
);
this
.
model
.
on
(
'
change:chat_status
'
,
this
.
onChatStatusChanged
,
this
);
this
.
model
.
on
(
'
change:image
'
,
this
.
renderAvatar
,
this
);
this
.
model
.
on
(
'
change:minimized
'
,
this
.
onMinimizedChanged
,
this
);
this
.
model
.
on
(
'
change:status
'
,
this
.
onStatusChanged
,
this
);
this
.
model
.
on
(
'
showHelpMessages
'
,
this
.
showHelpMessages
,
this
);
this
.
model
.
on
(
'
sendMessage
'
,
this
.
sendMessage
,
this
);
...
...
@@ -100,6 +98,7 @@
show_textarea
:
true
,
title
:
this
.
model
.
get
(
'
fullname
'
),
info_close
:
__
(
'
Close this chat box
'
),
// FIXME: leaky-abstraction from converse-minimize
info_minimize
:
__
(
'
Minimize this chat box
'
),
label_personal_message
:
__
(
'
Personal message
'
)
}
...
...
@@ -450,12 +449,16 @@
}
},
shouldShowOnTextMessage
:
function
()
{
return
!
this
.
$el
.
is
(
'
:visible
'
);
},
handleTextMessage
:
function
(
message
)
{
this
.
showMessage
(
_
.
clone
(
message
.
attributes
));
if
((
message
.
get
(
'
sender
'
)
!==
'
me
'
)
&&
(
converse
.
windowState
===
'
blur
'
))
{
converse
.
incrementMsgCounter
();
}
if
(
!
this
.
model
.
get
(
'
minimized
'
)
&&
!
this
.
$el
.
is
(
'
:visible
'
))
{
if
(
this
.
shouldShowOnTextMessage
(
))
{
this
.
show
();
}
},
...
...
@@ -642,18 +645,15 @@
},
setChatBoxHeight
:
function
(
height
)
{
if
(
!
this
.
model
.
get
(
'
minimized
'
))
{
if
(
height
)
{
height
=
converse
.
applyDragResistance
(
height
,
this
.
model
.
get
(
'
default_height
'
))
+
'
px
'
;
}
else
{
height
=
""
;
}
this
.
$el
.
children
(
'
.box-flyout
'
)[
0
].
style
.
height
=
height
;
}
},
setChatBoxWidth
:
function
(
width
)
{
if
(
!
this
.
model
.
get
(
'
minimized
'
))
{
if
(
width
)
{
width
=
converse
.
applyDragResistance
(
width
,
this
.
model
.
get
(
'
default_width
'
))
+
'
px
'
;
}
else
{
...
...
@@ -661,7 +661,6 @@
}
this
.
$el
[
0
].
style
.
width
=
width
;
this
.
$el
.
children
(
'
.box-flyout
'
)[
0
].
style
.
width
=
width
;
}
},
resizeChatBox
:
function
(
ev
)
{
...
...
@@ -746,14 +745,6 @@
});
},
onMinimizedChanged
:
function
(
item
)
{
if
(
item
.
get
(
'
minimized
'
))
{
this
.
minimize
();
}
else
{
this
.
maximize
();
}
},
showStatusMessage
:
function
(
msg
)
{
msg
=
msg
||
this
.
model
.
get
(
'
status
'
);
if
(
typeof
msg
===
"
string
"
)
{
...
...
@@ -777,34 +768,6 @@
return
this
;
},
onMaximized
:
function
()
{
converse
.
chatboxviews
.
trimChats
(
this
);
utils
.
refreshWebkit
();
this
.
$content
.
scrollTop
(
this
.
model
.
get
(
'
scroll
'
));
this
.
setChatState
(
converse
.
ACTIVE
).
focus
();
converse
.
emit
(
'
chatBoxMaximized
'
,
this
);
},
onMinimized
:
function
()
{
utils
.
refreshWebkit
();
converse
.
emit
(
'
chatBoxMinimized
'
,
this
);
},
maximize
:
function
()
{
// Restore a minimized chat box
$
(
'
#conversejs
'
).
prepend
(
this
.
$el
);
this
.
$el
.
show
(
'
fast
'
,
this
.
onMaximized
.
bind
(
this
));
return
this
;
},
minimize
:
function
(
ev
)
{
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
// save the scroll position to restore it on maximize
this
.
model
.
save
({
'
scroll
'
:
this
.
$content
.
scrollTop
()});
this
.
setChatState
(
converse
.
INACTIVE
).
model
.
minimize
();
this
.
$el
.
hide
(
'
fast
'
,
this
.
onMinimized
.
bind
(
this
));
},
renderToolbar
:
function
(
options
)
{
if
(
!
converse
.
show_toolbar
)
{
return
;
...
...
src/converse-minimize.js
View file @
8f601e8c
...
...
@@ -10,6 +10,7 @@
define
(
"
converse-minimize
"
,
[
"
converse-core
"
,
"
converse-api
"
,
"
converse-chatview
"
],
factory
);
}(
this
,
function
(
converse
,
converse_api
)
{
"
use strict
"
;
...
...
@@ -93,6 +94,71 @@
},
},
ChatBoxView
:
{
events
:
{
'
click .toggle-chatbox-button
'
:
'
minimize
'
,
},
initialize
:
function
()
{
this
.
model
.
on
(
'
change:minimized
'
,
this
.
onMinimizedChanged
,
this
);
return
this
.
_super
.
initialize
.
apply
(
this
,
arguments
);
},
shouldShowOnTextMessage
:
function
()
{
return
!
this
.
model
.
get
(
'
minimized
'
)
&&
this
.
_super
.
shouldShowOnTextMessage
.
apply
(
this
,
arguments
);
},
setChatBoxHeight
:
function
(
height
)
{
if
(
!
this
.
model
.
get
(
'
minimized
'
))
{
return
this
.
_super
.
setChatBoxHeight
.
apply
(
this
,
arguments
);
}
},
setChatBoxWidth
:
function
(
width
)
{
if
(
!
this
.
model
.
get
(
'
minimized
'
))
{
return
this
.
_super
.
setChatBoxWidth
.
apply
(
this
,
arguments
);
}
},
onMinimizedChanged
:
function
(
item
)
{
if
(
item
.
get
(
'
minimized
'
))
{
this
.
minimize
();
}
else
{
this
.
maximize
();
}
},
onMaximized
:
function
()
{
converse
.
chatboxviews
.
trimChats
(
this
);
utils
.
refreshWebkit
();
this
.
$content
.
scrollTop
(
this
.
model
.
get
(
'
scroll
'
));
this
.
setChatState
(
converse
.
ACTIVE
).
focus
();
converse
.
emit
(
'
chatBoxMaximized
'
,
this
);
},
onMinimized
:
function
()
{
utils
.
refreshWebkit
();
converse
.
emit
(
'
chatBoxMinimized
'
,
this
);
},
maximize
:
function
()
{
// Restore a minimized chat box
$
(
'
#conversejs
'
).
prepend
(
this
.
$el
);
this
.
$el
.
show
(
'
fast
'
,
this
.
onMaximized
.
bind
(
this
));
return
this
;
},
minimize
:
function
(
ev
)
{
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
// save the scroll position to restore it on maximize
this
.
model
.
save
({
'
scroll
'
:
this
.
$content
.
scrollTop
()});
this
.
setChatState
(
converse
.
INACTIVE
).
model
.
minimize
();
this
.
$el
.
hide
(
'
fast
'
,
this
.
onMinimized
.
bind
(
this
));
},
},
ChatBoxes
:
{
chatBoxShouldBeShown
:
function
(
chatbox
)
{
return
this
.
_super
.
chatBoxShouldBeShown
.
apply
(
this
,
arguments
)
&&
...
...
@@ -101,7 +167,6 @@
},
ChatBoxViews
:
{
showChat
:
function
(
attrs
)
{
/* Find the chat box and show it. If it doesn't exist, create it.
*/
...
...
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