aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-03-18 17:30:57 +0300
committerGravatar Vitaly Takmazov2022-03-18 17:30:57 +0300
commit23b9f667590e996f16b979d885515d527bf18347 (patch)
tree03e36cad3af185bd6df113b36930e82031e4d2fd /src/main
parentc2db5bc9e0595e258fce78e33c2173aa0998db8e (diff)
Embed Telegram posts
Diffstat (limited to 'src/main')
-rw-r--r--src/main/assets/embed.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/assets/embed.js b/src/main/assets/embed.js
index bef6f80c..739b95f3 100644
--- a/src/main/assets/embed.js
+++ b/src/main/assets/embed.js
@@ -283,6 +283,25 @@ function getEmbeddableLinkTypes() {
return div;
}
},
+ {
+ name: 'Telegram posts',
+ id: 'embed_telegram_posts',
+ className: 'tg compact',
+ ctsDefault: true,
+ re: /https?:\/\/t\.me\/(\S+)/i,
+ makeNode: function(aNode, reResult, div) {
+ let [url, post] = reResult;
+ // innerHTML cannot insert scripts, so...
+ let script = document.createElement('script');
+ script.src = 'https://telegram.org/js/telegram-widget.js?18';
+ script.setAttribute('data-telegram-post', post);
+ script.setAttribute('data-tme-mode', 'data-tme-mode');
+ script.setAttribute('data-width', '100%');
+ script.charset = 'utf-8';
+ div.appendChild(script);
+ return div;
+ }
+ },
];
}