diff options
author | Vitaly Takmazov | 2024-10-25 05:01:33 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2024-10-25 05:01:33 +0300 |
commit | 2ea1de77ab4851f8024c546d9f14bb84d47a1d3e (patch) | |
tree | 2adf53b9ec1f0d9bdf8f25f072ad15497b4197be /vnext | |
parent | e9464b8a10eb57d9b021251ff97bcbd9c53a1e98 (diff) |
embed: Tiktok videos
Diffstat (limited to 'vnext')
-rw-r--r-- | vnext/src/utils/embed.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/vnext/src/utils/embed.js b/vnext/src/utils/embed.js index d020dbc2..6a5c9c95 100644 --- a/vnext/src/utils/embed.js +++ b/vnext/src/utils/embed.js @@ -314,6 +314,24 @@ function getEmbeddableLinkTypes() { return div } }, + { + name: 'Tiktok', + id: 'embed_tiktok', + className: 'tiktok compact', + re: /https?:\/\/www\.?tiktok\.com\/(\S+)/i, + makeNode: function(aNode, reResult, div) { + const tiktok_url = reResult[0] + fetch('https://www.tiktok.com/oembed?url=' + tiktok_url) + .then(response => response.json()) + .then(json => { + div.innerHTML = json.html + let script = document.createElement('script') + script.src = 'https://www.tiktok.com/embed.js' + div.appendChild(script) + }).catch(console.log) + return div + } + }, ] } |