Skip to content
Snippets Groups Projects
Commit 84d4011d authored by florian's avatar florian
Browse files

FIX: Introduce class for already linkified properties

parent e30f3eed
No related branches found
No related tags found
2 merge requests!103Quick main-release of documentation,!94F fix linkify preview
...@@ -38,7 +38,7 @@ var cosmetics = new function () { ...@@ -38,7 +38,7 @@ var cosmetics = new function () {
var _linkify = function () { var _linkify = function () {
$('.caosdb-f-property-text-value').each(function (index) { $('.caosdb-f-property-text-value').each(function (index) {
if (/https?:\/\//.test(this.innerText)) { if (!($(this).hasClass("caosdb-v-property-linkified")) && (/https?:\/\//.test(this.innerText))) {
var result = this.innerText.replace(/https?:\/\/[^\s]*/g, function (href, index) { var result = this.innerText.replace(/https?:\/\/[^\s]*/g, function (href, index) {
var link_text = href; var link_text = href;
if (_link_cut_off_length > 4 && link_text.length > _link_cut_off_length) { if (_link_cut_off_length > 4 && link_text.length > _link_cut_off_length) {
...@@ -48,6 +48,8 @@ var cosmetics = new function () { ...@@ -48,6 +48,8 @@ var cosmetics = new function () {
return `<a title="Open ${href} in a new tab." target="_blank" class="caosdb-v-property-href-value" href="${href}">${link_text} <i class="bi bi-box-arrow-up-right"></i></a>`; return `<a title="Open ${href} in a new tab." target="_blank" class="caosdb-v-property-href-value" href="${href}">${link_text} <i class="bi bi-box-arrow-up-right"></i></a>`;
}); });
// add class to highlight that this has been linkified already.
$(this).addClass("caosdb-v-property-linkified")
$(this).hide(); $(this).hide();
$(this).after(result); $(this).after(result);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment