-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
434 lines (373 loc) · 18.8 KB
/
Copy pathindex.html
File metadata and controls
434 lines (373 loc) · 18.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Template</title>
<link rel="stylesheet" href="base.css">
</head>
<body>
<div class="app-container">
<!-- Header Section -->
<header class="header">
<nav class="nav-menu">
<div class="nav-buttons">
<a href="#" class="nav-btn active" data-page="home">Home</a>
<a href="#" class="nav-btn" data-page="about">About</a>
<a href="#" class="nav-btn" data-page="projects">Projects</a>
<a href="#" class="nav-btn" data-page="contact">Contact</a>
</div>
<div class="header-controls">
<button class="theme-toggle" id="themeToggle" title="Toggle theme">🌙</button>
<button class="settings-btn" id="settingsBtn" title="Settings">⚙️</button>
</div>
</nav>
</header>
<!-- Sidebar Section -->
<aside class="sidebar">
<h2>Navigation</h2>
<div class="sidebar-content">
<p>Welcome to the HTML template. This sidebar takes up 35% of the screen width and provides additional navigation or content.</p>
<h3>Quick Links</h3>
<ul>
<li><a href="#section1">Section 1</a></li>
<li><a href="#section2">Section 2</a></li>
<li><a href="#section3">Section 3</a></li>
<li><a href="#section4">Section 4</a></li>
</ul>
<h3>Features</h3>
<ul>
<li>Responsive design</li>
<li>Light/Dark theme</li>
<li>Sticky header & footer</li>
<li>Modal settings</li>
<li>Progress tracking</li>
<li>Integrated logging</li>
</ul>
</div>
</aside>
<!-- Main Content Section -->
<main class="main">
<div id="pageContent">
<!-- Home Page Content -->
<div id="homePage" class="page-content">
<h1>Welcome to HTML Template</h1>
<p>This is the main content area that occupies 65% of the screen width. The layout is fully responsive and includes theme switching capabilities.</p>
<div class="card">
<h2>Template Features</h2>
<p>This template includes a comprehensive set of features for modern web applications:</p>
<ul style="margin-left: 2rem; margin-top: 1rem;">
<li>CSS Grid layout with sticky header and footer</li>
<li>Responsive design that works on all screen sizes</li>
<li>Light and dark theme support with smooth transitions</li>
<li>Modal dialog system for settings and configuration</li>
<li>Integrated logging system using simple-logger.js</li>
<li>Progress bar for user feedback</li>
<li>Horizontal navigation menu with active states</li>
</ul>
</div>
<div class="card" id="section1">
<h2>Section 1: Layout Structure</h2>
<p>The layout uses CSS Grid with the following areas:</p>
<ul style="margin-left: 2rem; margin-top: 1rem;">
<li><strong>Header:</strong> Spans full width with navigation menu</li>
<li><strong>Sidebar:</strong> Takes 35% width on desktop</li>
<li><strong>Main:</strong> Takes remaining 65% width</li>
<li><strong>Footer:</strong> Spans full width with progress bar</li>
</ul>
</div>
<div class="card" id="section2">
<h2>Section 2: Theme System</h2>
<p>The theme system uses CSS custom properties (variables) to enable smooth transitions between light and dark modes. Click the moon/sun icon in the header to toggle themes.</p>
</div>
<div class="card" id="section3">
<h2>Section 3: Logging Integration</h2>
<p>This template includes the simple-logger.js for browser-based logging. All interactions are logged to the browser console with timestamps and structured data.</p>
<button onclick="testLogging()" style="background: var(--nav-bg); color: var(--text); border: 1px solid var(--text); padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer;">Test Logging</button>
</div>
<div class="card" id="section4">
<h2>Section 4: Progress Tracking</h2>
<p>The footer includes a progress bar that can be used to provide user feedback during operations.</p>
<button onclick="simulateProgress()" style="background: var(--nav-bg); color: var(--text); border: 1px solid var(--text); padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer;">Simulate Progress</button>
</div>
</div>
<!-- About Page Content -->
<div id="aboutPage" class="page-content" style="display: none;">
<h1>About This Template</h1>
<p>This HTML template was created to provide a solid foundation for web applications with modern design patterns and user experience considerations.</p>
<div class="card">
<h2>Technical Specifications</h2>
<ul style="margin-left: 2rem; margin-top: 1rem;">
<li>CSS Grid for layout structure</li>
<li>CSS Custom Properties for theming</li>
<li>Vanilla JavaScript for interactions</li>
<li>Responsive design with mobile-first approach</li>
<li>Accessibility considerations built-in</li>
</ul>
</div>
<div class="card">
<h2>Browser Support</h2>
<p>This template supports all modern browsers including Chrome, Firefox, Safari, and Edge. CSS Grid and Custom Properties are well-supported across all target browsers.</p>
</div>
</div>
<!-- Projects Page Content -->
<div id="projectsPage" class="page-content" style="display: none;">
<h1>Projects</h1>
<p>This section can showcase various projects or applications built using this template.</p>
<div class="card">
<h2>Project Template</h2>
<p>This template itself serves as a project, demonstrating the integration of multiple web technologies and design patterns.</p>
</div>
<div class="card">
<h2>Customization Options</h2>
<p>The template can be easily customized by modifying the CSS custom properties in the :root selector. Change colors, spacing, and layout proportions to match your design needs.</p>
</div>
</div>
<!-- Contact Page Content -->
<div id="contactPage" class="page-content" style="display: none;">
<h1>Contact</h1>
<p>Get in touch for questions about this template or custom development needs.</p>
<div class="card">
<h2>Template Support</h2>
<p>For questions about using or customizing this template, please refer to the documentation or create an issue in the project repository.</p>
</div>
<div class="card">
<h2>Custom Development</h2>
<p>This template can serve as a starting point for custom web application development with additional features and functionality.</p>
</div>
</div>
</div>
</main>
<!-- Footer Section -->
<footer class="footer">
<div class="footer-content">
<small class="copyright">Application © 2025 by Erich Quade</small>
<div class="progress-container">
<div class="progress-bar">
<div class="progress-fill" id="progressFill"></div>
</div>
</div>
</div>
</footer>
</div>
<!-- Settings Modal -->
<div id="settingsModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title">Settings</h2>
<button class="close-btn" id="closeModal">×</button>
</div>
<div class="settings-section">
<h3>Appearance</h3>
<div class="setting-item">
<span class="setting-label">Theme:</span>
<button id="modalThemeToggle" class="theme-toggle">🌙</button>
</div>
</div>
<div class="settings-section">
<h3>Logging</h3>
<div class="setting-item">
<span class="setting-label">Log Level:</span>
<select id="logLevel" style="background: var(--nav-bg); color: var(--text); border: 1px solid var(--text); padding: 0.25rem; border-radius: 4px;">
<option value="NONE">None</option>
<option value="LOW">Low (Errors only)</option>
<option value="MED">Medium (Errors + Warnings)</option>
<option value="HIGH" selected>High (All except Dev)</option>
<option value="DEV">Dev (Everything)</option>
</select>
</div>
</div>
<div class="settings-section">
<h3>Layout</h3>
<div class="setting-item">
<span class="setting-label">Sidebar Width:</span>
<span>35% (Fixed for this template)</span>
</div>
<div class="setting-item">
<span class="setting-label">Responsive:</span>
<span>✓ Enabled</span>
</div>
</div>
<div class="settings-section">
<h3>About</h3>
<p style="font-size: 0.9rem; margin: 0.5rem 0;">HTML Template v1.0<br>
Built with CSS Grid, Custom Properties, and vanilla JavaScript.<br>
Integrated with simple-logger.js for comprehensive logging.</p>
</div>
</div>
</div>
<!-- Scripts -->
<script src="simple-logger.js"></script>
<script>
// Initialize logger for browser use
const logger = new SimpleLogger({
appName: "HTMLTemplate",
level: "HIGH",
compactMode: true,
showProcessId: false,
enableFileLogging: false // File logging not available in browser
});
// Log application startup
logger.info("Application initialized", {
theme: document.documentElement.getAttribute('data-theme'),
timestamp: new Date().toISOString(),
userAgent: navigator.userAgent
});
// Theme toggle functionality
let currentTheme = 'light';
const themeToggle = document.getElementById('themeToggle');
const modalThemeToggle = document.getElementById('modalThemeToggle');
function toggleTheme() {
currentTheme = currentTheme === 'light' ? 'dark' : 'light';
document.documentElement.setAttribute('data-theme', currentTheme);
// Update toggle buttons
const icon = currentTheme === 'light' ? '🌙' : '☀️';
themeToggle.textContent = icon;
modalThemeToggle.textContent = icon;
logger.info("Theme changed", { newTheme: currentTheme });
}
themeToggle.addEventListener('click', toggleTheme);
modalThemeToggle.addEventListener('click', toggleTheme);
// Navigation functionality
const navButtons = document.querySelectorAll('.nav-btn');
const pageContents = document.querySelectorAll('.page-content');
function showPage(pageId) {
// Hide all pages
pageContents.forEach(page => {
page.style.display = 'none';
});
// Show selected page
const targetPage = document.getElementById(pageId + 'Page');
if (targetPage) {
targetPage.style.display = 'block';
}
// Update active navigation button
navButtons.forEach(btn => {
btn.classList.remove('active');
});
const activeBtn = document.querySelector(`[data-page="${pageId}"]`);
if (activeBtn) {
activeBtn.classList.add('active');
}
logger.info("Page navigation", { pageId: pageId });
}
navButtons.forEach(button => {
button.addEventListener('click', (e) => {
e.preventDefault();
const pageId = button.getAttribute('data-page');
showPage(pageId);
});
});
// Modal functionality
const settingsModal = document.getElementById('settingsModal');
const settingsBtn = document.getElementById('settingsBtn');
const closeModal = document.getElementById('closeModal');
settingsBtn.addEventListener('click', () => {
settingsModal.classList.add('show');
logger.info("Settings modal opened");
});
closeModal.addEventListener('click', () => {
settingsModal.classList.remove('show');
logger.info("Settings modal closed");
});
// Close modal when clicking outside
settingsModal.addEventListener('click', (e) => {
if (e.target === settingsModal) {
settingsModal.classList.remove('show');
logger.info("Settings modal closed (outside click)");
}
});
// Log level change handler
const logLevelSelect = document.getElementById('logLevel');
logLevelSelect.addEventListener('change', (e) => {
const newLevel = e.target.value;
logger.setLevel(newLevel);
logger.info("Log level changed", { newLevel: newLevel });
});
// Progress bar functionality
let progressInterval;
function setProgress(percent) {
const progressFill = document.getElementById('progressFill');
progressFill.style.width = Math.min(100, Math.max(0, percent)) + '%';
}
function simulateProgress() {
// Clear any existing progress simulation
if (progressInterval) {
clearInterval(progressInterval);
}
logger.info("Progress simulation started");
let progress = 0;
let step = 0;
const totalSteps = 50; // Total number of steps for smooth animation
const stepSize = 100 / totalSteps; // Each step is 2%
setProgress(0);
progressInterval = setInterval(() => {
step++;
// Smooth incremental progress with slight variation
progress = (step / totalSteps) * 100;
// Add small random variation for realistic feel (±0.5%)
const variation = (Math.random() - 0.5) * 1;
const displayProgress = Math.min(100, progress + variation);
setProgress(displayProgress);
// Log progress at 25% intervals only to reduce console spam
if (step % Math.floor(totalSteps / 4) === 0 || step === totalSteps) {
logger.debug("Progress update", {
progress: Math.round(displayProgress),
step: step,
totalSteps: totalSteps
});
}
if (step >= totalSteps) {
clearInterval(progressInterval);
progressInterval = null;
setProgress(100);
logger.info("Progress simulation completed", { finalProgress: 100 });
// Reset after 2 seconds
setTimeout(() => {
setProgress(0);
logger.debug("Progress bar reset");
}, 2000);
}
}, 80); // Faster interval (80ms) for smoother animation
}
// Test logging function
function testLogging() {
logger.error("Test error message", { errorCode: 404, endpoint: "/api/test" });
logger.warn("Test warning message", { threshold: 90, current: 95 });
logger.info("Test info message", { userId: 123, action: "test_log" });
logger.debug("Test debug message", { debugInfo: "test data" });
logger.dev("Test development message", { devMode: true });
console.log("Check the browser console to see the formatted log messages!");
}
// Smooth scrolling for sidebar links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const targetId = this.getAttribute('href').substring(1);
const targetElement = document.getElementById(targetId);
if (targetElement) {
targetElement.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
logger.debug("Scrolled to section", { targetId: targetId });
}
});
});
// Window resize handler
let resizeTimeout;
window.addEventListener('resize', () => {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(() => {
logger.debug("Window resized", {
width: window.innerWidth,
height: window.innerHeight
});
}, 250);
});
// Initialize progress bar (optional demonstration)
setProgress(0);
logger.info("All event handlers attached and application ready");
</script>
</body>
</html>