diff --git a/index.php b/index.php index eb277f9..6edb979 100644 --- a/index.php +++ b/index.php @@ -143,6 +143,13 @@ function outputWatermarked(string $path, string $mime): never .stack{display:grid;gap:12px;grid-template-columns:1fr} .cmt{border-top:1px solid #eee;padding:8px 0} .muted{color:#6b7280;font-size:13px} + .img-box{position:relative;display:block;background:#f3f4f6} + .img-box::before{content:'';position:absolute;left:50%;top:50%;width:28px;height:28px;margin:-14px 0 0 -14px;border:3px solid #cbd5e1;border-top-color:#1f6feb;border-radius:50%;opacity:0;pointer-events:none} + .img-box.is-loading::before{opacity:1;animation:spin .75s linear infinite} + .img-box.is-loading img{opacity:.38} + .img-box img{transition:opacity .2s ease} + .thumb-img-box{height:130px} + @keyframes spin{to{transform:rotate(360deg)}} .sidebar-head{display:flex;align-items:center;justify-content:space-between;gap:10px} .sidebar-head h3{margin:0} .sidebar-toggle{display:none} @@ -200,8 +207,8 @@ function outputWatermarked(string $path, string $mime): never

-
До обработки
-
После обработки (watermark)
+
До обработки
+
После обработки (watermark)

Комментарии

@@ -232,7 +239,7 @@ function outputWatermarked(string $path, string $mime): never
- +
AI

@@ -254,6 +261,24 @@ function outputWatermarked(string $path, string $mime): never img.addEventListener('contextmenu', (e) => e.preventDefault()); img.addEventListener('dragstart', (e) => e.preventDefault()); }); + + document.querySelectorAll('.js-public-image').forEach((img) => { + const box = img.closest('.img-box'); + if (!box) { + return; + } + + const clearLoading = () => { + box.classList.remove('is-loading'); + }; + + img.addEventListener('load', clearLoading, { once: true }); + img.addEventListener('error', clearLoading, { once: true }); + + if (img.complete) { + clearLoading(); + } + }); })(); (() => {