You've already forked Tricky-Addon-Update-Target-List
mirror of
https://github.com/KOWX712/Tricky-Addon-Update-Target-List.git
synced 2025-09-06 06:37:09 +00:00
opt: reduce code
This commit is contained in:
@@ -234,9 +234,11 @@ document.getElementById("validkb").addEventListener("click", async () => {
|
||||
});
|
||||
});
|
||||
|
||||
// File selector
|
||||
const fileSelector = document.querySelector('.file-selector-overlay');
|
||||
let currentPath = '/storage/emulated/0/Download';
|
||||
|
||||
// Function to display file in current path
|
||||
function updateCurrentPath() {
|
||||
const currentPathElement = document.querySelector('.current-path');
|
||||
const segments = currentPath.split('/').filter(Boolean);
|
||||
@@ -281,17 +283,8 @@ async function listFiles(path, skipAnimation = false) {
|
||||
<span>..</span>
|
||||
`;
|
||||
backItem.addEventListener('click', async () => {
|
||||
currentPath = currentPath.split('/').slice(0, -1).join('/');
|
||||
if (currentPath === '') currentPath = '/storage/emulated/0';
|
||||
const currentPathElement = document.querySelector('.current-path');
|
||||
currentPathElement.innerHTML = currentPath.split('/').filter(Boolean).join('<span class="separator">›</span>');
|
||||
currentPathElement.scrollTo({
|
||||
left: currentPathElement.scrollWidth,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
await listFiles(currentPath);
|
||||
document.querySelector('.back-button').click();
|
||||
});
|
||||
|
||||
fileList.appendChild(backItem);
|
||||
}
|
||||
items.forEach(item => {
|
||||
|
||||
Reference in New Issue
Block a user