changement du fonctionnement des depêches, retours a la ligne
This commit is contained in:
parent
650cd6eab2
commit
624b21554c
|
|
@ -93,11 +93,21 @@ function chargerAlbums() {
|
|||
async function chargerDepeches() {
|
||||
const feed = document.getElementById('feed');
|
||||
|
||||
function escapeHtml(str) {
|
||||
return str
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
}
|
||||
|
||||
async function parseTexte(texte) {
|
||||
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
||||
const urls = texte.match(urlRegex) || [];
|
||||
let html = texte.replace(urlRegex, '___URL___');
|
||||
|
||||
// échappe le HTML et convertit les retours à la ligne
|
||||
html = escapeHtml(html).replace(/\n/g, '<br>');
|
||||
|
||||
const embeds = await Promise.all(urls.map(async url => {
|
||||
if (url.includes('soundcloud.com')) {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue