From 8c52a15d5c360f9dd7ac3f693e12d2b49127ccb2 Mon Sep 17 00:00:00 2001 From: D4708 Date: Sun, 11 Jul 2021 17:13:10 +0300 Subject: [PATCH] add webp images support --- js/interface_common.js | 2 +- js/twister_formatpost.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/interface_common.js b/js/interface_common.js index 1c3d7254..87b2a310 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -1334,7 +1334,7 @@ function _startTorrentDownloadAndPreview(torrentId, previewContainer, isMedia) { function webtorrentFilePreview(file, previewContainer, isMedia) { if (!isMedia) { // try guessing by filename extension - isMedia = /^[^?]+\.(?:jpe?g|gif|png|mp4|webm|mp3|ogg|wav|)$/i.test(file.name) + isMedia = /^[^?]+\.(?:jpe?g|gif|png|webp|mp4|webm|mp3|ogg|wav|)$/i.test(file.name) } if (isMedia) { diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index c6b96e45..a48e2350 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -885,7 +885,7 @@ function setPostImagePreview(elem, links) { if (!previewContainer.children().length) { // is there any links to images in the post? for (var i = 0; i < links.length; i++) { - if (/^[^?]+\.(?:jpe?g|gif|png)$/i.test(links[i].href)) { + if (/^[^?]+\.(?:jpe?g|gif|png|webp)$/i.test(links[i].href)) { var url = proxyURL(links[i].href); previewContainer.append($('')); }