Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
SemWeb
libview
Commits
069d3bd786ae
Commit
8f50729c
authored
Nov 14, 2018
by
Laurent Wouters
Browse files
[fix] Fixed linting issues with ldbrowser
parent
d7f89b38fa5c
Changes
4
Hide whitespace changes
Inline
Side-by-side
extension/src/background/main.ts
View file @
069d3bd7
...
...
@@ -308,9 +308,9 @@ chrome.runtime.onMessage.addListener(
allObservations
,
sender
.
tab
.
id
);
if
(
observation
.
primaryTopic
===
""
)
{
if
(
observation
.
primaryTopic
.
length
===
0
)
{
let
topic
=
detectTopicOnlinks
(
request
.
payload
);
observation
.
primaryTopic
=
topic
!==
null
?
topic
:
""
;
observation
.
primaryTopic
=
topic
;
}
observation
.
sources
=
observation
.
sources
.
concat
(
detectDataOnLinks
(
request
.
payload
,
{
...
...
extension/src/common/config/CurrentTabCompliance.tsx
View file @
069d3bd7
...
...
@@ -65,7 +65,7 @@ export class CurrentTabCompliance extends React.Component<
<
div
className
=
"card-header"
>
Source from redirection
</
div
>
<
div
className
=
"card-body"
>
The source of data at
<
a
href
=
{
w
.
source
.
url
}
>
{
w
.
source
.
url
}
</
a
>
has
been found through a rediction.
been found through a redi
re
ction.
</
div
>
</
div
>
);
...
...
extension/src/common/data.ts
View file @
069d3bd7
...
...
@@ -154,13 +154,11 @@ export function parseLinks(content: string): Link[] {
* Detects the primary topic in the links
* @param links The links in the header
*/
export
function
detectTopicOnlinks
(
links
:
Link
[]):
string
|
null
{
return
links
.
filter
((
link
:
Link
)
=>
refersToPrimaryTopic
(
link
))
.
reduce
(
(
acc
:
string
|
null
,
link
:
Link
)
=>
(
acc
!==
null
?
acc
:
link
.
url
),
null
);
export
function
detectTopicOnlinks
(
links
:
Link
[]):
string
{
for
(
let
i
=
0
;
i
!==
links
.
length
;
i
++
)
{
if
(
refersToPrimaryTopic
(
links
[
i
]))
return
links
[
i
].
url
;
}
return
""
;
}
/**
...
...
@@ -186,11 +184,11 @@ export function detectDataOnLinks(
export
function
findLinksInDocument
(
document
:
HTMLDocument
,
url
:
string
,
primaryTopic
:
string
|
null
primaryTopic
:
string
):
Link
[]
{
let
links
:
Link
[]
=
[];
let
resource
=
primaryTopic
;
if
(
resource
===
null
)
{
if
(
resource
.
length
===
0
)
{
resource
=
url
;
}
...
...
@@ -707,7 +705,7 @@ export function observeContent(
);
let
observations
:
DocumentObservations
=
{
origin
:
origin
,
primaryTopic
:
primary
===
null
?
""
:
primary
,
primaryTopic
:
primary
,
url
:
observable
.
url
,
sources
:
[
source
],
preemptable
:
true
,
...
...
@@ -732,7 +730,7 @@ export function observeContent(
);
let
otherLinks
=
findLinksInDocument
(
doc
,
observable
.
url
,
primary
);
links
=
links
.
concat
(
otherLinks
);
if
(
primary
===
null
||
primary
===
""
)
{
if
(
primary
.
length
===
0
)
{
primary
=
detectTopicOnlinks
(
links
);
}
}
...
...
@@ -745,7 +743,7 @@ export function observeContent(
);
let
observations
:
DocumentObservations
=
{
origin
:
origin
,
primaryTopic
:
primary
===
null
?
""
:
primary
,
primaryTopic
:
primary
,
url
:
observable
.
url
,
sources
:
sources
,
preemptable
:
MIME
.
hasOwnProperty
(
observable
.
contentType
),
...
...
libview/src/rdf-meta.ts
View file @
069d3bd7
...
...
@@ -183,7 +183,7 @@ export class MetaPropertyData implements MetaProperty {
return
{
literal
:
literal
,
rank
:
l
}
as
RankedLiteral
;
}
}
if
(
literal
.
lang
===
""
)
{
if
(
literal
.
lang
.
length
===
0
)
{
// lang-tag is not defined, has more priority than other tagged literals that do not match (considered as a default)
return
{
literal
:
literal
,
...
...
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