|
593 | 593 | background-color: var(--col-bg3); |
594 | 594 | border-radius: var(--siz-radius1); |
595 | 595 |
|
596 | | - &>span{ |
| 596 | + &>span { |
597 | 597 | transform: scale(0.9); |
| 598 | + |
598 | 599 | &.droptglbtn { |
599 | | - transform: translateY(3px); |
600 | | - }} |
| 600 | + transform: translateY(3px); |
| 601 | + } |
| 602 | + } |
601 | 603 | } |
602 | 604 |
|
603 | 605 | [flap-fl-topnav] div { |
|
1528 | 1530 | title: "Sort files", |
1529 | 1531 | onclick: async function () { |
1530 | 1532 | const options = [ |
1531 | | - { label: "Time ↑", mode: "time_asc", icon: "schedule" }, |
1532 | | - { label: "Time ↓", mode: "time_desc", icon: "schedule" }, |
| 1533 | + { label: "Oldest first", mode: "time_asc", icon: "schedule" }, |
| 1534 | + { label: "Newest first", mode: "time_desc", icon: "schedule" }, |
1533 | 1535 | { label: "Name A-Z", mode: "name_asc", icon: "sort_by_alpha" }, |
1534 | 1536 | { label: "Name Z-A", mode: "name_desc", icon: "sort_by_alpha" }, |
1535 | | - { label: "Type", mode: "type", icon: "category" } |
| 1537 | + { label: "File type", mode: "type", icon: "category" } |
1536 | 1538 | ]; |
1537 | 1539 | const selected = await window.parent.showDropdownModal( |
1538 | 1540 | "Sort files", |
|
1559 | 1561 | })(), |
1560 | 1562 | label: (() => { |
1561 | 1563 | const mapping = { |
1562 | | - time_asc: "Time ↑", |
1563 | | - time_desc: "Time ↓", |
| 1564 | + time_asc: "Oldest first", |
| 1565 | + time_desc: "Newest first", |
1564 | 1566 | name_asc: "Name A-Z", |
1565 | 1567 | name_desc: "Name Z-A", |
1566 | | - type: "Type" |
| 1568 | + type: "File type" |
1567 | 1569 | }; |
1568 | 1570 | return mapping[currentSort] || "Sort files"; |
1569 | 1571 | })() |
|
2383 | 2385 | action: (itemuid) => window.parent.makewall(itemuid), |
2384 | 2386 | condition: async (file) => (await ntxSession.send("utility.getBaseFileType", getFileExtension(file.fileName))) === 'image', |
2385 | 2387 | }, |
| 2388 | + exportFile: { |
| 2389 | + icon: 'file_save', |
| 2390 | + icon_color: '#b5ead7', |
| 2391 | + label: 'Export file', |
| 2392 | + action: async (itemuid) => { |
| 2393 | + let file = await ntxSession.send("fileGet.byId", itemuid) |
| 2394 | + let [meta, b64] = file.content.split(',') |
| 2395 | + let mime = meta.match(/:(.*?);/)[1] |
| 2396 | + let binary = atob(b64) |
| 2397 | + let len = binary.length |
| 2398 | + let bytes = new Uint8Array(len) |
| 2399 | + for (let i = 0; i < len; i++) bytes[i] = binary.charCodeAt(i) |
| 2400 | + let blob = new Blob([bytes], { type: mime }) |
| 2401 | + let url = URL.createObjectURL(blob) |
| 2402 | + let link = document.createElement("a") |
| 2403 | + link.href = url |
| 2404 | + link.download = file.fileName |
| 2405 | + document.body.appendChild(link) |
| 2406 | + link.click() |
| 2407 | + document.body.removeChild(link) |
| 2408 | + URL.revokeObjectURL(url) |
| 2409 | + }, |
| 2410 | + condition: (file) => true, |
| 2411 | + }, |
2386 | 2412 | copyId: { |
2387 | 2413 | icon: 'content_copy', |
2388 | 2414 | icon_color: '#b5ead7', |
|
0 commit comments