display link if location is url
This commit is contained in:
parent
de0032d639
commit
1392e94f62
|
@ -76,7 +76,16 @@ function zerocalcareDisplay(xhr) {
|
||||||
let locationElement = document.createElement('div');
|
let locationElement = document.createElement('div');
|
||||||
let locationText = document.createElement('span');
|
let locationText = document.createElement('span');
|
||||||
if (json_obj[i]['LOCATION'] !== undefined && json_obj[i]['LOCATION'] != '') {
|
if (json_obj[i]['LOCATION'] !== undefined && json_obj[i]['LOCATION'] != '') {
|
||||||
locationText.appendChild(document.createTextNode(decodeURI(json_obj[i]['LOCATION'])));
|
let text = decodeURI(json_obj[i]['LOCATION']);
|
||||||
|
let textNode = document.createTextNode(text);
|
||||||
|
if (text.match("^(http|https):\\/\\/.*$")) {
|
||||||
|
let anchorElement = document.createElement('a');
|
||||||
|
anchorElement.href = text;
|
||||||
|
anchorElement.appendChild(textNode);
|
||||||
|
locationText.appendChild(anchorElement);
|
||||||
|
} else {
|
||||||
|
locationText.appendChild(textNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
locationText.appendChild(document.createTextNode('Officina Informatica'));
|
locationText.appendChild(document.createTextNode('Officina Informatica'));
|
||||||
|
|
Loading…
Reference in New Issue