Files
2026-04-02 00:59:42 +08:00

373 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>Hello World - Frontend Demo</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.container {
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
padding: 40px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
text-align: center;
max-width: 600px;
width: 100%;
animation: fadeIn 0.8s ease-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
h1 {
color: #333;
font-size: 3.5rem;
margin-bottom: 20px;
background: linear-gradient(45deg, #667eea, #764ba2);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.subtitle {
color: #666;
font-size: 1.2rem;
margin-bottom: 30px;
line-height: 1.6;
}
.message-box {
background: #f8f9fa;
border-radius: 15px;
padding: 25px;
margin: 30px 0;
border-left: 5px solid #667eea;
transition: all 0.3s ease;
}
.message-box:hover {
transform: translateY(-5px);
box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}
#dynamic-message {
font-size: 1.8rem;
color: #333;
font-weight: 600;
min-height: 60px;
display: flex;
align-items: center;
justify-content: center;
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 15px;
justify-content: center;
margin: 30px 0;
}
button {
background: linear-gradient(45deg, #667eea, #764ba2);
color: white;
border: none;
padding: 12px 24px;
border-radius: 50px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
button:hover {
transform: translateY(-3px);
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}
button:active {
transform: translateY(0);
}
button.secondary {
background: linear-gradient(45deg, #6c757d, #495057);
}
button.danger {
background: linear-gradient(45deg, #dc3545, #c82333);
}
.counter {
display: flex;
align-items: center;
justify-content: center;
gap: 20px;
margin: 25px 0;
}
.counter-value {
font-size: 2.5rem;
font-weight: bold;
color: #667eea;
min-width: 60px;
}
.features {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-top: 30px;
}
.feature {
background: white;
padding: 20px;
border-radius: 15px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
transition: transform 0.3s ease;
}
.feature:hover {
transform: translateY(-5px);
}
.feature h3 {
color: #667eea;
margin-bottom: 10px;
}
.feature p {
color: #666;
font-size: 0.9rem;
}
footer {
margin-top: 40px;
color: #888;
font-size: 0.9rem;
border-top: 1px solid #eee;
padding-top: 20px;
}
@media (max-width: 768px) {
.container {
padding: 25px;
}
h1 {
font-size: 2.5rem;
}
.controls {
flex-direction: column;
}
button {
width: 100%;
}
}
</style>
</head>
<body>
<div class="container">
<h1>Hello World!</h1>
<p class="subtitle">
Welcome to this interactive frontend demo. This page demonstrates modern CSS styling,
JavaScript interactivity, and responsive design principles.
</p>
<div class="message-box">
<div id="dynamic-message">Welcome to the interactive demo!</div>
</div>
<div class="controls">
<button id="change-message">Change Message</button>
<button id="toggle-color" class="secondary">Toggle Theme</button>
<button id="reset" class="danger">Reset</button>
</div>
<div class="counter">
<button id="decrement">-</button>
<div class="counter-value" id="counter">0</div>
<button id="increment">+</button>
</div>
<div class="features">
<div class="feature">
<h3>Responsive Design</h3>
<p>Adapts to all screen sizes from mobile to desktop</p>
</div>
<div class="feature">
<h3>Modern CSS</h3>
<p>Uses gradients, animations, and flexbox</p>
</div>
<div class="feature">
<h3>Interactive JS</h3>
<p>Dynamic content updates and event handling</p>
</div>
</div>
<footer>
<p>Created with ❤️ by Frontend Engineer | OpenClaw Multi-Agent System</p>
<p id="timestamp"></p>
</footer>
</div>
<script>
// DOM Elements
const dynamicMessage = document.getElementById('dynamic-message');
const counterElement = document.getElementById('counter');
const timestampElement = document.getElementById('timestamp');
// State
let counter = 0;
let isDarkTheme = false;
// Messages array
const messages = [
"Hello World! 🌍",
"Welcome to Frontend Development! 💻",
"CSS is awesome! 🎨",
"JavaScript makes things interactive! ⚡",
"Have a great day! 😊",
"Keep coding! 👨‍💻",
"Learning every day! 📚",
"Frontend magic! ✨"
];
// Initialize
function init() {
updateTimestamp();
updateCounter();
// Event Listeners
document.getElementById('change-message').addEventListener('click', changeMessage);
document.getElementById('toggle-color').addEventListener('click', toggleTheme);
document.getElementById('reset').addEventListener('click', resetAll);
document.getElementById('increment').addEventListener('click', () => updateCounter(1));
document.getElementById('decrement').addEventListener('click', () => updateCounter(-1));
// Add some initial animation
setTimeout(() => {
dynamicMessage.style.transform = 'scale(1.05)';
setTimeout(() => {
dynamicMessage.style.transform = 'scale(1)';
}, 300);
}, 500);
}
// Update timestamp
function updateTimestamp() {
const now = new Date();
timestampElement.textContent = `Loaded: ${now.toLocaleString()}`;
}
// Change message
function changeMessage() {
const randomIndex = Math.floor(Math.random() * messages.length);
const newMessage = messages[randomIndex];
// Animation
dynamicMessage.style.opacity = '0';
dynamicMessage.style.transform = 'translateY(10px)';
setTimeout(() => {
dynamicMessage.textContent = newMessage;
dynamicMessage.style.opacity = '1';
dynamicMessage.style.transform = 'translateY(0)';
}, 300);
}
// Update counter
function updateCounter(value = 0) {
counter += value;
counterElement.textContent = counter;
// Visual feedback
if (value > 0) {
counterElement.style.color = '#28a745';
counterElement.style.transform = 'scale(1.2)';
} else if (value < 0) {
counterElement.style.color = '#dc3545';
counterElement.style.transform = 'scale(0.8)';
}
setTimeout(() => {
counterElement.style.transform = 'scale(1)';
counterElement.style.color = '#667eea';
}, 300);
}
// Toggle theme
function toggleTheme() {
isDarkTheme = !isDarkTheme;
const body = document.body;
const container = document.querySelector('.container');
if (isDarkTheme) {
body.style.background = 'linear-gradient(135deg, #2c3e50 0%, #1a1a2e 100%)';
container.style.background = 'rgba(40, 44, 52, 0.95)';
container.style.color = '#f8f9fa';
} else {
body.style.background = 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)';
container.style.background = 'rgba(255, 255, 255, 0.95)';
container.style.color = '#333';
}
}
// Reset everything
function resetAll() {
counter = 0;
isDarkTheme = false;
// Reset counter
counterElement.textContent = counter;
// Reset message
dynamicMessage.textContent = 'Welcome to the interactive demo!';
// Reset theme
document.body.style.background = 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)';
document.querySelector('.container').style.background = 'rgba(255, 255, 255, 0.95)';
document.querySelector('.container').style.color = '#333';
// Animation
dynamicMessage.style.opacity = '0';
setTimeout(() => {
dynamicMessage.style.opacity = '1';
}, 300);
updateTimestamp();
}
// Initialize on load
document.addEventListener('DOMContentLoaded', init);
</script>
</body>
</html>