中控页面去掉安装到桌面按钮,改由浏览器地址栏安装。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+1
-39
@@ -169,16 +169,11 @@ a:hover { color: #7dd3fc; }
|
||||
.nav-spot--flat .nav-spot-last,
|
||||
.nav-spot--flat .nav-spot-chg,
|
||||
.nav-spot--flat .nav-spot-pct { color: #9aa3bf; }
|
||||
.topbar-actions {
|
||||
.topbar-logout {
|
||||
position: fixed;
|
||||
top: 16px;
|
||||
right: 22px;
|
||||
z-index: 20;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.topbar-logout {
|
||||
color: var(--muted);
|
||||
font-size: 0.82rem;
|
||||
letter-spacing: 0.04em;
|
||||
@@ -186,39 +181,6 @@ a:hover { color: #7dd3fc; }
|
||||
.topbar-logout:hover {
|
||||
color: #e8f1ff;
|
||||
}
|
||||
.topbar-install {
|
||||
appearance: none;
|
||||
border: 1px solid #304164;
|
||||
background: #151a2a;
|
||||
color: #dbe4ff;
|
||||
font-size: 0.78rem;
|
||||
border-radius: 8px;
|
||||
padding: 4px 10px;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
}
|
||||
.topbar-install:hover {
|
||||
color: #ffffff;
|
||||
border-color: #3d5278;
|
||||
}
|
||||
.topbar-install-hint {
|
||||
position: fixed;
|
||||
top: 46px;
|
||||
right: 22px;
|
||||
z-index: 20;
|
||||
margin: 0;
|
||||
max-width: min(360px, calc(100vw - 40px));
|
||||
color: var(--muted);
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.4;
|
||||
text-align: right;
|
||||
}
|
||||
@media (display-mode: standalone) {
|
||||
.topbar-install,
|
||||
.topbar-install-hint {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
@media (max-width: 1100px) {
|
||||
.topbar-row {
|
||||
grid-template-columns: 1fr;
|
||||
|
||||
+2
-84
@@ -1,89 +1,7 @@
|
||||
(function (global) {
|
||||
var deferredPrompt = null;
|
||||
|
||||
function isStandalone() {
|
||||
return (
|
||||
(global.matchMedia && global.matchMedia("(display-mode: standalone)").matches) ||
|
||||
global.navigator.standalone === true
|
||||
);
|
||||
}
|
||||
|
||||
function btn() {
|
||||
return document.getElementById("hub-install-btn");
|
||||
}
|
||||
|
||||
function setHint(msg) {
|
||||
var el = document.getElementById("hub-install-hint");
|
||||
if (el) el.textContent = msg || "";
|
||||
}
|
||||
|
||||
function showInstall() {
|
||||
var el = btn();
|
||||
if (!el || isStandalone()) return;
|
||||
el.hidden = false;
|
||||
}
|
||||
|
||||
function hideInstall() {
|
||||
var el = btn();
|
||||
if (el) el.hidden = true;
|
||||
setHint("");
|
||||
}
|
||||
|
||||
function downloadShortcut() {
|
||||
var origin = global.location.origin;
|
||||
var body = "[InternetShortcut]\r\nURL=" + origin + "/\r\n";
|
||||
var blob = new Blob([body], { type: "application/internet-shortcut" });
|
||||
var a = document.createElement("a");
|
||||
a.href = URL.createObjectURL(blob);
|
||||
a.download = "期权中控.url";
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
setTimeout(function () {
|
||||
URL.revokeObjectURL(a.href);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
async function onInstallClick() {
|
||||
setHint("");
|
||||
if (deferredPrompt) {
|
||||
deferredPrompt.prompt();
|
||||
try {
|
||||
var choice = await deferredPrompt.userChoice;
|
||||
deferredPrompt = null;
|
||||
if (choice && choice.outcome === "accepted") {
|
||||
hideInstall();
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
deferredPrompt = null;
|
||||
}
|
||||
}
|
||||
downloadShortcut();
|
||||
setHint("已下载快捷方式,拖到桌面即可。Chrome / Edge 也可在地址栏右侧点「安装」。");
|
||||
}
|
||||
|
||||
function boot() {
|
||||
if (isStandalone()) {
|
||||
hideInstall();
|
||||
return;
|
||||
}
|
||||
showInstall();
|
||||
global.addEventListener("beforeinstallprompt", function (ev) {
|
||||
ev.preventDefault();
|
||||
deferredPrompt = ev;
|
||||
showInstall();
|
||||
});
|
||||
global.addEventListener("appinstalled", function () {
|
||||
deferredPrompt = null;
|
||||
hideInstall();
|
||||
});
|
||||
var el = btn();
|
||||
if (el) el.addEventListener("click", onInstallClick);
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.register("/sw.js", { scope: "/" }).catch(function () {});
|
||||
}
|
||||
if (!("serviceWorker" in navigator)) return;
|
||||
navigator.serviceWorker.register("/sw.js", { scope: "/" }).catch(function () {});
|
||||
}
|
||||
|
||||
global.HubPwa = { boot: boot };
|
||||
})(window);
|
||||
|
||||
+5
-9
@@ -11,16 +11,12 @@
|
||||
<link rel="icon" href="{{ url_for('static', filename='icons/favicon.ico') }}?v=2" sizes="any">
|
||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='icons/apple-touch-icon.png') }}?v=2">
|
||||
<link rel="manifest" href="/manifest.webmanifest">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='hub.css') }}?v=37">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='hub.css') }}?v=38">
|
||||
</head>
|
||||
<body class="{% if request.path.startswith('/login') %}page-login{% elif request.path.startswith('/desk') %}page-desk{% elif request.path.startswith('/stats') %}page-stats{% elif request.path.startswith('/instances') %}page-instances{% elif request.path.startswith('/settings') %}page-settings{% elif request.path.startswith('/cond_orders') %}page-cond-orders{% elif request.path == '/' %}page-dashboard{% endif %}">
|
||||
<div class="topbar-actions">
|
||||
<button type="button" class="topbar-install" id="hub-install-btn" hidden>安装到桌面</button>
|
||||
{% if session.get('logged_in') %}
|
||||
<a href="/logout" class="topbar-logout">退出</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<p class="topbar-install-hint" id="hub-install-hint"></p>
|
||||
{% if session.get('logged_in') %}
|
||||
<a href="/logout" class="topbar-logout">退出</a>
|
||||
{% endif %}
|
||||
<main class="main">
|
||||
{% if session.get('logged_in') %}
|
||||
<a href="/" class="topbar-brand">加密货币|OKX 期权中控</a>
|
||||
@@ -65,7 +61,7 @@
|
||||
{% if session.get('logged_in') and not request.path.startswith('/desk') %}
|
||||
<script>if (window.HubQuotes) HubQuotes.boot();</script>
|
||||
{% endif %}
|
||||
<script src="{{ url_for('static', filename='hub_pwa.js') }}?v=1"></script>
|
||||
<script src="{{ url_for('static', filename='hub_pwa.js') }}?v=2"></script>
|
||||
<script>if (window.HubPwa) HubPwa.boot();</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user