From 71b478e6e2c7f8ab34a5cd705d1d2ce16aac84d0 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 24 Oct 2021 00:23:51 +0200 Subject: [PATCH] persist webp test result --- copyparty/web/browser.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 597b19a3..f835ea5a 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -268,14 +268,19 @@ function goto(dest) { } -var have_webp = null; +var have_webp = sread('have_webp'); (function () { + if (have_webp !== null) + return; + var img = new Image(); img.onload = function () { have_webp = img.width > 0 && img.height > 0; + swrite('have_webp', 'ya'); }; img.onerror = function () { have_webp = false; + swrite('have_webp', ''); }; img.src = "data:image/webp;base64,UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA=="; })();