-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFiles.js
More file actions
173 lines (141 loc) · 4.32 KB
/
Copy pathFiles.js
File metadata and controls
173 lines (141 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
function open_files() {
open_app("files-app", "FILES", `
<div class="files-body">
<div class="sidebar">
<button onclick="show_files('documents')">Documents</button>
<hr />
<button onclick="show_files('pictures')">Pictures</button>
<hr />
<button onclick="show_files('audios')">Audios</button>
<hr />
<button onclick="show_files('videos')">Videos</button>
</div>
<div id="files-collection"></div>
</div>
`);
show_files("documents");
};
let default_files = [
{
folder: "Documents",
icon: "Pictures/PDF (Icon).png",
path: "Documents/Hitarth Pathak.pdf",
type: "documents"
},
{
folder: "Pictures",
icon: "Pictures/App Icon (Default).png",
path: "Pictures/App Icon (Default).png",
type: "pictures"
},
{
folder: "Pictures",
icon: "Pictures/User.png",
path: "Pictures/User.png",
type: "pictures"
},
{
folder: "Pictures",
icon: "Pictures/Wallpaper.jpg",
path: "Pictures/Wallpaper.jpg",
type: "pictures"
},
{
folder: "Pictures",
icon: "Pictures/Files App (Icon).png",
path: "Pictures/Files App (Icon).png",
type: "pictures"
},
{
folder: "Pictures",
icon: "Pictures/Browser App (Icon).png",
path: "Pictures/Browser App (Icon).png",
type: "pictures"
},
{
folder: "Pictures",
icon: "Pictures/Trash App (Icon).png",
path: "Pictures/Trash App (Icon).png",
type: "pictures"
},
{
folder: "Pictures",
icon: "Pictures/Clock App (Icon).png",
path: "Pictures/Clock App (Icon).png",
type: "pictures"
},
{
folder: "Pictures",
icon: "Pictures/Audio (Icon).png",
path: "Pictures/Audio (Icon).png",
type: "pictures"
},
{
folder: "Pictures",
icon: "Pictures/Video (Icon).png",
path: "Pictures/Video (Icon).png",
type: "pictures"
},
{
folder: "Pictures",
icon: "Pictures/Folder (Icon).png",
path: "Pictures/Folder (Icon).png",
type: "pictures"
},
{
folder: "Pictures",
icon: "Pictures/PDF (Icon).png",
path: "Pictures/PDF (Icon).png",
type: "pictures"
},
{
folder: "Pictures",
icon: "Pictures/Word (Icon).png",
path: "Pictures/Word (Icon).png",
type: "pictures"
},
{
folder: "Audio",
icon: "Pictures/Audio (Icon).png",
path: "Audios/Error.mp3",
type: "audios"
},
{
folder: "Audios",
icon: "Pictures/Audio (Icon).png",
path: "Audios/Startup Sound.mp3",
type: "audios"
},
{
folder: "Videos",
icon: "Pictures/Video (Icon).png",
path: "Videos/Ayesha Hashmi.mp4",
type: "videos"
},
];
function show_files(type) {
let files_collection = document.getElementById("files-collection");
files_collection.innerHTML = "";
let sidebar_buttons = document.querySelectorAll(".sidebar button");
sidebar_buttons.forEach((button) => button.classList.remove("active"));
let active_button = Array.from(sidebar_buttons).find((button) => button.textContent.toLowerCase() == type);
if (active_button) active_button.classList.add("active");
let filtered_files = default_files.filter((file) => file.type == type);
filtered_files.forEach((file) => {
let individual_file = document.createElement("div");
individual_file.classList.add("file");
individual_file.setAttribute("onclick", `open_file_viewer("${file.path}")`);
let file_icon = document.createElement("img");
file_icon.classList.add("icon");
file_icon.style.maxWidth = "5vw";
file_icon.id = "file-icon";
file_icon.src = file.icon;
file_icon.alt = "Icon";
let file_name = document.createElement("span");
file_name.id = "file-name";
file_name.textContent = file.path.split("/").pop();
individual_file.appendChild(file_icon);
individual_file.appendChild(file_name);
files_collection.appendChild(individual_file);
});
};