From 39af6579053cfc8d63a1b82720893c7b5aef5972 Mon Sep 17 00:00:00 2001 From: Furrium Network Date: Mon, 10 Aug 2026 11:08:08 +0800 Subject: [PATCH] Update app.js --- js/app.js | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/js/app.js b/js/app.js index 7c00eb2..d7b8bef 100644 --- a/js/app.js +++ b/js/app.js @@ -901,6 +901,57 @@ function showRecoveryCodesModal(codes) { }); } +// ============================================================ +// 🖼️ 图片查看器 +// ============================================================ + +function openImageViewer(imageUrl) { + const existing = document.getElementById('imageViewerModal'); + if (existing) existing.remove(); + + const modal = document.createElement('div'); + modal.id = 'imageViewerModal'; + modal.style.cssText = ` + position:fixed;inset:0;background:rgba(0,0,0,0.85);z-index:9999; + display:flex;align-items:center;justify-content:center; + cursor:pointer;animation:fadeIn 0.2s ease-out; + `; + + const img = document.createElement('img'); + img.src = imageUrl; + img.style.cssText = ` + max-width:90vw;max-height:90vh;object-fit:contain; + border-radius:8px;box-shadow:0 8px 32px rgba(0,0,0,0.5); + cursor:default;user-select:none; + `; + + modal.addEventListener('click', function(e) { + if (e.target === this) { + this.remove(); + } + }); + + modal.addEventListener('keydown', function(e) { + if (e.key === 'Escape') this.remove(); + }); + + modal.appendChild(img); + document.body.appendChild(modal); + modal.focus(); +} + +// 添加淡入动画 +(function() { + const style = document.createElement('style'); + style.textContent = ` + @keyframes fadeIn { + from { opacity: 0; transform: scale(0.95); } + to { opacity: 1; transform: scale(1); } + } + `; + document.head.appendChild(style); +})(); + // ============================================================ // 🚀 初始化 // ============================================================