-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
629 lines (531 loc) · 19.2 KB
/
Copy pathscript.js
File metadata and controls
629 lines (531 loc) · 19.2 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
const bootText = document.getElementById("bootText");
const bootLines = [
`
██████ █████ ███████ █████████
░░██████ ░░███ ███░░░░░███ ███░░░░░███
░███░███ ░███ ██████ █████████████ ███ ░░███░███ ░░░
░███░░███░███ ███░░███░░███░░███░░███ ░███ ░███░░█████████
░███ ░░██████ ░███████ ░███ ░███ ░███ ░███ ░███ ░░░░░░░░███
░███ ░░█████ ░███░░░ ░███ ░███ ░███ ░░███ ███ ███ ░███
█████ ░░█████░░██████ █████░███ █████ ░░░███████░ ░░█████████
░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░ ░░░░░ ░░░░░░░ ░░░░░░░░░
`,
"NemOS RECOVERY BOOT LOADER v0.13",
"",
"Checking archive integrity...",
"[CORRUPTED]",
"",
"Mounting archive sectors...",
"[PARTIAL]",
"",
"Scanning memory partitions...",
"[WARNING]",
"",
"Loading user profile...",
"",
"User:",
"[Nemo]",
"",
"Identity verification...",
"[FAILED]",
"",
"Attempting reconstruction...",
"[ERROR 0x0013]",
"",
"Archive owner could not be verified.",
"",
"Recovered records:",
"- ARCHIVE_NOTICE.txt",
"- README_FIRST.txt",
"",
"Corrupted records:",
"[UNKNOWN]",
"",
"Missing records:",
"[UNKNOWN]",
"",
"ERROR 0x0013",
"ERROR 0x0013",
"ERROR 0x0013",
"",
"[REDACTED]",
"",
"Project [NULL] records detected.",
"",
"WARNING:",
"Recovered files may contain altered or incomplete information.",
"",
"[REDACTED]:",
"01001001 00100000 01100001 01101101 00100000 01110011 01101111 01110010 01110010 01111001 00100000 01100111 01110010 01100001 01101110 01100100 01101101 01100001 00101110 00101110 00101110 00100000",
"",
"Grant access to launch NemOS? (Y/N)",
];
let lineIndex = 0;
let waitingForAnswer = false;
function launchDesktop() {
document.getElementById("bootScreen").style.display = "none";
document.getElementById("desktop").style.display = "block";
}
const line = bootLines[lineIndex];
function addLine(line) {
if (
line.includes("ERROR") ||
line.includes("WARNING") ||
line.includes("REDACTED") ||
line.includes("UNKNOWN") ||
line.includes("FAILED") ||
line.includes("CORRUPTED") ||
line.includes("PARTIAL")
) {
bootText.innerHTML +=
`<span class="red">${line}</span>\n`;
} else {
bootText.innerHTML += line + "\n";
}
window.scrollTo(0, document.body.scrollHeight);
const bootScreen = document.getElementById("bootScreen");
requestAnimationFrame(() => {
bootScreen.scrollTop = bootScreen.scrollHeight;
});
}
function typeBootLine() {
if (lineIndex >= bootLines.length) {
waitingForAnswer = true;
return;
}
addLine(bootLines[lineIndex]);
lineIndex++;
setTimeout(typeBootLine, 250);
}
document.addEventListener("keydown", function(event) {
if (!waitingForAnswer) return;
const key = event.key.toLowerCase();
if (key !== "y" && key !== "n") return;
waitingForAnswer = false;
addLine("");
addLine("> " + key.toUpperCase());
addLine("");
if (key == "y") {
addLine("Access granted.");
addLine("");
addLine("[REDACTED]:")
addLine("01010100 01101000 01100001 01101110 01101011 00100000 01111001 01101111 01110101 00100000 01110011 01101111 00100000 01101101 01110101 01100011 01101000 00100000 01110110 01101001 01100101 01110111 01100101 01110010 00101110 00101110 00101110");
addLine("");
addLine("Launching NemOS...");
setTimeout(launchDesktop, 1500);
} else {
addLine("Access denied.");
addLine("");
addLine("ERROR: Firewall integrity compromised.");
addLine("ERROR: Unauthorized process detected.");
addLine("");
addLine("[REDACTED]:")
addLine("01010000 01101100 01100101 01100001 01110011 01100101 00100000 01100100 01101111 01101110 00100111 01110100 00100000 01100111 01101111 00100000 01100001 01110111 01100001 01111001 00101110 00101110 00101110 00100000");
addLine("");
addLine("Forceful access granted to NemOS.");
addLine("Launching NemOS...");
setTimeout(launchDesktop, 2500);
}
});
typeBootLine();
setInterval(function () {
document.querySelector("#timeElement").innerHTML = new
Date().toLocaleString();
}, 1000);
dragElement(
document.getElementById("welcomeWindow"),
document.getElementById("welcomeHeader")
);
function dragElement(element, header) {
var initialX = 0;
var initialY = 0;
var currentX = 0;
var currentY = 0;
header.onmousedown = dragMouseDown;
function dragMouseDown(e) {
e = e || window.event;
e.preventDefault();
initialX = e.clientX;
initialY = e.clientY;
document.onmouseup = stopDragging;
document.onmousemove = dragWindow;
}
function dragWindow(e) {
e = e || window.event;
e.preventDefault();
currentX = initialX - e.clientX;
currentY = initialY - e.clientY;
initialX = e.clientX;
initialY = e.clientY;
let newTop = element.offsetTop - currentY;
let newLeft = element.offsetLeft - currentX;
newTop = Math.max(
47,
Math.min(newTop, window.innerHeight - element.offsetHeight)
);
newLeft = Math.max(
0,
Math.min(newLeft, window.innerWidth - element.offsetWidth)
);
element.style.top = newTop + "px";
element.style.left = newLeft + "px";
}
function stopDragging() {
document.onmouseup = null;
document.onmousemove = null;
}
}
var welcomeScreen = document.querySelector("#welcomeWindow")
function closeWindow(element) {
element.style.display = "none"
}
function openWindow(element) {
element.style.display = "flex"
}
var welcomeScreenClose = document.querySelector('#welcomeClose');
var welcomeScreenOpen = document.querySelector('#welcomeOpen');
welcomeScreenClose.addEventListener("click", function() {
closeWindow(welcomeScreen);
});
const icon = document.getElementById("nemoTXTIcon");
const windowElement = document.getElementById("nemoTXT");
const closeButton = document.getElementById("txtClose");
let selectedIcon = null;
icon.addEventListener("click", () => {
document.querySelectorAll(".desktopIcon").forEach(i => i.classList.remove("selected"));
icon.classList.add("selected");
});
icon.addEventListener("dblclick", () => {
icon.classList.add("selected");
windowElement.style.display = "block";
});
const archiveItems = [
{
id: "diaryFolder",
name: "Daily_Diary",
type: "folder",
unlocked: true,
expanded: false
},
{
id: "labFolder",
type: "folder",
name: "Lab_Logs",
unlocked: false,
expanded: false
},
{
id: "securityFolder",
type: "folder",
name: "Security_Footage",
unlocked: false,
expanded: false
},
{
id: "diary001",
parent: "diaryFolder",
type: "file",
name: "diary_001.txt",
unlocked: true,
content: `
Day 1 on the new project.
They're calling it "Ti-plasmid downprocessing"
which sounds much cooler than what I studied
in college for the past 4 years.
Grandma made cabbage rolls tonight.
I told her about the lab.
She pretends to understand every word.
I love her. She's my reason for living.
[05. 04. 2007]`
},
{
id: "diary002",
name: "diary_002.txt",
type: "file",
parent: "diaryFolder",
unlocked: false,
content: `
Day 2 on the project.
Today I met my supervisor.
His name is [REDACTED], CODENAME: Donut.
Today he just stood next to my working bench
for 3 hours and 41 minutes without saying a word.
When I asked him why was he here, he just ignored me as if I wasn't there.
And I swear he looked really happy when leaving... That smile was kind of horrifying...
I am probably overthinking stuff...
He assigned me for a overtime today so I can't go back home to tell this
all to grandma ;-;
I am sure she would've said the most comforting words and
all my worries would've vanished :]
I really dont deserver her love :<
For now I just hope Donut is a nice chill guy.
He came early morning said he was worried if I was doing fine during my
first overnight overtime...
He asked me to make coffee for both of us ;-; supervisor perks I guess
But when I came back I saw him quickly move away from my desk I wonder
what he was doing... Surely not something I gotta worry about.
01001110 01100101 01110110 01100101 01110010 00100000 01110100 01110010 01110101
01110011 01110100 00100000 01000100 01101111 01101110 01110101 01110100
[06. 04. 2007]`
},
{
id: "diary003",
parent: "diaryFolder",
type: "file",
name: "diary_003.txt",
unlocked: false,
hidden: true,
content: `
Note:
(if someone is seeing this... I dont think anyone will see but if you
do see this please dont forget me)
This shouldn't have been restored.
Why do the files keep restoring?!
If anyone is reading this,
the archive isn't behaving normally.
Files meant to be deleted are getting restored... infact this file shouldn't exist must..
delete.. diary.
I can't let him see these. [REDACTED] will make me go through that pain again...
I can't take this anymore.
I swear someone else is behind this but he keeps telling
this is just because I am too stressed from working this is my first job after all.
13: 01000100 01101111 01101110 00100111 01110100 00100000 01101100 01100101 01110100
00100000 01101000 01101001 01101101 00100000 01100111 01100101 01110100 00100000
01111001 01101111 01110101 00100000 01100010 01111001 00100000 01101000 01101001
01110011 00100000 01110011 01110101 01100111 01100001 01110010 00100000 01100011
01101111 01100001 01110100 01100101 01100100 00100000 01110111 01101111 01110010
01100100 01110011 00101110 00101110 00101110 00100000 01010000 01100001 01110100
01101000 01110011 00100000 01100110 01101001 01101100 01101100 01100101 01100100
00100000 01110111 01101001 01110100 01101000 00100000 01101100 01101001 01100111
01101000 01110100 00100000 01100001 01110010 01100101 00100000 01101110 01101111
01110100 00100000 01100001 01101100 01110111 01100001 01111001 01110011 00100000
01110100 01101000 01100101 00100000 01110010 01101001 01100111 01101000 01110100
00100000 01110000 01100001 01110100 01101000 00101110`
}
];
function renderExplorer() {
const explorer = document.getElementById("explorerContent");
explorer.innerHTML = "";
const root=document.createElement("div");
root.className="explorerRoot";
root.innerText="▼ ROOT";
explorer.appendChild(root);
archiveItems.forEach(item=>{
if(item.type==="folder" && item.unlocked){
const folder=document.createElement("div");
folder.className="explorerFolder";
folder.innerText=(item.expanded ? "├── " : "├── ") + item.name;
folder.style.cursor = "pointer";
folder.onclick=()=>{
item.expanded=!item.expanded;
renderExplorer();
};
explorer.appendChild(folder);
if(item.expanded){
const children = archiveItems.filter(
child => child.parent === item.id && child.unlocked
);
children.forEach((child,index)=>{
if(child.parent===item.id && child.unlocked && !child.hidden){
const file=document.createElement("div");
file.className="explorerFile";
file.style.paddingLeft="30px";
const branch = index === children.length-1 ? "└──" : "├──";
file.innerText = " " + branch + child.name;
file.ondblclick=()=>openFile(child);
explorer.appendChild(file);
}
});
}
}
});
}
function openFile(file) {
document.getElementById("viewerTitle").innerText = file.name;
document.getElementById("viewerContent").value = file.content;
openWindow(document.getElementById("fileViewer"));
if (file.id === "diary001") {
archiveItems.find(f => f.id === "diary002").unlocked = true;
renderExplorer();
}
}
document.getElementById("viewerClose").addEventListener("click", () => {
closeWindow(document.getElementById("fileViewer"));
});
dragElement(document.getElementById("fileViewer"), document.getElementById("fileViewerHeader"));
closeButton.addEventListener("click", () => {
windowElement.style.display = "none";
});
document.addEventListener("click", (e) => {
if (
!icon.contains(e.target) &&
!windowElement.contains(e.target)
) {
icon.classList.remove("selected");
}
});
var biggestIndex = 1;
function addWindowTapHandling(element) {
element.addEventListener("mousedown", () =>
handleWindowTap(element)
)
}
function handleWindowTap(element) {
biggestIndex++;
element.style.zIndex = biggestIndex;
}
function openWindow(element) {
element.style.display = "flex";
biggestIndex++;
element.style.zIndex = biggestIndex;
}
const nemoTXTIcon = addEventListener("dbclick", () => {
nemoTXTIcon.classList.add("selected");
openWindow(txtWindow);
})
dragWindow(
document.getElementById("nemoTXT"),
document.getElementById("txtHeader")
);
function dragWindow(windowElement, headerElement) {
let pos1 = 0;
let pos2 = 0;
let pos3 = 0;
let pos4 = 0;
headerElement.onmousedown = dragMouseDown;
function dragMouseDown(e) {
e = e || window.event;
e.preventDefault();
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
document.onmousemove = elementDrag;
}
function elementDrag(e) {
e = e || window.event;
e.preventDefault();
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
let newTop = windowElement.offsetTop - pos2;
let newLeft = windowElement.offsetLeft - pos1;
const topBarHeight = document.querySelector(".topBar").offsetHeight;
newTop = Math.max(
topBarHeight,
Math.min(
newTop,
window.innerHeight - windowElement.offsetHeight
)
);
newLeft = Math.max(
0,
Math.min(
newLeft,
window.innerWidth - windowElement.offsetWidth
)
);
windowElement.style.top = newTop + "px";
windowElement.style.left = newLeft + "px";
}
function closeDragElement() {
document.onmouseup = null;
document.onmousemove = null;
}
}
addWindowTapHandling(document.getElementById("welcomeWindow"));
addWindowTapHandling(document.getElementById("nemoTXT"));
addWindowTapHandling(document.getElementById("fileViewer"));
document.getElementById("fileText").value = `
[NOTES: LAST SYNC FAILED]
If you are reading this then the sync system probably broke again.
Not surpriseing.
Most things in this archive seem to break eventually.
This folder mostly exists so I don't forget things.
Work notes.
Ideas.
Daily diary.
Reminders.
Recipes grandma keeps insisting I'll lose.
Nothing important.
If files seem incomplete, they're probably corrupted.
Maybe hidden too.
I don't really have an explanation for that one.
Anyways.
If I forget something important, it's probably somewhere else in the
archive.
- [REDACTED], CODENAME: Nemo
01110100 01111001 01110000 01100101 00100000 01110100 01101000 01101001 01110011 00100000 01101001 01110011 00100000 01110100 01101000 01100101 00100000 01110100 01100101 01111000 01110100 00100000 01100010 01101111 01111000 00100000 01100001 01100010 01101111 01110110 01100101
2:9; 3:11; 4:1; 5:16; 9:3; 13:4; 17:7; 18:3;
`;
const readmeCommand = document.getElementById("readmeCommand");
readmeCommand.addEventListener("keydown", function(e){
if(e.key !== "Enter") return;
const command = this.value.trim().toLowerCase();
this.value = "";
if(command === "remember"){
document.getElementById("archiveExplorerIcon").style.display="block";
document.getElementById("fileText").value +=
`\n\n> ${command}
[ARCHIVE RESTORED]
Recovery progress increased by 1.
ARCHIVE_EXPLORER.exe restored.
NemOS is everchanging...`;
fileText.scrollTop = fileText.scrollHeight;
}
else if(command==="show hidden"){
const hiddenFile = archiveItems.find(f=>f.id==="diary003");
if(hiddenFile){
hiddenFile.hidden=false;
hiddenFile.unlocked = true;
renderExplorer();
}
document.getElementById("fileText").value+=
`> ${command}
Archive preference changed.
Deleted entries are now visible.
`;
fileText.scrollTop = fileText.scrollHeight;
}
else{
document.getElementById("fileText").value +=
`\n\n> ${command}
No response.`;
fileText.scrollTop = fileText.scrollHeight;
}
});
const archiveExplorerWindow = document.getElementById("archiveExplorerWindow");
const archiveExplorerIcon = document.getElementById("archiveExplorerIcon");
archiveExplorerIcon.addEventListener("click", () => {
document.querySelectorAll(".desktopIcon").forEach(i => i.classList.remove("selected"));
archiveExplorerIcon.classList.add("selected");
});
archiveExplorerIcon.addEventListener("dblclick", () => {
openWindow(
archiveExplorerWindow
);
});
const archiveExplorerClose = document.getElementById("archiveExplorerClose");
archiveExplorerClose.addEventListener(
"click", () => {
closeWindow(
archiveExplorerWindow
);
}
);
dragElement(
document.getElementById("archiveExplorerWindow"),
document.getElementById("archiveExplorerHeader")
);
addWindowTapHandling(
document.getElementById("archiveExplorerWindow")
);
document.addEventListener("click", (e) => {
if (
!archiveExplorerIcon.contains(e.target) &&
!archiveExplorerWindow.contains(e.target)
) {
!archiveExplorerIcon.classList.remove("selected");
}
});
renderExplorer();