mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-11 15:37:55 +00:00
add webp images support
This commit is contained in:
parent
6f6bac4a22
commit
8c52a15d5c
@ -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) {
|
||||
|
@ -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($('<img src="' + url + '" class="image-preview" />'));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user