-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterminal.html
1572 lines (1401 loc) · 73.5 KB
/
terminal.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SCP Foundation - Terminal</title>
<link rel="stylesheet" href="assets/css/styles.css">
<link rel="icon" type="image/png" href="assets/images/favicon.ico">
<style>
body, html {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
background-color: var(--background-color, #131);
}
.terminal-container {
width: 100%;
height: 100vh;
background-color: var(--background-color, #131);
color: var(--main-color, #80FF80);
background-image: var(--background-gradient);
background-position: center;
box-shadow: inset 0 0 10em 1em rgba(0, 0, 0, 0.5);
position: relative;
}
.terminal-header {
height: 40px;
background-color: rgba(0, 0, 0, 0.7);
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 15px;
font-family: monospace;
user-select: none;
border-bottom: 1px solid var(--main-color, #80FF80);
box-shadow: 0 0 15px rgba(128, 255, 128, 0.3);
position: relative;
z-index: 10;
}
.terminal-header .title {
font-weight: bold;
display: flex;
align-items: center;
animation: textPulse 3s infinite ease-in-out;
}
.terminal-header .title::before {
content: "■";
margin-right: 10px;
animation: blink 1.5s infinite;
}
.terminal-header .controls {
display: flex;
gap: 15px;
}
.terminal-header .controls a {
color: var(--main-color, #80FF80);
text-decoration: none;
padding: 5px 10px;
cursor: pointer;
border: 1px solid transparent;
transition: all 0.3s ease;
position: relative;
border-radius: 2px;
}
.terminal-header .controls a:hover {
border: 1px solid var(--main-color, #80FF80);
background-color: rgba(128, 255, 128, 0.1);
box-shadow: 0 0 8px rgba(128, 255, 128, 0.4);
}
.terminal-header .controls a:hover::before {
content: "> ";
}
.terminal-view {
height: calc(100vh - 40px);
position: relative;
overflow: hidden;
display: flex;
}
.terminal-main {
flex: 1;
height: 100%;
position: relative;
}
.terminal-sidebar {
width: 250px;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
border-left: 1px solid var(--main-color, #80FF80);
padding: 10px;
overflow-y: auto;
transform: translateX(250px);
transition: transform 0.3s ease;
position: absolute;
right: 0;
top: 0;
z-index: 10;
}
.terminal-sidebar.visible {
transform: translateX(0);
}
.scanline {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
pointer-events: none;
background: linear-gradient(
to bottom,
rgba(18, 16, 16, 0) 50%,
rgba(0, 0, 0, 0.1) 50%
);
background-size: 100% 4px;
z-index: 5;
opacity: 0.3;
}
@keyframes blink {
0%, 49% { opacity: 1; }
50%, 100% { opacity: 0.3; }
}
.loading-terminal {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
text-align: center;
color: var(--main-color, #80FF80);
background-color: var(--background-color, #131);
background-image: var(--background-gradient);
position: relative;
z-index: 10;
animation: fadeIn 1s ease-in;
}
.loading-terminal h1 {
font-size: 3em;
margin-bottom: 20px;
text-shadow: 0 0 10px rgba(128, 255, 128, 0.6);
letter-spacing: 3px;
}
.terminal-prompt {
margin: 30px 0;
font-size: 1.5em;
}
.dots {
display: flex;
justify-content: center;
gap: 15px;
margin-top: 30px;
}
.dot {
width: 15px;
height: 15px;
background-color: var(--main-color, #80FF80);
border-radius: 50%;
opacity: 0.7;
animation: pulse 1.5s infinite;
}
.dot:nth-child(2) {
animation-delay: 0.3s;
}
.dot:nth-child(3) {
animation-delay: 0.6s;
}
@keyframes pulse {
0%, 100% { transform: scale(1); opacity: 0.7; }
50% { transform: scale(1.3); opacity: 1; }
}
.foundation-logo {
width: 150px;
height: 150px;
background-color: rgba(0, 0, 0, 0.6);
padding: 20px;
border-radius: 50%;
margin-bottom: 30px;
border: 2px solid var(--main-color, #80FF80);
box-shadow: 0 0 20px rgba(128, 255, 128, 0.5);
display: flex;
align-items: center;
justify-content: center;
font-size: 2em;
font-weight: bold;
}
.foundation-logo span {
border: 2px solid var(--main-color, #80FF80);
display: inline-block;
padding: 5px 10px;
border-radius: 5px;
}
.footer-info {
position: absolute;
bottom: 10px;
text-align: center;
width: 100%;
font-size: 0.8em;
opacity: 0.7;
}
.status-indicator {
display: inline-block;
margin-left: 10px;
padding: 3px 8px;
background-color: rgba(0, 0, 0, 0.3);
border: 1px solid var(--main-color, #80FF80);
animation: pulseBadge 2s infinite;
border-radius: 2px;
}
@keyframes pulseBadge {
0% { box-shadow: 0 0 5px rgba(128, 255, 128, 0.3); }
50% { box-shadow: 0 0 10px rgba(128, 255, 128, 0.6); }
100% { box-shadow: 0 0 5px rgba(128, 255, 128, 0.3); }
}
.stats-panel {
background-color: rgba(0, 0, 0, 0.7);
border: 1px solid var(--main-color, #80FF80);
padding: 10px;
margin-bottom: 15px;
font-size: 0.9em;
border-radius: 4px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}
.stats-panel .title {
text-align: center;
margin-bottom: 10px;
padding-bottom: 5px;
border-bottom: 1px solid rgba(128, 255, 128, 0.3);
font-weight: bold;
}
.stats-panel .stat {
display: flex;
justify-content: space-between;
margin: 5px 0;
}
.stat-value {
font-weight: bold;
}
.clearance-section {
margin-top: 15px;
}
.sidebar-section {
margin-bottom: 20px;
}
.sidebar-title {
font-weight: bold;
padding-bottom: 5px;
margin-bottom: 10px;
border-bottom: 1px solid rgba(128, 255, 128, 0.3);
}
.file-list {
list-style: none;
padding: 0;
margin: 0;
}
.file-list li {
padding: 5px 8px;
cursor: pointer;
transition: background-color 0.2s;
border-radius: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.file-list li:hover {
background-color: rgba(128, 255, 128, 0.1);
}
.file-list li::before {
content: "📄 ";
opacity: 0.7;
}
.command-list {
list-style: none;
padding: 0;
margin: 0;
}
.command-list li {
padding: 5px 8px;
cursor: pointer;
transition: background-color 0.2s;
border-radius: 2px;
}
.command-list li:hover {
background-color: rgba(128, 255, 128, 0.1);
}
.command-list li::before {
content: "> ";
opacity: 0.7;
}
.context-menu {
position: absolute;
background-color: rgba(0, 0, 0, 0.9);
border: 1px solid var(--main-color, #80FF80);
padding: 5px 0;
border-radius: 4px;
z-index: 100;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
min-width: 150px;
display: none;
}
.context-menu-item {
padding: 8px 15px;
cursor: pointer;
}
.context-menu-item:hover {
background-color: rgba(128, 255, 128, 0.1);
}
.notification {
position: fixed;
bottom: 20px;
right: 20px;
background-color: rgba(0, 0, 0, 0.8);
color: var(--main-color, #80FF80);
padding: 10px 15px;
border-radius: 4px;
border-left: 3px solid var(--main-color, #80FF80);
z-index: 1000;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
transition: transform 0.3s, opacity 0.3s;
transform: translateX(120%);
opacity: 0;
}
.notification.show {
transform: translateX(0);
opacity: 1;
}
.notification.error {
border-left-color: #ff6347;
}
.notification.warning {
border-left-color: #ffa500;
}
.notification.success {
border-left-color: #32cd32;
}
</style>
</head>
<body>
<div id="loading-screen" class="loading-terminal">
<div class="foundation-logo">
<span>SCP</span>
</div>
<h1>SECURE TERMINAL</h1>
<div class="terminal-prompt">
INITIALIZING SYSTEM<span class="cursor-blink">_</span>
</div>
<div class="dots">
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
</div>
<div class="footer-info">
FOUNDATION SECURE NETWORK - AUTHORIZED ACCESS ONLY
</div>
<div class="scanline"></div>
</div>
<div id="main-content" class="terminal-container" style="display:none;">
<div class="scanline"></div>
<div class="terminal-header">
<div class="title">SCiPNET Terminal - <span id="user-id">Authenticating...</span> <span class="status-indicator">ACTIVE</span></div>
<div class="controls">
<a href="dashboard.html">Dashboard</a>
<a id="toggle-sidebar">Files</a>
<a id="theme-toggle">Theme</a>
<a href="login.html">Log Out</a>
</div>
</div>
<div class="terminal-view">
<div class="terminal-main">
<terminal-console id="terminal" prompt="scp> " auto-focus="true"></terminal-console>
</div>
<div id="terminal-sidebar" class="terminal-sidebar">
<div class="stats-panel">
<div class="title">SYSTEM STATUS</div>
<div class="stat">
<span>Connection</span>
<span class="stat-value" style="color: #32cd32;">SECURE</span>
</div>
<div class="stat">
<span>Uptime</span>
<span class="stat-value" id="uptime">00:00:00</span>
</div>
<div class="stat">
<span>Access Level</span>
<span class="stat-value" id="access-level">Level 4</span>
</div>
<div class="stat">
<span>Commands Run</span>
<span class="stat-value" id="commands-run">0</span>
</div>
</div>
<div class="sidebar-section">
<div class="sidebar-title">QUICK ACCESS FILES</div>
<ul class="file-list" id="quick-files">
<li data-file="about.txt">about.txt</li>
<li data-file="clearance.txt">clearance.txt</li>
<li data-file="protocols.txt">protocols.txt</li>
</ul>
</div>
<div class="sidebar-section">
<div class="sidebar-title">SCP DATABASE</div>
<ul class="file-list" id="scp-files">
<!-- Will be populated dynamically -->
<li>Loading files...</li>
</ul>
</div>
<div class="sidebar-section">
<div class="sidebar-title">COMMON COMMANDS</div>
<ul class="command-list" id="command-list">
<li data-command="help">help</li>
<li data-command="ls">ls</li>
<li data-command="search">search</li>
<li data-command="status">status</li>
<li data-command="clear">clear</li>
</ul>
</div>
<div class="clearance-section">
<div class="sidebar-title">CLEARANCE CONTROL</div>
<select id="clearance-selector" style="width: 100%; padding: 5px; background: rgba(0,0,0,0.7); color: var(--main-color); border: 1px solid var(--main-color);">
<option value="Level 1">Level 1 - Confidential</option>
<option value="Level 2">Level 2 - Restricted</option>
<option value="Level 3">Level 3 - Secret</option>
<option value="Level 4" selected>Level 4 - Top Secret</option>
<option value="Level 5">Level 5 - O5 Command</option>
</select>
</div>
</div>
</div>
</div>
<!-- Context Menu -->
<div id="context-menu" class="context-menu">
<div class="context-menu-item" data-action="copy">Copy</div>
<div class="context-menu-item" data-action="paste">Paste</div>
<div class="context-menu-item" data-action="select-all">Select All</div>
<div class="context-menu-item" data-action="clear">Clear Terminal</div>
</div>
<!-- Notification -->
<div id="notification" class="notification">
<span id="notification-message"></span>
</div>
<!-- Theme Modal -->
<div id="theme-modal" class="theme-modal" style="display: none;">
<div class="theme-content">
<h3>Select a Theme</h3>
<div class="theme-option" data-theme="default">Default Theme</div>
<div class="theme-option" data-theme="night">Night Time Theme</div>
<div class="theme-option" data-theme="ice">Ice Theme</div>
<div class="theme-option" data-theme="demon">Demon Theme</div>
<div class="theme-option" data-theme="galaxy">Galaxy Theme</div>
</div>
</div>
<!-- Load necessary scripts -->
<script src="components/terminal-console.js"></script>
<script src="data/scp-data.js"></script>
<script src="data/personnel-data.js"></script>
<script src="assets/js/data-loader.js"></script>
<script src="assets/js/script.js"></script>
<script>
document.addEventListener("DOMContentLoaded", async function() {
// Initialize references
const loadingScreen = document.getElementById('loading-screen');
const mainContent = document.getElementById('main-content');
const userId = document.getElementById('user-id');
const terminal = document.getElementById('terminal');
const themeToggle = document.getElementById('theme-toggle');
const themeModal = document.getElementById('theme-modal');
const toggleSidebar = document.getElementById('toggle-sidebar');
const terminalSidebar = document.getElementById('terminal-sidebar');
const uptimeEl = document.getElementById('uptime');
const accessLevelEl = document.getElementById('access-level');
const commandsRunEl = document.getElementById('commands-run');
const clearanceSelector = document.getElementById('clearance-selector');
const contextMenu = document.getElementById('context-menu');
const notification = document.getElementById('notification');
const notificationMessage = document.getElementById('notification-message');
const quickFiles = document.getElementById('quick-files');
const scpFilesList = document.getElementById('scp-files');
const commandList = document.getElementById('command-list');
// Initialize variables
let commandsRun = 0;
let startTime = new Date();
let userData = {
username: 'Researcher',
clearanceLevel: 'Level 4',
id: generateRandomId(),
department: 'Research',
lastLogin: new Date(Date.now() - 86400000 * Math.floor(Math.random() * 14)).toISOString().split('T')[0]
};
let systemFiles = {};
let accessDeniedCount = 0;
let terminalHistory = [];
// Generate random ID for user
function generateRandomId() {
const prefix = "P-";
const randomNum = Math.floor(10000 + Math.random() * 90000);
return prefix + randomNum;
}
// Show loading messages
let loadingMsgs = [
"Establishing connection to SCP network...",
"Verifying user credentials...",
"Decrypting secure files...",
"Initializing terminal services...",
"Loading database protocols...",
"Calibrating reality anchors...",
"Verifying security clearance...",
"Connection established!"
];
let msgIndex = 0;
const terminalPrompt = document.querySelector('.terminal-prompt');
// Animate loading messages
const loadingInterval = setInterval(() => {
if (msgIndex < loadingMsgs.length) {
terminalPrompt.innerHTML = loadingMsgs[msgIndex] + '<span class="cursor-blink">_</span>';
msgIndex++;
} else {
clearInterval(loadingInterval);
// Finish loading sequence
setTimeout(() => {
loadingScreen.style.opacity = '0';
loadingScreen.style.transition = 'opacity 0.5s ease';
setTimeout(() => {
loadingScreen.style.display = 'none';
mainContent.style.display = 'block';
terminal.focus();
// Add welcome message
showWelcomeMessage();
}, 500);
}, 500);
}
}, 800);
// Update uptime clock
setInterval(() => {
const now = new Date();
const diff = now - startTime;
const hours = Math.floor(diff / 3600000).toString().padStart(2, '0');
const minutes = Math.floor((diff % 3600000) / 60000).toString().padStart(2, '0');
const seconds = Math.floor((diff % 60000) / 1000).toString().padStart(2, '0');
uptimeEl.textContent = `${hours}:${minutes}:${seconds}`;
}, 1000);
// Toggle sidebar
toggleSidebar.addEventListener('click', function() {
terminalSidebar.classList.toggle('visible');
});
// Set initial user info
function initializeUserInfo() {
// Try to get from session storage
const authData = JSON.parse(sessionStorage.getItem('scp_auth') || '{}');
if (authData && authData.name) {
userData.username = authData.name;
}
if (authData && authData.clearanceLevel) {
userData.clearanceLevel = authData.clearanceLevel;
}
// Set display elements
userId.textContent = `${userData.username} (${userData.id})`;
accessLevelEl.textContent = userData.clearanceLevel;
clearanceSelector.value = userData.clearanceLevel;
// Set database clearance level
if (typeof scpDatabase !== 'undefined' && typeof scpDatabase.setUserClearance === 'function') {
scpDatabase.setUserClearance(userData.clearanceLevel);
}
}
// Show welcome message
function showWelcomeMessage() {
initializeUserInfo();
terminal._addOutput(`===== SCIPNET TERMINAL SYSTEM v3.8.2 =====`, 'info');
terminal._addOutput(`Welcome, ${userData.username} (${userData.clearanceLevel})`, 'info');
terminal._addOutput(`Last login: ${userData.lastLogin} from [REDACTED]`, 'system');
terminal._addOutput(`Your current clearance level grants you access to:`);
terminal._addOutput(` - Safe class SCPs`);
terminal._addOutput(` - Euclid class SCPs`);
// Show different access based on clearance
const level = parseInt(userData.clearanceLevel.replace('Level ', ''));
if (level >= 3) terminal._addOutput(` - Keter class SCPs`);
if (level >= 4) terminal._addOutput(` - Thaumiel class SCPs`);
if (level >= 5) terminal._addOutput(` - Apollyon class SCPs`);
terminal._addOutput(`For assistance, type 'help' or click the 'Files' button to browse available resources.`);
terminal._addOutput(`All commands are logged and monitored. Unauthorized access attempts will be reported.`, 'warning');
terminal._addOutput(`================================================`, 'info');
terminal._addOutput('');
}
// Override terminal's execute command method to count commands and add logging
const origExecuteCommand = terminal.executeCommand;
terminal.executeCommand = function(command) {
if (!command.trim()) return;
// Increment command counter
commandsRun++;
commandsRunEl.textContent = commandsRun;
// Log command in history
terminalHistory.push({
command: command,
timestamp: new Date().toISOString(),
clearance: userData.clearanceLevel
});
// Add system message occasionally
if (Math.random() > 0.7) {
terminal._addOutput(`[SYSTEM: Command executed - ${new Date().toISOString()}]`, 'system');
}
// Execute the original command
return origExecuteCommand.call(this, command);
};
// Handle file clicks from sidebar
quickFiles.addEventListener('click', function(e) {
if (e.target.tagName === 'LI') {
const fileName = e.target.getAttribute('data-file');
terminal.value = `cat ${fileName}`;
terminal.executeCommand(terminal.value);
}
});
// Handle command clicks
commandList.addEventListener('click', function(e) {
if (e.target.tagName === 'LI') {
const command = e.target.getAttribute('data-command');
terminal.value = command;
terminal.executeCommand(terminal.value);
}
});
// Handle SCP file clicks
scpFilesList.addEventListener('click', function(e) {
if (e.target.tagName === 'LI') {
const scpId = e.target.getAttribute('data-scp');
if (scpId) {
terminal.value = `view ${scpId}`;
terminal.executeCommand(terminal.value);
}
}
});
// Handle clearance level changes
clearanceSelector.addEventListener('change', function() {
const newClearance = this.value;
userData.clearanceLevel = newClearance;
accessLevelEl.textContent = newClearance;
// Set database clearance level
if (typeof scpDatabase !== 'undefined' && typeof scpDatabase.setUserClearance === 'function') {
scpDatabase.setUserClearance(newClearance);
}
showNotification(`Clearance level updated to ${newClearance}`, 'success');
updateScpFilesList(); // Refresh SCP files based on new clearance
});
// Show notification
function showNotification(message, type = 'info') {
notificationMessage.textContent = message;
notification.className = 'notification ' + type;
notification.classList.add('show');
setTimeout(() => {
notification.classList.remove('show');
}, 3000);
}
// Theme handling
themeToggle.addEventListener('click', function() {
themeModal.style.display = themeModal.style.display === 'none' ? 'flex' : 'none';
});
document.querySelectorAll('.theme-option').forEach(option => {
option.addEventListener('click', function() {
const theme = this.getAttribute('data-theme');
applyTheme(theme);
themeModal.style.display = 'none';
showNotification(`Theme changed to ${theme}`, 'info');
});
});
// Close modal when clicking outside
window.addEventListener('click', function(event) {
if (event.target === themeModal) {
themeModal.style.display = 'none';
}
});
// Handle context menu
terminal.addEventListener('contextmenu', function(e) {
e.preventDefault();
contextMenu.style.display = 'block';
contextMenu.style.left = e.pageX + 'px';
contextMenu.style.top = e.pageY + 'px';
// Handle click elsewhere to close
const closeContextMenu = function(e) {
if (!contextMenu.contains(e.target)) {
contextMenu.style.display = 'none';
document.removeEventListener('click', closeContextMenu);
}
};
setTimeout(() => {
document.addEventListener('click', closeContextMenu);
}, 0);
});
// Handle context menu actions
contextMenu.addEventListener('click', function(e) {
const action = e.target.getAttribute('data-action');
if (!action) return;
switch (action) {
case 'copy':
document.execCommand('copy');
break;
case 'paste':
navigator.clipboard.readText().then(text => {
terminal.value += text;
});
break;
case 'select-all':
terminal.select();
break;
case 'clear':
terminal.clear();
break;
}
contextMenu.style.display = 'none';
});
// Load theme if stored
const storedTheme = localStorage.getItem('selectedTheme');
if (storedTheme) {
applyTheme(storedTheme);
}
// Update SCP files list based on clearance
function updateScpFilesList() {
// Clear current list
scpFilesList.innerHTML = '';
if (typeof scpDatabase === 'undefined' || !scpDatabase.scps) {
scpFilesList.innerHTML = '<li>Error loading SCP database</li>';
return;
}
// Get accessible SCPs
let accessibleSCPs = [];
if (typeof scpDatabase.getAccessibleSCPs === 'function') {
accessibleSCPs = scpDatabase.getAccessibleSCPs();
} else {
// Fallback to object keys
accessibleSCPs = Object.values(scpDatabase.scps);
}
// Sort by item number
accessibleSCPs.sort((a, b) => {
const aNum = parseInt(a.item.replace(/\D/g, '')) || 0;
const bNum = parseInt(b.item.replace(/\D/g, '')) || 0;
return aNum - bNum;
});
// Show only first 10 for performance, with a "more" option
const displaySCPs = accessibleSCPs.slice(0, 10);
// Create list items
displaySCPs.forEach(scp => {
const li = document.createElement('li');
li.textContent = `${scp.item} - ${scp.object_class}`;
li.setAttribute('data-scp', scp.item.toLowerCase());
li.title = scp.item;
// Add color based on object class
const objectClass = scp.object_class.toLowerCase();
if (objectClass === 'safe') {
li.style.color = '#3cb371'; // green
} else if (objectClass === 'euclid') {
li.style.color = '#ffa500'; // orange
} else if (objectClass === 'keter') {
li.style.color = '#ff6347'; // red
} else if (objectClass === 'thaumiel') {
li.style.color = '#4169e1'; // blue
}
scpFilesList.appendChild(li);
});
// Add "more" option if needed
if (accessibleSCPs.length > 10) {
const moreItem = document.createElement('li');
moreItem.textContent = `... ${accessibleSCPs.length - 10} more files`;
moreItem.style.opacity = '0.7';
moreItem.style.fontStyle = 'italic';
scpFilesList.appendChild(moreItem);
}
}
// Set up terminal command system
function setupTerminalCommands() {
// Define system files
systemFiles = {
'about.txt':
`===================================\n` +
` SCP FOUNDATION TERMINAL SYSTEM \n` +
` Version 3.8.2 (Build 20231103) \n` +
`===================================\n\n` +
`Copyright (c) SCP Foundation\n\n` +
`This terminal provides secure access to the SCP Foundation database.\n` +
`All activities are logged and monitored for security purposes.\n\n` +
`Current user: ${userData.username} (${userData.id})\n` +
`Department: ${userData.department}\n` +
`Clearance: ${userData.clearanceLevel}\n\n` +
`For assistance, type 'help' or 'man [command]'.`,
'clearance.txt':
`=================================\n` +
` SCP FOUNDATION CLEARANCE LEVELS \n` +
`=================================\n\n` +
`Level 1: Confidential - Access to Safe class SCPs only\n` +
`Level 2: Restricted - Access to Safe and Euclid class SCPs\n` +
`Level 3: Secret - Access to Safe, Euclid, and Keter class SCPs\n` +
`Level 4: Top Secret - Access to most SCPs including Thaumiel class\n` +
`Level 5: O5 Command - Unrestricted access to all Foundation data\n\n` +
`Your current clearance level: ${userData.clearanceLevel}\n\n` +
`NOTE: Attempting to access files beyond your clearance level\n` +
`will be logged and may result in disciplinary action.`,
'protocols.txt':
`===============================\n` +
` SCP FOUNDATION PROTOCOLS \n` +
`===============================\n\n` +
`1. ALPHA Protocol - Standard containment procedures\n` +
`2. BETA Protocol - Enhanced security measures\n` +
`3. GAMMA Protocol - Hostile organism containment\n` +
`4. DELTA Protocol - Cognitohazard containment\n` +
`5. EPSILON Protocol - Reality-altering anomaly procedures\n` +
`6. OMEGA Protocol - XK-class end-of-world scenario procedures\n\n` +
`For detailed information on specific protocols, use command:\n` +
`protocol <protocol-name>\n\n` +
`Example: protocol gamma`,
'help.txt':
`===========================\n` +
` AVAILABLE COMMANDS \n` +
`===========================\n\n` +
`help - Display this help message\n` +
`ls - List available files\n` +
`cat [filename] - Display file contents\n` +
`view [scp-xxx] - View SCP file with proper formatting\n` +
`scp [scp-xxx] - Alias for view command\n` +
`search [term] - Search the database for matching entries\n` +
`list-scps - List all accessible SCPs\n` +
`personnel [id] - View personnel information\n` +
`list-personnel - List all accessible personnel records\n` +
`mtf [designation] - View Mobile Task Force information\n` +
`list-mtf - List all accessible MTF records\n` +
`status - Display system status information\n` +
`protocol [name] - View protocol information\n` +
`breach [scp-xxx] - Simulate containment breach (training only)\n` +
`whoami - Display current user information\n` +
`date - Display current date and time\n` +
`clear - Clear the terminal screen\n` +
`dashboard - Go to visual dashboard interface\n` +
`logout/exit - Exit the terminal\n\n` +
`Type "help" for a list of available commands.`,
'history.txt':
`Command history will be generated dynamically`
};
// Add basic commands
terminal.addCommand('help', function() {
this._addOutput(systemFiles['help.txt']);
});
terminal.addCommand('ls', function() {
this._addOutput('Available files:', 'info');
// Standard system files first
Object.keys(systemFiles).forEach(file => {
this._addOutput(` - ${file}`);
});
// SCP files based on clearance
if (typeof scpDatabase !== 'undefined' && typeof scpDatabase.getAccessibleSCPs === 'function') {
const accessibleSCPs = scpDatabase.getAccessibleSCPs();
if (accessibleSCPs.length > 0) {
this._addOutput('\nSCP Files:', 'info');
accessibleSCPs.slice(0, 15).forEach(scp => {
this._addOutput(` - ${scp.item.toLowerCase().replace(/[- ]/g, '')}.txt`);
});
if (accessibleSCPs.length > 15) {
this._addOutput(` - ... and ${accessibleSCPs.length - 15} more files`);
}
}
}
});
terminal.addCommand('cat', function(args) {
if (args.length === 0) {
this._addOutput('Usage: cat [filename]', 'error');
return;
}
const fileName = args[0];
// Check if it's a system file
if (systemFiles[fileName]) {
// Special case for history.txt
if (fileName === 'history.txt') {
this._addOutput('=== COMMAND HISTORY ===', 'info');
terminalHistory.forEach((entry, i) => {
this._addOutput(`${i+1}. [${entry.timestamp}] ${entry.command}`);
});
if (terminalHistory.length === 0) {
this._addOutput('No commands executed yet.');
}
} else {
this._addOutput(systemFiles[fileName]);
}
return;
}
// Try to find it in SCP files
const scpMatch = fileName.match(/^scp-?(\d+)\.txt$/i);
if (scpMatch) {
const scpId = 'scp' + scpMatch[1];
// Redirect to view command
this.executeCommand(`view ${scpId}`);
return;
}
this._addOutput(`File not found: ${fileName}`, 'error');
});
// Store start time for uptime calculation
window.startTime = new Date();
// Set up core commands - implement the personnel commands directly
// Command to list all personnel
terminal.addCommand('list-personnel', function() {
this._addOutput('Retrieving accessible personnel records...', 'info');
let accessiblePersonnel = [];
// Get user clearance
const userClearance = typeof scpDatabase !== 'undefined' ?
parseInt(scpDatabase.getUserClearance().replace('Level ', '')) : 1;
// Check PersonnelDataStore
if (typeof PersonnelDataStore !== 'undefined') {
for (const key in PersonnelDataStore) {
const person = PersonnelDataStore[key];
const requiredClearance = parseInt((person.clearanceRequired || 'Level 1').replace('Level ', ''));
if (requiredClearance <= userClearance) {
accessiblePersonnel.push(person);
}
}
}
if (accessiblePersonnel.length === 0) {
this._addOutput('No personnel records accessible for your clearance level.', 'warning');
return;
}
// Display results
this._addOutput(`Found ${accessiblePersonnel.length} accessible personnel records:`, 'success');
// Display in a simpler format since we don't have _addTable method
accessiblePersonnel.forEach(person => {
this._addOutput(`${person.id}: ${person.name} - ${person.position} (${person.department})`);
});