mirror of
https://github.com/driftywinds/driftywinds.github.io.git
synced 2025-12-19 11:03:32 +00:00
Update shared.js
This commit is contained in:
@@ -103,7 +103,7 @@ function formatString(string) {
|
|||||||
const urlArray = string.match(urlRegex);
|
const urlArray = string.match(urlRegex);
|
||||||
// const urlSet = [...new Set(urlArray)]; // Converting to set to remove duplicates
|
// const urlSet = [...new Set(urlArray)]; // Converting to set to remove duplicates
|
||||||
var result = "";
|
var result = "";
|
||||||
urlArray.forEach(url => {
|
urlArray?.forEach(url => {
|
||||||
string = string.replace(url, `<a href="${url}">${url}</a>`)
|
string = string.replace(url, `<a href="${url}">${url}</a>`)
|
||||||
// Remove formatted substring so it won't get formatted again (prevents <a> tag within the href attribute another <a> tag)
|
// Remove formatted substring so it won't get formatted again (prevents <a> tag within the href attribute another <a> tag)
|
||||||
let endIndexOfClosingTag = string.indexOf("</a>") + 4;
|
let endIndexOfClosingTag = string.indexOf("</a>") + 4;
|
||||||
@@ -112,8 +112,10 @@ function formatString(string) {
|
|||||||
string = string.replace(formattedSubstring, "");
|
string = string.replace(formattedSubstring, "");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
result += string;
|
||||||
|
|
||||||
// New lines
|
// New lines
|
||||||
return result.replaceAll("\n", "<br>");;
|
return result.replaceAll("\n", "<br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTintColor(color) {
|
function setTintColor(color) {
|
||||||
|
|||||||
Reference in New Issue
Block a user