完善预览页面
This commit is contained in:
@@ -404,19 +404,23 @@
|
||||
<!-- ================= 文档预览右栏(桌面端≥960px;office/全部文档类型统一承载;移动端走全屏 #fs-viewer,本栏隐藏) -->
|
||||
<aside id="pv-pane" aria-label="文档预览">
|
||||
<header class="pv-head">
|
||||
<span class="pv-title" id="pv-title"></span>
|
||||
<span class="pv-actions">
|
||||
<button class="icon-btn hidden" id="pv-download" title="下载文件" aria-label="下载文件">
|
||||
<svg class="ic sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>
|
||||
</button>
|
||||
<!-- 地址条胶囊:路径 input(点击全选可复制) + 内嵌 刷新/新窗口,模拟浏览器地址栏 -->
|
||||
<span class="pv-addr">
|
||||
<input class="pv-title" id="pv-title" readonly aria-label="文件路径">
|
||||
<button class="icon-btn hidden" id="pv-refresh" title="重新载入" aria-label="重新载入">
|
||||
<svg class="ic sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"></polyline><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"></path></svg>
|
||||
</button>
|
||||
<button class="icon-btn hidden" id="pv-popup" title="新窗口打开" aria-label="新窗口打开">
|
||||
<svg class="ic sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>
|
||||
</button>
|
||||
</span>
|
||||
<span class="pv-actions">
|
||||
<button class="icon-btn hidden" id="pv-download" title="下载文件" aria-label="下载文件">
|
||||
<svg class="ic sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>
|
||||
</button>
|
||||
<button class="icon-btn" id="pv-max" title="放大" aria-label="放大">
|
||||
<svg class="ic sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3"></path><path d="M21 8V5a2 2 0 0 0-2-2h-3"></path><path d="M16 21h3a2 2 0 0 0 2-2v-3"></path><path d="M3 16v3a2 2 0 0 0 2 2h3"></path></svg>
|
||||
<svg class="ic sm hidden" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3v3a2 2 0 0 1-2 2H3"></path><path d="M21 8h-3a2 2 0 0 1-2-2V3"></path><path d="M3 16h3a2 2 0 0 1 2 2v3"></path><path d="M16 21v-3a2 2 0 0 1 2-2h3"></path></svg>
|
||||
</button>
|
||||
<button class="icon-btn" id="pv-close" title="关闭预览" aria-label="关闭预览">✕</button>
|
||||
</span>
|
||||
@@ -442,5 +446,25 @@
|
||||
<script src="/js/files.js"></script>
|
||||
<script src="/js/preview.js"></script>
|
||||
<script src="/js/settings.js"></script>
|
||||
<script>
|
||||
// 启动自愈:外部工具改前端文件是非原子写入,极端时机下浏览器可能拿到半截或重复拼接的 HTML
|
||||
// (脚本缺半 → 白屏裸首页;重复注入 → 每个文件报 duplicate variable 后 JS 全挂)。
|
||||
// 这里检测关键脚本数量与入口全局,不对就自动整页重载一次(sessionStorage 防循环)。
|
||||
// 注意:js/ 脚本增减时需同步改这里的期望数 7。
|
||||
(function () {
|
||||
var ok = false;
|
||||
try {
|
||||
var n = document.querySelectorAll('script[src^="/js/"]').length;
|
||||
ok = n === 7 && typeof state !== 'undefined' &&
|
||||
typeof openFilePreview === 'function' && typeof restartNow === 'function';
|
||||
} catch (_) {}
|
||||
if (ok) { try { sessionStorage.removeItem('boot-heal'); } catch (_) {} return; }
|
||||
try {
|
||||
if (sessionStorage.getItem('boot-heal')) { sessionStorage.removeItem('boot-heal'); return; }
|
||||
sessionStorage.setItem('boot-heal', '1');
|
||||
} catch (_) { return; }
|
||||
location.reload();
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user