Imgur fix

This commit is contained in:
Mr. Stallion 2019-12-07 07:58:11 -06:00
parent 6ce52820a1
commit 10ce9a83c8
2 changed files with 20 additions and 0 deletions

View File

@ -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';

View File

@ -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');" : ''}