mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
feat(webui): 增加界面缩放功能
This commit is contained in:
1 parent
39f1cfe34b
commit
61763fc4a0
3 files changed
+31
-10
No files matched your search
+4
-4
@@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
||||
<title>LuminPro</title>
|
||||
<link rel="stylesheet" type="text/css" href="/internal/insets.css" />
|
||||
<script type="module" crossorigin src="/assets/index-BynSyTFT.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-CAVUA-QK.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-sFzuRF0i.css">
|
||||
</head>
|
||||
|
||||
@@ -265,11 +265,11 @@
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">配置卡片刷新间隔</span>
|
||||
<span class="config-desc">单位: 毫秒 (最小1000ms)</span>
|
||||
<span class="config-name">界面缩放</span>
|
||||
<span class="config-desc">50% - 150% (立即生效)</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-config-refresh-interval" class="config-input" min="1000" value="5000" />
|
||||
<input type="number" id="input-ui-zoom" class="config-input" min="50" max="150" value="100" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+3
-3
@@ -264,11 +264,11 @@
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">配置卡片刷新间隔</span>
|
||||
<span class="config-desc">单位: 毫秒 (最小1000ms)</span>
|
||||
<span class="config-name">界面缩放</span>
|
||||
<span class="config-desc">50% - 150% (立即生效)</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-config-refresh-interval" class="config-input" min="1000" value="5000" />
|
||||
<input type="number" id="input-ui-zoom" class="config-input" min="50" max="150" value="100" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+24
-3
@@ -1,5 +1,5 @@
|
||||
import { exec, listPackages, getPackagesInfo } from 'kernelsu';
|
||||
import { createIcons, Sun, Settings, Settings2, Save, Activity, RefreshCw, FileText, Smartphone, MoreVertical, Eye, EyeOff, CheckSquare, CheckCheck, Square, Search, Sparkles, Plus, ShieldCheck, Moon, Play, RotateCcw, Monitor, Info, Code, User, BookOpen, X, Globe } from 'lucide';
|
||||
import { createIcons, Sun, Settings, Settings2, Save, Activity, RefreshCw, FileText, Smartphone, MoreVertical, Eye, EyeOff, CheckSquare, CheckCheck, Square, Search, Sparkles, Plus, ShieldCheck, Moon, Play, RotateCcw, Monitor, Info, Code, User, BookOpen, X, Globe, Minus } from 'lucide';
|
||||
import MarkdownIt from 'markdown-it';
|
||||
import PinyinMatch from 'pinyin-match';
|
||||
|
||||
@@ -25,6 +25,7 @@ let statusLogRefreshInterval = 1000; // 状态/日志刷新间隔(默认1秒
|
||||
let configRefreshInterval = 5000; // 配置卡片刷新间隔(默认5秒)
|
||||
let autoRefreshStatusLogTimer = null; // 状态/日志刷新定时器
|
||||
let autoRefreshConfigTimer = null; // 配置刷新定时器
|
||||
let uiZoom = 100; // 界面缩放百分比 (50-150)
|
||||
|
||||
// ==========================
|
||||
// 工具函数
|
||||
@@ -146,6 +147,16 @@ async function loadConfig() {
|
||||
|
||||
document.getElementById('input-status-refresh-interval').value = statusLogRefreshInterval;
|
||||
document.getElementById('input-config-refresh-interval').value = configRefreshInterval;
|
||||
|
||||
const savedUIZoom = localStorage.getItem('uiZoom');
|
||||
if (savedUIZoom && !isNaN(parseInt(savedUIZoom, 10))) {
|
||||
uiZoom = Math.min(150, Math.max(50, parseInt(savedUIZoom, 10)));
|
||||
}
|
||||
const uiZoomInput = document.getElementById('input-ui-zoom');
|
||||
const uiZoomDisplay = document.getElementById('ui-zoom-display');
|
||||
if (uiZoomInput) uiZoomInput.value = uiZoom;
|
||||
if (uiZoomDisplay) uiZoomDisplay.textContent = uiZoom + '%';
|
||||
applyUIZoom(uiZoom);
|
||||
}
|
||||
|
||||
// 2. 保存配置并重启服务
|
||||
@@ -225,6 +236,7 @@ async function saveAdvancedConfig() {
|
||||
function saveWebUIConfig() {
|
||||
const statusRefresh = parseInt(document.getElementById('input-status-refresh-interval').value, 10) || 1000;
|
||||
const configRefresh = parseInt(document.getElementById('input-config-refresh-interval').value, 10) || 5000;
|
||||
const zoom = parseInt(document.getElementById('input-ui-zoom').value, 10) || 100;
|
||||
|
||||
// 验证最小值
|
||||
if (statusRefresh < 100) {
|
||||
@@ -241,16 +253,25 @@ function saveWebUIConfig() {
|
||||
// 保存到 localStorage
|
||||
localStorage.setItem('statusLogRefreshInterval', statusRefresh);
|
||||
localStorage.setItem('configRefreshInterval', configRefresh);
|
||||
localStorage.setItem('uiZoom', zoom);
|
||||
|
||||
// 更新全局变量
|
||||
statusLogRefreshInterval = statusRefresh;
|
||||
configRefreshInterval = configRefresh;
|
||||
uiZoom = zoom;
|
||||
|
||||
// 重启刷新循环
|
||||
stopAutoRefresh();
|
||||
startAutoRefresh();
|
||||
|
||||
showToast('Web UI 配置已保存,刷新间隔已更新');
|
||||
applyUIZoom(zoom);
|
||||
showToast('Web UI 配置已保存');
|
||||
}
|
||||
|
||||
function applyUIZoom(zoom) {
|
||||
const scale = zoom / 100;
|
||||
// 使用 zoom 属性,它是最直接且不破坏 fixed 定位的方式 (Blink 支持很好)
|
||||
document.body.style.zoom = scale;
|
||||
}
|
||||
|
||||
// 2.5 恢复默认
|
||||
@@ -1016,7 +1037,7 @@ async function init() {
|
||||
RotateCcw,
|
||||
Monitor,
|
||||
Info,
|
||||
Code, User, BookOpen, X, Globe
|
||||
Code, User, BookOpen, X, Globe, Minus
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user