mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-30 01:27:26 +08:00
1 parent
ec2602746c
commit
eedfa72721
3 files changed
+14
-32
No files matched your search
@@ -706,14 +706,6 @@
|
||||
</section>
|
||||
|
||||
<aside class="meta-panel">
|
||||
<section id="appPanel" class="app-panel" hidden>
|
||||
<div class="panel-row">
|
||||
<div id="appPanelTitle" class="panel-title compact">应用</div>
|
||||
<div class="panel-actions">
|
||||
<span id="offlineStatus" class="app-status">准备中</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="panel-row">
|
||||
<div class="panel-title compact">文档</div>
|
||||
<div class="panel-actions">
|
||||
|
||||
+14
-17
@@ -458,6 +458,7 @@ a:focus-visible {
|
||||
}
|
||||
|
||||
.app-update {
|
||||
order: 2;
|
||||
flex: 0 0 auto;
|
||||
align-self: center;
|
||||
margin: 0 10px 0 0;
|
||||
@@ -473,6 +474,17 @@ a:focus-visible {
|
||||
background: #f2faf7;
|
||||
}
|
||||
|
||||
.toolbar-frame:has(.app-update:not([hidden]))::before {
|
||||
order: 1;
|
||||
flex: 0 0 1px;
|
||||
align-self: center;
|
||||
width: 1px;
|
||||
height: 22px;
|
||||
margin: 0 12px 0 2px;
|
||||
background: var(--line);
|
||||
content: "";
|
||||
}
|
||||
|
||||
.app-update[hidden] {
|
||||
display: none;
|
||||
}
|
||||
@@ -2297,22 +2309,6 @@ body[data-hide-meta] .meta-panel {
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.app-panel {
|
||||
margin-bottom: 12px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.app-panel .panel-row {
|
||||
margin-bottom: 0;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.app-status {
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.navigation-tabs {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
@@ -4156,7 +4152,8 @@ audio.page-media {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.tool-group + .tool-group::before {
|
||||
.tool-group + .tool-group::before,
|
||||
.toolbar-frame:has(.app-update:not([hidden]))::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -522,10 +522,8 @@ const el = {
|
||||
searchNext: document.querySelector("#searchNext"),
|
||||
searchResults: document.querySelector("#searchResults"),
|
||||
metaPanel: document.querySelector(".meta-panel"),
|
||||
appPanel: document.querySelector("#appPanel"),
|
||||
renderVectorButton: document.querySelector("#renderVectorButton"),
|
||||
renderRasterButton: document.querySelector("#renderRasterButton"),
|
||||
offlineStatus: document.querySelector("#offlineStatus"),
|
||||
refreshAppButton: document.querySelector("#refreshAppButton"),
|
||||
metaFile: document.querySelector("#metaFile"),
|
||||
metaTitle: document.querySelector("#metaTitle"),
|
||||
@@ -4164,14 +4162,11 @@ async function registerOffline() {
|
||||
|
||||
async function prepareOffline() {
|
||||
if (nativeHost) {
|
||||
el.appPanel.hidden = false;
|
||||
el.offlineStatus.textContent = "可离线";
|
||||
return true;
|
||||
}
|
||||
if (!window.isSecureContext || !("serviceWorker" in navigator) || !("caches" in window) || !("locks" in navigator)) {
|
||||
return true;
|
||||
}
|
||||
el.appPanel.hidden = false;
|
||||
setProgress("正在准备离线", null, "正在准备离线");
|
||||
try {
|
||||
const registration = await registerOffline();
|
||||
@@ -4183,10 +4178,8 @@ async function prepareOffline() {
|
||||
if (navigator.storage?.persist) {
|
||||
navigator.storage.persist().catch(() => false);
|
||||
}
|
||||
el.offlineStatus.textContent = "可离线";
|
||||
watchApplicationUpdates(result.checksum);
|
||||
} catch {
|
||||
el.offlineStatus.textContent = "未就绪";
|
||||
}
|
||||
el.refreshAppButton.disabled = false;
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user