From 91dc2d1b42d8208f257947b9379a37d4df514747 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 30 May 2022 14:52:00 +0000 Subject: [PATCH] Media: Add support for WebP images in the Thickbox library. This ensures that `.webp` images are properly recognized and displayed in the modal as expected. Follow-up to [50810], [51227], [52073]. Props ilunabar, graham73may, sabernhardt, mukesh27, SergeyBiryukov. Fixes #55786. git-svn-id: https://develop.svn.wordpress.org/trunk@53451 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/vendor/thickbox/thickbox.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/vendor/thickbox/thickbox.js b/src/js/_enqueues/vendor/thickbox/thickbox.js index 62ffb4b941..5470467a1e 100644 --- a/src/js/_enqueues/vendor/thickbox/thickbox.js +++ b/src/js/_enqueues/vendor/thickbox/thickbox.js @@ -76,10 +76,16 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic baseURL = url; } - var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/; + var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$|\.webp$/; var urlType = baseURL.toLowerCase().match(urlString); - if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images + if(urlType == '.jpg' || + urlType == '.jpeg' || + urlType == '.png' || + urlType == '.gif' || + urlType == '.bmp' || + urlType == '.webp' + ){//code to show images TB_PrevCaption = ""; TB_PrevURL = "";