diff --git a/chat/ImagePreview.vue b/chat/ImagePreview.vue index 91b736f..a72a617 100644 --- a/chat/ImagePreview.vue +++ b/chat/ImagePreview.vue @@ -55,6 +55,8 @@ [url=https://imgur.com/CIKv6sA]Imgur image[/url] [url=https://imgur.com/a/nMafj]Imgur album[/url] + + [url=http://i.imgur.com/txEREOg.gifv]Imgur video[/url] */ import * as _ from 'lodash'; diff --git a/chat/image-preview-mutator.ts b/chat/image-preview-mutator.ts index 7034dae..704f3ab 100644 --- a/chat/image-preview-mutator.ts +++ b/chat/image-preview-mutator.ts @@ -261,6 +261,24 @@ export class ImagePreviewMutator { ${this.debug ? "console.log('Wrapper', el);" : ''} + if ((!img.src) && (img.tagName) && (img.tagName.toUpperCase() === 'VIDEO')) { + ${this.debug ? "console.log('Nedds a content URL', img);" : ''} + + const contentUrls = document.querySelectorAll('meta[itemprop="contentURL"]'); + + if ((contentUrls) && (contentUrls.length > 0)) { + ${this.debug ? "console.log('Found content URLs', contentUrls);" : ''} + + const cu = contentUrls[0]; + + if ((cu.attributes) && (cu.attributes.content) && (cu.attributes.content.value)) { + ${this.debug ? "console.log('Content URL', cu.attributes.content.value);" : ''} + + img.src = cu.attributes.content.value; + } + } + } + document.addEventListener('DOMContentLoaded', (event) => { ${this.debug ? "console.log('on DOMContentLoaded');" : ''}