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
75a94fb2
Commit
75a94fb2
authored
Jun 30, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/derek-wangpch/converse.js
into derek-wangpch-master
parents
63ad3e13
fffc0213
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
converse.js
converse.js
+2
-2
spec/chatbox.js
spec/chatbox.js
+24
-0
No files found.
converse.js
View file @
75a94fb2
...
@@ -60,6 +60,7 @@
...
@@ -60,6 +60,7 @@
if
(
this
.
length
>
0
)
{
if
(
this
.
length
>
0
)
{
this
.
each
(
function
(
i
,
obj
)
{
this
.
each
(
function
(
i
,
obj
)
{
var
text
=
$
(
obj
).
html
();
var
text
=
$
(
obj
).
html
();
text
=
text
.
replace
(
/>:
\)
/g
,
'
<span class="emoticon icon-evil"></span>
'
);
text
=
text
.
replace
(
/:
\)
/g
,
'
<span class="emoticon icon-smiley"></span>
'
);
text
=
text
.
replace
(
/:
\)
/g
,
'
<span class="emoticon icon-smiley"></span>
'
);
text
=
text
.
replace
(
/:
\-\)
/g
,
'
<span class="emoticon icon-smiley"></span>
'
);
text
=
text
.
replace
(
/:
\-\)
/g
,
'
<span class="emoticon icon-smiley"></span>
'
);
text
=
text
.
replace
(
/;
\)
/g
,
'
<span class="emoticon icon-wink"></span>
'
);
text
=
text
.
replace
(
/;
\)
/g
,
'
<span class="emoticon icon-wink"></span>
'
);
...
@@ -71,7 +72,6 @@
...
@@ -71,7 +72,6 @@
text
=
text
.
replace
(
/:p/g
,
'
<span class="emoticon icon-tongue"></span>
'
);
text
=
text
.
replace
(
/:p/g
,
'
<span class="emoticon icon-tongue"></span>
'
);
text
=
text
.
replace
(
/:
\-
p/g
,
'
<span class="emoticon icon-tongue"></span>
'
);
text
=
text
.
replace
(
/:
\-
p/g
,
'
<span class="emoticon icon-tongue"></span>
'
);
text
=
text
.
replace
(
/8
\)
/g
,
'
<span class="emoticon icon-cool"></span>
'
);
text
=
text
.
replace
(
/8
\)
/g
,
'
<span class="emoticon icon-cool"></span>
'
);
text
=
text
.
replace
(
/>:
\)
/g
,
'
<span class="emoticon icon-evil"></span>
'
);
text
=
text
.
replace
(
/:S/g
,
'
<span class="emoticon icon-confused"></span>
'
);
text
=
text
.
replace
(
/:S/g
,
'
<span class="emoticon icon-confused"></span>
'
);
text
=
text
.
replace
(
/:
\\
/g
,
'
<span class="emoticon icon-wondering"></span>
'
);
text
=
text
.
replace
(
/:
\\
/g
,
'
<span class="emoticon icon-wondering"></span>
'
);
text
=
text
.
replace
(
/:
\/
/g
,
'
<span class="emoticon icon-wondering"></span>
'
);
text
=
text
.
replace
(
/:
\/
/g
,
'
<span class="emoticon icon-wondering"></span>
'
);
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
text
=
text
.
replace
(
/:
\-
O/g
,
'
<span class="emoticon icon-shocked"></span>
'
);
text
=
text
.
replace
(
/:
\-
O/g
,
'
<span class="emoticon icon-shocked"></span>
'
);
text
=
text
.
replace
(
/
\=\-
O/g
,
'
<span class="emoticon icon-shocked"></span>
'
);
text
=
text
.
replace
(
/
\=\-
O/g
,
'
<span class="emoticon icon-shocked"></span>
'
);
text
=
text
.
replace
(
/
\(\^
.
\^\)
b/g
,
'
<span class="emoticon icon-thumbs-up"></span>
'
);
text
=
text
.
replace
(
/
\(\^
.
\^\)
b/g
,
'
<span class="emoticon icon-thumbs-up"></span>
'
);
text
=
text
.
replace
(
/
<
3/g
,
'
<span class="emoticon icon-heart"></span>
'
);
text
=
text
.
replace
(
/
<
3/g
,
'
<span class="emoticon icon-heart"></span>
'
);
$
(
obj
).
html
(
text
);
$
(
obj
).
html
(
text
);
});
});
}
}
...
...
spec/chatbox.js
View file @
75a94fb2
...
@@ -626,6 +626,30 @@
...
@@ -626,6 +626,30 @@
expect
(
msg
.
html
()).
toEqual
(
'
This message contains a hyperlink: <a target="_blank" href="http://www.opkode.com">www.opkode.com</a>
'
);
expect
(
msg
.
html
()).
toEqual
(
'
This message contains a hyperlink: <a target="_blank" href="http://www.opkode.com">www.opkode.com</a>
'
);
},
converse
));
},
converse
));
it
(
"
should display emoticons correctly
"
,
$
.
proxy
(
function
()
{
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
var
view
=
this
.
chatboxviews
.
get
(
contact_jid
);
var
messages
=
[
'
:)
'
,
'
;)
'
,
'
:D
'
,
'
:P
'
,
'
8)
'
,
'
>:)
'
,
'
:S
'
,
'
:
\\
'
,
'
>:(
'
,
'
:(
'
,
'
:O
'
,
'
(^.^)b
'
,
'
<3
'
];
var
emoticons
=
[
'
<span class="emoticon icon-smiley"></span>
'
,
'
<span class="emoticon icon-wink"></span>
'
,
'
<span class="emoticon icon-grin"></span>
'
,
'
<span class="emoticon icon-tongue"></span>
'
,
'
<span class="emoticon icon-cool"></span>
'
,
'
<span class="emoticon icon-evil"></span>
'
,
'
<span class="emoticon icon-confused"></span>
'
,
'
<span class="emoticon icon-wondering"></span>
'
,
'
<span class="emoticon icon-angry"></span>
'
,
'
<span class="emoticon icon-sad"></span>
'
,
'
<span class="emoticon icon-shocked"></span>
'
,
'
<span class="emoticon icon-thumbs-up"></span>
'
,
'
<span class="emoticon icon-heart"></span>
'
];
spyOn
(
view
,
'
sendMessage
'
).
andCallThrough
();
for
(
var
i
=
0
;
i
<
messages
.
length
;
i
++
)
{
var
message
=
messages
[
i
];
utils
.
sendMessage
(
view
,
message
);
expect
(
view
.
sendMessage
).
toHaveBeenCalled
();
var
msg
=
view
.
$el
.
find
(
'
.chat-content
'
).
find
(
'
.chat-message
'
).
last
().
find
(
'
.chat-message-content
'
);
expect
(
msg
.
html
()).
toEqual
(
emoticons
[
i
]);
}
},
converse
));
it
(
"
will have properly escaped URLs
"
,
$
.
proxy
(
function
()
{
it
(
"
will have properly escaped URLs
"
,
$
.
proxy
(
function
()
{
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
utils
.
openChatBoxFor
(
contact_jid
);
...
...
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