ui: Replace anchors title if looks like an URI

Fix #1567
This commit is contained in:
Cédric Bellegarde 2023-10-14 18:39:05 +02:00 committed by Niels De Graef
parent 4c442f6253
commit 4141953cee

View file

@ -59,6 +59,7 @@ ConversationPageState.prototype = {
this.updateDirection();
this.createControllableQuotes();
this.wrapSignature();
this.deceptiveLinksTitle();
PageState.prototype.loaded.apply(this, []);
},
/**
@ -151,6 +152,15 @@ ConversationPageState.prototype = {
}
}
},
deceptiveLinksTitle: function() {
let pattern = /^((http|https|ftp):\/\/)/;
let anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++) {
if(pattern.test(anchors[i].title)) {
anchors[i].title = anchors[i].href;
}
}
},
/**
* Look for and wrap a signature.
*