From 764f8bb7960126a7b5646c52ce0a363a96aedd99 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Wed, 20 Jun 2018 06:23:38 +0000 Subject: [PATCH] Support for video embeds like discord --- webapp/titanembeds/static/js/embed.js | 5 +++++ webapp/titanembeds/templates/embed.html.j2 | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/webapp/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js index 44e1d8d..26bc423 100644 --- a/webapp/titanembeds/static/js/embed.js +++ b/webapp/titanembeds/static/js/embed.js @@ -1110,6 +1110,11 @@ // if ($.inArray(disembed.type, ["rich", "link", "video"]) == -1) { // continue; // } + + disembed.isVideo = false; + if (disembed.type == "video") { + disembed.isVideo = true; + } disembed.toRenderFooter = false; if (disembed.footer) { disembed.toRenderFooter = true; diff --git a/webapp/titanembeds/templates/embed.html.j2 b/webapp/titanembeds/templates/embed.html.j2 index 81391f0..228bb14 100644 --- a/webapp/titanembeds/templates/embed.html.j2 +++ b/webapp/titanembeds/templates/embed.html.j2 @@ -401,9 +401,14 @@ " target="_blank">{{title}} {{/title}} + {{^isVideo}} {{#description}}
{{description}}
{{/description}} + {{/isVideo}} + {{#isVideo}} + + {{/isVideo}} {{#fields.length}}
{{#fields}} @@ -415,11 +420,11 @@
{{/fields.length}} - {{#thumbnail}} + {{#thumbnail}}{{^isVideo}}
- {{/thumbnail}} + {{/isVideo}}{{/thumbnail}} {{#image}}