-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
1174 lines (1047 loc) · 49.1 KB
/
script.js
File metadata and controls
1174 lines (1047 loc) · 49.1 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
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//! TO_DO: projects, mini_projects, posts, fortune, secret, print
//programming quotes, calculator, weather.
function replaceNewlinesWithBreaks(text) {
return text.replace(/\n/g, '<br>');
}
let about_me_txt = replaceNewlinesWithBreaks("\n Hi! I'm Brandon Ramirez, computer science senior at the University of Houston - Clear Lake!\n" +
"I love to challenge myself and find creative ways to solve complex problems. I like making \n" +
"software that provides value to other people and the process of making/learning new and novel \n" +
"things. Whenever I have free time I like playing guitar, going to the gym, digital art, writing,\n" +
"and teaching! My technical interests include software/game development, web dev, GNU/Linux,\n" +
"and open source! :)\n");
let help_txt =
`<br>
{ <br>
"valid_commands": { <br><br>
"help" : "print list of valid commands to standard output", <br>
"whoami" : "short description of who I am", <br>
"resume" : "print simple version of my resume",<br>
"projects" : "list of projects",<br>
"mini_projects" : "list of small, simple projects",<br>
"posts" : "scientific/technical articles I've written",<br>
"banner" : "print ascii art name + site instructions", <br>
"nufetch" : "system information tool", <br>
"paper" : "change wallpaper",<br>
"dark" : "dark website theme(default)",<br>
"light" : "light website theme",<br>
"sound" : "play music",<br>
"stop" : "stop music", <br>
"fortune" : "receive a fortune", <br>
"echo [str]" : "print custom text to std output", <br>
"secret" : "mystery", <br>
"hist" : "show user command history",<br>
"s" : "simple version of this website [Github profile]", <br>
"t-repo" : "Github repository for this resume",<br>
"clear" : "clear std output"<br><br>
} <br>
} <br>
`;
let resume_txt =
`<br>
#####################################################################################################################################<br><br>
TECHNICAL SKILLS/TECHNOLOGIES<br>
Languages: Java, C#, Python, HTML5, CSS3, & JavaScript. Experience with C++, SQL, & MASM x86<br>
Development Tools: JetBrains IDEs, VS/Code, MySQL Workbench, Node.js, Unity, Blender®, & Monday.com<br>
Frameworks/Platforms: ASP.NET Core, Arduino Uno R3<br>
Libraries/Testing: React.js, P5.js, Junit, Jest, npm<br>
Hard Skills: Git, Bash, Vim, i3wm, Emmet, SSH, Jupyter Notebooks, LaTeX, Markdown<br>
Operating Systems: Debian© based distributions (Linux Mint, Raspberry Pi), Windows 7/10<br>
Additional Skills: Spanish (Native), R/RStudio<br>
<br><br>
EDUCATION<br>
Bachelor of Science – Computer Science Graduation Date: December 2023<br>
University of Houston-Clear Lake; Houston, TX<br><br>
Associates of Science – General Studies May 2021<br>
Galveston College; Galveston, TX<br><br>
Relevant coursework: Computer Org & Assembly Lang, Advanced Data Structures & Algorithms, Web Application Development,<br>
Programming Language Concepts, Machine Learning, Enterprise Java & Frameworks, & Design of Database Systems.<br>
<br><br>
RELEVANT PROJECTS<br>
• IEEE 754 Floating Point Calculator (Final Project) | (https://tinyurl.com/mrma7yxu) Fall 2022<br>
Multi-number system floating-point calculator with .NET Core Forms app for software engineering class (SWEN 4342). Was<br>
responsible for programming, researching, prototyping, & testing. Used Waterfall methodology and held meetings with instructor.<br>
Tech stack: .NET Core, C#, & Monday.com<br>
<br><br>
PROFESSIONAL EXPERIENCE<br>
Code Sensei March 2023 - Present<br>
Code Ninjas - League City, TX<br>
• Learned & taught Code Ninjas® curriculum, taught basic skills in coding, engineering, & game development<br>
• Responsible for facilitating/leading workshops in applied computing, advanced game development, and robotics<br>
• Catered to needs of different students and fostered problem solving, logic, & STEM skills<br><br>
Website Administrator/Developer July 2022 - August 2022<br>
CoPilot - College Forward; Salesforce application<br>
• Renovated and added functionality to: https://collegeforward.org/copilot/ using WordPress & Elementor<br>
• Created and modified HTML & CSS code to comply with company style/requirements<br>
• Implemented internal training platform content for future employees<br><br>
IT Administrator Intern June 2021 - August 2021<br>
Moody Gardens - Galveston, TX<br>
• Restored functionality to old computers via updating software and replacing hardware components<br>
• Managed multifunction/ticketing printer repairs<br>
• Troubleshot internet issues using CLI and monitoring system processes<br><br>
#####################################################################################################################################<br>
<br><br>
Copy of full resume has been downloaded!
<br>`;
let socials_txt = `<br> Show a nice version of media (use banner shields)<br>`;
let date_cal_weather_txt = `<br> Show local weather and time information<br>`;
let projects_txt = `<br> List of projects, links, and instructions<br>`;
let mini_projects_txt = ` <br> List/Redirect to mini-projects<br>`;
let technical_posts_txt = `<br> Papers, scientific documents, technical posts, its all fun!<br>`;
let preBanner = document.createElement('pre');
preBanner.textContent = `
________
$$$$$$$\ $$\ | \ $$$$$$$\ $$\
$$ __$$\ $$ | | $$$$$$$$ $$ __$$\ \__|
$$ | $$ | $$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$$ | $$$$$$\ $$$$$$$\ | $$__ $$ | $$ | $$$$$$\ $$$$$$\$$$$\ $$\ $$$$$$\ $$$$$$\ $$$$$$$$\
$$$$$$$\ |$$ __$$\ \____$$\ $$ __$$\ $$ __$$ |$$ __$$\ $$ __$$\ | $$ \ $$$$$$$ | \____$$\ $$ _$$ _$$\ $$ |$$ __$$\ $$ __$$\ \____$$ |
$$ __$$\ $$ | \__|$$$$$$$ |$$ | $$ |$$ / $$ |$$ / $$ |$$ | $$ | | $$$$$ $$ __$$< $$$$$$$ |$$ / $$ / $$ |$$ |$$ | \__|$$$$$$$$ | $$$$ _/
$$ | $$ |$$ | $$ __$$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ | | $$___ $$ | $$ |$$ __$$ |$$ | $$ | $$ |$$ |$$ | $$ ____| $$ _/
$$$$$$$ |$$ | \$$$$$$$ |$$ | $$ |\$$$$$$$ |\$$$$$$ |$$ | $$ | | $$ \ $$ | $$ |\$$$$$$$ |$$ | $$ | $$ |$$ |$$ | \$$$$$$$\ $$$$$$$$\
\_______/ \__| \_______|\__| \__| \_______| \______/ \__| \__| \$$$$$$$$ \__| \__| \_______|\__| \__| \__|\__|\__| \_______|\________| v1.0.2
`;
// Create the main banner text
let banner_txt = `<br>
Hello world! Welcome to my beautiful website fellow humans and bots...<br>
<br>
This is an interactive retro terminal portfolio! Please type in commands and press "Enter" to<br>
uncover more information about its creator and work. Here you will find my personal projects,<br>
technical blog posts, and other random stuff I've been working on lately...feel free to reach out to me!<br>
<br>
Type "help" for a list of available commands<br>
This project is now open source, type 't-repo' to check it out<br>
For a simplified version, type 's'<br>
`;
let fortune_txt = `<br> Receive a ✨fortune✨<br>`;
//let secret_txt = `<br> Easter egg? Cicada type stuff coming soon <br>`;
let clear_text = `The terminal has been cleared!`;
let ok = "[ OK ] "
let dot = "..." + "<br>";
let loading_txt =
`<br>
${ok}Starting GRUB boot detection${dot}
${ok}Setting console scheme${dot}
${ok}Running diagnostics${dot}
${ok}Started User Login Management${dot}
${ok}Started Console Daemon${dot}
${ok}Loading UNIX Secure Shell Server${dot}
${ok}Started LSB: automatic crash report generation${dot}
${ok}Initializing Boot Sections${dot}
${ok}Implementing Routine Directories${dot}
${ok}Reached Target Login Prompts${dot}
${ok}Started Time & Date Service${dot}
${ok}Waiting on seed regeration${dot} <br>
UNIX OS 22.04.1. LTS localhost <br>
<br> Easter egg? Cicada type stuff coming soon <br>
`
//banner art: https://patorjk.com/software/taag/#p=testall&f=Crawford2&t=Ramirez
/***
* /$$$$$$$ /$$ /$$$$$$$$ /$$$$$$$ /$$
* | $$__ $$ | $$ | $$_____/ | $$__ $$ |__/
* | $$ \ $$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ | $$ | $$ \ $$ /$$$$$$ /$$$$$$/$$$$ /$$ /$$$$$$ /$$$$$$ /$$$$$$$$
* | $$$$$$$ /$$__ $$|____ $$| $$__ $$ /$$__ $$ /$$__ $$| $$__ $$ | $$$$$ | $$$$$$$/ |____ $$| $$_ $$_ $$| $$ /$$__ $$ /$$__ $$|____ /$$/
* | $$__ $$| $$ \__/ /$$$$$$$| $$ \ $$| $$ | $$| $$ \ $$| $$ \ $$ | $$__/ | $$__ $$ /$$$$$$$| $$ \ $$ \ $$| $$| $$ \__/| $$$$$$$$ /$$$$/
* | $$ \ $$| $$ /$$__ $$| $$ | $$| $$ | $$| $$ | $$| $$ | $$ | $$ | $$ \ $$ /$$__ $$| $$ | $$ | $$| $$| $$ | $$_____/ /$$__/
* | $$$$$$$/| $$ | $$$$$$$| $$ | $$| $$$$$$$| $$$$$$/| $$ | $$ | $$$$$$$$ | $$ | $$| $$$$$$$| $$ | $$ | $$| $$| $$ | $$$$$$$ /$$$$$$$$
* |_______/ |__/ \_______/|__/ |__/ \_______/ \______/ |__/ |__/ |________/ |__/ |__/ \_______/|__/ |__/ |__/|__/|__/ \_______/|________/
*/
//*Everything above this line is "content", logic below...
let typeWriterRate = 10;
console.log("Hello world!");
const validCommands = ["load", "whoami", "resume", "nufetch", "paper", "banner", "help", "fortune", "secret", "projects", "dark", "light","posts", "mini_projects", "t-repo", "clear", "s", "sound", "stop", "echo", "hist"];
var nfetch = document.getElementById("nuFetchDiv");
var miniProjectsDiv = document.getElementById("mini-projects-div");
var postsDiv = document.getElementById("postsDiv");
var projects = document.getElementById("mainProjects");
var textArt = document.getElementById("text-art");
var textArtClone = textArt.cloneNode(true);
nfetch.style.display = "none"; //does not exist on the page at all
var body = document.querySelector("body");
var input = document.getElementById("inputField");
var output = document.getElementById("outputField");
var button = document.getElementById("myBtn");
var cmnd = document.getElementById("cmnd-prompt");
// Get a reference to the audio element
var audio = document.getElementById("myAudio");
var playButton = document.getElementById("playButton");
//this code checks if enter is ever pressed at any time(button is pressed), in this case the selected text is printed
inputField.addEventListener("keypress", function(event) {
if (event.key === "Enter") {
event.preventDefault();
button.click();
input.style.width = 0;
}
});
function rstInput(){
let div = document.createElement('div');
div.innerHTML = "";
commandStack.push(input.value);
input.value = "";
output.append(div);
window.scrollTo(0, document.body.scrollHeight);
removeDiv();
}
function cmndHist(){
let div = document.createElement('div');
div.innerHTML = `<br>`;
const node = cmnd;
const clone = node.cloneNode(true);//copy of command prompt
output.append(div);
output.append(clone);
output.append(input.value);
}
function displayText(str) {
let div = document.createElement('div');
let span = document.createElement('span');
let preElement = document.createElement('pre');
let brElement = document.createElement('br');
if(input.value.includes("echo", 0)){
cmndHist();
span.innerHTML = `<br><br>` + input.value.substring(5) + `<br>`;
output.append(span);
rstInput();
}else{
switch (str) {
case "load":
cmndHist();
span.innerHTML = loading_txt;
output.append(span);
rstInput();
break;
/*Add CLI audio control rather than with buttons. Hide buttons
sound: plays sound, stop_sound: stops sound
*/
case "sound":
cmndHist();
//div.innerHTML = `<br>Loading sound module...<br>`;
const typewriterSoundText = `<br>Loading sound module...<br>`;
const typewriterSoundElement = div;
output.append(div);
typeWriter(typewriterSoundText, typewriterSoundElement, typeWriterRate);
output.append(div);
playButton.click();
rstInput();
break;
case "stop":
cmndHist();
//div.innerHTML = `<br>Stopping audio...<br>`;
const typewriterStopText = `<br>Stopping audio...<br>`;
const typewriterStopElement = div;
output.append(div);
typeWriter(typewriterStopText, typewriterStopElement, typeWriterRate);
output.append(div);
audio.pause();
playButton.innerHTML = "audio null";
rstInput();
break;
case "paper":
cmndHist();
selectWallpaper();
const typewriterPaperText = `<br> new wallpaper! <br>`;
const typewriterPaperElement = div;
output.append(div);
typeWriter(typewriterPaperText, typewriterPaperElement, typeWriterRate);
//div.innerHTML = `<br> new wallpaper! <br>`;
output.append(div);
rstInput();
break;
case "whoami":
cmndHist();
const typewriterText = about_me_txt;
const typewriterElement = div;
output.append(div);
typeWriter(typewriterText, typewriterElement, typeWriterRate);
//div.innerHTML = about_me_txt;
rstInput();
break;
case "resume":
cmndHist();
var link = document.createElement('a');
link.href = 'assets/documents/Brandon E Ramirez Resume - Fall 2023.pdf';
//link.target = '_blank'; // Open the PDF in a new tab/window
link.download = 'Brandon_Ramirez_Resume' || 'document.pdf'; // Set the default filename if not provided
link.click();
div.innerHTML = resume_txt;
div.style.color = "#1da1f2";
output.append(div);
rstInput();
break;
case "nufetch":
cmndHist();
var newDiv = document.createElement("div");
newDiv = nfetch;
newDiv.style.display = "block"
output.append(newDiv);
rstInput();
break;
case "banner":
cmndHist();
var tArt = document.createElement("div");
tArt = textArtClone;
tArt.style.display = "block"
output.append(tArt);
div.innerHTML = banner_txt;
output.append(div)
rstInput();
break;
case "help":
cmndHist();
div.innerHTML = help_txt;
output.append(div);
/*
const typewriterHelpText = help_txt;
const typewriterHelpElement = div;
output.append(div);
typeWriter(typewriterHelpText, typewriterHelpElement, typeWriterRate);
*/
rstInput();
break;
case "fortune":
cmndHist();
let fortuneIndex = getRandomInt(0, fortuneArr.length);
let fortuneArrSize = fortuneArr.length;
let usrFortune = replaceNewlinesWithBreaks(`\nfortune[${fortuneIndex}/${fortuneArrSize}]: \"${fortuneArr[fortuneIndex]}\"`);
//div.innerHTML = usrFortune;
let typewriterFortuneElement = div;
typeWriter(usrFortune, typewriterFortuneElement, typeWriterRate);
output.append(div);
rstInput();
break;
case "dark":
cmndHist()
output.style.color = "#ffffff";
body.style.backdropFilter = "brightness(20%) blur(5px)";
rstInput();
break;
case "light":
cmndHist();
output.style.color = "#ebdbb2";
body.style.backdropFilter = "blur(10px) brightness(50%)";
rstInput();
break;
case "secret":
cmndHist();
let typewriterLoadElement = div;
typeWriter(loading_txt, typewriterLoadElement, typeWriterRate);
output.append(div);
rstInput();
break;
case "projects":
cmndHist();
/*
div.innerHTML = projects_txt;
output.append(div);
*/
newDiv = projects;
newDiv.style.display = "block"
div.innerHTML = `<br>`;
output.append(div);
output.append(newDiv);
rstInput();
break;
case "posts":
cmndHist();
newDiv = postsDiv;
newDiv.style.display = "block"
div.innerHTML = `<br>`;
output.append(div);
output.append(newDiv);
rstInput();
break;
case "mini_projects":
//div.innerHTML = mini_projects_txt;
cmndHist();
newDiv = miniProjectsDiv;
newDiv.style.display = "block"
div.innerHTML = `<br>`;
output.append(div)
output.append(newDiv);
rstInput();
break;
case "t-repo":
cmndHist();
window.open("https://github.com/Brandon-E-Ramirez/terminal_portfolio", "_blank");//will send user to repo for this website;
div.innerHTML = `<br> Redirecting to website...\"https://github.com/Brandon-E-Ramirez/terminal_portfolio\"<br>`;
output.append(div);
rstInput();
break;
case "clear":
cmndHist();
div.innerHTML = `<br><br><br><br><br><br>` + clear_text + `<br><br><br><br><br><br><br>`;
output.replaceChildren(div);
//let ds = document.getElementById("divSpace");
//const lineBreak = document.createElement('br');
//ds.appendChild(lineBreak);
rstInput();
break;
case "hist":
cmndHist();
div.innerHTML = `<br> user command history: [${commandStack}]`;
output.append(div);
rstInput();
break;
case "s": //this will send the guest to my Github page
cmndHist();
window.open("https://github.com/Brandon-E-Ramirez", "_blank");
div.innerHTML = `<br> Redirecting to website...\"https://github.com/Brandon-E-Ramirez\"`;
output.append(div)
rstInput();
break;
case "Stack has been cleared!":
cmndHist();
div.innerHTML = "<br>The command buffer is has been reset, enter new command(s)";
output.append(div);
rstInput;
break;
case "":
cmndHist();
div.innerHTML = " <br> Error, field is empty. For a list of commands, type \"help\"" + "\n";
output.append(div);
rstInput();
break;
default:
cmndHist();
let errorQuery = input.value;
div.innerHTML = `<br> Command not found, "${errorQuery}" is not a valid command. For a list of valid commands, type "help"\n`;
output.append("");
output.append(div);
rstInput();
break;
}
}
}
//function that makes the text input be in focus when window is pressed anywhere in body
function focusInput() {
document.getElementById("inputField").focus();
}
/*
Make it so that when the user types in the text input the width of the input
dynamicaly resizes, the animated green caret should move left/right at the same rate the user
types*/
//This code shifts the text to the right while typing
input.addEventListener('input', () => {
if(input.value.length == 0){
input.style.width = '2px';
}else{
input.style.width = 'initial';
input.setAttribute('size', input.value.length);
}
});
//color changes if command is valid
input.addEventListener('input', () => {
if(validCommands.includes(input.value,0)){
input.style.color = "#fbf1c7";
}else{
input.style.color = "#f92672";
}
});
//this code checks if up-arrow is ever pressed at any time. This will invoke previous commands which can be quickly retrieved
const commandStack = [];
commandStack.push("Stack is empty!");//the command currently in the input is added to the stack
let cmndIndex = commandStack.length;
window.addEventListener(
"keydown",
(event) => {
if (event.defaultPrevented) {
return; // Do nothing if the event was already processed
}
switch (event.key) {
case "ArrowDown":
//increase index by 1, return value
//input.value = "Stack has been cleared!";
cmndIndex++;
input.style.width = commandStack[cmndIndex].style.width;
input.value = commandStack[cmndIndex];
if (input.value == "undefined"){
rstInput();
}
break;
//have array push elements to array, when up arrow is pressed decrease index by 1 and return the value from updated index.
case "ArrowUp":
/*
cmndIndex--; //retrieve most recent command
//input.style.width = commandStack[cmndIndex].style.width;
input.value = commandStack[cmndIndex];
if (input.value == "undefined"){
rstInput();
}
*/
break;
//do this later
case "Tab":
window.alert("Implement auto completion!")
break;
default:
return; // Quit when this doesn't handle the key event.
}
});
const time = document.getElementById('uptime');
const clock = document.getElementById('time');
const calendar = document.getElementById('calendar');
let t = 0
setInterval(function () {
const currentDate = new Date();
let month = currentDate.getMonth() + 1;
switch (month){
case 1:
month = "January";
break;
case 2:
month = "February";
break;
case 3:
month = "March";
break;
case 4:
month = "April";
break;
case 5:
month = "May";
break;
case 6:
month = "June";
break;
case 7:
month = "July";
break;
case 8:
month = "August";
break;
case 9:
month = "September";
break;
case 10:
month = "October";
break;
case 11:
month = "November";
break;
case 12:
month = "December";
break;
}
clock.innerText = " Time: " + currentDate.getHours() + ":" + currentDate.getMinutes() + ":" + currentDate.getSeconds();
calendar.innerText = " Date: " + month + ", " + currentDate.getDate() + " " + currentDate.getFullYear();
time.innerText = "Uptime: " + (t += 1) + " seconds";
}, 1000);//update every second
let net = document.getElementById('network');
let pwr = document.getElementById('charge');
let cpu = document.getElementById('cpu');
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min) + min);
}
setInterval(function() {
net.innerText = "Network: " + getRandomInt(50,100) + "%";
pwr.innerText = "Power: " + getRandomInt(93,95) + "%";
cpu.innerText = "CPU: " + getRandomInt(0,50) + "%";
}, 2000)
//!generate random user id in form of 8 digit hex string
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min)
}
function genHexId(){
let n = 8; //*length of the password
const alph = ["a", "b", "c", "d", "e", "f", "g"]
const nums = [0,1,2,3,4,5,6,7,8,9]
let pw = "#";
let alphLength = alph.length;
let numsLength = nums.length;
for(let x = 0; x < n; x++){
//TODO choose element type
//* Generate random number to decide if next character will be a symbol, letter, or number
let option = randomIntFromInterval(1,2);
let index = 0;
switch(option){
case 1://reserved for alphabet
//*decide which element in chosen array will be the next in pw
index = randomIntFromInterval(0, alphLength - 1);
//*if element is a letter, make it a 50/50 chance it will be upperCase
let upperCase = randomIntFromInterval(0,1)
pw += alph[index].toLowerCase();
break;
case 2://reserved for numbers
//*decide which element in chosen array will be the next in pw
index = randomIntFromInterval(0, numsLength - 1)
pw += nums[index]
break;
default:
log('There is an error!')
}
}
return pw;
}
const hashStr = document.getElementById('id');
hashStr.innerHTML = "USR_ID: " + genHexId();
//songs that play randomly when the page loads
const songs = [
"/assets/sound/music/Homeshake - Pareidolia Catalog.mp3",
"/assets/sound/music/8 Bit Ocean - Random Chiptune Mix.mp3",
"/assets/sound/music/Space Jazz - Jazzy Beats Compilation.mp3",
"/assets/sound/music/Heavenly breakcore, DnB & Jungle Compilation (10th).mp3",
"/assets/sound/music/Looking Forward - Atmospheric Drum & Bass Compilation.mp3",
"/assets/sound/music/Best Of Jazz Anime OST - Chill Mix To Study Relax To.mp3",
"/assets/sound/music/Total Science - Volume 2 (1996).mp3",
"/assets/sound/music/Aphex Twin - Selected Ambient Works 85-92.mp3",
"/assets/sound/music/Perfect Piano - A Video Game Music Mix.mp3",
"/assets/sound/music/Atmosphere Chapter 1 - Deeper Drum and Bass.mp3",
"/assets/sound/music/Atmosphere Chapter 3 - Deeper Drum And Bass (2012).mp3",
"/assets/sound/music/Jungle DB Gaming Mix - Ambient, Intelligent, Liquid.mp3",
"/assets/sound/music/Modern Ambient Jungle Compilation - (Intelligent DnB).mp3",
"/assets/sound/music/Relaxing Gran Turismo (GT2-6).mp3",
"/assets/sound/music/Relaxing L.A. Noire Music - 1940s Smoky Jazz Bar & Rain Ambience.mp3",
"/assets/sound/music/Relaxing Gran Turismo+ - Study, Gaming Mix.mp3",
"/assets/sound/music/Jazz Bar in Paris - Piano Compilation.mp3"
];
//play songs in predetermined order
let o = 0;
function playRandomSong() {
o++;
if(o < songs.length){
const selectedSong = songs[o];
playButton.innerText = selectedSong.substring(20, selectedSong.length - 4);
// Set the source of the audio element to the selected song
audio.src = selectedSong;
// Play the selected song
audio.volume = 0.5;
audio.play();
}else{
o = 0;
const selectedSong = songs[o];
playButton.innerText = selectedSong.substring(20, selectedSong.length - 4);
// Set the source of the audio element to the selected song
audio.src = selectedSong;
// Play the selected song
audio.volume = 0.5;
audio.play();
}
}
/*'/assets/images/backgrounds/use/1.jpg',*/
const backgrounds = [
'/assets/images/backgrounds/use/1.jpg',
'/assets/images/backgrounds/use/4.webp',
'/assets/images/backgrounds/use/17.webp',
'/assets/images/backgrounds/use/3.webp',
'/assets/images/backgrounds/use/9.webp',
'/assets/images/backgrounds/use/2.gif',
'/assets/images/backgrounds/use/6.gif',
'/assets/images/backgrounds/use/12.webp',
'/assets/images/backgrounds/use/14.webp',
'/assets/images/backgrounds/use/15.webp',
'/assets/images/backgrounds/use/10.webp',
'/assets/images/backgrounds/use/13.webp',
'/assets/images/backgrounds/use/11.gif',
'/assets/images/backgrounds/use/7.webp',
'/assets/images/backgrounds/use/8.webp',
'/assets/images/backgrounds/use/5.webp',
'/assets/images/backgrounds/use/16.gif'
];
let i = 0
function selectWallpaper(){
//const randomIndex = Math.floor(Math.random() * backgrounds.length);
i++;
if(i < backgrounds.length){
const wallpaper = backgrounds[i];
document.body.style.backgroundImage = `url('${wallpaper}')`;
}else{
i = 0;
const wallpaper = backgrounds[i];
document.body.style.backgroundImage = `url('${wallpaper}')`;
}
}
let brIndex = 0;
const brElements = document.getElementsByClassName("lb");
function removeDiv(){
if(brIndex <= 27){
brElements[brIndex].remove();
brElements[brIndex + 1].remove();
}
brIndex+=2;
}
function typeWriter(text, element, speed) {
let i = 0;
const length = text.length;
function type() {
if (i < length) {
if (text.charAt(i) === '<') {
// Find the closing '>' character for the HTML tag
const closingIndex = text.indexOf('>', i);
if (closingIndex !== -1) {
const htmlTag = text.substring(i, closingIndex + 1);
element.innerHTML += htmlTag;
i = closingIndex + 1;
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' })
//window.scrollTo(0, document.body.scrollHeight);
}
} else {
element.innerHTML += text.charAt(i);
i++;
}
setTimeout(type, speed);
}
}
type();
}
const fortuneArr = [
"A beautiful, smart, and loving person will be coming into your life.",
"A dubious friend may be an enemy in camouflage.",
"A faithful friend is a strong defense.",
"A feather in the hand is better than a bird in the air.",
"A fresh start will put you on your way.",
"A friend asks only for your time not your money.",
"A friend is a present you give yourself.",
"A gambler not only will lose what he has, but also will lose what he doesn’t have.",
"A golden egg of opportunity falls into your lap this month.",
"A good friendship is often more important than a passionate romance.",
"A good time to finish up old tasks.",
"A hunch is creativity trying to tell you something.",
"A lifetime friend shall soon be made.",
"A lifetime of happiness lies ahead of you.",
"A light heart carries you through all the hard times.",
"A new outlook brightens your image and brings new friends.",
"A new perspective will come with the new year.",
"A person is never to (sic) old to learn. ",
"A person of words and not deeds is like a garden full of weeds.",
"A pleasant surprise is waiting for you.",
"A short pencil is usually better than a long memory any day.",
"A small donation is call for. It’s the right thing to do.",
"A smile is your personal welcome mat.",
"A smooth long journey! Great expectations.",
"A soft voice may be awfully persuasive.",
"A truly rich life contains love and art in abundance.",
"Accept something that you cannot change, and you will feel better.",
"Adventure can be real happiness.",
"Advice is like kissing. It costs nothing and is a pleasant thing to do. ",
"Advice, when most needed, is least heeded.",
"All the effort you are making will ultimately pay off.",
"All the troubles you have will pass away very quickly.",
"All will go well with your new project.",
"All your hard work will soon pay off.",
"Allow compassion to guide your decisions.",
"An acquaintance of the past will affect you in the near future.",
"An agreeable romance might begin to take on the appearance.",
"An important person will offer you support.",
"An inch of time is an inch of gold.",
"Any day above ground is a good day.",
"Any decision you have to make tomorrow is a good decision.",
"At the touch of love, everyone becomes a poet.",
"Be careful or you could fall for some tricks today.",
"Beauty in its various forms appeals to you. ",
"Because you demand more from yourself, others respect you deeply.",
"Believe in yourself and others will too.",
"Believe it can be done.",
"Better ask twice than lose yourself once.",
"Bide your time, for success is near.",
"Carve your name on your heart and not on marble.",
"Chance favors those in motion.",
"Change is happening in your life, so go with the flow!",
"Competence like yours is underrated.",
"Congratulations! You are on your way.",
"Could I get some directions to your heart? ",
"Courtesy begins in the home.",
"Courtesy is contagious.",
"Curiosity kills boredom. Nothing can kill curiosity.",
"Dedicate yourself with a calm mind to the task at hand.",
"Depart not from the path which fate has you assigned.",
"Determination is what you need now.",
"Diligence and modesty can raise your social status.",
"Disbelief destroys the magic.",
"Distance yourself from the vain.",
"Do not be intimidated by the eloquence of others.",
"Do not demand for someone’s soul if you already got his heart.",
"Do not let ambitions overshadow small success.",
"Do not make extra work for yourself.",
"Do not underestimate yourself. Human beings have unlimited potentials.",
"Do you know that the busiest person has the largest amount of time?",
"Don’t be discouraged, because every wrong attempt discarded is another step forward.",
"Don’t confuse recklessness with confidence. ",
"Don’t expect romantic attachments to be strictly logical or rational.",
"Don’t just spend time. Invest it.",
"Don’t just think, act!",
"Don’t let friends impose on you, work calmly and silently.",
"Don’t let the past and useless detail choke your existence.",
"Don’t let your limitations overshadow your talents.",
"Don’t worry; prosperity will knock on your door soon.",
"Each day, compel yourself to do something you would rather not do.",
"Education is the ability to meet life’s situations.",
"Embrace this love relationship you have!",
"Emulate what you admire in your parents. ",
"Emulate what you respect in your friends.",
"Every flower blooms in its own sweet time.",
"Every wise man started out by asking many questions.",
"Everyday in your life is a special occasion.",
"Everywhere you choose to go, friendly faces will greet you.",
"Expect much of yourself and little of others.",
"Failure is the chance to do better next time.",
"Failure is the path of lease persistence.",
"Fear and desire – two sides of the same coin.",
"Fearless courage is the foundation of victory.",
"Feeding a cow with roses does not get extra appreciation.",
"First think of what you want to do; then do what you have to do.",
"Follow the middle path. Neither extreme will make you happy.",
"For hate is never conquered by hate. Hate is conquered by love.",
"For the things we have to learn before we can do them, we learn by doing them.",
"Fortune Not Found: Abort, Retry, Ignore?",
"From listening comes wisdom and from speaking repentance.",
"From now on your kindness will lead you to success.",
"Get your mind set – confidence will lead you on.",
"Get your mind set…confidence will lead you on.",
"Go for the gold today! You’ll be the champion of whatever.",
"Go take a rest; you deserve it.",
"Good news will be brought to you by mail.",
"Good news will come to you by mail.",
"Good to begin well, better to end well.",
"Happiness begins with facing life with a smile and a wink.",
"Happiness will bring you good luck.",
"Happy life is just in front of you.",
"Hard words break no bones, fine words butter no parsnips.",
"Have a beautiful day.",
"He who expects no gratitude shall never be disappointed. ",
"He who knows he has enough is rich.",
"He who knows others is wise. He who knows himself is enlightened.",
"Help! I’m being held prisoner in a chinese bakery!",
"How many of you believe in psycho-kinesis? Raise my hand.",
"How you look depends on where you go.",
"I learn by going where I have to go.",
"If a true sense of value is to be yours it must come through service.",
"If certainty were truth, we would never be wrong.",
"If you continually give, you will continually have.",
"If you look in the right places, you can find some good offerings.",
"If you think you can do a thing or think you can’t do a thing, you’re right.",
"If you wish to see the best in others, show the best of yourself.",
"If your desires are not extravagant, they will be granted.",
"If your desires are not to extravagant they will be granted. ",
"If you’re feeling down, try throwing yourself into your work.",
"Imagination rules the world.",
"In order to take, one must first give.",
"In the end all things will be known.",
"In this world of contradiction, It’s better to be merry than wise.",
"It could be better, but its [sic] good enough.",
"It is better to be an optimist and proven a fool than to be a pessimist and be proven right.",
"It is better to deal with problems before they arise.",
"It is honorable to stand up for what is right, however unpopular it seems.",
"It is worth reviewing some old lessons.",
"It takes courage to admit fault.",
"It’s not the amount of time you devote, but what you devote to the time that counts.",
"It’s time to get moving. Your spirits will lift accordingly.",
"Keep your face to the sunshine and you will never see shadows.",
"Let the world be filled with tranquility and goodwill.",
"Like the river flow into the sea. Something are just meant to be.",
"Listen not to vain words of empty tongue.",
"Listen to everyone. Ideas come from everywhere.",
"Living with a commitment to excellence shall take you far.",
"Long life is in store for you.",
"Love is a warm fire to keep the soul warm.",
"Love is like sweet medicine, good to the last drop.",
"Love lights up the world.",
"Love truth, but pardon error.",
"Man is born to live and not prepared to live.",
"Man’s mind, once stretched by a new idea, never regains it’s original dimensions.",
"Many will travel to hear you speak.",
"Meditation with an old enemy is advised.",
"Miles are covered one step at a time.",
"Nature, time and patience are the three great physicians.",
"Never fear! The end of something marks the start of something new.",
"New ideas could be profitable.",
"New people will bring you new realizations, especially about big issues. (2)",
"No one can walk backwards into the future.",
"Nothing is more difficult, and therefore more precious, than to be able to decide.",
"Now is a good time to buy stock.",
"Now is the time to go ahead and pursue that love interest!",
"Now is the time to try something new",
"Observe all men, but most of all yourself.",
"One can never fill another’s shoes, rather he must outgrow the old shoes.",
"One of the first things you should look for in a problem is its positive side.",
"Others can help you now.",
"Pennies from heaven find their way to your doorstep this year!",
"People are attracted by your Delicate [sic] features.",
"People find it difficult to resist your persuasive manner.",
"Perhaps you’ve been focusing too much on saving.",
"Physical activity will dramatically improve your outlook today.",
"Pick battles big enough to matter, small enough to win.",
"Place special emphasis on old friendship.",
"Po Says: Pandas like eating bamboo, but I prefer mine dipped in chocolate.",
"Practice makes perfect.",
"Protective measures will prevent costly disasters.",
"Put your mind into planning today. Look into the future.",
"Remember the birthday but never the age.",
"Remember to share good fortune as well as bad with your friends.",
"Rest has a peaceful effect on your physical and emotional health.",
"Resting well is as important as working hard.",
"Romance moves you in a new direction.",
"Savor your freedom – it is precious.",
"Say hello to others. You will have a happier day.",