Add files via upload

This commit is contained in:
87owo authored and GitHub committed 2026-05-06 14:14:48 +08:00
1 parent f8dbd12b69
commit 90faf1007e
4 files changed
+123 -12

No files matched your search

+38
View File
@@ -797,6 +797,44 @@ body.resizing-active * {
color: var(--text-primary);
}
.custom-context-menu {
position: absolute;
z-index: 10000;
background-color: var(--bg-panel);
border: 1px solid var(--border-color);
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
padding: 4px;
display: none;
min-width: 160px;
}
.custom-context-menu.show {
display: block;
}
.custom-context-menu-item {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 12px;
border-radius: 6px;
cursor: pointer;
font-size: 13px;
color: var(--text-primary);
transition: background-color 0.2s;
}
.custom-context-menu-item:hover {
background-color: var(--bg-hover);
}
.custom-context-menu-item svg {
width: 16px;
height: 16px;
color: var(--text-secondary);
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
+22 -11
View File
@@ -124,7 +124,8 @@ window.AppI18n = {
"類別": "類別",
"標題": "標題",
"修復項目": "修復項目",
"全選": "全選"
"全選": "全選",
"打開檔案所在位置": "打開檔案所在位置"
},
"simplified_switch": {
"PYAS Security": "PYAS Security",
@@ -250,7 +251,8 @@ window.AppI18n = {
"類別": "类别",
"標題": "标题",
"修復項目": "修复项目",
"全選": "全选"
"全選": "全选",
"打開檔案所在位置": "打开文件所在位置"
},
"english_switch": {
"PYAS Security": "PYAS Security",
@@ -376,7 +378,8 @@ window.AppI18n = {
"類別": "Class",
"標題": "Title",
"修復項目": "Repair Items",
"全選": "Select All"
"全選": "Select All",
"打開檔案所在位置": "Open file location"
},
"japanese_switch": {
"PYAS Security": "PYAS Security",
@@ -502,7 +505,8 @@ window.AppI18n = {
"類別": "クラス",
"標題": "タイトル",
"修復項目": "修復項目",
"全選": "すべて選択"
"全選": "すべて選択",
"打開檔案所在位置": "ファイルの場所を開く"
},
"korean_switch": {
"PYAS Security": "PYAS Security",
@@ -628,7 +632,8 @@ window.AppI18n = {
"類別": "클래스",
"標題": "제목",
"修復項目": "복구 항목",
"全選": "전체 선택"
"全選": "전체 선택",
"打開檔案所在位置": "파일 위치 열기"
},
"french_switch": {
"PYAS Security": "PYAS Security",
@@ -754,7 +759,8 @@ window.AppI18n = {
"類別": "Classe",
"標題": "Titre",
"修復項目": "Éléments de réparation",
"全選": "Tout sélectionner"
"全選": "Tout sélectionner",
"打開檔案所在位置": "Ouvrir l'emplacement du fichier"
},
"spanish_switch": {
"PYAS Security": "PYAS Security",
@@ -880,7 +886,8 @@ window.AppI18n = {
"類別": "Clase",
"標題": "Título",
"修復項目": "Elementos de reparación",
"全選": "Seleccionar todo"
"全選": "Seleccionar todo",
"打開檔案所在位置": "Abrir ubicación de archivo"
},
"hindi_switch": {
"PYAS Security": "PYAS Security",
@@ -1006,7 +1013,8 @@ window.AppI18n = {
"類別": "वर्ग",
"標題": "शीर्षक",
"修復項目": "मरम्मत आइटम",
"全選": "सभी चुनें"
"全選": "सभी चुनें",
"打開檔案所在位置": "फ़ाइल स्थान खोलें"
},
"arabic_switch": {
"PYAS Security": "PYAS Security",
@@ -1132,7 +1140,8 @@ window.AppI18n = {
"類別": "الفئة",
"標題": "العنوان",
"修復項目": "عناصر الإصلاح",
"全選": "تحديد الكل"
"全選": "تحديد الكل",
"打開檔案所在位置": "فتح موقع الملف"
},
"russian_switch": {
"PYAS Security": "PYAS Security",
@@ -1258,7 +1267,8 @@ window.AppI18n = {
"類別": "Класс",
"標題": "Заголовок",
"修復項目": "Элементы восстановления",
"全選": "Выбрать все"
"全選": "Выбрать все",
"打開檔案所在位置": "Открыть расположение файла"
},
"slovenian_switch": {
"PYAS Security": "PYAS Security",
@@ -1384,7 +1394,8 @@ window.AppI18n = {
"類別": "Razred",
"標題": "Naslov",
"修復項目": "Predmeti za popravilo",
"全選": "Izberi vse"
"全選": "Izberi vse",
"打開檔案所在位置": "Odpri mesto datoteke"
}
},
langMap: {
+61
View File
@@ -1172,4 +1172,65 @@ document.addEventListener('DOMContentLoaded', () => {
});
}
});
const contextMenu = document.createElement('div');
contextMenu.className = 'custom-context-menu';
contextMenu.innerHTML = `
<div class="custom-context-menu-item" id="ctx_open_location">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path></svg>
<span data-i18n>打開檔案所在位置</span>
</div>
`;
document.body.appendChild(contextMenu);
const ctxSpan = contextMenu.querySelector('span[data-i18n]');
ctxSpan.dataset.originText = ctxSpan.textContent.trim();
let contextMenuTarget = null;
document.addEventListener('contextmenu', (e) => {
const listItem = e.target.closest('.manage-list-item');
if (listItem) {
const cb = listItem.querySelector('input[type="checkbox"]');
const path = cb ? cb.dataset.path : null;
if (path && path !== "Unknown" && path !== "None") {
e.preventDefault();
contextMenuTarget = path;
ctxSpan.textContent = getMsg(ctxSpan.dataset.originText);
contextMenu.style.left = `${e.clientX}px`;
contextMenu.style.top = `${e.clientY}px`;
contextMenu.classList.add('show');
const rect = contextMenu.getBoundingClientRect();
if (rect.right > window.innerWidth) {
contextMenu.style.left = `${window.innerWidth - rect.width - 5}px`;
}
if (rect.bottom > window.innerHeight) {
contextMenu.style.top = `${window.innerHeight - rect.height - 5}px`;
}
return;
}
}
contextMenu.classList.remove('show');
});
document.addEventListener('click', (e) => {
if (!e.target.closest('.custom-context-menu')) {
contextMenu.classList.remove('show');
}
});
document.addEventListener('scroll', () => {
contextMenu.classList.remove('show');
}, true);
document.getElementById('ctx_open_location').addEventListener('click', () => {
if (window.pywebview && contextMenuTarget) {
window.pywebview.api.open_file_location(contextMenuTarget);
}
contextMenu.classList.remove('show');
});
});
+2 -1
View File
@@ -1174,7 +1174,8 @@ class WindowAPI:
def open_file_location(self, file_path):
if file_path and os.path.exists(file_path):
try:
subprocess.Popen(f'explorer /select,"{file_path}"')
norm_path = os.path.normpath(file_path)
subprocess.Popen(f'explorer /select,"{norm_path}"')
return True
except Exception:
pass