Skip to content

Commit bacc323

Browse files
1 parent f9b40d0 commit bacc323

3 files changed

Lines changed: 48 additions & 20 deletions

File tree

appdata/files.html

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -593,11 +593,13 @@
593593
background-color: var(--col-bg3);
594594
border-radius: var(--siz-radius1);
595595

596-
&>span{
596+
&>span {
597597
transform: scale(0.9);
598+
598599
&.droptglbtn {
599-
transform: translateY(3px);
600-
}}
600+
transform: translateY(3px);
601+
}
602+
}
601603
}
602604

603605
[flap-fl-topnav] div {
@@ -1528,11 +1530,11 @@
15281530
title: "Sort files",
15291531
onclick: async function () {
15301532
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" },
15331535
{ label: "Name A-Z", mode: "name_asc", icon: "sort_by_alpha" },
15341536
{ 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" }
15361538
];
15371539
const selected = await window.parent.showDropdownModal(
15381540
"Sort files",
@@ -1559,11 +1561,11 @@
15591561
})(),
15601562
label: (() => {
15611563
const mapping = {
1562-
time_asc: "Time ↑",
1563-
time_desc: "Time ↓",
1564+
time_asc: "Oldest first",
1565+
time_desc: "Newest first",
15641566
name_asc: "Name A-Z",
15651567
name_desc: "Name Z-A",
1566-
type: "Type"
1568+
type: "File type"
15671569
};
15681570
return mapping[currentSort] || "Sort files";
15691571
})()
@@ -2383,6 +2385,30 @@
23832385
action: (itemuid) => window.parent.makewall(itemuid),
23842386
condition: async (file) => (await ntxSession.send("utility.getBaseFileType", getFileExtension(file.fileName))) === 'image',
23852387
},
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+
},
23862412
copyId: {
23872413
icon: 'content_copy',
23882414
icon_color: '#b5ead7',

script.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ async function openn() {
390390
}
391391
}
392392
gid("appdmod").showModal();
393-
document.activeElement.blur()
393+
document.activeElement.blur()
394394
}
395395
async function loadrecentapps() {
396396
gid("serrecentapps").innerHTML = ``
@@ -989,15 +989,17 @@ function openModal(type, { title = '', message, options = null, status = null, p
989989
const modalItemsCont = document.createElement('div');
990990
modalItemsCont.classList.add('modal-items');
991991

992-
const icon = document.createElement('span');
993-
icon.classList.add('material-symbols-rounded');
994-
let ic = "warning";
995-
if (status === "success") ic = "check_circle";
996-
else if (status === "failed") ic = "dangerous";
997-
icon.textContent = ic;
998-
icon.classList.add('modal-icon');
999-
modalItemsCont.appendChild(icon);
992+
if (status) {
993+
const icon = document.createElement('span');
994+
icon.classList.add('material-symbols-rounded');
995+
let ic = "warning";
996+
if (status === "success") ic = "check_circle";
997+
else if (status === "failed") ic = "dangerous";
998+
icon.textContent = ic;
999+
icon.classList.add('modal-icon');
1000+
modalItemsCont.appendChild(icon);
10001001

1002+
}
10011003
if (title && title.length > 0) {
10021004

10031005
const h1 = document.createElement('h1');

versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"files":1.2,
2+
"files":1.3,
33
"store":1.4,
44
"browser":1,
55
"camera":1.1,
66
"calculator":1,
77
"gallery":1.1,
88
"musicplr":1.1,
9-
"settings":1.1,
9+
"settings":1.2,
1010
"text":1,
1111
"studio":1.1,
1212
"time":1.1

0 commit comments

Comments
 (0)