From f831d4fa94bee160f7dbc72806a06d7d8818fa3f Mon Sep 17 00:00:00 2001 From: Valeria Fadeeva Date: Thu, 4 Jan 2024 23:42:45 +0500 Subject: [PATCH] Update --- public/assets/js/mastodon.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/public/assets/js/mastodon.js b/public/assets/js/mastodon.js index 546f1ce..594d505 100644 --- a/public/assets/js/mastodon.js +++ b/public/assets/js/mastodon.js @@ -28,6 +28,26 @@ async function fetchData(log, tpl) { } if(key == "content") { + let text = value; + + let youtube_frame_arr = []; + let spl_arr = text.split('"'); + let youtube_link_start = 'https://www.youtube.com/watch?v='; + + for (i = 0; i < spl_arr.length; i++) { + if (spl_arr[i].indexOf(youtube_link_start) === 0) { + let id = spl_arr[i].replace(youtube_link_start, ''); + let text_frame = ``; + youtube_frame_arr.push(text_frame); + } + } + + youtube_frame_arr.forEach(function(elem) { + text += elem; + }); + + value = text; + post_tpl = post_tpl.replace('{content}', `${value}`); }