Skip to content

Commit

Permalink
Merge pull request #25 from twisterarmy/add-webp-support
Browse files Browse the repository at this point in the history
add webp images support
  • Loading branch information
D4708 committed Jul 11, 2021
2 parents 44d3f49 + 8c52a15 commit 9364892
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/interface_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion js/twister_formatpost.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" />'));
}
Expand Down

0 comments on commit 9364892

Please sign in to comment.