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
c738d085
Commit
c738d085
authored
May 28, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Indicate to the user when there are unread messages
further down in the chat box.
parent
82ee7f69
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
237 additions
and
100 deletions
+237
-100
css/converse.css
css/converse.css
+16
-1
sass/_chatbox.scss
sass/_chatbox.scss
+12
-1
sass/_chatrooms.scss
sass/_chatrooms.scss
+7
-0
spec/chatbox.js
spec/chatbox.js
+138
-91
spec/chatroom.js
spec/chatroom.js
+46
-2
src/converse-chatview.js
src/converse-chatview.js
+8
-2
src/converse-core.js
src/converse-core.js
+3
-0
src/converse-dragresize.js
src/converse-dragresize.js
+1
-1
src/converse-headline.js
src/converse-headline.js
+2
-1
src/converse-muc.js
src/converse-muc.js
+1
-0
src/templates/chatarea.html
src/templates/chatarea.html
+1
-0
src/templates/chatbox.html
src/templates/chatbox.html
+1
-0
tests/main.js
tests/main.js
+1
-1
No files found.
css/converse.css
View file @
c738d085
...
...
@@ -1369,6 +1369,16 @@
color
:
#FB5D50
;
}
#conversejs
.chatbox
.chat-body
.delayed
.chat-msg-me
{
color
:
#7EABBB
;
}
#conversejs
.chatbox
.new-msgs-indicator
{
position
:
absolute
;
width
:
100%
;
cursor
:
pointer
;
background-color
:
#F4A261
;
color
:
#FCFDFD
;
padding
:
0.3em
;
font-size
:
0.9em
;
text-align
:
center
;
z-index
:
20
;
}
#conversejs
.chatbox
.chat-content
{
position
:
relative
;
padding
:
0.5em
;
...
...
@@ -1455,7 +1465,7 @@
box-shadow
:
-1px
-1px
2px
0
rgba
(
0
,
0
,
0
,
0.4
);
display
:
none
;
font-size
:
12px
;
margin
:
0
0
1px
0
;
margin
:
0
;
position
:
absolute
;
right
:
0
;
}
#conversejs
.chatbox
form
.sendXMPPMessage
.chat-toolbar
ul
li
{
...
...
@@ -1985,10 +1995,15 @@
max-width
:
70%
;
float
:
left
;
min-width
:
200px
;
}
#conversejs
.chatroom
.box-flyout
.chatroom-body
.chat-area
.new-msgs-indicator
{
background-color
:
#E76F51
;
max-width
:
70%
;
}
#conversejs
.chatroom
.box-flyout
.chatroom-body
.chat-area
.chat-content
{
padding
:
0
0.5em
0
0.5em
;
}
#conversejs
.chatroom
.box-flyout
.chatroom-body
.chat-area.full
{
max-width
:
100%
;
}
#conversejs
.chatroom
.box-flyout
.chatroom-body
.chat-area.full
.new-msgs-indicator
{
max-width
:
100%
;
}
#conversejs
.chatroom
.box-flyout
.chatroom-body
.mentioned
{
font-weight
:
bold
;
}
#conversejs
.chatroom
.box-flyout
.chatroom-body
.chat-msg-room
{
...
...
sass/_chatbox.scss
View file @
c738d085
...
...
@@ -187,6 +187,17 @@
}
}
}
.new-msgs-indicator
{
position
:
absolute
;
width
:
100%
;
cursor
:
pointer
;
background-color
:
$chat-head-color
;
color
:
$light-background-color
;
padding
:
0
.3em
;
font-size
:
0
.9em
;
text-align
:
center
;
z-index
:
20
;
}
.chat-content
{
position
:
relative
;
padding
:
0
.5em
;
...
...
@@ -283,7 +294,7 @@
box-shadow
:
-1px
-1px
2px
0
rgba
(
0
,
0
,
0
,
0
.4
);
display
:
none
;
font-size
:
12px
;
margin
:
0
0
1px
0
;
margin
:
0
;
position
:
absolute
;
right
:
0
;
li
{
...
...
sass/_chatrooms.scss
View file @
c738d085
...
...
@@ -50,12 +50,19 @@
max-width
:
70%
;
float
:
left
;
min-width
:
$chat-width
;
.new-msgs-indicator
{
background-color
:
$chatroom-head-color
;
max-width
:
70%
;
}
.chat-content
{
// There's an annoying Chrome box-sizing bug which prevents us from adding 0.5em padding here.
padding
:
0
0
.5em
0
0
.5em
;
}
&
.full
{
max-width
:
100%
;
.new-msgs-indicator
{
max-width
:
100%
;
}
}
}
.mentioned
{
...
...
spec/chatbox.js
View file @
c738d085
This diff is collapsed.
Click to expand it.
spec/chatroom.js
View file @
c738d085
...
...
@@ -216,6 +216,50 @@
expect
(
converse
.
emit
.
callCount
,
1
);
});
it
(
"
will cause the chat area to be scrolled down only if it was at the bottom already
"
,
function
()
{
var
message
=
'
This message is received while the chat area is scrolled up
'
;
test_utils
.
openChatRoom
(
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
var
view
=
converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
spyOn
(
view
,
'
scrollDown
'
).
andCallThrough
();
runs
(
function
()
{
/* Create enough messages so that there's a
* scrollbar.
*/
for
(
var
i
=
0
;
i
<
20
;
i
++
)
{
converse
.
chatboxes
.
onMessage
(
$msg
({
from
:
'
lounge@localhost/someone
'
,
to
:
'
dummy@localhost.com
'
,
type
:
'
groupchat
'
,
id
:
(
new
Date
()).
getTime
(),
}).
c
(
'
body
'
).
t
(
'
Message:
'
+
i
).
tree
());
}
});
waits
(
50
);
runs
(
function
()
{
view
.
$content
.
scrollTop
(
0
);
});
waits
(
250
);
runs
(
function
()
{
expect
(
view
.
model
.
get
(
'
scrolled
'
)).
toBeTruthy
();
converse
.
chatboxes
.
onMessage
(
$msg
({
from
:
'
lounge@localhost/someone
'
,
to
:
'
dummy@localhost.com
'
,
type
:
'
groupchat
'
,
id
:
(
new
Date
()).
getTime
(),
}).
c
(
'
body
'
).
t
(
message
).
tree
());
});
waits
(
150
);
runs
(
function
()
{
// Now check that the message appears inside the chatbox in the DOM
var
$chat_content
=
view
.
$el
.
find
(
'
.chat-content
'
);
var
msg_txt
=
$chat_content
.
find
(
'
.chat-message:last
'
).
find
(
'
.chat-msg-content
'
).
text
();
expect
(
msg_txt
).
toEqual
(
message
);
expect
(
view
.
$content
.
scrollTop
()).
toBe
(
0
);
});
});
it
(
"
shows received chatroom subject messages
"
,
function
()
{
var
text
=
'
Jabber/XMPP Development | RFCs and Extensions: http://xmpp.org/ | Protocol and XSF discussions: xsf@muc.xmpp.org
'
;
var
stanza
=
Strophe
.
xmlHtmlNode
(
...
...
@@ -461,8 +505,8 @@
}.
bind
(
converse
));
}.
bind
(
converse
));
}.
bind
(
converse
));
describe
(
"
Each chat room can take special commands
"
,
function
()
{
beforeEach
(
function
()
{
runs
(
function
()
{
...
...
src/converse-chatview.js
View file @
c738d085
...
...
@@ -99,6 +99,7 @@
show_toolbar
:
converse
.
show_toolbar
,
show_textarea
:
true
,
title
:
this
.
model
.
get
(
'
fullname
'
),
unread_msgs
:
__
(
'
You have unread messages
'
),
info_close
:
__
(
'
Close this chat box
'
),
label_personal_message
:
__
(
'
Personal message
'
)
}
...
...
@@ -333,6 +334,9 @@
if
(
converse
.
windowState
===
'
blur
'
||
this
.
model
.
get
(
'
scrolled
'
,
true
))
{
converse
.
incrementMsgCounter
();
}
if
(
this
.
model
.
get
(
'
scrolled
'
,
true
))
{
this
.
$el
.
find
(
'
.new-msgs-indicator
'
).
removeClass
(
'
hidden
'
);
}
}
else
{
// We remove the "scrolled" flag so that the chat area
// gets scrolled down. We always want to scroll down
...
...
@@ -688,15 +692,16 @@
// and the user is scrolled away...
// Should probably take a look at incrementMsgCounter
if
(
ev
&&
ev
.
preventDefault
)
{
ev
.
preventDefault
();
}
var
is_at_bottom
=
this
.
$content
.
scrollTop
()
+
this
.
$content
.
innerHeight
()
>=
this
.
$content
[
0
].
scrollHeight
;
var
is_at_bottom
=
this
.
$content
.
scrollTop
()
+
this
.
$content
.
innerHeight
()
>=
this
.
$content
[
0
].
scrollHeight
-
10
;
if
(
is_at_bottom
)
{
this
.
model
.
set
(
'
scrolled
'
,
false
);
this
.
$el
.
find
(
'
.new-msgs-indicator
'
).
addClass
(
'
hidden
'
);
}
else
{
// We're not at the bottom of the chat area, so we mark
// that the box is in a scrolled-up state.
this
.
model
.
set
(
'
scrolled
'
,
true
);
}
},
50
),
},
1
50
),
scrollDownMessageHeight
:
function
(
$message
)
{
if
(
this
.
$content
.
is
(
'
:visible
'
)
&&
!
this
.
model
.
get
(
'
scrolled
'
))
{
...
...
@@ -708,6 +713,7 @@
scrollDown
:
function
()
{
if
(
this
.
$content
.
is
(
'
:visible
'
)
&&
!
this
.
model
.
get
(
'
scrolled
'
))
{
this
.
$content
.
scrollTop
(
this
.
$content
[
0
].
scrollHeight
);
this
.
$el
.
find
(
'
.new-msgs-indicator
'
).
addClass
(
'
hidden
'
);
}
return
this
;
}
...
...
src/converse-core.js
View file @
c738d085
...
...
@@ -1577,6 +1577,9 @@
});
this
.
setUpXMLLogging
=
function
()
{
Strophe
.
log
=
function
(
level
,
msg
)
{
converse
.
log
(
msg
,
level
);
};
if
(
this
.
debug
)
{
this
.
connection
.
xmlInput
=
function
(
body
)
{
converse
.
log
(
body
.
outerHTML
);
};
this
.
connection
.
xmlOutput
=
function
(
body
)
{
converse
.
log
(
body
.
outerHTML
);
};
...
...
src/converse-dragresize.js
View file @
c738d085
...
...
@@ -27,7 +27,7 @@
// relevant objects or classes.
//
// New functions which don't exist yet can also be added.
registerGlobalEventHandlers
:
function
()
{
$
(
document
).
on
(
'
mousemove
'
,
function
(
ev
)
{
if
(
!
this
.
resizing
||
!
this
.
allow_dragresize
)
{
return
true
;
}
...
...
src/converse-headline.js
View file @
c738d085
...
...
@@ -44,7 +44,7 @@
// relevant objects or classes.
//
// New functions which don't exist yet can also be added.
ChatBoxViews
:
{
onChatBoxAdded
:
function
(
item
)
{
var
view
=
this
.
get
(
item
.
get
(
'
id
'
));
...
...
@@ -93,6 +93,7 @@
show_toolbar
:
converse
.
show_toolbar
,
show_textarea
:
false
,
title
:
this
.
model
.
get
(
'
fullname
'
),
unread_msgs
:
__
(
'
You have unread messages
'
),
info_close
:
__
(
'
Close this box
'
),
info_minimize
:
__
(
'
Minimize this box
'
),
label_personal_message
:
''
...
...
src/converse-muc.js
View file @
c738d085
...
...
@@ -216,6 +216,7 @@
this
.
$
(
'
.chatroom-body
'
).
empty
()
.
append
(
converse
.
templates
.
chatarea
({
'
unread_msgs
'
:
__
(
'
You have unread messages
'
),
'
show_toolbar
'
:
converse
.
show_toolbar
,
'
label_message
'
:
__
(
'
Message
'
)
}))
...
...
src/templates/chatarea.html
View file @
c738d085
<div
class=
"chat-area"
>
<div
class=
"chat-content"
></div>
<div
class=
"new-msgs-indicator hidden"
>
▼ {{ unread_msgs }} ▼
</div>
<form
class=
"sendXMPPMessage"
action=
""
method=
"post"
>
{[ if (show_toolbar) { ]}
<ul
class=
"chat-toolbar no-text-select"
></ul>
...
...
src/templates/chatbox.html
View file @
c738d085
...
...
@@ -17,6 +17,7 @@
</div>
<div
class=
"chat-body"
>
<div
class=
"chat-content"
></div>
<div
class=
"new-msgs-indicator hidden"
>
▼ {{ unread_msgs }} ▼
</div>
{[ if (show_textarea) { ]}
<form
class=
"sendXMPPMessage"
action=
""
method=
"post"
>
{[ if (show_toolbar) { ]}
...
...
tests/main.js
View file @
c738d085
...
...
@@ -55,7 +55,7 @@ require([
auto_login
:
true
,
jid
:
'
dummy@localhost
'
,
password
:
'
secret
'
,
debug
:
false
debug
:
true
},
function
(
converse
)
{
window
.
converse
=
converse
;
window
.
crypto
=
{
...
...
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