From 0bd9da2bbc0ab36891b3b8cffcbc9ec40c0aee7a Mon Sep 17 00:00:00 2001 From: 87owo <85057800+87owo@users.noreply.github.com> Date: Thu, 28 May 2026 14:31:24 +0800 Subject: [PATCH] Add files via upload --- Interface/static/js/i18n.js | 11 +++++++++++ Interface/static/js/main.js | 12 +++++++++++- Interface/templates/index.html | 1 + PYAS.py | 2 +- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Interface/static/js/i18n.js b/Interface/static/js/i18n.js index d4e2351..1a20efc 100644 --- a/Interface/static/js/i18n.js +++ b/Interface/static/js/i18n.js @@ -49,6 +49,7 @@ window.AppI18n = { "scan_context_desc": "此選項可以啟用右鍵掃描功能", "theme_color": "顯色主題", "theme_color_desc": "此選項可以選擇主題顏色", + "theme_system": "跟隨系統", "theme_white": "白色主題", "theme_red": "紅色主題", "theme_yellow": "黃色主題", @@ -185,6 +186,7 @@ window.AppI18n = { "scan_context_desc": "此选项可以启用右键扫描功能", "theme_color": "显色主题", "theme_color_desc": "此选项可以选择主题颜色", + "theme_system": "跟随系统", "theme_white": "白色主题", "theme_red": "红色主题", "theme_yellow": "黄色主题", @@ -321,6 +323,7 @@ window.AppI18n = { "scan_context_desc": "Enable right-click scan functionality", "theme_color": "Color Theme", "theme_color_desc": "Select application color theme", + "theme_system": "System Theme", "theme_white": "Light Mode", "theme_red": "Red Theme", "theme_yellow": "Yellow Theme", @@ -457,6 +460,7 @@ window.AppI18n = { "scan_context_desc": "右クリックでスキャン機能を有効にします", "theme_color": "カラーテーマ", "theme_color_desc": "アプリケーションのテーマカラーを選択します", + "theme_system": "システムに従う", "theme_white": "ライトモード", "theme_red": "レッドテーマ", "theme_yellow": "イエローテーマ", @@ -593,6 +597,7 @@ window.AppI18n = { "scan_context_desc": "우클릭 스캔 기능을 활성화합니다", "theme_color": "색상 테마", "theme_color_desc": "응용 프로그램 테마 색상을 선택합니다", + "theme_system": "시스템 테마", "theme_white": "라이트 모드", "theme_red": "레드 테마", "theme_yellow": "옐로우 테마", @@ -729,6 +734,7 @@ window.AppI18n = { "scan_context_desc": "Activer la fonctionnalité d'analyse par clic droit", "theme_color": "Thème de couleur", "theme_color_desc": "Sélectionnez le thème de couleur de l'application", + "theme_system": "Thème du système", "theme_white": "Mode clair", "theme_red": "Thème rouge", "theme_yellow": "Thème jaune", @@ -865,6 +871,7 @@ window.AppI18n = { "scan_context_desc": "Habilitar la función de escaneo con el botón derecho", "theme_color": "Tema de color", "theme_color_desc": "Seleccione el tema de color de la aplicación", + "theme_system": "Tema del sistema", "theme_white": "Modo claro", "theme_red": "Tema rojo", "theme_yellow": "Tema amarillo", @@ -1001,6 +1008,7 @@ window.AppI18n = { "scan_context_desc": "राइट-क्लिक स्कैन कार्यक्षमता सक्षम करें", "theme_color": "रंग थीम", "theme_color_desc": "एप्लिकेशन का रंग थीम चुनें", + "theme_system": "सिस्टम थीम", "theme_white": "लाइट मोड", "theme_red": "लाल थीम", "theme_yellow": "पीला थीम", @@ -1137,6 +1145,7 @@ window.AppI18n = { "scan_context_desc": "تمكين ميزة الفحص بزر الماوس الأيمن", "theme_color": "سمة اللون", "theme_color_desc": "تحديد سمة ألوان التطبيق", + "theme_system": "سمة النظام", "theme_white": "الوضع الفاتح", "theme_red": "سمة حمراء", "theme_yellow": "سمة صفراء", @@ -1273,6 +1282,7 @@ window.AppI18n = { "scan_context_desc": "Включить функцию сканирования по правому клику", "theme_color": "Цветовая тема", "theme_color_desc": "Выберите цветовую тему приложения", + "theme_system": "Системная тема", "theme_white": "Светлый режим", "theme_red": "Красная тема", "theme_yellow": "Желтая тема", @@ -1409,6 +1419,7 @@ window.AppI18n = { "scan_context_desc": "Omogoči funkcijo skeniranja z desnim klikom", "theme_color": "Barvna tema", "theme_color_desc": "Izberite barvno temo aplikacije", + "theme_system": "Sistemska tema", "theme_white": "Svetel način", "theme_red": "Rdeča tema", "theme_yellow": "Rumena tema", diff --git a/Interface/static/js/main.js b/Interface/static/js/main.js index ddeb620..596e817 100644 --- a/Interface/static/js/main.js +++ b/Interface/static/js/main.js @@ -9,6 +9,7 @@ document.addEventListener('DOMContentLoaded', () => { const appState = { lang: "english_switch", + theme: "system_switch", scanning: false, firstLaunch: false, taskmgrTimer: null, @@ -198,7 +199,12 @@ document.addEventListener('DOMContentLoaded', () => { }; const applyTheme = (theme) => { - const themeVars = themes[theme]; + appState.theme = theme; + const actualTheme = theme === "system_switch" + ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? "black_switch" : "white_switch") + : theme; + + const themeVars = themes[actualTheme]; if (themeVars) { for (const [key, value] of Object.entries(themeVars)) { document.documentElement.style.setProperty(key, value.startsWith("rgba") ? value : `rgb(${value})`); @@ -206,6 +212,10 @@ document.addEventListener('DOMContentLoaded', () => { } }; + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => { + if (appState.theme === "system_switch") applyTheme("system_switch"); + }); + const renderDataGrid = (containerSelector, dataList, columns, valKey, defaultChecked = false) => { const widget = document.querySelector(`${containerSelector} .manage-widget`) || document.querySelector(`${containerSelector} .virus-widget`); const listUl = document.querySelector(`${containerSelector} .manage-list`) || document.querySelector(`${containerSelector} .virus-list`); diff --git a/Interface/templates/index.html b/Interface/templates/index.html index e56cbb8..18e510e 100644 --- a/Interface/templates/index.html +++ b/Interface/templates/index.html @@ -214,6 +214,7 @@

顯色主題

此選項可以選擇主題顏色