-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
527 lines (451 loc) · 25.6 KB
/
index.html
File metadata and controls
527 lines (451 loc) · 25.6 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
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Warped Visions (test site)</title>
<link rel="stylesheet" href="warped.css">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@600&family=Alumni+Sans+Pinstripe:wght@400;500;800&family=Lora:wght@100;400;700&display=swap" rel="stylesheet">
<style>
/* Test-specific styles */
:root {
--main-width: 700px;
--gap: 20px;
--primary: #007acc;
--content: #333;
}
/* Blog-specific test styles */
.post-card {
margin: 2rem 0;
padding: 1.5rem;
border: 1px solid #ddd;
border-radius: 4px;
background: #fefefe;
}
.post-card h2 {
margin: 0 0 0.5rem 0;
font-family: "Montserrat", sans-serif;
font-weight: 600;
}
.post-card .post-meta {
color: #666;
font-size: 0.9em;
margin-bottom: 1rem;
}
.post-card .excerpt {
margin-bottom: 1rem;
}
.archive-list, .category-list {
list-style: none;
padding: 0;
}
.archive-list li, .category-list li {
margin: 0.5rem 0;
padding: 0.5rem;
border-left: 3px solid var(--primary);
background: #f9f9f9;
}
.image-placeholder {
width: 100%;
height: 200px;
background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
border: 2px dashed #ccc;
display: flex;
align-items: center;
justify-content: center;
color: #999;
font-style: italic;
margin: 1rem 0;
}
.test-section {
margin: 2rem 0;
padding: 1.5rem;
border: 2px solid #ddd;
border-radius: 8px;
background: #fafafa;
}
.test-title {
font-family: "Montserrat", sans-serif;
font-weight: 600;
color: #007acc;
margin-bottom: 1rem;
border-bottom: 2px solid #007acc;
padding-bottom: 0.5rem;
}
.test-description {
font-style: italic;
color: #666;
margin-bottom: 1rem;
}
.js-test-result {
padding: 0.5rem;
margin: 0.5rem 0;
border-radius: 4px;
font-family: Monaco, monospace;
font-size: 0.9em;
}
.js-test-pass {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.js-test-fail {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.dark {
background: #222;
color: #ddd;
}
.dark .test-section {
background: #333;
border-color: #555;
}
.dark .post-card {
background: #333;
border-color: #555;
}
.dark .archive-list li, .dark .category-list li {
background: #2a2a2a;
border-color: var(--primary);
}
.main {
position: relative;
min-height: calc(100vh - var(--header-height) - var(--footer-height));
max-width: calc(var(--main-width) + var(--gap) * 2);
margin: auto;
padding: var(--gap);
}
</style>
</head>
<body id="top" class="list test-page">
<!-- Header Test Section -->
<header class="header">
<nav>
<div class="logo">
<a href="/">Warped Visions (test site)</a>
<div class="logo-switches">
<button onclick="toggleDarkMode()" style="padding: 0.25rem 0.5rem;">🌙</button>
</div>
<p class="tagline description p-note">
Modern web development thoughts and <a href="#experiments">experiments</a>
</p>
</div>
</nav>
<div class="post-meta">Testing warped.js rainbow links and brand bars • v1.0</div>
</header>
<main class="main">
<header class="page-header">
<h1>
Homepage H1 test
</h1>
</header>
<div class="post-content">
<p>Welcome to the warped.js testing page.</p>
<hr>
</div>
<!-- Blog Post Previews Section -->
<section>
<h2>Recent Posts</h2>
<article class="post-card">
<header>
<h2><a href="#post1">Building Modern Web Components with Vanilla JavaScript</a></h2>
<div class="post-meta">March 15, 2024 • 8 min read • <a href="#javascript">JavaScript</a>, <a href="#webdev">Web Development</a></div>
</header>
<div class="entry-content excerpt">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. This post explores how to create reusable web components without frameworks, focusing on <a href="#performance">performance</a> and <a href="#accessibility">accessibility</a>.</p>
</div>
</article>
<article class="post-card">
<header>
<h2><a href="#post2">CSS Grid vs Flexbox: When to Use Each Layout System</a></h2>
<div class="post-meta">March 8, 2024 • 6 min read • <a href="#css">CSS</a>, <a href="#layout">Layout</a></div>
</header>
<div class="entry-content excerpt">
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris. A practical guide comparing <a href="#css-grid">CSS Grid</a> and <a href="#flexbox">Flexbox</a> with real-world examples and <a href="#best-practices">best practices</a> for modern layouts.</p>
</div>
</article>
<article class="post-card">
<header>
<h2><a href="#post3">Optimizing JavaScript Bundle Size for Better Performance</a></h2>
<div class="post-meta">February 28, 2024 • 12 min read • <a href="#performance">Performance</a>, <a href="#optimization">Optimization</a></div>
</header>
<div class="entry-content excerpt">
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore. Learn techniques for reducing bundle size including <a href="#tree-shaking">tree shaking</a>, <a href="#code-splitting">code splitting</a>, and <a href="#dynamic-imports">dynamic imports</a>.</p>
</div>
</article>
</section>
<!-- Full Blog Post Sample -->
<article class="post-single">
<header>
<h1>Understanding Modern JavaScript Module Patterns</h1>
<div class="post-meta">March 20, 2024 • 15 min read • <a href="#javascript">JavaScript</a>, <a href="#modules">Modules</a>, <a href="#architecture">Architecture</a></div>
<div class="image-placeholder">Featured Image Placeholder (800x400)</div>
</header>
<div class="post-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Modern JavaScript development relies heavily on <a href="#es6-modules">ES6 modules</a>, <a href="#commonjs">CommonJS</a>, and various <a href="#bundling-tools">bundling tools</a> to create maintainable applications.</p>
<h2>The Evolution of Module Systems</h2>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. The journey from <a href="#iife">IIFE patterns</a> to <a href="#amd">AMD</a> and finally to <a href="#es-modules">ES modules</a> represents a significant shift in how we structure JavaScript applications.</p>
<div class="image-placeholder">Diagram: Module Evolution Timeline</div>
<h3>IIFE (Immediately Invoked Function Expression)</h3>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. The <a href="#iife-pattern">IIFE pattern</a> was one of the earliest approaches to <a href="#scope-isolation">scope isolation</a> in JavaScript.</p>
<div class="highlight">
<pre class="chroma"><code class="language-javascript"><span class="c1">// Classic IIFE pattern for module encapsulation</span>
<span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">global</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">privateVar</span> <span class="o">=</span> <span class="s1">'hidden'</span><span class="p">;</span>
<span class="kd">function</span> <span class="nx">privateFunction</span><span class="p">()</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">privateVar</span><span class="p">;</span>
<span class="p">}</span>
<span class="c1">// Expose public API</span>
<span class="nx">global</span><span class="p">.</span><span class="nx">MyModule</span> <span class="o">=</span> <span class="p">{</span>
<span class="nx">publicMethod</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">privateFunction</span><span class="p">();</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">})(</span><span class="k">this</span><span class="p">);</span></code></pre>
</div>
<h4>Benefits of IIFE Approach</h4>
<p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Key advantages include:</p>
<ul>
<li><a href="#namespace-pollution">Avoiding namespace pollution</a> in the global scope</li>
<li><a href="#private-variables">Creating private variables</a> and functions</li>
<li><a href="#dependency-injection">Enabling dependency injection</a> patterns</li>
<li><a href="#browser-compatibility">Maintaining browser compatibility</a> across older environments</li>
</ul>
<h5>Modern Alternatives</h5>
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium. Today's developers have access to <a href="#es6-classes">ES6 classes</a>, <a href="#es-modules">ES modules</a>, and <a href="#typescript">TypeScript</a> for better code organization.</p>
<blockquote>
<p>"The best module system is the one that your team understands and can maintain effectively. While ES6 modules are the future, legacy patterns like <a href="#iife-pattern">IIFE</a> still have their place in certain contexts."</p>
</blockquote>
<h3>ES6 Modules: The Modern Standard</h3>
<p>Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit. ES6 modules provide native <a href="#import-export">import/export syntax</a> that's both powerful and intuitive:</p>
<div class="highlight">
<pre class="chroma"><code class="language-javascript"><span class="c1">// utils.js - Named exports</span>
<span class="k">export</span> <span class="kd">const</span> <span class="nx">API_URL</span> <span class="o">=</span> <span class="s1">'https://api.example.com'</span><span class="p">;</span>
<span class="k">export</span> <span class="kd">function</span> <span class="nx">fetchData</span><span class="p">(</span><span class="nx">endpoint</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">fetch</span><span class="p">(</span><span class="sb">`</span><span class="si">${</span><span class="nx">API_URL</span><span class="si">}</span><span class="sb">/</span><span class="si">${</span><span class="nx">endpoint</span><span class="si">}</span><span class="sb">`</span><span class="p">);</span>
<span class="p">}</span>
<span class="c1">// main.js - Importing modules</span>
<span class="k">import</span> <span class="p">{</span> <span class="nx">fetchData</span><span class="p">,</span> <span class="nx">API_URL</span> <span class="p">}</span> <span class="k">from</span> <span class="s1">'./utils.js'</span><span class="p">;</span></code></pre>
</div>
<div class="image-placeholder">Code Architecture Diagram</div>
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti. Modern tooling like <a href="#webpack">Webpack</a>, <a href="#rollup">Rollup</a>, and <a href="#vite">Vite</a> make working with modules seamless.</p>
<ul class="post-tags">
<li><a href="#javascript">#javascript</a></li>
<li><a href="#modules">#modules</a></li>
<li><a href="#es6">#es6</a></li>
<li><a href="#architecture">#architecture</a></li>
<li><a href="#best-practices">#bestpractices</a></li>
</ul>
</div>
</article>
<hr/><br/>
<!-- Warped grams -->
<article class="post-single grams-test">
<header>
<h1>Let's test a few grams</h1>
<div class="post-meta">March 20, 2024 • 15 min read • <a href="#javascript">JavaScript</a>, <a href="#modules">Modules</a>, <a href="#architecture">Architecture</a></div>
</header>
<div class="post-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Modern JavaScript development relies heavily on <a href="#es6-modules">ES6 modules</a>, <a href="#commonjs">CommonJS</a>, and various <a href="#bundling-tools">bundling tools</a> to create maintainable applications.</p>
<h2>This is another section</h2>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. The journey from <a href="#iife">IIFE patterns</a> to <a href="#amd">AMD</a> and finally to <a href="#es-modules">ES modules</a> represents a significant shift in how we structure JavaScript applications.</p>
<!-- example simple diagram -->
<p><code>Novel → Expensive → Common → Invisible</code></p>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. The journey from <a href="#iife">IIFE patterns</a> to <a href="#amd">AMD</a> and finally to <a href="#es-modules">ES modules</a> represents a significant shift in how we structure JavaScript applications.</p>
<p>This is a regular non-gram block with some <code>code</code></p>
</div>
</article>
<!-- Archive Section -->
<section>
<h2>Archive</h2>
<ul class="archive-list">
<li><strong>2024</strong>
<ul>
<li>March: <a href="#post1">Building Modern Web Components</a>, <a href="#post2">CSS Grid vs Flexbox</a>, <a href="#post3">JavaScript Modules</a></li>
<li>February: <a href="#post4">Optimizing Bundle Size</a>, <a href="#post5">Async JavaScript Patterns</a></li>
<li>January: <a href="#post6">Web Performance Metrics</a>, <a href="#post7">Modern CSS Features</a></li>
</ul>
</li>
<li><strong>2023</strong>
<ul>
<li>December: <a href="#post8">Year in Review</a>, <a href="#post9">TypeScript Best Practices</a></li>
<li>November: <a href="#post10">React vs Vue Comparison</a></li>
</ul>
</li>
</ul>
</section>
<!-- Category Section -->
<section>
<h2>Categories</h2>
<ul class="category-list">
<li><strong><a href="#javascript-cat">JavaScript</a></strong> (12 posts)
<ul>
<li><a href="#post1">ES6 Modules and Import Patterns</a></li>
<li><a href="#post2">Async/Await vs Promises</a></li>
<li><a href="#post3">Modern JavaScript Bundle Optimization</a></li>
</ul>
</li>
<li><strong><a href="#css-cat">CSS & Styling</a></strong> (8 posts)
<ul>
<li><a href="#post4">CSS Grid Layout Masterclass</a></li>
<li><a href="#post5">Flexbox vs CSS Grid Usage</a></li>
<li><a href="#post6">Custom Properties and Theming</a></li>
</ul>
</li>
<li><strong><a href="#performance-cat">Web Performance</a></strong> (6 posts)
<ul>
<li><a href="#post7">Core Web Vitals Optimization</a></li>
<li><a href="#post8">Image Optimization Strategies</a></li>
</ul>
</li>
</ul>
</section>
<!-- JavaScript Tests Section (moved to bottom) -->
<div class="test-section">
<h2 class="test-title">🔧 JavaScript Functionality Tests</h2>
<p class="test-description">Testing warped.js functions and initialization</p>
<div id="js-test-results"></div>
<button onclick="runJavaScriptTests()" style="padding: 0.5rem 1rem; margin-top: 1rem;">Run JS Tests</button>
</div>
<!-- Pagination Test -->
<nav class="pagination">
<a href="#prev">← Older Posts</a>
<a href="#next">Newer Posts →</a>
</nav>
<!-- Footer Test -->
<footer class="footer">
<span class="kudos">Blog footer styling test • Warped Visions</span>
</footer>
<!-- Visual & Responsive Test Note -->
<div class="test-section">
<h2 class="test-title">🎨 Visual & Responsive Tests</h2>
<p class="test-description">Resize browser to test mobile styles. Check top and bottom of viewport for rainbow brand bars.</p>
</div>
</main>
<script>
// Configure warped.js for testing - disable debounce for reliable tests
window.WarpedConfig = {
debounceDelay: 0 // Disable debounce for immediate hover response in tests
};
</script>
<script src="warped.js"></script>
<script>
// Test Suite JavaScript
let testResults = [];
function addTestResult(testName, passed, details = '') {
testResults.push({
name: testName,
passed: passed,
details: details
});
}
function displayTestResults() {
const resultsContainer = document.getElementById('js-test-results');
resultsContainer.innerHTML = '';
testResults.forEach(result => {
const div = document.createElement('div');
div.className = `js-test-result ${result.passed ? 'js-test-pass' : 'js-test-fail'}`;
div.innerHTML = `
<strong>${result.passed ? '✓ PASS' : '✗ FAIL'}</strong>: ${result.name}
${result.details ? `<br><small>${result.details}</small>` : ''}
`;
resultsContainer.appendChild(div);
});
}
function runJavaScriptTests() {
testResults = [];
// Test 1: Check if Warped object exists (from IIFE)
try {
// Test brand bars exist
const topBar = document.querySelector('.top.warped-bar');
const bottomBar = document.querySelector('.bottom.warped-bar');
addTestResult('Brand bars created', topBar && bottomBar,
`Found top bar: ${!!topBar}, bottom bar: ${!!bottomBar}`);
} catch (e) {
addTestResult('Brand bars created', false, `Error: ${e.message}`);
}
// Test 2: Check brand bar structure
try {
const flourishes = document.querySelectorAll('.warped-bar .flourish');
addTestResult('Brand bar flourishes', flourishes.length >= 2,
`Found ${flourishes.length} flourish elements (expected: 4)`);
} catch (e) {
addTestResult('Brand bar flourishes', false, `Error: ${e.message}`);
}
// Test 3: Check rainbow link colorization
try {
const colorizedLinks = document.querySelectorAll('article p>a[data-hue], article li>a[data-hue], header p.description a[data-hue]');
addTestResult('Rainbow links colorized', colorizedLinks.length > 0,
`Found ${colorizedLinks.length} colorized links`);
} catch (e) {
addTestResult('Rainbow links colorized', false, `Error: ${e.message}`);
}
// Test 4: Check link HSL color attributes
try {
const firstLink = document.querySelector('article p>a[data-hue]');
if (firstLink) {
const hue = firstLink.getAttribute('data-hue');
const hueHover = firstLink.getAttribute('data-hue-hover');
const isValidHSL = hue && hue.includes('hsla(') && hueHover && hueHover.includes('hsla(');
addTestResult('HSL color attributes', isValidHSL,
`Default: ${hue}, Hover: ${hueHover}`);
} else {
addTestResult('HSL color attributes', false, 'No colorized links found');
}
} catch (e) {
addTestResult('HSL color attributes', false, `Error: ${e.message}`);
}
// Test 5: Test link hover functionality
try {
const testLink = document.querySelector('article p>a[data-hue]');
if (testLink) {
const originalColor = testLink.style.borderBottomColor;
// Simulate mouseover
const mouseOverEvent = new MouseEvent('mouseover', { bubbles: true });
testLink.dispatchEvent(mouseOverEvent);
const hoverColor = testLink.style.borderBottomColor;
// Simulate mouseout
const mouseOutEvent = new MouseEvent('mouseout', { bubbles: true });
testLink.dispatchEvent(mouseOutEvent);
const finalColor = testLink.style.borderBottomColor;
const hoverWorked = hoverColor !== originalColor;
addTestResult('Link hover functionality', hoverWorked,
`Original: ${originalColor}, Hover: ${hoverColor}, Final: ${finalColor}`);
} else {
addTestResult('Link hover functionality', false, 'No test link available');
}
} catch (e) {
addTestResult('Link hover functionality', false, `Error: ${e.message}`);
}
// Test 6: Check CSS custom properties
try {
const rootStyles = getComputedStyle(document.documentElement);
const warpedBlue = rootStyles.getPropertyValue('--warped-blue').trim();
const warpedGreen = rootStyles.getPropertyValue('--warped-green').trim();
addTestResult('CSS custom properties', warpedBlue && warpedGreen,
`--warped-blue: ${warpedBlue}, --warped-green: ${warpedGreen}`);
} catch (e) {
addTestResult('CSS custom properties', false, `Error: ${e.message}`);
}
// Test 7: Font loading
try {
const headerFont = getComputedStyle(document.querySelector('header nav div.logo > a')).fontFamily;
const bodyFont = getComputedStyle(document.querySelector('.post-content p')).fontFamily;
const fontsLoaded = headerFont.includes('Montserrat') && bodyFont.includes('Lora');
addTestResult('Font families loaded', fontsLoaded,
`Header: ${headerFont}, Body: ${bodyFont}`);
} catch (e) {
addTestResult('Font families loaded', false, `Error: ${e.message}`);
}
displayTestResults();
}
function toggleDarkMode() {
document.body.classList.toggle('dark');
}
// Auto-run tests after a short delay to ensure everything is loaded
setTimeout(runJavaScriptTests, 1000);
</script>
</body>
</html>