mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-04-09 04:18:17 +02:00
fix for rendering images without new line
This commit is contained in:
parent
81de3a4cd2
commit
bdf389929b
@ -10,9 +10,9 @@ const Regex_Nip05_Str= "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^
|
||||
const StringUtil = {
|
||||
isValidUrl: (str: string): boolean => new RegExp(Regex_Url_Str, "i").test(str),
|
||||
parseHyperlinks: (str: string): string => str.replace(new RegExp(Regex_Urlw_Str, "gim"), "<a class='purple' target=\"_blank\" rel=\"noreferrer\" href=\"$&\">$&</a>").replace(new RegExp(Regex_Nip05_Str, "gim"), "<a class='purple' target=\"_blank\" rel=\"noreferrer\" href=\"https://njump.me/$&\">$&</a> "),
|
||||
parseImages: (str: string): string => str.toLowerCase().includes('nsfw') || str.toLowerCase().includes('lingerie') || str.toLowerCase().includes('sex') || str.toLowerCase().includes('porn') ? str.replace(new RegExp(Regex_Url_Img, "gim"), "<details><summary class=\"collapse-title \"><div class=\"btn\">NSFW Show/Hide Results</div></summary><img src='$&'/></div></details> ").replace(new RegExp(Regex_Url_Video, "gim"), "<details><summary class=\"collapse-title \"><div class=\"btn\">NSFW Show/Hide Results</div><video controls muted autoplay src=\"$&\"></video></summary></details>").replace(new RegExp(Regex_Url_Str, "gim"), "<a class='purple' target=\"_blank\" rel=\"noreferrer\" href=\"$&\">$&</a> ") : str.replace(new RegExp(Regex_Url_Img, "gim"), "<img src='$&'/> ").replace(new RegExp(Regex_Url_Video, "gim"), "<video controls muted autoplay src=\"$&\"></video> ").replace(new RegExp(Regex_Url_Str, "gim"), "<a class='purple' target=\"_blank\" rel=\"noreferrer\" href=\"$&\">$&</a> "),
|
||||
parseImages: (str: string): string => str.toLowerCase().includes('nsfw') || str.toLowerCase().includes('lingerie') || str.toLowerCase().includes('sex') || str.toLowerCase().includes('porn') ? str.replace(" http", "\nhttp").replace(new RegExp(Regex_Url_Img, "gim"), "<details><summary class=\"collapse-title \"><div class=\"btn\">NSFW Show/Hide Results</div></summary><img src='$&'/></div></details> ").replace(new RegExp(Regex_Url_Video, "gim"), "<details><summary class=\"collapse-title \"><div class=\"btn\">NSFW Show/Hide Results</div><video controls muted autoplay src=\"$&\"></video></summary></details>").replace(new RegExp(Regex_Url_Str, "gim"), "<a class='purple' target=\"_blank\" rel=\"noreferrer\" href=\"$&\">$&</a> ") : str.replace(" http", "\nhttp").replace(new RegExp(Regex_Url_Img, "gim"), "<img src='$&'/> ").replace(new RegExp(Regex_Url_Video, "gim"), "<video controls muted autoplay src=\"$&\"></video> ").replace(new RegExp(Regex_Url_Str, "gim"), "<a class='purple' target=\"_blank\" rel=\"noreferrer\" href=\"$&\">$&</a> "),
|
||||
|
||||
//parseImages: (str: string): string => str.replace("\n", " ").replace(new RegExp(Regex_Url_Img, "gim"), "<img src='$&'/> ")
|
||||
//parseImages: (str: string): string => str.replace(" http", "<br>http") //.replace("\n", " ").replace(new RegExp(Regex_Url_Img, "gim"), "<img src='$&'/> ")
|
||||
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user