···
4
+
<meta charset="UTF-8" />
5
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+
<title>C:\PLASTIC.EXE - Self-Modifying System</title>
8
+
@import url("https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&display=swap");
11
+
background: #f0f0f0;
12
+
font-family: "Courier Prime", "Courier New", monospace;
21
+
background: #ffffff;
22
+
border: 2px solid #808080;
24
+
inset -2px -2px #c0c0c0,
25
+
inset 2px 2px #404040;
32
+
background: #c0c0c0;
36
+
border-bottom: 1px solid #808080;
42
+
background: #ffffff;
51
+
background: #000000;
53
+
animation: blink 1s infinite;
71
+
text-transform: uppercase;
77
+
margin: 15px 0 5px 0;
78
+
text-transform: uppercase;
83
+
background: #808080;
85
+
display: inline-block;
90
+
background: #c0c0c0;
92
+
border: 2px outset #c0c0c0;
94
+
font-family: inherit;
98
+
display: inline-block;
99
+
text-decoration: none;
100
+
text-transform: uppercase;
104
+
border: 2px inset #c0c0c0;
108
+
background: #d0d0d0;
112
+
width: calc(100% - 20px);
114
+
background: #0000ff;
116
+
font-family: inherit;
119
+
border: 2px inset #c0c0c0;
125
+
background: #c0c0c0;
128
+
border-top: 1px solid #808080;
131
+
justify-content: space-between;
140
+
font-family: inherit;
157
+
background: #ff0000;
163
+
padding-left: 20px;
185
+
<div class="terminal">
186
+
<div class="title-bar">
187
+
C:\PLASTIC.EXE - [Self-Modifying System v2.1]
190
+
<div class="content">
191
+
<p class="prompt">C:\PLASTIC> DIR</p>
193
+
<div class="file-listing">
194
+
<div class="file-line">
195
+
Volume in drive C is PLASTIC-SYS
197
+
<div class="file-line">Directory of C:\PLASTIC</div>
198
+
<div class="file-line"></div>
199
+
<div class="file-line">
200
+
<span class="dir">SYSTEM <DIR></span> 12-15-95
203
+
<div class="file-line">
204
+
<span class="exe">PLASTIC EXE</span> 24,576 12-15-95
207
+
<div class="file-line">
208
+
<span class="txt">README TXT</span> 1,024 12-15-95 3:42p
210
+
<div class="file-line">
211
+
<span class="txt">CONFIG SYS</span> 512 12-15-95 3:42p
213
+
<div class="file-line">4 File(s) 26,112 bytes</div>
214
+
<div class="file-line">524,288 bytes free</div>
217
+
<p class="prompt">C:\PLASTIC> PLASTIC.EXE</p>
219
+
<pre class="ascii-art">
220
+
██████╗ ██╗ █████╗ ███████╗████████╗██╗ ██████╗
221
+
██╔══██╗██║ ██╔══██╗██╔════╝╚══██╔══╝██║██╔════╝
222
+
██████╔╝██║ ███████║███████╗ ██║ ██║██║
223
+
██╔═══╝ ██║ ██╔══██║╚════██║ ██║ ██║██║
224
+
██║ ███████╗██║ ██║███████║ ██║ ██║╚██████╗
225
+
╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═════╝</pre
228
+
<h2>System Information:</h2>
229
+
<p>PLASTIC v2.1 - Self-Modifying Code System</p>
230
+
<p>Copyright (C) 1995 DUNKIRK Corp.</p>
232
+
All rights reserved. Licensed to: REGISTERED USER under MIT
235
+
<div class="separator">
236
+
════════════════════════════════════════════════════════════
239
+
<h2>About This System:</h2>
241
+
PLASTIC.EXE is an experimental self-modifying executable
242
+
that allows real-time code injection and system
243
+
modification. WARNING: Use at your own risk. System may
247
+
<h2>Experimental Code Generator:</h2>
248
+
<p>Describe changes to make to the page:</p>
252
+
placeholder="e.g., 'Add a retro calculator widget', 'Change theme to green terminal', or 'Completely redesign as a DOS file manager'"
254
+
<div class="button" onclick="generateAndExecute()">
257
+
<div class="button" onclick="clearEditor()">CLEAR</div>
260
+
style="color: #000080; margin-top: 10px"
263
+
<h2>System Features:</h2>
266
+
Real-time <span class="command">EXEC</span> code
269
+
<li>Compatible with DOS 6.22 and Windows 95</li>
270
+
<li>640K memory optimized</li>
271
+
<li>No TSR conflicts detected</li>
272
+
<li>Supports EGA/VGA graphics modes</li>
275
+
<h2>System Commands:</h2>
277
+
<span class="command">HELP</span>
278
+
<span class="command">DIR</span>
279
+
<span class="command">EDIT</span>
280
+
<span class="command">RUN</span>
281
+
<span class="command">EXIT</span>
284
+
<div class="separator">
285
+
════════════════════════════════════════════════════════════
288
+
<p>Runtime: 00:13:37 | Memory: 589K free | CPU: 80486DX-33</p>
290
+
WARNING: Unauthorized modification may corrupt system files
293
+
<p class="prompt">C:\PLASTIC> <span class="cursor">_</span></p>
296
+
<div class="status-bar">
297
+
<span>F1=Help F2=Save F3=Load F10=Menu</span>
298
+
<span>12:34 PM</span>
303
+
async function generateAndExecute() {
304
+
const userPrompt = document.getElementById("codeEditor").value;
305
+
const statusDiv = document.getElementById("statusDisplay");
307
+
if (userPrompt.trim() === "") {
308
+
statusDiv.textContent = "ERROR: No description provided";
312
+
statusDiv.textContent = "CONNECTING TO AI SYSTEM...";
315
+
const currentPageHTML = document.documentElement.outerHTML;
317
+
const response = await fetch(
318
+
"https://ai.hackclub.com/chat/completions",
322
+
"Content-Type": "application/json",
324
+
body: JSON.stringify({
328
+
content: `Here is the current HTML page:\n\n${currentPageHTML}\n\nUser request: "${userPrompt}"\n\nGenerate HTML code that fits the DOS/retro terminal aesthetic for this request. Use flat colors like #00ff41 (green), #ffff00 (yellow), #00ffff (cyan), #ffffff (white), #c0c0c0 (gray), #000080 (blue), and #ff0000 (red). Use monospace fonts and simple borders. Make it look like it belongs in a 1990s DOS program. Only return the HTML code to add, no explanations.`,
335
+
if (!response.ok) {
337
+
`HTTP ${response.status}: ${response.statusText}`,
341
+
statusDiv.textContent = "AI PROCESSING...";
343
+
const data = await response.json();
344
+
console.log("API Response:", data); // Debug log
350
+
data.choices[0].message
352
+
generatedCode = data.choices[0].message.content;
353
+
} else if (data.content) {
354
+
generatedCode = data.content;
355
+
} else if (data.response) {
356
+
generatedCode = data.response;
357
+
} else if (typeof data === "string") {
358
+
generatedCode = data;
360
+
throw new Error("Unexpected API response format");
363
+
// Clean up the code (remove markdown formatting if present)
364
+
let cleanCode = generatedCode
365
+
.replace(/```html\n?/g, "")
366
+
.replace(/```\n?/g, "");
368
+
statusDiv.textContent = "INJECTING CODE...";
370
+
// Insert the generated code
371
+
document.querySelector(".content").innerHTML += cleanCode;
372
+
document.getElementById("codeEditor").value = "";
374
+
statusDiv.textContent = "CODE EXECUTION SUCCESSFUL";
376
+
// Clear status after 3 seconds
378
+
statusDiv.textContent = "";
381
+
statusDiv.textContent = `SYSTEM ERROR: ${error.message}`;
382
+
console.error("Error:", error);
386
+
function clearEditor() {
387
+
document.getElementById("codeEditor").value = "";
388
+
document.getElementById("statusDisplay").textContent = "";
391
+
// Handle Ctrl+Enter in textarea
392
+
document.addEventListener("DOMContentLoaded", function () {
394
+
.getElementById("codeEditor")
395
+
.addEventListener("keydown", function (e) {
396
+
if (e.ctrlKey && e.key === "Enter") {
397
+
e.preventDefault();
398
+
generateAndExecute();
403
+
// Update time in status bar
404
+
setInterval(() => {
405
+
const now = new Date();
406
+
const timeStr = now.toLocaleTimeString([], {
410
+
const statusBarTime = document.querySelector(
411
+
".status-bar span:last-child",
413
+
if (statusBarTime) {
414
+
statusBarTime.textContent = timeStr;