aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
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;
+ }
+ },
];
}