Commit b638a6e1 authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[fix] Fixed primary topic detection in data.bnf.fr

parent b65161238ebf
......@@ -562,7 +562,7 @@ export function observeContent(
])
);
let observations: ResourceObservedData = {
primaryTopic: primary == null ? observable.url : primary,
primaryTopic: primary == null ? "" : primary,
url: observable.url,
sources: [source]
};
......@@ -589,8 +589,7 @@ export function observeContent(
}
let sources = detectDataOnLinks(links);
let observations: ResourceObservedData = {
primaryTopic:
primary == null || primary == undefined ? observable.url : primary,
primaryTopic: primary == null || primary == undefined ? "" : primary,
url: observable.url,
sources: sources
};
......@@ -699,6 +698,11 @@ export function selectPrimaryTopic(resource: ResourceData): string {
resource.command.selectedTopic == null ||
resource.command.selectedTopic == ""
) {
if (
resource.observations.primaryTopic == null ||
resource.observations.primaryTopic.length == 0
)
return resource.observations.url;
return resource.observations.primaryTopic;
} else {
return resource.command.selectedTopic;
......
......@@ -295,7 +295,7 @@ function onRequestNavigateTo(uri: string) {
function onNavigatedTo(resource: ResourceData): void {
history.pushState(
{ resource: resource },
resource.observations.primaryTopic,
selectPrimaryTopic(resource),
chrome.extension.getURL("ldbrowser/index.html?target=") +
encodeURIComponent(resource.observations.url)
);
......@@ -346,9 +346,7 @@ function onReachedResource(resource: ResourceData): void {
* When a resource has been suggested by the rendered view for expansion
* @param uri The URI of the resource
*/
function onSuggestedResource(uri: string): void {
}
function onSuggestedResource(uri: string): void {}
/**
* Creates a new rendering context
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment