Windows3.1 / index.html
junho85's picture
Add 2 files
4a59d71 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Windows 3.1 Recreation</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
@font-face {
font-family: 'MS Sans Serif';
src: url('https://www.cufonfonts.com/download/font/ms-sans-serif-2');
}
body {
font-family: 'MS Sans Serif', sans-serif;
background-color: #008080;
user-select: none;
overflow: hidden;
}
.window {
box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px #808080, inset 2px 2px #ffffff;
}
.title-bar {
background: linear-gradient(90deg, #000080, #1084d0);
color: white;
}
.button {
box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px #808080, inset 2px 2px #ffffff;
}
.button:active {
box-shadow: inset -1px -1px #ffffff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080;
}
.icon {
text-shadow: 1px 1px 0px white;
}
.taskbar {
box-shadow: inset -1px -1px #ffffff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080;
}
.start-button {
box-shadow: inset -1px -1px #ffffff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080;
}
.start-button:active {
box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px #808080, inset 2px 2px #ffffff;
}
.menu {
box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px #808080, inset 2px 2px #ffffff;
}
.menu-item:hover {
background-color: #000080;
color: white;
}
.draggable {
cursor: move;
}
.resizable {
resize: both;
overflow: hidden;
}
</style>
</head>
<body class="h-screen w-screen overflow-hidden">
<!-- Desktop Icons -->
<div class="absolute left-0 top-0 p-2 flex flex-col space-y-4">
<div class="icon w-16 flex flex-col items-center text-center cursor-pointer" onclick="openProgram('my-computer')">
<img src="https://win98icons.alexmeub.com/icons/png/computer_explorer-4.png" width="32" height="32">
<span class="text-xs mt-1">My Computer</span>
</div>
<div class="icon w-16 flex flex-col items-center text-center cursor-pointer" onclick="openProgram('recycle-bin')">
<img src="https://win98icons.alexmeub.com/icons/png/recycle_bin_empty-4.png" width="32" height="32">
<span class="text-xs mt-1">Recycle Bin</span>
</div>
<div class="icon w-16 flex flex-col items-center text-center cursor-pointer" onclick="openProgram('notepad')">
<img src="https://win98icons.alexmeub.com/icons/png/notepad-4.png" width="32" height="32">
<span class="text-xs mt-1">Notepad</span>
</div>
</div>
<!-- Windows -->
<div id="my-computer-window" class="window absolute left-20 top-20 w-64 h-64 bg-gray-200 flex flex-col hidden">
<div class="title-bar h-6 flex items-center justify-between px-1 draggable">
<div class="flex items-center">
<img src="https://win98icons.alexmeub.com/icons/png/computer_explorer-0.png" width="16" height="16" class="mr-1">
<span class="text-sm">My Computer</span>
</div>
<div class="flex">
<div class="button w-4 h-4 flex items-center justify-center mx-px">_</div>
<div class="button w-4 h-4 flex items-center justify-center mx-px"></div>
<div class="button w-4 h-4 flex items-center justify-center mx-px" onclick="closeWindow('my-computer')">×</div>
</div>
</div>
<div class="flex-1 p-2 overflow-auto resizable">
<div class="grid grid-cols-3 gap-4">
<div class="icon w-16 flex flex-col items-center text-center cursor-pointer">
<img src="https://win98icons.alexmeub.com/icons/png/drive-4.png" width="32" height="32">
<span class="text-xs mt-1">Drive C:</span>
</div>
<div class="icon w-16 flex flex-col items-center text-center cursor-pointer">
<img src="https://win98icons.alexmeub.com/icons/png/drive-4.png" width="32" height="32">
<span class="text-xs mt-1">Drive A:</span>
</div>
<div class="icon w-16 flex flex-col items-center text-center cursor-pointer">
<img src="https://win98icons.alexmeub.com/icons/png/control_panel_users-4.png" width="32" height="32">
<span class="text-xs mt-1">Control Panel</span>
</div>
</div>
</div>
<div class="h-6 bg-gray-300 flex items-center px-2 text-xs">
<span>2 object(s)</span>
</div>
</div>
<div id="notepad-window" class="window absolute left-40 top-40 w-80 h-64 bg-white flex flex-col hidden">
<div class="title-bar h-6 flex items-center justify-between px-1 draggable">
<div class="flex items-center">
<img src="https://win98icons.alexmeub.com/icons/png/notepad-0.png" width="16" height="16" class="mr-1">
<span class="text-sm">Untitled - Notepad</span>
</div>
<div class="flex">
<div class="button w-4 h-4 flex items-center justify-center mx-px">_</div>
<div class="button w-4 h-4 flex items-center justify-center mx-px"></div>
<div class="button w-4 h-4 flex items-center justify-center mx-px" onclick="closeWindow('notepad')">×</div>
</div>
</div>
<div class="flex-1 p-1 overflow-auto resizable">
<textarea class="w-full h-full p-1 font-mono text-sm resize-none" style="background-color: white;">Welcome to Windows 3.1!
This is a recreation of the classic operating system in your browser.
You can:
- Open programs from the desktop
- Use the Start menu
- Move windows around
- Resize windows
- Close windows
Have fun!</textarea>
</div>
</div>
<!-- Taskbar -->
<div class="taskbar absolute bottom-0 left-0 right-0 h-8 bg-gray-300 flex items-center px-1">
<button id="start-button" class="start-button h-6 px-2 flex items-center" onclick="toggleStartMenu()">
<img src="https://win98icons.alexmeub.com/icons/png/windows-0.png" width="16" height="16" class="mr-1">
<span class="text-sm font-bold">Start</span>
</button>
<div id="start-menu" class="menu absolute bottom-8 left-0 w-48 bg-gray-300 hidden">
<div class="menu-item p-1 flex items-center cursor-pointer">
<img src="https://win98icons.alexmeub.com/icons/png/programs-0.png" width="16" height="16" class="mr-2">
<span class="text-sm">Programs</span>
</div>
<div class="menu-item p-1 flex items-center cursor-pointer">
<img src="https://win98icons.alexmeub.com/icons/png/documents-0.png" width="16" height="16" class="mr-2">
<span class="text-sm">Documents</span>
</div>
<div class="menu-item p-1 flex items-center cursor-pointer">
<img src="https://win98icons.alexmeub.com/icons/png/settings-0.png" width="16" height="16" class="mr-2">
<span class="text-sm">Settings</span>
</div>
<div class="menu-item p-1 flex items-center cursor-pointer">
<img src="https://win98icons.alexmeub.com/icons/png/find-0.png" width="16" height="16" class="mr-2">
<span class="text-sm">Find</span>
</div>
<div class="menu-item p-1 flex items-center cursor-pointer">
<img src="https://win98icons.alexmeub.com/icons/png/help_book-0.png" width="16" height="16" class="mr-2">
<span class="text-sm">Help</span>
</div>
<div class="menu-item p-1 flex items-center cursor-pointer">
<img src="https://win98icons.alexmeub.com/icons/png/run-0.png" width="16" height="16" class="mr-2">
<span class="text-sm">Run...</span>
</div>
<div class="menu-item p-1 flex items-center cursor-pointer" onclick="shutdown()">
<img src="https://win98icons.alexmeub.com/icons/png/shut_down_normal-0.png" width="16" height="16" class="mr-2">
<span class="text-sm">Shut Down...</span>
</div>
</div>
<div class="flex-1"></div>
<div class="h-6 px-2 flex items-center text-xs">
<span>4:20 PM</span>
</div>
</div>
<!-- Shutdown Dialog -->
<div id="shutdown-dialog" class="window absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-64 bg-gray-200 flex flex-col hidden">
<div class="title-bar h-6 flex items-center justify-between px-1">
<div class="flex items-center">
<img src="https://win98icons.alexmeub.com/icons/png/shut_down_normal-0.png" width="16" height="16" class="mr-1">
<span class="text-sm">Shut Down Windows</span>
</div>
<div class="flex">
<div class="button w-4 h-4 flex items-center justify-center mx-px" onclick="closeWindow('shutdown')">×</div>
</div>
</div>
<div class="p-4">
<p class="text-sm mb-4">Are you sure you want to shut down your computer?</p>
<div class="flex justify-end space-x-2">
<button class="button px-4 py-1 text-sm" onclick="closeWindow('shutdown')">Cancel</button>
<button class="button px-4 py-1 text-sm bg-gray-300" onclick="alert('Goodbye! This is just a simulation.'); closeWindow('shutdown')">OK</button>
</div>
</div>
</div>
<script>
// Make windows draggable
document.querySelectorAll('.draggable').forEach(draggable => {
draggable.addEventListener('mousedown', function(e) {
const window = this.closest('.window');
let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
e = e || window.event;
e.preventDefault();
// get the mouse cursor position at startup:
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
document.onmousemove = elementDrag;
function elementDrag(e) {
e = e || window.event;
e.preventDefault();
// calculate the new cursor position:
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
// set the element's new position:
window.style.top = (window.offsetTop - pos2) + "px";
window.style.left = (window.offsetLeft - pos1) + "px";
}
function closeDragElement() {
// stop moving when mouse button is released:
document.onmouseup = null;
document.onmousemove = null;
}
});
});
// Window management
function openProgram(program) {
document.getElementById(`${program}-window`).classList.remove('hidden');
}
function closeWindow(program) {
document.getElementById(`${program}-window`).classList.add('hidden');
}
function toggleStartMenu() {
const menu = document.getElementById('start-menu');
menu.classList.toggle('hidden');
}
function shutdown() {
document.getElementById('start-menu').classList.add('hidden');
document.getElementById('shutdown-dialog').classList.remove('hidden');
}
// Close start menu when clicking elsewhere
document.addEventListener('click', function(e) {
if (!e.target.closest('#start-button') && !e.target.closest('#start-menu')) {
document.getElementById('start-menu').classList.add('hidden');
}
});
// Simulate loading
setTimeout(() => {
document.getElementById('my-computer-window').classList.remove('hidden');
}, 1000);
</script>
<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=junho85/junho85" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
</html>