persist webp test result

This commit is contained in:
ed 2021-10-24 00:23:51 +02:00
parent ed8fff8c52
commit 71b478e6e2

View file

@ -268,14 +268,19 @@ function goto(dest) {
} }
var have_webp = null; var have_webp = sread('have_webp');
(function () { (function () {
if (have_webp !== null)
return;
var img = new Image(); var img = new Image();
img.onload = function () { img.onload = function () {
have_webp = img.width > 0 && img.height > 0; have_webp = img.width > 0 && img.height > 0;
swrite('have_webp', 'ya');
}; };
img.onerror = function () { img.onerror = function () {
have_webp = false; have_webp = false;
swrite('have_webp', '');
}; };
img.src = "data:image/webp;base64,UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA=="; img.src = "data:image/webp;base64,UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==";
})(); })();