Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
1842d7d2
Commit
1842d7d2
authored
3 years ago
by
Andreas Traczyk
Browse files
Options
Downloads
Patches
Plain Diff
web-previews: fix js octal escape warnings
Change-Id: I3a320c8f58633a2bfb271ff513732e53a0335d5a
parent
15f94ffd
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/web-chatview/previewInfo.js
+10
-9
10 additions, 9 deletions
src/web-chatview/previewInfo.js
with
10 additions
and
9 deletions
src/web-chatview/previewInfo.js
+
10
−
9
View file @
1842d7d2
...
...
@@ -26,11 +26,11 @@ SOFTWARE.*/
* @returns the title of the given webpage
*/
function
getTitle
(
doc
){
const
og_title
=
doc
.
querySelector
(
"
meta[property=
\
"
og:title
\
"
]
"
)
const
og_title
=
doc
.
querySelector
(
'
meta[property="og:title"]
'
)
if
(
og_title
!==
null
&&
og_title
.
content
.
length
>
0
)
{
return
og_title
.
content
}
const
twitter_title
=
doc
.
querySelector
(
"
meta[name=
\
"
twitter:title
\
"
]
"
)
const
twitter_title
=
doc
.
querySelector
(
'
meta[name="twitter:title"]
'
)
if
(
twitter_title
!==
null
&&
twitter_title
.
content
.
length
>
0
)
{
return
twitter_title
.
content
}
...
...
@@ -59,22 +59,23 @@ function getTitle(doc){
* @returns a description of the webpage
*/
function
getDescription
(
doc
){
const
og_description
=
doc
.
querySelector
(
"
meta[property=
\
"
og:description
\
"
]
"
)
const
og_description
=
doc
.
querySelector
(
'
meta[property="og:description"]
'
)
if
(
og_description
!==
null
&&
og_description
.
content
.
length
>
0
)
{
return
og_description
.
content
}
const
twitter_description
=
doc
.
querySelector
(
"
meta[name=
\
"
twitter:description
\
"
]
"
)
const
twitter_description
=
doc
.
querySelector
(
'
meta[name="twitter:description"]
'
)
if
(
twitter_description
!==
null
&&
twitter_description
.
content
.
length
>
0
)
{
return
twitter_description
.
content
}
const
meta_description
=
doc
.
querySelector
(
"
meta[name=
\
"
description
\
"
]
"
)
const
meta_description
=
doc
.
querySelector
(
'
meta[name="description"]
'
)
if
(
meta_description
!==
null
&&
meta_description
.
content
.
length
>
0
)
{
return
meta_description
.
content
}
var
all_paragraphs
=
doc
.
querySelectorAll
(
"
p
"
)
let
first_visible_paragraph
=
null
for
(
var
i
=
0
;
i
<
all_paragraphs
.
length
;
i
++
)
{
if
(
all_paragraphs
[
i
].
offsetParent
!==
null
&&
!
all_paragraphs
[
i
].
childElementCount
!=
0
)
{
if
(
all_paragraphs
[
i
].
offsetParent
!==
null
&&
!
all_paragraphs
[
i
].
childElementCount
!==
0
)
{
first_visible_paragraph
=
all_paragraphs
[
i
].
textContent
break
}
...
...
@@ -88,15 +89,15 @@ function getDescription(doc){
* @returns the image representing the url or null if no such image was found
*/
function
getImage
(
doc
)
{
const
og_image
=
doc
.
querySelector
(
"
meta[property=
\
"
og:image
\
"
]
"
)
const
og_image
=
doc
.
querySelector
(
'
meta[property="og:image"]
'
)
if
(
og_image
!==
null
&&
og_image
.
content
.
length
>
0
){
return
og_image
.
content
}
const
image_rel_link
=
doc
.
querySelector
(
"
link[rel=
\
"
image_src
\
"
]
"
)
const
image_rel_link
=
doc
.
querySelector
(
'
link[rel="image_src"]
'
)
if
(
image_rel_link
!==
null
&&
image_rel_link
.
href
.
length
>
0
){
return
image_rel_link
.
href
}
const
twitter_img
=
doc
.
querySelector
(
"
meta[name=
\
"
twitter:image
\
"
]
"
)
const
twitter_img
=
doc
.
querySelector
(
'
meta[name="twitter:image"]
'
)
if
(
twitter_img
!==
null
&&
twitter_img
.
content
.
length
>
0
)
{
return
twitter_img
.
content
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment