Lines 629-638
Link Here
|
629 |
let nodes = ''; |
629 |
let nodes = ''; |
630 |
if ( row.uri.split(' \| ').length > 1 ) { |
630 |
if ( row.uri.split(' \| ').length > 1 ) { |
631 |
row.uri.split(' \| ').forEach((uri, i) => { |
631 |
row.uri.split(' \| ').forEach((uri, i) => { |
632 |
nodes += '<a href="%s">%s</a><br/>'.format(escape_str(uri), escape_str(uri)); |
632 |
let node = safe_link(uri,uri); |
|
|
633 |
nodes += node.outerHTML + "<br>"; |
633 |
}); |
634 |
}); |
634 |
} else { |
635 |
} else { |
635 |
nodes += '<a href="%s">%s</a><br/>'.format(escape_str(row.uri), escape_str(url_link_text)); |
636 |
let node = safe_link(row.uri,url_link_text); |
|
|
637 |
nodes += node.outerHTML; |
636 |
} |
638 |
} |
637 |
return nodes; |
639 |
return nodes; |
638 |
} |
640 |
} |
Lines 846-850
Link Here
|
846 |
|
848 |
|
847 |
return items_table; |
849 |
return items_table; |
848 |
} |
850 |
} |
|
|
851 |
function safe_link(uri,link_text) { |
852 |
let node = document.createElement('a'); |
853 |
let url_str = '#'; |
854 |
try { |
855 |
const safe_url = new URL(uri); |
856 |
url_str = safe_url.href; |
857 |
} catch (e) { |
858 |
//console.error('Invalid URL:', e); |
859 |
} |
860 |
node.setAttribute('href',url_str); |
861 |
node.textContent = link_text; |
862 |
return node; |
863 |
} |
849 |
</script> |
864 |
</script> |
850 |
[% END %] |
865 |
[% END %] |
851 |
- |
|
|