中控手机端使用独立底栏与卡片总览,电脑端布局保持不变。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-05 19:19:56 +08:00
parent 2dcb191c2f
commit cf347e7b6b
7 changed files with 554 additions and 19 deletions
+288
View File
@@ -1666,3 +1666,291 @@ input.readonly {
body.page-stats .main { body.page-stats .main {
max-width: 1800px; max-width: 1800px;
} }
/* —— 手机单独壳:电脑样式不动,仅 html.hub-phone-html 启用 —— */
.hub-phone-chrome {
display: none;
}
html.hub-phone-html .hub-desk-chrome {
display: none !important;
}
html.hub-phone-html .hub-phone-bar {
display: flex;
}
html.hub-phone-html .hub-phone-tabbar {
display: flex;
}
html.hub-phone-html .hub-phone-more {
display: block;
}
html.hub-phone-html body {
padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}
html.hub-phone-html body.page-desk {
height: auto;
overflow: auto;
}
html.hub-phone-html body.page-desk .main {
height: auto;
max-height: none;
display: block;
padding: 10px 14px 20px;
}
html.hub-phone-html .main {
max-width: none;
padding: 10px 14px 20px;
}
html.hub-phone-html .topbar-logout {
display: none;
}
.hub-phone-bar {
display: none;
align-items: center;
justify-content: space-between;
gap: 10px;
margin: 8px 0 12px;
padding: 8px 4px 10px;
border-bottom: 1px solid rgba(56, 189, 248, 0.16);
}
.hub-phone-bar-title {
font-size: 1.05rem;
font-weight: 700;
color: #dbe4ff;
white-space: nowrap;
}
.hub-phone-quotes {
display: flex;
flex-direction: column;
gap: 3px;
min-width: 0;
font-variant-numeric: tabular-nums;
}
.hub-phone-quotes .nav-spot-row {
grid-template-columns: 16px minmax(4.2em, auto) minmax(3.4em, auto);
padding: 1px 6px 1px 4px;
font-size: 0.72rem;
background: transparent;
border: none;
}
.hub-phone-tabbar {
display: none;
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 40;
justify-content: space-around;
align-items: stretch;
gap: 4px;
padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
background: rgba(10, 16, 28, 0.96);
border-top: 1px solid rgba(56, 189, 248, 0.22);
backdrop-filter: blur(10px);
}
.hub-phone-tab {
flex: 1;
appearance: none;
border: 0;
background: transparent;
color: #8aa0b8;
font: inherit;
font-size: 0.86rem;
font-weight: 600;
padding: 10px 4px;
text-align: center;
cursor: pointer;
}
.hub-phone-tab.is-active,
.hub-phone-tab[aria-expanded="true"] {
color: #e8f1ff;
}
.hub-phone-more {
display: none;
}
html.hub-phone-html .hub-phone-more {
pointer-events: none;
}
html.hub-phone-html.hub-phone-more-open .hub-phone-more,
html.hub-phone-html body.hub-phone-more-open .hub-phone-more {
pointer-events: auto;
}
.hub-phone-more-backdrop {
position: fixed;
inset: 0;
z-index: 45;
background: rgba(0, 0, 0, 0.45);
opacity: 0;
visibility: hidden;
transition: opacity 0.18s ease;
}
body.hub-phone-more-open .hub-phone-more-backdrop {
opacity: 1;
visibility: visible;
}
.hub-phone-more-sheet {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 46;
max-height: min(78vh, 560px);
overflow: auto;
padding: 10px 16px calc(18px + env(safe-area-inset-bottom, 0px));
border-radius: 16px 16px 0 0;
background: #101828;
border: 1px solid rgba(56, 189, 248, 0.28);
transform: translateY(110%);
transition: transform 0.2s ease;
}
body.hub-phone-more-open .hub-phone-more-sheet {
transform: translateY(0);
}
.hub-phone-more-handle {
width: 42px;
height: 4px;
margin: 4px auto 10px;
border-radius: 99px;
background: #3a4568;
}
.hub-phone-more-title {
margin: 0 0 4px;
font-size: 1rem;
}
.hub-phone-more-hint {
margin: 0 0 12px;
font-size: 0.78rem;
color: var(--muted);
}
.hub-phone-more-nav {
display: flex;
flex-direction: column;
gap: 6px;
}
.hub-phone-more-nav a {
display: block;
padding: 12px 12px;
border-radius: 10px;
background: #151a2a;
border: 1px solid #304164;
color: #dbe4ff;
}
.hub-phone-more-nav a.is-active {
background: #2a3f6c;
}
.hub-phone-more-close {
display: block;
width: 100%;
margin-top: 14px;
padding: 10px;
border-radius: 10px;
border: 1px solid #304164;
background: transparent;
color: #8aa0b8;
font: inherit;
}
html.hub-phone-html .page-head {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-bottom: 8px;
}
html.hub-phone-html .page-head h1 {
font-size: 1.15rem;
margin: 0;
flex: 1;
}
html.hub-phone-html .overview-bj-clock {
display: none;
}
html.hub-phone-html .overview-summary {
display: none !important;
}
html.hub-phone-html #overview-status {
font-size: 0.78rem;
margin: 0 0 10px;
}
.hub-phone-cards {
display: flex;
flex-direction: column;
gap: 10px;
}
.hub-phone-card {
background: rgba(16, 24, 40, 0.92);
border: 1px solid rgba(56, 189, 248, 0.2);
border-radius: 12px;
padding: 12px;
}
.hub-phone-card-head {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px 8px;
margin-bottom: 8px;
}
.hub-phone-card-kpis {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 8px;
margin-bottom: 8px;
}
.hub-phone-card-kpis .muted {
display: block;
font-size: 0.68rem;
margin-bottom: 2px;
}
.hub-phone-card-pos .pos-brief {
font-size: 0.78rem;
}
.hub-phone-card-exit,
.hub-phone-card-liq {
font-size: 0.76rem;
margin-top: 4px;
}
.hub-phone-card-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 10px;
}
html.hub-phone-html .desk {
display: none !important;
}
.hub-phone-desk {
display: none;
}
html.hub-phone-html .hub-phone-desk {
display: block;
}
.hub-phone-desk-list {
list-style: none;
margin: 12px 0 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 8px;
}
.hub-phone-desk-open {
width: 100%;
text-align: left;
}
html.hub-phone-html .settings-row-2,
html.hub-phone-html .settings-grid {
display: block;
}
html.hub-phone-html .inst-table,
html.hub-phone-html .backup-table,
html.hub-phone-html .stats-table {
font-size: 0.78rem;
}
html.hub-phone-html .table-wrap {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
html.hub-phone-html .login-wrap {
padding: 48px 16px 24px;
}
html.hub-phone-html .login-card {
width: 100%;
max-width: none;
}
+103 -5
View File
@@ -298,6 +298,104 @@
); );
} }
function isHubPhone() {
return (
document.documentElement.classList.contains("hub-phone-html") ||
!!(document.body && document.body.classList.contains("hub-phone"))
);
}
function openClient(instanceId) {
if (!instanceId) return;
fetch("/api/instances/" + encodeURIComponent(instanceId) + "/open_url")
.then(function (r) {
return r.json();
})
.then(function (d) {
if (d && d.url) {
window.location.href = d.url;
return;
}
window.location.href = "/desk?id=" + encodeURIComponent(instanceId);
})
.catch(function () {
window.location.href = "/desk?id=" + encodeURIComponent(instanceId);
});
}
function bindOverviewActions(root) {
if (!root) return;
root.querySelectorAll("[data-close-opt]").forEach(function (btn) {
btn.addEventListener("click", function () {
requestClose(btn);
});
});
root.querySelectorAll("[data-open-inst]").forEach(function (btn) {
btn.addEventListener("click", function () {
openClient(btn.getAttribute("data-open-inst"));
});
});
}
function renderPhoneCard(row) {
const snap = row.snapshot || {};
const inst = snap.instance || {};
const pnl =
snap.pnl && snap.pnl.unrealized_usdt != null
? snap.pnl.unrealized_usdt
: snap.upl_total_usdc;
const brief = snap.positions_brief || snap.positions || [];
const cond = activeCondOrder(snap);
const online = !!row.online;
const m = String(inst.mode || "").toLowerCase();
const modeHtml =
m === "sim" || m === "live"
? '<span class="overview-mode-tag overview-mode-tag--' + m + '">' + escapeHtml(m) + "</span>"
: '<span class="muted">' + escapeHtml(inst.mode || "—") + "</span>";
const err = row.error
? '<div class="muted hub-phone-card-err">错误: ' + escapeHtml(row.error) + "</div>"
: "";
return (
'<article class="hub-phone-card">' +
'<div class="hub-phone-card-head">' +
"<strong>" +
escapeHtml(row.name || "") +
"</strong>" +
(online ? '<span class="status-on">在线</span>' : '<span class="status-off">离线</span>') +
modeHtml +
condTagHtml(cond) +
"</div>" +
err +
'<div class="hub-phone-card-kpis">' +
'<div><span class="muted">浮盈</span>' +
fmtPnlHtml(pnl) +
"</div>" +
'<div><span class="muted">权利金</span>' +
premiumCell(snap) +
"</div>" +
'<div><span class="muted">占比</span>' +
premiumRatioCell(snap) +
"</div>" +
"</div>" +
'<div class="hub-phone-card-pos">' +
positionSummary(brief, cond) +
"</div>" +
'<div class="hub-phone-card-exit muted">出场 ' +
(brief.length ? escapeHtml(formatExitBrief(brief[0])) : "—") +
"</div>" +
'<div class="hub-phone-card-liq">' +
bidLiquiditySummary(brief) +
"</div>" +
'<div class="hub-phone-card-actions">' +
'<button type="button" class="btn" data-open-inst="' +
escapeHtml(String(row.id || "")) +
'">打开</button>' +
closeActionButtons(brief, row.id, online) +
"</div>" +
"</article>"
);
}
function renderRow(row) { function renderRow(row) {
const snap = row.snapshot || {}; const snap = row.snapshot || {};
const inst = snap.instance || {}; const inst = snap.instance || {};
@@ -594,6 +692,10 @@
if (!list.length) { if (!list.length) {
grid.innerHTML = grid.innerHTML =
'<p class="muted">暂无启用实例,请先到「实例」添加.</p>'; '<p class="muted">暂无启用实例,请先到「实例」添加.</p>';
} else if (isHubPhone()) {
grid.innerHTML =
'<div class="hub-phone-cards">' + list.map(renderPhoneCard).join("") + "</div>";
bindOverviewActions(grid);
} else { } else {
grid.innerHTML = grid.innerHTML =
'<div class="overview-table-wrap"><table class="overview-table">' + '<div class="overview-table-wrap"><table class="overview-table">' +
@@ -602,11 +704,7 @@
"</tr></thead><tbody>" + "</tr></thead><tbody>" +
list.map(renderRow).join("") + list.map(renderRow).join("") +
"</tbody></table></div>"; "</tbody></table></div>";
grid.querySelectorAll("[data-close-opt]").forEach(function (btn) { bindOverviewActions(grid);
btn.addEventListener("click", function () {
requestClose(btn);
});
});
} }
if (status) { if (status) {
const s = summarizeOverview(list); const s = summarizeOverview(list);
+62
View File
@@ -0,0 +1,62 @@
(function (global) {
var MQ = "(max-width: 720px)";
function isMobile() {
try {
return window.matchMedia(MQ).matches;
} catch (e) {
return false;
}
}
function sync() {
var on = isMobile();
document.documentElement.classList.toggle("hub-phone-html", on);
if (document.body) document.body.classList.toggle("hub-phone", on);
if (!on) closeMore();
}
function closeMore() {
if (!document.body) return;
document.body.classList.remove("hub-phone-more-open");
var more = document.getElementById("hub-phone-more");
var btn = document.getElementById("hub-phone-more-btn");
if (more) more.setAttribute("aria-hidden", "true");
if (btn) btn.setAttribute("aria-expanded", "false");
}
function openMore() {
if (!isMobile()) return;
document.body.classList.add("hub-phone-more-open");
var more = document.getElementById("hub-phone-more");
var btn = document.getElementById("hub-phone-more-btn");
if (more) more.setAttribute("aria-hidden", "false");
if (btn) btn.setAttribute("aria-expanded", "true");
}
function boot() {
sync();
var moreBtn = document.getElementById("hub-phone-more-btn");
var backdrop = document.getElementById("hub-phone-more-backdrop");
var closeBtn = document.getElementById("hub-phone-more-close");
if (moreBtn) {
moreBtn.addEventListener("click", function (ev) {
ev.preventDefault();
if (document.body.classList.contains("hub-phone-more-open")) closeMore();
else openMore();
});
}
if (backdrop) backdrop.addEventListener("click", closeMore);
if (closeBtn) closeBtn.addEventListener("click", closeMore);
document.addEventListener("keydown", function (ev) {
if (ev.key === "Escape") closeMore();
});
var t = null;
window.addEventListener("resize", function () {
clearTimeout(t);
t = setTimeout(sync, 120);
});
}
global.HubPhone = { boot: boot, isMobile: isMobile, sync: sync };
})(window);
+10 -6
View File
@@ -77,11 +77,7 @@
return best; return best;
} }
function paint(list) { function paintRoot(root, tickers, src) {
const root = document.getElementById("nav-spot-tickers");
if (!root) return;
const src = pickQuoteSource(list);
const tickers = src ? src.tickers : [];
["ETH", "BTC"].forEach(function (base) { ["ETH", "BTC"].forEach(function (base) {
const row = root.querySelector('.nav-spot-row[data-base="' + base + '"]'); const row = root.querySelector('.nav-spot-row[data-base="' + base + '"]');
if (!row) return; if (!row) return;
@@ -119,6 +115,14 @@
} }
} }
function paint(list) {
const src = pickQuoteSource(list);
const tickers = src ? src.tickers : [];
document.querySelectorAll("[data-hub-quotes]").forEach(function (root) {
paintRoot(root, tickers, src);
});
}
let timer = null; let timer = null;
let inflight = false; let inflight = false;
@@ -137,7 +141,7 @@
} }
function boot() { function boot() {
if (!document.getElementById("nav-spot-tickers")) return; if (!document.querySelector("[data-hub-quotes]")) return;
if (global.HubOverview) return; if (global.HubOverview) return;
refresh(); refresh();
if (timer) clearInterval(timer); if (timer) clearInterval(timer);
+55 -7
View File
@@ -2,7 +2,7 @@
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>{% block title %}加密货币|OKX 期权中控{% endblock %}</title> <title>{% block title %}加密货币|OKX 期权中控{% endblock %}</title>
<meta name="theme-color" content="#070b14"> <meta name="theme-color" content="#070b14">
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
@@ -11,16 +11,40 @@
<link rel="icon" href="{{ url_for('static', filename='icons/favicon.ico') }}?v=2" sizes="any"> <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="apple-touch-icon" href="{{ url_for('static', filename='icons/apple-touch-icon.png') }}?v=2">
<link rel="manifest" href="/manifest.webmanifest"> <link rel="manifest" href="/manifest.webmanifest">
<link rel="stylesheet" href="{{ url_for('static', filename='hub.css') }}?v=38"> <link rel="stylesheet" href="{{ url_for('static', filename='hub.css') }}?v=39">
<script>
(function () {
try {
if (window.matchMedia("(max-width: 720px)").matches) {
document.documentElement.classList.add("hub-phone-html");
}
} catch (e) {}
})();
</script>
</head> </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 %}"> <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 %}">
{% if session.get('logged_in') %} {% if session.get('logged_in') %}
<a href="/logout" class="topbar-logout">退出</a> <a href="/logout" class="topbar-logout hub-desk-chrome">退出</a>
{% endif %} {% endif %}
<main class="main"> <main class="main">
{% if session.get('logged_in') %} {% if session.get('logged_in') %}
<a href="/" class="topbar-brand">加密货币|OKX 期权中控</a> <header class="hub-phone-bar hub-phone-chrome">
<div class="topbar-row"> <div class="hub-phone-bar-title">期权中控</div>
<div class="hub-phone-quotes" id="nav-spot-tickers-phone" data-hub-quotes="1" aria-label="BTC ETH 报价">
<div class="nav-spot-row" data-base="ETH">
<span class="nav-spot-icon nav-spot-icon--eth" aria-hidden="true">Ξ</span>
<span class="nav-spot-last" data-field="last">—</span>
<span class="nav-spot-pct" data-field="change_pct">—</span>
</div>
<div class="nav-spot-row" data-base="BTC">
<span class="nav-spot-icon nav-spot-icon--btc" aria-hidden="true">₿</span>
<span class="nav-spot-last" data-field="last">—</span>
<span class="nav-spot-pct" data-field="change_pct">—</span>
</div>
</div>
</header>
<a href="/" class="topbar-brand hub-desk-chrome">加密货币|OKX 期权中控</a>
<div class="topbar-row hub-desk-chrome">
<nav class="topbar-nav"> <nav class="topbar-nav">
<a href="/" class="{% if request.path == '/' %}active{% endif %}">总览</a> <a href="/" class="{% if request.path == '/' %}active{% endif %}">总览</a>
<a href="/cond_orders" class="{% if request.path.startswith('/cond_orders') %}active{% endif %}">条件单</a> <a href="/cond_orders" class="{% if request.path.startswith('/cond_orders') %}active{% endif %}">条件单</a>
@@ -29,7 +53,7 @@
<a href="/stats" class="{% if request.path.startswith('/stats') %}active{% endif %}">数据统计</a> <a href="/stats" class="{% if request.path.startswith('/stats') %}active{% endif %}">数据统计</a>
<a href="/settings" class="{% if request.path.startswith('/settings') %}active{% endif %}">系统设置</a> <a href="/settings" class="{% if request.path.startswith('/settings') %}active{% endif %}">系统设置</a>
</nav> </nav>
<div class="top-nav-spot-tickers" id="nav-spot-tickers" aria-label="BTC ETH 报价" title="来自在线客户端 · 相对北京 08:00"> <div class="top-nav-spot-tickers" id="nav-spot-tickers" data-hub-quotes="1" aria-label="BTC ETH 报价" title="来自在线客户端 · 相对北京 08:00">
<div class="nav-spot-row" data-base="ETH"> <div class="nav-spot-row" data-base="ETH">
<span class="nav-spot-ribbon" aria-hidden="true"></span> <span class="nav-spot-ribbon" aria-hidden="true"></span>
<span class="nav-spot-icon nav-spot-icon--eth" aria-hidden="true">Ξ</span> <span class="nav-spot-icon nav-spot-icon--eth" aria-hidden="true">Ξ</span>
@@ -54,14 +78,38 @@
{% endwith %} {% endwith %}
{% block body %}{% endblock %} {% block body %}{% endblock %}
</main> </main>
{% if session.get('logged_in') %}
<nav id="hub-phone-tabbar" class="hub-phone-tabbar hub-phone-chrome" aria-label="手机导航">
<a href="/" class="hub-phone-tab{% if request.path == '/' %} is-active{% endif %}" data-hub-tab="/">总览</a>
<a href="/cond_orders" class="hub-phone-tab{% if request.path.startswith('/cond_orders') %} is-active{% endif %}" data-hub-tab="/cond_orders">条件单</a>
<button type="button" class="hub-phone-tab" id="hub-phone-more-btn" aria-haspopup="dialog" aria-expanded="false">更多</button>
</nav>
<div id="hub-phone-more" class="hub-phone-more hub-phone-chrome" aria-hidden="true">
<div class="hub-phone-more-backdrop" id="hub-phone-more-backdrop"></div>
<div class="hub-phone-more-sheet" role="dialog" aria-modal="true">
<div class="hub-phone-more-handle" aria-hidden="true"></div>
<h2 class="hub-phone-more-title">更多</h2>
<p class="hub-phone-more-hint">次要页面 · 完整操作请用电脑</p>
<nav class="hub-phone-more-nav">
<a href="/instances"{% if request.path.startswith('/instances') %} class="is-active"{% endif %}>实例</a>
<a href="/stats"{% if request.path.startswith('/stats') %} class="is-active"{% endif %}>数据统计</a>
<a href="/settings"{% if request.path.startswith('/settings') %} class="is-active"{% endif %}>系统设置</a>
<a href="/logout">退出登录</a>
</nav>
<button type="button" class="hub-phone-more-close" id="hub-phone-more-close">关闭</button>
</div>
</div>
{% endif %}
{% if session.get('logged_in') and not request.path.startswith('/desk') %} {% if session.get('logged_in') and not request.path.startswith('/desk') %}
<script src="{{ url_for('static', filename='hub_quotes.js') }}?v=1"></script> <script src="{{ url_for('static', filename='hub_quotes.js') }}?v=2"></script>
{% endif %} {% endif %}
{% block scripts %}{% endblock %} {% block scripts %}{% endblock %}
{% if session.get('logged_in') and not request.path.startswith('/desk') %} {% if session.get('logged_in') and not request.path.startswith('/desk') %}
<script>if (window.HubQuotes) HubQuotes.boot();</script> <script>if (window.HubQuotes) HubQuotes.boot();</script>
{% endif %} {% endif %}
<script src="{{ url_for('static', filename='hub_pwa.js') }}?v=2"></script> <script src="{{ url_for('static', filename='hub_pwa.js') }}?v=2"></script>
<script src="{{ url_for('static', filename='hub_phone.js') }}?v=1"></script>
<script>if (window.HubPwa) HubPwa.boot();</script> <script>if (window.HubPwa) HubPwa.boot();</script>
<script>if (window.HubPhone) HubPhone.boot();</script>
</body> </body>
</html> </html>
+1 -1
View File
@@ -15,6 +15,6 @@
<div id="overview-grid"></div> <div id="overview-grid"></div>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ url_for('static', filename='hub.js') }}?v=26"></script> <script src="{{ url_for('static', filename='hub.js') }}?v=27"></script>
<script>HubOverview.boot();</script> <script>HubOverview.boot();</script>
{% endblock %} {% endblock %}
+35
View File
@@ -37,9 +37,44 @@
{% endif %} {% endif %}
</div> </div>
</section> </section>
<section class="hub-phone-desk hub-phone-chrome">
<p class="hub-phone-desk-hint muted">点开后进入该客户端(手机页),不经过中控工作台嵌页。</p>
<ul class="hub-phone-desk-list">
{% for inst in instances %}
<li>
<button type="button" class="btn hub-phone-desk-open" data-open-id="{{ inst.id }}">{{ inst.name }}</button>
</li>
{% else %}
<li class="muted">无启用实例</li>
{% endfor %}
</ul>
</section>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script> <script>
(function () {
var phone = document.documentElement.classList.contains("hub-phone-html");
if (!phone) return;
var blank = document.getElementById("desk-open-blank");
if (blank && blank.getAttribute("href")) {
window.location.replace(blank.getAttribute("href"));
return;
}
document.querySelectorAll(".hub-phone-desk-open[data-open-id]").forEach(function (btn) {
btn.addEventListener("click", function () {
var id = btn.getAttribute("data-open-id");
if (!id) return;
fetch("/api/instances/" + encodeURIComponent(id) + "/open_url")
.then(function (r) { return r.json(); })
.then(function (d) {
if (d && d.url) window.location.href = d.url;
})
.catch(function () {});
});
});
})();
</script>
<script>
(function () { (function () {
var KEY = "hub_desk_side_collapsed"; var KEY = "hub_desk_side_collapsed";
var root = document.getElementById("desk-root"); var root = document.getElementById("desk-root");