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
158f3f00
Commit
158f3f00
authored
Jan 09, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils/html: expose more methods
parent
ef1f16c1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
src/utils/html.js
src/utils/html.js
+7
-7
No files found.
src/utils/html.js
View file @
158f3f00
...
@@ -94,9 +94,9 @@ function checkFileTypes (types, url) {
...
@@ -94,9 +94,9 @@ function checkFileTypes (types, url) {
return
!!
types
.
filter
(
ext
=>
filename
.
endsWith
(
ext
)).
length
;
return
!!
types
.
filter
(
ext
=>
filename
.
endsWith
(
ext
)).
length
;
}
}
const
isAudioURL
=
url
=>
checkFileTypes
([
'
.ogg
'
,
'
.mp3
'
,
'
.m4a
'
],
url
);
u
.
isAudioURL
=
url
=>
checkFileTypes
([
'
.ogg
'
,
'
.mp3
'
,
'
.m4a
'
],
url
);
const
isImageURL
=
url
=>
checkFileTypes
([
'
.jpg
'
,
'
.jpeg
'
,
'
.png
'
,
'
.gif
'
,
'
.bmp
'
,
'
.tiff
'
,
'
.svg
'
],
url
);
u
.
isImageURL
=
url
=>
checkFileTypes
([
'
.jpg
'
,
'
.jpeg
'
,
'
.png
'
,
'
.gif
'
,
'
.bmp
'
,
'
.tiff
'
,
'
.svg
'
],
url
);
const
isVideoURL
=
url
=>
checkFileTypes
([
'
.mp4
'
,
'
.webm
'
],
url
);
u
.
isVideoURL
=
url
=>
checkFileTypes
([
'
.mp4
'
,
'
.webm
'
],
url
);
function
getFileName
(
uri
)
{
function
getFileName
(
uri
)
{
try
{
try
{
...
@@ -146,11 +146,11 @@ u.getOOBURLMarkup = function (_converse, url) {
...
@@ -146,11 +146,11 @@ u.getOOBURLMarkup = function (_converse, url) {
if
(
uri
===
null
)
{
if
(
uri
===
null
)
{
return
url
;
return
url
;
}
}
if
(
isVideoURL
(
uri
))
{
if
(
u
.
isVideoURL
(
uri
))
{
return
tpl_video
({
url
})
return
tpl_video
({
url
})
}
else
if
(
isAudioURL
(
uri
))
{
}
else
if
(
u
.
isAudioURL
(
uri
))
{
return
renderAudioURL
(
_converse
,
uri
);
return
renderAudioURL
(
_converse
,
uri
);
}
else
if
(
isImageURL
(
uri
))
{
}
else
if
(
u
.
isImageURL
(
uri
))
{
return
renderImageURL
(
_converse
,
uri
);
return
renderImageURL
(
_converse
,
uri
);
}
else
{
}
else
{
return
renderFileURL
(
_converse
,
uri
);
return
renderFileURL
(
_converse
,
uri
);
...
@@ -197,7 +197,7 @@ u.renderImageURLs = function (_converse, el) {
...
@@ -197,7 +197,7 @@ u.renderImageURLs = function (_converse, el) {
return
Promise
.
all
(
return
Promise
.
all
(
list
.
map
(
url
=>
list
.
map
(
url
=>
new
Promise
((
resolve
)
=>
{
new
Promise
((
resolve
)
=>
{
if
(
isImageURL
(
url
))
{
if
(
u
.
isImageURL
(
url
))
{
return
isImage
(
url
).
then
(
img
=>
{
return
isImage
(
url
).
then
(
img
=>
{
const
i
=
new
Image
();
const
i
=
new
Image
();
i
.
src
=
img
.
src
;
i
.
src
=
img
.
src
;
...
...
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