Files

346 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gemini Web OS</title>
<style>
/* Basic Setup */
body, html {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
overflow: hidden;
}
/* Desktop */
#desktop {
position: relative;
height: calc(100% - 40px); /* Full height minus taskbar */
width: 100%;
background: url('https://source.unsplash.com/random/1920x1080?nature,water') no-repeat center center/cover;
overflow: hidden;
}
.icon {
width: 80px;
height: 80px;
margin: 10px;
text-align: center;
color: white;
text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.icon img {
width: 48px;
height: 48px;
}
.icon span {
margin-top: 5px;
font-size: 14px;
}
/* Taskbar */
#taskbar {
position: absolute;
bottom: 0;
width: 100%;
height: 40px;
background-color: rgba(30, 30, 30, 0.9);
backdrop-filter: blur(10px);
display: flex;
align-items: center;
color: white;
box-shadow: 0 -2px 5px rgba(0,0,0,0.2);
}
#start-button {
width: 50px;
height: 100%;
display: grid;
place-items: center;
font-size: 24px;
cursor: pointer;
transition: background-color 0.2s;
}
#start-button:hover {
background-color: rgba(255, 255, 255, 0.2);
}
#clock {
margin-left: auto;
padding: 0 15px;
font-size: 14px;
}
/* Window Styling */
.window {
position: absolute;
width: 600px;
height: 400px;
background-color: #f1f1f1;
border: 1px solid #ccc;
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
border-radius: 8px;
display: flex;
flex-direction: column;
resize: both;
overflow: hidden;
min-width: 250px;
min-height: 150px;
}
.window.active {
border-color: #0078d4;
box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.title-bar {
width: 100%;
height: 30px;
background-color: #e1e1e1;
display: flex;
align-items: center;
justify-content: space-between;
cursor: move;
user-select: none;
flex-shrink: 0;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
}
.window.active .title-bar {
background-color: #0078d4;
color: white;
}
.title {
padding-left: 10px;
font-weight: bold;
font-size: 14px;
}
.window-controls {
display: flex;
}
.window-controls button {
width: 30px;
height: 30px;
border: none;
background: transparent;
font-size: 16px;
cursor: pointer;
}
.window.active .window-controls button {
color: white;
}
.window-controls button:hover {
background-color: rgba(0,0,0,0.2);
}
.window-controls .close:hover {
background-color: #e81123;
color: white;
}
.window-content {
padding: 0;
flex-grow: 1;
overflow: auto;
background-color: #fff;
display: flex;
flex-direction: column;
}
/* App-Specific Styles */
.notepad-textarea {
width: 100%;
height: 100%;
border: none;
resize: none;
padding: 10px;
box-sizing: border-box;
font-family: monospace;
font-size: 14px;
}
.browser-container {
display: flex;
flex-direction: column;
height: 100%;
}
.browser-nav {
display: flex;
padding: 5px;
background-color: #f1f1f1;
border-bottom: 1px solid #ccc;
}
.browser-url {
flex-grow: 1;
border: 1px solid #ccc;
border-radius: 3px;
padding: 5px;
}
.browser-iframe {
width: 100%;
height: 100%;
border: none;
}
</style>
</head>
<body>
<main id="desktop">
<div class="icon" id="notepad-icon">
<img src="https://img.icons8.com/fluent/48/000000/note.png" alt="Notepad Icon"/>
<span>Notepad</span>
</div>
<div class="icon" id="browser-icon">
<img src="https://img.icons8.com/fluent/48/000000/globe.png" alt="Browser Icon"/>
<span>WebSurf</span>
</div>
</main>
<footer id="taskbar">
<div id="start-button">🚀</div>
<div id="running-apps"></div>
<div id="clock"></div>
</footer>
<script>
document.addEventListener('DOMContentLoaded', () => {
const desktop = document.getElementById('desktop');
const notepadIcon = document.getElementById('notepad-icon');
const browserIcon = document.getElementById('browser-icon');
const clockElement = document.getElementById('clock');
let highestZIndex = 1;
let windowCount = 0;
// Update clock every second
function updateClock() {
const now = new Date();
const time = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
clockElement.textContent = time;
}
setInterval(updateClock, 1000);
updateClock();
// Function to create a new window
function createWindow(title, content) {
windowCount++;
const newWindow = document.createElement('div');
newWindow.className = 'window';
newWindow.style.left = `${50 + windowCount * 20}px`;
newWindow.style.top = `${50 + windowCount * 20}px`;
newWindow.innerHTML = `
<div class="title-bar">
<span class="title">${title}</span>
<div class="window-controls">
<button class="close">X</button>
</div>
</div>
<div class="window-content"></div>
`;
newWindow.querySelector('.window-content').appendChild(content);
desktop.appendChild(newWindow);
makeWindowActive(newWindow);
makeWindowDraggable(newWindow);
newWindow.querySelector('.close').addEventListener('click', () => {
newWindow.remove();
});
newWindow.addEventListener('mousedown', () => {
makeWindowActive(newWindow);
});
}
// Function to bring a window to the front
function makeWindowActive(windowElement) {
document.querySelectorAll('.window').forEach(win => win.classList.remove('active'));
windowElement.classList.add('active');
highestZIndex++;
windowElement.style.zIndex = highestZIndex;
}
// Function to make windows draggable
function makeWindowDraggable(windowElement) {
const titleBar = windowElement.querySelector('.title-bar');
let isDragging = false;
let offsetX, offsetY;
titleBar.addEventListener('mousedown', (e) => {
isDragging = true;
offsetX = e.clientX - windowElement.getBoundingClientRect().left;
offsetY = e.clientY - windowElement.getBoundingClientRect().top;
// Prevent text selection while dragging
e.preventDefault();
});
document.addEventListener('mousemove', (e) => {
if (!isDragging) return;
windowElement.style.left = `${e.clientX - offsetX}px`;
windowElement.style.top = `${e.clientY - offsetY}px`;
});
document.addEventListener('mouseup', () => {
isDragging = false;
});
}
// App Creation Logic
notepadIcon.addEventListener('click', () => {
const textarea = document.createElement('textarea');
textarea.className = 'notepad-textarea';
textarea.placeholder = "Start typing...";
createWindow('Notepad', textarea);
});
browserIcon.addEventListener('click', () => {
const browserContent = document.createElement('div');
browserContent.className = 'browser-container';
browserContent.innerHTML = `
<div class="browser-nav">
<input type="text" class="browser-url" value="https://www.google.com/webhp?igu=1">
</div>
<iframe class="browser-iframe" src="https://www.google.com/webhp?igu=1" sandbox="allow-forms allow-scripts allow-same-origin allow-popups"></iframe>
`;
const iframe = browserContent.querySelector('.browser-iframe');
const urlInput = browserContent.querySelector('.browser-url');
urlInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
let url = urlInput.value;
if (!url.startsWith('http')) {
url = 'https://' + url;
}
iframe.src = url;
}
});
createWindow('WebSurf', browserContent);
});
});
</script>
</body>
</html>