fix for reference error (#5080)

This commit is contained in:
gabryon99 2021-03-08 16:18:42 +01:00
parent 315f9b6dcd
commit c81c96416a

View file

@ -46,14 +46,23 @@ export default {
},
onClick: function(e) {
let url;
const element = this.getElementAtEvent(e);
const httpPrefix = http_prefix || location.origin;
// if you click on at least 1 element ...
if (element.length > 0) {
const dataset = this.config.data.datasets[element[0]._datasetIndex];
const data = dataset.data[element[0]._index];
window.location.href = new URL(dataset.baseUrl + data.link, httpPrefix).toString(); // Jump to this host
if (typeof http_prefix === "undefined") {
url = new URL(dataset.baseUrl + data.link, location.origin).toString();
}
else {
url = http_prefix + dataset.baseUrl + data.link;
}
window.location.href = url;
}
},
}