abiyeenzo commited on
Commit
c2e1a35
·
verified ·
1 Parent(s): a4acaf2

dans le terminal la commande help dois fonctionne et on dois pouvoir saisi des truc - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +774 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Os
3
- emoji: 📊
4
- colorFrom: red
5
- colorTo: yellow
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: os
3
+ emoji: 🐳
4
+ colorFrom: green
5
+ colorTo: green
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,774 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="fr">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>ÆOS - Système d'exploitation minimaliste</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ @keyframes boot-animation {
10
+ 0% { opacity: 0; }
11
+ 100% { opacity: 1; }
12
+ }
13
+ .boot-screen {
14
+ animation: boot-animation 1.5s ease-out;
15
+ }
16
+ .window {
17
+ box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
18
+ }
19
+ .title-bar {
20
+ user-select: none;
21
+ }
22
+ .cursor-blink {
23
+ animation: cursor-blink 1s infinite;
24
+ }
25
+ @keyframes cursor-blink {
26
+ 0%, 100% { opacity: 1; }
27
+ 50% { opacity: 0; }
28
+ }
29
+ </style>
30
+ </head>
31
+ <body class="bg-gray-100 h-screen overflow-hidden font-mono">
32
+ <!-- Écran de démarrage -->
33
+ <div id="boot-screen" class="boot-screen fixed inset-0 bg-black text-white flex flex-col items-center justify-center z-50">
34
+ <div class="text-4xl mb-8">ÆOS</div>
35
+ <div class="text-sm text-gray-400">© Æ Corporation - Développé par Abiye Enzo</div>
36
+ <div class="w-64 h-1 bg-gray-700 rounded-full overflow-hidden">
37
+ <div id="boot-progress" class="h-full bg-blue-500 rounded-full" style="width: 0%"></div>
38
+ </div>
39
+ <div class="mt-4 text-gray-400">Chargement du système...</div>
40
+ </div>
41
+
42
+ <!-- Bureau -->
43
+ <div id="desktop" class="hidden h-full flex flex-col">
44
+ <!-- Barre de tâches -->
45
+ <div class="bg-gray-800 text-white p-2 flex justify-between items-center">
46
+ <div class="flex items-center">
47
+ <button id="menu-btn" class="px-3 py-1 bg-gray-700 hover:bg-gray-600 rounded mr-2">
48
+ ☰ Menu
49
+ </button>
50
+ <button id="new-file-btn" class="px-3 py-1 bg-blue-600 hover:bg-blue-700 rounded mr-2">
51
+ Éditeur
52
+ </button>
53
+ <button id="terminal-btn" class="px-3 py-1 bg-purple-600 hover:bg-purple-700 rounded mr-2">
54
+ Terminal
55
+ </button>
56
+ <button id="calculator-btn" class="px-3 py-1 bg-green-600 hover:bg-green-700 rounded mr-2">
57
+ Calculatrice
58
+ </button>
59
+ <div id="clock" class="px-3 py-1 bg-gray-700 rounded">00:00:00</div>
60
+ </div>
61
+ <div class="text-sm">ÆOS v1.0</div>
62
+ </div>
63
+
64
+ <!-- Fenêtre de l'éditeur (cachée au début) -->
65
+ <div id="editor-window" class="window hidden absolute top-10 left-10 w-3/4 h-3/4 flex flex-col bg-white rounded-lg overflow-hidden border border-gray-300">
66
+ <div class="title-bar bg-gray-800 text-white p-2 flex justify-between items-center cursor-move">
67
+ <div class="flex items-center">
68
+ <span class="ml-2">Éditeur de texte</span>
69
+ </div>
70
+ <div>
71
+ <button class="window-control px-3 py-1 hover:bg-gray-700">_</button>
72
+ <button class="window-control px-3 py-1 hover:bg-gray-700">□</button>
73
+ <button id="close-editor" class="window-control px-3 py-1 hover:bg-red-600">×</button>
74
+ </div>
75
+ </div>
76
+ <div class="flex-1 flex flex-col">
77
+ <div class="toolbar bg-gray-100 p-2 flex space-x-2 border-b">
78
+ <button id="save-btn" class="px-3 py-1 bg-green-600 text-white rounded hover:bg-green-700">Enregistrer</button>
79
+ <button id="open-btn" class="px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700">Ouvrir</button>
80
+ <input type="file" id="file-input" class="hidden" accept=".txt">
81
+ </div>
82
+ <div class="flex-1 relative">
83
+ <textarea id="text-editor" class="w-full h-full p-4 outline-none resize-none" spellcheck="false"></textarea>
84
+ <div id="status-bar" class="absolute bottom-0 left-0 right-0 bg-gray-100 p-1 text-sm text-gray-600 border-t">
85
+ Ligne 1, Colonne 1 | UTF-8
86
+ </div>
87
+ </div>
88
+ </div>
89
+ </div>
90
+
91
+ <!-- Calculator Window -->
92
+ <div id="calculator-window" class="window hidden absolute top-30 left-30 w-64 h-auto flex flex-col bg-gray-100 rounded-lg overflow-hidden border border-gray-300">
93
+ <div class="title-bar bg-gray-800 text-white p-2 flex justify-between items-center cursor-move">
94
+ <div class="flex items-center">
95
+ <span class="ml-2">Calculatrice</span>
96
+ </div>
97
+ <div>
98
+ <button class="window-control px-3 py-1 hover:bg-gray-700">_</button>
99
+ <button class="window-control px-3 py-1 hover:bg-gray-700">□</button>
100
+ <button id="close-calculator" class="window-control px-3 py-1 hover:bg-red-600">×</button>
101
+ </div>
102
+ </div>
103
+ <div class="p-4">
104
+ <input type="text" id="calc-display" class="w-full p-2 mb-2 text-right bg-white border border-gray-300 rounded" readonly>
105
+ <div class="grid grid-cols-4 gap-2">
106
+ <button class="calc-btn p-2 bg-gray-200 hover:bg-gray-300 rounded">7</button>
107
+ <button class="calc-btn p-2 bg-gray-200 hover:bg-gray-300 rounded">8</button>
108
+ <button class="calc-btn p-2 bg-gray-200 hover:bg-gray-300 rounded">9</button>
109
+ <button class="calc-btn p-2 bg-blue-200 hover:bg-blue-300 rounded">/</button>
110
+ <button class="calc-btn p-2 bg-gray-200 hover:bg-gray-300 rounded">4</button>
111
+ <button class="calc-btn p-2 bg-gray-200 hover:bg-gray-300 rounded">5</button>
112
+ <button class="calc-btn p-2 bg-gray-200 hover:bg-gray-300 rounded">6</button>
113
+ <button class="calc-btn p-2 bg-blue-200 hover:bg-blue-300 rounded">*</button>
114
+ <button class="calc-btn p-2 bg-gray-200 hover:bg-gray-300 rounded">1</button>
115
+ <button class="calc-btn p-2 bg-gray-200 hover:bg-gray-300 rounded">2</button>
116
+ <button class="calc-btn p-2 bg-gray-200 hover:bg-gray-300 rounded">3</button>
117
+ <button class="calc-btn p-2 bg-blue-200 hover:bg-blue-300 rounded">-</button>
118
+ <button class="calc-btn p-2 bg-gray-200 hover:bg-gray-300 rounded">0</button>
119
+ <button class="calc-btn p-2 bg-gray-200 hover:bg-gray-300 rounded">.</button>
120
+ <button class="calc-btn p-2 bg-green-200 hover:bg-green-300 rounded">=</button>
121
+ <button class="calc-btn p-2 bg-blue-200 hover:bg-blue-300 rounded">+</button>
122
+ <button class="calc-btn p-2 bg-red-200 hover:bg-red-300 rounded col-span-2">C</button>
123
+ <button class="calc-btn p-2 bg-red-200 hover:bg-red-300 rounded col-span-2">CE</button>
124
+ </div>
125
+ </div>
126
+ </div>
127
+
128
+ <!-- Menu Window -->
129
+ <div id="menu-window" class="window hidden absolute top-20 left-20 w-64 h-auto flex flex-col bg-white rounded-lg overflow-hidden border border-gray-300">
130
+ <div class="title-bar bg-gray-800 text-white p-2 flex justify-between items-center cursor-move">
131
+ <div class="flex items-center">
132
+ <span class="ml-2">Menu</span>
133
+ </div>
134
+ <div>
135
+ <button class="window-control px-3 py-1 hover:bg-gray-700">_</button>
136
+ <button class="window-control px-3 py-1 hover:bg-gray-700">□</button>
137
+ <button id="close-menu" class="window-control px-3 py-1 hover:bg-red-600">×</button>
138
+ </div>
139
+ </div>
140
+ <div class="p-2">
141
+ <button class="menu-item w-full p-2 text-left hover:bg-gray-100 rounded flex items-center" onclick="openEditor()">
142
+ <span class="mr-2">📝</span> Éditeur de texte
143
+ </button>
144
+ <button class="menu-item w-full p-2 text-left hover:bg-gray-100 rounded flex items-center" onclick="openTerminal()">
145
+ <span class="mr-2">💻</span> Terminal
146
+ </button>
147
+ <button class="menu-item w-full p-2 text-left hover:bg-gray-100 rounded flex items-center" onclick="openCalculator()">
148
+ <span class="mr-2">🧮</span> Calculatrice
149
+ </button>
150
+ <div class="border-t my-1"></div>
151
+ <button id="settings-btn" class="menu-item w-full p-2 text-left hover:bg-gray-100 rounded flex items-center">
152
+ <span class="mr-2">⚙️</span> Paramètres
153
+ </button>
154
+ <button class="menu-item w-full p-2 text-left hover:bg-gray-100 rounded flex items-center" onclick="addTerminalLine('ÆOS v1.0 - Développé par Abiye Enzo')">
155
+ <span class="mr-2">ℹ️</span> À propos
156
+ </button>
157
+ <div class="border-t my-1"></div>
158
+ <button class="menu-item w-full p-2 text-left hover:bg-gray-100 rounded flex items-center" onclick="document.getElementById('menu-window').classList.add('hidden')">
159
+ <span class="mr-2">🚪</span> Fermer
160
+ </button>
161
+ </div>
162
+ </div>
163
+
164
+ <!-- Settings Window -->
165
+ <div id="settings-window" class="window hidden absolute top-30 left-30 w-96 h-64 flex flex-col bg-white rounded-lg overflow-hidden border border-gray-300">
166
+ <div class="title-bar bg-gray-800 text-white p-2 flex justify-between items-center cursor-move">
167
+ <div class="flex items-center">
168
+ <span class="ml-2">Paramètres</span>
169
+ </div>
170
+ <div>
171
+ <button class="window-control px-3 py-1 hover:bg-gray-700">_</button>
172
+ <button class="window-control px-3 py-1 hover:bg-gray-700">□</button>
173
+ <button id="close-settings" class="window-control px-3 py-1 hover:bg-red-600">×</button>
174
+ </div>
175
+ </div>
176
+ <div class="p-4">
177
+ <div class="mb-4">
178
+ <label class="block text-sm font-medium mb-1">Thème</label>
179
+ <select class="w-full p-2 border rounded">
180
+ <option>Clair</option>
181
+ <option>Sombre</option>
182
+ </select>
183
+ </div>
184
+ <div class="mb-4">
185
+ <label class="block text-sm font-medium mb-1">Langue</label>
186
+ <select class="w-full p-2 border rounded">
187
+ <option>Français</option>
188
+ <option>English</option>
189
+ </select>
190
+ </div>
191
+ </div>
192
+ </div>
193
+
194
+ <!-- Terminal Window -->
195
+ <div id="terminal-window" class="window hidden absolute top-20 left-20 w-3/4 h-3/4 flex flex-col bg-black text-green-400 rounded-lg overflow-hidden border border-gray-700">
196
+ <div class="title-bar bg-gray-800 text-white p-2 flex justify-between items-center cursor-move">
197
+ <div class="flex items-center">
198
+ <span class="ml-2">Terminal</span>
199
+ </div>
200
+ <div>
201
+ <button class="window-control px-3 py-1 hover:bg-gray-700">_</button>
202
+ <button class="window-control px-3 py-1 hover:bg-gray-700">□</button>
203
+ <button id="close-terminal" class="window-control px-3 py-1 hover:bg-red-600">×</button>
204
+ </div>
205
+ </div>
206
+ <div class="flex-1 p-4 overflow-auto font-mono" id="terminal-output">
207
+ <div class="text-center mb-2">
208
+ <div class="text-2xl text-green-400">Bienvenue sur ÆOS Terminal</div>
209
+ <div class="text-sm text-gray-500">v1.0 - Tapez 'help' pour la liste des commandes</div>
210
+ </div>
211
+ <div class="border-t border-gray-700 my-2"></div>
212
+ <div class="mt-2">
213
+ <span class="text-green-500">┌──(</span>
214
+ <span class="text-yellow-400">user@ÆOS</span>
215
+ <span class="text-green-500">)-[</span>
216
+ <span class="text-blue-400">~</span>
217
+ <span class="text-green-500">]</span>
218
+ <br>
219
+ <span class="text-green-500">└─$</span>
220
+ <span id="command-line" class="inline-flex items-center">
221
+ <span id="command-input" contenteditable="true"></span>
222
+ <span class="cursor-blink">|</span>
223
+ </span>
224
+ </div>
225
+ </div>
226
+ </div>
227
+
228
+ </div>
229
+
230
+ <script>
231
+ // Simulation du démarrage du système
232
+ document.addEventListener('DOMContentLoaded', () => {
233
+ const bootScreen = document.getElementById('boot-screen');
234
+ const bootProgress = document.getElementById('boot-progress');
235
+ const desktop = document.getElementById('desktop');
236
+
237
+ let progress = 0;
238
+ const bootInterval = setInterval(() => {
239
+ progress += Math.random() * 10;
240
+ if (progress > 100) progress = 100;
241
+ bootProgress.style.width = `${progress}%`;
242
+
243
+ if (progress >= 100) {
244
+ clearInterval(bootInterval);
245
+ setTimeout(() => {
246
+ bootScreen.classList.add('hidden');
247
+ desktop.classList.remove('hidden');
248
+ updateClock();
249
+ setInterval(updateClock, 1000);
250
+ setupTerminal();
251
+ }, 500);
252
+ }
253
+ }, 150);
254
+ });
255
+
256
+ // Mise à jour de l'horloge
257
+ function updateClock() {
258
+ const now = new Date();
259
+ const timeString = now.toLocaleTimeString();
260
+ document.getElementById('clock').textContent = timeString;
261
+ }
262
+
263
+ // Terminal functionality
264
+ const terminalCommands = {
265
+ help: () => `
266
+ Commandes disponibles:
267
+
268
+ help - Affiche cette aide
269
+ clear - Efface l'écran du terminal
270
+ about - Affiche les informations sur ÆOS
271
+ echo [text] - Affiche le texte spécifié
272
+ ls - Liste les commandes disponibles
273
+ date - Affiche la date et l'heure actuelles
274
+ calc [expr] - Évalue une expression mathématique
275
+ shutdown - Ferme la fenêtre du terminal
276
+ sysinfo - Affiche les informations système
277
+ neofetch - Affiche le logo et informations système
278
+ whoami - Affiche le nom d'utilisateur actuel
279
+ pwd - Affiche le répertoire courant
280
+ history - Affiche les 10 dernières commandes
281
+ color [c] - Change la couleur du texte (rouge, vert, bleu, jaune, violet)
282
+ theme [t] - Change le thème du terminal (dark/light)
283
+
284
+ Pour plus d'informations sur une commande, essayez 'help [commande]'
285
+ `,
286
+ clear: () => { terminalOutput.innerHTML = ''; return ""; },
287
+ about: () => "ÆOS v1.0\nSystème d'exploitation minimaliste\n© Æ Corporation",
288
+ echo: (args) => args.join(" "),
289
+ date: () => new Date().toLocaleString('fr-FR'),
290
+ ls: () => Object.keys(terminalCommands).join(" "),
291
+ calc: (args) => {
292
+ try {
293
+ return eval(args.join(" "));
294
+ } catch {
295
+ return "Erreur: Expression invalide";
296
+ }
297
+ },
298
+ shutdown: () => {
299
+ document.getElementById('terminal-window').classList.add('hidden');
300
+ return "Terminal fermé";
301
+ },
302
+ sysinfo: () => `Système: ÆOS v1.0\nCPU: Virtual CPU @ 2.4GHz\nMémoire: 1024MB\nDisque: 10GB\nRéseau: eth0 (192.168.1.100)`,
303
+ neofetch: () => {
304
+ const art = `
305
+ _____ ______
306
+ / _ \\ / __ \\
307
+ / /_\\ \\| | | |
308
+ / | \\ | | |
309
+ \\____|__ /__|__|__|
310
+ \\/
311
+ `;
312
+ return art + "\nÆOS v1.0\nDéveloppé par Abiye Enzo";
313
+ },
314
+ whoami: () => "user",
315
+ pwd: () => "/home/user",
316
+ history: () => commandHistory.slice(0, 10).join("\n"),
317
+ color: (args) => {
318
+ const colors = {
319
+ 'rouge': 'text-red-400',
320
+ 'vert': 'text-green-400',
321
+ 'bleu': 'text-blue-400',
322
+ 'jaune': 'text-yellow-400',
323
+ 'violet': 'text-purple-400'
324
+ };
325
+ const color = args[0];
326
+ if (color in colors) {
327
+ document.getElementById('terminal-output').className = `flex-1 p-4 overflow-auto font-mono ${colors[color]}`;
328
+ return `Couleur changée en ${color}`;
329
+ }
330
+ return "Couleurs disponibles: rouge, vert, bleu, jaune, violet";
331
+ },
332
+ theme: (args) => {
333
+ const theme = args[0];
334
+ if (theme === 'dark') {
335
+ document.getElementById('terminal-window').className = 'window hidden absolute top-20 left-20 w-3/4 h-3/4 flex flex-col bg-black text-green-400 rounded-lg overflow-hidden border border-gray-700';
336
+ return "Thème changé en sombre";
337
+ } else if (theme === 'light') {
338
+ document.getElementById('terminal-window').className = 'window hidden absolute top-20 left-20 w-3/4 h-3/4 flex flex-col bg-gray-100 text-gray-800 rounded-lg overflow-hidden border border-gray-300';
339
+ return "Thème changé en clair";
340
+ }
341
+ return "Utilisation: theme [dark/light]";
342
+ }
343
+ };
344
+
345
+ function processCommand(command) {
346
+ const parts = command.trim().split(/\s+/);
347
+ const cmd = parts[0].toLowerCase();
348
+ const args = parts.slice(1);
349
+
350
+ if (cmd === '') return "";
351
+
352
+ if (cmd in terminalCommands) {
353
+ const result = terminalCommands[cmd](args);
354
+ if (result === undefined) return "";
355
+ if (typeof result === 'string') {
356
+ return result.split('\n').map(line => line.trim()).join('\n');
357
+ }
358
+ return String(result);
359
+ }
360
+ return `Commande inconnue: ${cmd}\nTapez 'help' pour la liste des commandes`;
361
+ }
362
+
363
+ const terminalOutput = document.getElementById('terminal-output');
364
+ const commandInput = document.getElementById('command-input');
365
+
366
+ function addTerminalLine(text) {
367
+ const line = document.createElement('div');
368
+ line.textContent = text;
369
+ terminalOutput.appendChild(line);
370
+ terminalOutput.scrollTop = terminalOutput.scrollHeight;
371
+ }
372
+
373
+ let commandHistory = [];
374
+ let historyIndex = -1;
375
+
376
+ function setupTerminal() {
377
+ commandInput.addEventListener('keydown', (e) => {
378
+ if (e.key === 'Enter') {
379
+ e.preventDefault();
380
+ const command = commandInput.textContent.trim();
381
+
382
+ if (command) {
383
+ // Affiche la commande exécutée
384
+ const promptLine = document.createElement('div');
385
+ promptLine.innerHTML = `<span class="text-green-500">┌──(</span><span class="text-yellow-400">user@ÆOS</span><span class="text-green-500">)-[</span><span class="text-blue-400">~</span><span class="text-green-500">]</span><br><span class="text-green-500">└─$</span> ${command}`;
386
+ terminalOutput.appendChild(promptLine);
387
+
388
+ commandHistory.unshift(command);
389
+ if (commandHistory.length > 10) commandHistory.pop();
390
+
391
+ // Traite la commande et affiche le résultat
392
+ const result = processCommand(command);
393
+ if (result) {
394
+ const resultLines = result.split('\n');
395
+ resultLines.forEach(line => {
396
+ const resultElement = document.createElement('div');
397
+ resultElement.textContent = line;
398
+ terminalOutput.appendChild(resultElement);
399
+ });
400
+ }
401
+ }
402
+
403
+ // Ajoute un nouveau prompt
404
+ const newPrompt = document.createElement('div');
405
+ newPrompt.className = 'terminal-prompt';
406
+ newPrompt.innerHTML = `
407
+ <span class="text-green-500">┌──(</span>
408
+ <span class="text-yellow-400">user@ÆOS</span>
409
+ <span class="text-green-500">)-[</span>
410
+ <span class="text-blue-400">~</span>
411
+ <span class="text-green-500">]</span>
412
+ <br>
413
+ <span class="text-green-500">└─$</span>
414
+ <span class="command-input" contenteditable="true"></span>
415
+ <span class="cursor-blink">|</span>
416
+ `;
417
+ terminalOutput.appendChild(newPrompt);
418
+
419
+ // Met à jour le focus sur le nouveau champ de saisie
420
+ const newInput = newPrompt.querySelector('.command-input');
421
+ newInput.focus();
422
+
423
+ // Fait défiler vers le bas et nettoie l'ancien input
424
+ terminalOutput.scrollTop = terminalOutput.scrollHeight;
425
+ commandInput = newInput;
426
+ historyIndex = -1;
427
+
428
+ } else if (e.key === 'ArrowUp') {
429
+ e.preventDefault();
430
+ if (commandHistory.length > 0) {
431
+ if (historyIndex < commandHistory.length - 1) {
432
+ historyIndex++;
433
+ commandInput.textContent = commandHistory[historyIndex];
434
+ placeCaretAtEnd(commandInput);
435
+ }
436
+ }
437
+ } else if (e.key === 'ArrowDown') {
438
+ e.preventDefault();
439
+ if (historyIndex > 0) {
440
+ historyIndex--;
441
+ commandInput.textContent = commandHistory[historyIndex];
442
+ placeCaretAtEnd(commandInput);
443
+ } else if (historyIndex === 0) {
444
+ historyIndex = -1;
445
+ commandInput.textContent = '';
446
+ }
447
+ }
448
+ });
449
+
450
+ // Focus initial sur l'input
451
+ commandInput.focus();
452
+ }
453
+
454
+ function placeCaretAtEnd(el) {
455
+ el.focus();
456
+ const range = document.createRange();
457
+ range.selectNodeContents(el);
458
+ range.collapse(false);
459
+ const sel = window.getSelection();
460
+ sel.removeAllRanges();
461
+ sel.addRange(range);
462
+ }
463
+
464
+ // Terminal window controls
465
+ document.getElementById('terminal-btn').addEventListener('click', () => {
466
+ openTerminal();
467
+ });
468
+
469
+ document.getElementById('close-terminal').addEventListener('click', () => {
470
+ document.getElementById('terminal-window').classList.add('hidden');
471
+ });
472
+
473
+ function openTerminal() {
474
+ const terminalWindow = document.getElementById('terminal-window');
475
+ terminalWindow.classList.remove('hidden');
476
+ commandInput.focus();
477
+
478
+ // Position aléatoire pour la fenêtre
479
+ const maxX = window.innerWidth - terminalWindow.offsetWidth;
480
+ const maxY = window.innerHeight - terminalWindow.offsetHeight;
481
+ const randomX = Math.floor(Math.random() * maxX * 0.5);
482
+ const randomY = Math.floor(Math.random() * maxY * 0.5);
483
+
484
+ terminalWindow.style.left = `${randomX}px`;
485
+ terminalWindow.style.top = `${randomY}px`;
486
+
487
+ makeDraggable(terminalWindow);
488
+ }
489
+
490
+ document.getElementById('new-file-btn').addEventListener('click', openEditor);
491
+
492
+ document.getElementById('close-editor').addEventListener('click', () => {
493
+ document.getElementById('editor-window').classList.add('hidden');
494
+ });
495
+
496
+ function openEditor() {
497
+ const editorWindow = document.getElementById('editor-window');
498
+ editorWindow.classList.remove('hidden');
499
+ document.getElementById('home-screen').classList.add('hidden');
500
+ document.getElementById('text-editor').focus();
501
+
502
+ // Position aléatoire pour la fenêtre
503
+ const maxX = window.innerWidth - editorWindow.offsetWidth;
504
+ const maxY = window.innerHeight - editorWindow.offsetHeight;
505
+ const randomX = Math.floor(Math.random() * maxX * 0.5);
506
+ const randomY = Math.floor(Math.random() * maxY * 0.5);
507
+
508
+ editorWindow.style.left = `${randomX}px`;
509
+ editorWindow.style.top = `${randomY}px`;
510
+
511
+ makeDraggable(editorWindow);
512
+ }
513
+
514
+ // Gestion du glisser-déposer pour la fenêtre
515
+ function makeDraggable(element) {
516
+ const titleBar = element.querySelector('.title-bar');
517
+ let isDragging = false;
518
+ let offsetX, offsetY;
519
+
520
+ titleBar.addEventListener('mousedown', (e) => {
521
+ isDragging = true;
522
+ offsetX = e.clientX - element.getBoundingClientRect().left;
523
+ offsetY = e.clientY - element.getBoundingClientRect().top;
524
+ element.style.cursor = 'grabbing';
525
+ });
526
+
527
+ document.addEventListener('mousemove', (e) => {
528
+ if (!isDragging) return;
529
+
530
+ const x = e.clientX - offsetX;
531
+ const y = e.clientY - offsetY;
532
+
533
+ // Limites pour empêcher la fenêtre de sortir de l'écran
534
+ const maxX = window.innerWidth - element.offsetWidth;
535
+ const maxY = window.innerHeight - element.offsetHeight;
536
+
537
+ element.style.left = `${Math.max(0, Math.min(x, maxX))}px`;
538
+ element.style.top = `${Math.max(0, Math.min(y, maxY))}px`;
539
+ });
540
+
541
+ document.addEventListener('mouseup', () => {
542
+ isDragging = false;
543
+ element.style.cursor = '';
544
+ });
545
+ }
546
+
547
+ // Gestion des boutons de fenêtre
548
+ document.querySelectorAll('.window-control').forEach(btn => {
549
+ btn.addEventListener('click', function() {
550
+ const editorWindow = document.getElementById('editor-window');
551
+ if (this.textContent === '_') {
552
+ // Minimiser
553
+ editorWindow.classList.add('hidden');
554
+ } else if (this.textContent === '×') {
555
+ // Fermer
556
+ editorWindow.classList.add('hidden');
557
+ document.getElementById('home-screen').classList.remove('hidden');
558
+ } else if (this.textContent === '□') {
559
+ // Maximiser/restaurer
560
+ if (editorWindow.classList.contains('maximized')) {
561
+ editorWindow.classList.remove('maximized');
562
+ editorWindow.style.width = '75%';
563
+ editorWindow.style.height = '75%';
564
+ editorWindow.style.left = '10%';
565
+ editorWindow.style.top = '10%';
566
+ } else {
567
+ editorWindow.classList.add('maximized');
568
+ editorWindow.style.width = '100%';
569
+ editorWindow.style.height = 'calc(100% - 40px)';
570
+ editorWindow.style.left = '0';
571
+ editorWindow.style.top = '0';
572
+ }
573
+ }
574
+ });
575
+ });
576
+
577
+ // Gestion de l'éditeur
578
+ const textEditor = document.getElementById('text-editor');
579
+ const statusBar = document.getElementById('status-bar');
580
+
581
+ textEditor.addEventListener('input', updateCursorPosition);
582
+ textEditor.addEventListener('click', updateCursorPosition);
583
+ textEditor.addEventListener('keyup', updateCursorPosition);
584
+
585
+ function updateCursorPosition() {
586
+ const text = textEditor.value;
587
+ const cursorPos = textEditor.selectionStart;
588
+
589
+ let line = 1;
590
+ let column = 1;
591
+
592
+ for (let i = 0; i < cursorPos; i++) {
593
+ if (text[i] === '\n') {
594
+ line++;
595
+ column = 1;
596
+ } else {
597
+ column++;
598
+ }
599
+ }
600
+
601
+ statusBar.textContent = `Ligne ${line}, Colonne ${column} | UTF-8`;
602
+ }
603
+
604
+ // Menu and Settings functionality
605
+ document.getElementById('menu-btn').addEventListener('click', openMenu);
606
+ document.getElementById('close-menu').addEventListener('click', () => {
607
+ document.getElementById('menu-window').classList.add('hidden');
608
+ });
609
+
610
+ document.getElementById('settings-btn').addEventListener('click', () => {
611
+ document.getElementById('menu-window').classList.add('hidden');
612
+ openSettings();
613
+ });
614
+
615
+ document.getElementById('close-settings').addEventListener('click', () => {
616
+ document.getElementById('settings-window').classList.add('hidden');
617
+ });
618
+
619
+ function openMenu() {
620
+ const menuWindow = document.getElementById('menu-window');
621
+ menuWindow.classList.remove('hidden');
622
+ document.getElementById('home-screen').classList.add('hidden');
623
+
624
+ // Position aléatoire pour la fenêtre
625
+ const maxX = window.innerWidth - menuWindow.offsetWidth;
626
+ const maxY = window.innerHeight - menuWindow.offsetHeight;
627
+ const randomX = Math.floor(Math.random() * maxX * 0.5);
628
+ const randomY = Math.floor(Math.random() * maxY * 0.5);
629
+
630
+ menuWindow.style.left = `${randomX}px`;
631
+ menuWindow.style.top = `${randomY}px`;
632
+
633
+ makeDraggable(menuWindow);
634
+ }
635
+
636
+ function openSettings() {
637
+ const settingsWindow = document.getElementById('settings-window');
638
+ settingsWindow.classList.remove('hidden');
639
+
640
+ // Position aléatoire pour la fenêtre
641
+ const maxX = window.innerWidth - settingsWindow.offsetWidth;
642
+ const maxY = window.innerHeight - settingsWindow.offsetHeight;
643
+ const randomX = Math.floor(Math.random() * maxX * 0.5);
644
+ const randomY = Math.floor(Math.random() * maxY * 0.5);
645
+
646
+ settingsWindow.style.left = `${randomX}px`;
647
+ settingsWindow.style.top = `${randomY}px`;
648
+
649
+ makeDraggable(settingsWindow);
650
+ }
651
+
652
+ // Calculator functionality
653
+ document.getElementById('calculator-btn').addEventListener('click', openCalculator);
654
+ document.getElementById('close-calculator').addEventListener('click', () => {
655
+ document.getElementById('calculator-window').classList.add('hidden');
656
+ });
657
+
658
+ function openCalculator() {
659
+ const calculatorWindow = document.getElementById('calculator-window');
660
+ calculatorWindow.classList.remove('hidden');
661
+ document.getElementById('home-screen').classList.add('hidden');
662
+
663
+ // Position aléatoire pour la fenêtre
664
+ const maxX = window.innerWidth - calculatorWindow.offsetWidth;
665
+ const maxY = window.innerHeight - calculatorWindow.offsetHeight;
666
+ const randomX = Math.floor(Math.random() * maxX * 0.5);
667
+ const randomY = Math.floor(Math.random() * maxY * 0.5);
668
+
669
+ calculatorWindow.style.left = `${randomX}px`;
670
+ calculatorWindow.style.top = `${randomY}px`;
671
+
672
+ makeDraggable(calculatorWindow);
673
+ }
674
+
675
+ // Calculator logic
676
+ let currentInput = '0';
677
+ let previousInput = '';
678
+ let operation = null;
679
+ const display = document.getElementById('calc-display');
680
+
681
+ document.querySelectorAll('.calc-btn').forEach(button => {
682
+ button.addEventListener('click', () => {
683
+ const value = button.textContent;
684
+
685
+ if (value >= '0' && value <= '9') {
686
+ if (currentInput === '0') {
687
+ currentInput = value;
688
+ } else {
689
+ currentInput += value;
690
+ }
691
+ } else if (value === '.') {
692
+ if (!currentInput.includes('.')) {
693
+ currentInput += value;
694
+ }
695
+ } else if (value === 'C') {
696
+ currentInput = '0';
697
+ previousInput = '';
698
+ operation = null;
699
+ } else if (value === 'CE') {
700
+ currentInput = '0';
701
+ } else if (value === '+' || value === '-' || value === '*' || value === '/') {
702
+ if (operation !== null) calculate();
703
+ previousInput = currentInput;
704
+ currentInput = '0';
705
+ operation = value;
706
+ } else if (value === '=') {
707
+ if (operation !== null) calculate();
708
+ }
709
+
710
+ display.value = currentInput;
711
+ });
712
+ });
713
+
714
+ function calculate() {
715
+ let result;
716
+ const prev = parseFloat(previousInput);
717
+ const current = parseFloat(currentInput);
718
+
719
+ if (isNaN(prev) || isNaN(current)) return;
720
+
721
+ switch (operation) {
722
+ case '+':
723
+ result = prev + current;
724
+ break;
725
+ case '-':
726
+ result = prev - current;
727
+ break;
728
+ case '*':
729
+ result = prev * current;
730
+ break;
731
+ case '/':
732
+ result = prev / current;
733
+ break;
734
+ default:
735
+ return;
736
+ }
737
+
738
+ currentInput = result.toString();
739
+ operation = null;
740
+ previousInput = '';
741
+ }
742
+
743
+ // Gestion des fichiers
744
+ document.getElementById('save-btn').addEventListener('click', () => {
745
+ const text = textEditor.value;
746
+ const blob = new Blob([text], { type: 'text/plain' });
747
+ const url = URL.createObjectURL(blob);
748
+
749
+ const a = document.createElement('a');
750
+ a.href = url;
751
+ a.download = 'document.txt';
752
+ a.click();
753
+
754
+ URL.revokeObjectURL(url);
755
+ });
756
+
757
+ document.getElementById('open-btn').addEventListener('click', () => {
758
+ document.getElementById('file-input').click();
759
+ });
760
+
761
+ document.getElementById('file-input').addEventListener('change', (e) => {
762
+ const file = e.target.files[0];
763
+ if (!file) return;
764
+
765
+ const reader = new FileReader();
766
+ reader.onload = (event) => {
767
+ textEditor.value = event.target.result;
768
+ updateCursorPosition();
769
+ };
770
+ reader.readAsText(file);
771
+ });
772
+ </script>
773
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=abiyeenzo/os" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
774
+ </html>