feat: categories, runtime nav, and UX updates

This commit is contained in:
2026-04-21 11:43:43 +00:00
parent 9eb3403f8c
commit 52d1991092
12 changed files with 560 additions and 51 deletions
+37
View File
@@ -38,16 +38,33 @@ cat > /opt/portal/index.html <<'HTML'
color:#ffe3e3;
}
.status.hidden{display:none}
.nav-panel{
position:fixed;right:14px;top:14px;z-index:99;display:flex;gap:8px;
background:rgba(12,18,26,.88);border:1px solid rgba(255,255,255,.14);
box-shadow:0 8px 22px rgba(0,0,0,.35);padding:8px;border-radius:10px
}
.nav-btn{
border:1px solid rgba(255,255,255,.14);border-radius:8px;padding:8px 12px;cursor:pointer;
background:linear-gradient(180deg,#1a73b3,#0f5b94);color:#fff;font:600 13px/1 sans-serif
}
.nav-btn:hover{filter:brightness(1.08)}
.nav-btn:active{transform:translateY(1px)}
</style>
</head>
<body>
<div id="screen"></div>
<div id="status" class="status">Подключение к слоту...</div>
<div class="nav-panel">
<button class="nav-btn" id="btn-back" type="button">Назад</button>
<button class="nav-btn" id="btn-home" type="button">Главная</button>
</div>
<script type="module">
import RFB from './core/rfb.js';
const basePath = location.pathname.replace(/\/+$/, '');
const wsUrl = (location.protocol === 'https:' ? 'wss://' : 'ws://') + location.host + basePath + '/websockify';
const statusEl = document.getElementById('status');
const XK_ALT_L = 0xffe9;
const XK_LEFT = 0xff51;
let connected = false;
let connectTimer = null;
@@ -94,6 +111,26 @@ cat > /opt/portal/index.html <<'HTML'
setInterval(touch, 60000);
touch();
}
function keyTap(keysym, code) {
rfb.sendKey(keysym, code, true);
rfb.sendKey(keysym, code, false);
}
function chord(mod, key, modCode, keyCode) {
rfb.sendKey(mod, modCode, true);
keyTap(key, keyCode);
rfb.sendKey(mod, modCode, false);
}
function goHome() {
try {
if (window.top && window.top !== window) {
window.top.location.href = '/';
return;
}
} catch (e) {}
window.location.href = '/';
}
document.getElementById('btn-back').addEventListener('click', () => chord(XK_ALT_L, XK_LEFT, 'AltLeft', 'ArrowLeft'));
document.getElementById('btn-home').addEventListener('click', goHome);
document.addEventListener('contextmenu', (e) => e.preventDefault());
</script>
</body>