-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtool-18-Lorem-Ipsum-Generator.html
More file actions
545 lines (457 loc) · 20.9 KB
/
Copy pathtool-18-Lorem-Ipsum-Generator.html
File metadata and controls
545 lines (457 loc) · 20.9 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
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tool 18 - Lorem Ipsum Generator - Developer Toolbox</title>
<link rel="stylesheet" href="assets/core.css">
<style>
.lorem-container {
max-width: 900px;
margin: 2rem auto;
position: relative;
z-index: 10;
}
.generator-panel {
background: rgba(0, 0, 0, 0.4);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
padding: 2rem;
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.controls-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1.5rem;
background: rgba(255, 255, 255, 0.02);
padding: 1.5rem;
border-radius: var(--radius-sm);
border: 1px solid rgba(255, 255, 255, 0.05);
}
.control-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.control-group label {
font-size: 0.9rem;
color: var(--text-secondary);
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
}
.control-group select,
.control-group input[type="number"] {
padding: 0.8rem;
background: var(--bg-main);
border: 1px solid var(--border-color);
color: var(--text-primary);
border-radius: var(--radius-sm);
font-family: var(--font-mono);
outline: none;
width: 100%;
}
.control-group select:focus,
.control-group input[type="number"]:focus {
border-color: var(--accent-primary);
}
/* Generate Button Row */
.action-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 1rem;
}
.action-row .btn-primary {
font-size: 1.1rem;
padding: 0.8rem 3rem;
background: #BB86FC;
color: #000;
}
/* Results Area */
.results-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 1.5rem;
margin-bottom: 0.5rem;
}
#lorem-output {
width: 100%;
height: 350px;
background: rgba(0, 0, 0, 0.5);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
padding: 1.5rem;
color: var(--text-primary);
font-family: var(--font-ui);
font-size: 1.1rem;
line-height: 1.6;
resize: vertical;
outline: none;
transition: border-color 0.3s;
}
#lorem-output.html-format {
font-family: var(--font-mono);
font-size: 0.95rem;
white-space: pre-wrap;
}
#lorem-output:focus {
border-color: var(--accent-primary);
}
/* 3D background container */
#canvas-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
opacity: 0.4;
pointer-events: none;
}
</style>
</head>
<body class="theme-dark">
<div id="canvas-container"></div>
<main class="main-content" style="position: relative; z-index: 10;">
<div class="container">
<div class="tool-header">
<div>
<a href="index.html" class="back-link">← Back to Toolbox</a>
<h1>18. Lorem Ipsum Generator</h1>
<p style="color: var(--text-secondary); margin-top: 0.5rem;">Generate placeholder text with various
flavors formats.</p>
</div>
<div>
<select id="theme-select" aria-label="Select Theme">
<option value="dark">Dark Theme</option>
<option value="light">Light Theme</option>
<option value="solarized">Solarized</option>
<option value="neon">Neon Glow</option>
<option value="highcontrast">High Contrast</option>
</select>
</div>
</div>
<div class="lorem-container">
<div class="generator-panel glass-panel">
<div class="controls-grid">
<div class="control-group">
<label for="lorem-type">Type</label>
<select id="lorem-type">
<option value="paragraphs" selected>Paragraphs</option>
<option value="sentences">Sentences</option>
<option value="words">Words</option>
</select>
</div>
<div class="control-group">
<label for="lorem-length">Length</label>
<input type="number" id="lorem-length" value="3" min="1" max="100">
</div>
<div class="control-group">
<label for="lorem-flavor">Flavor</label>
<select id="lorem-flavor">
<option value="classic" selected>Classic (Latin)</option>
<option value="corporate">Corporate Buzzwords</option>
<option value="cyberpunk">Cyberpunk / Tech</option>
</select>
</div>
<div class="control-group">
<label for="lorem-format">Output Format</label>
<select id="lorem-format">
<option value="text" selected>Plain Text</option>
<option value="html">HTML (<p> tags)</option>
</select>
</div>
</div>
<div class="action-row">
<div></div> <!-- spacer -->
<button id="btn-generate" class="btn btn-primary">Generate Text</button>
</div>
<div class="results-container">
<div class="results-header">
<h3 style="margin:0;">Generated Output <span id="word-count" class="text-secondary"
style="font-size: 0.9rem; font-weight: normal;">(0 words)</span></h3>
<button id="btn-copy" class="btn">Copy to Clipboard</button>
</div>
<textarea id="lorem-output" readonly
placeholder="Your generated text will appear here..."></textarea>
</div>
</div>
</div>
</div>
</main>
<!-- Three.js and GSAP for 3D Background -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="assets/core.js"></script>
<script>
// --- Core Generator Logic ---
// Vocabularies
const dicts = {
classic: [
"lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit",
"sed", "do", "eiusmod", "tempor", "incididunt", "ut", "labore", "et", "dolore",
"magna", "aliqua", "enim", "ad", "minim", "veniam", "quis", "nostrud",
"exercitation", "ullamco", "laboris", "nisi", "ut", "aliquip", "ex", "ea",
"commodo", "consequat", "duis", "aute", "irure", "dolor", "in", "reprehenderit",
"in", "voluptate", "velit", "esse", "cillum", "dolore", "eu", "fugiat",
"nulla", "pariatur", "excepteur", "sint", "occaecat", "cupidatat", "non",
"proident", "sunt", "in", "culpa", "qui", "officia", "deserunt", "mollit",
"anim", "id", "est", "laborum"
],
corporate: [
"synergy", "paradigm", "leverage", "robust", "scalable", "proactive", "bandwidth",
"pipeline", "deliverable", "agile", "touchpoint", "ecosystem", "holistic",
"alignment", "ideation", "onboarding", "stakeholder", "innovative", "disruptive",
"empower", "metrics", "optimization", "seamless", "vertical", "integration",
"value-add", "wheelhouse", "pivot", "ROI", "best-practice", "frictionless",
"granular", "game-changer", "insight", "milestone", "traction", "cross-functional"
],
cyberpunk: [
"neon", "matrix", "cyber", "neural", "grid", "mainframe", "synth", "deck",
"data", "stream", "hologram", "jack-in", "proxy", "ice", "node", "nexus",
"quantum", "glitch", "algorithm", "upload", "override", "protocol", "dystopia",
"cortex", "interface", "chrome", "wire", "byte", "server", "code", "terminal"
]
};
const typeSelect = document.getElementById('lorem-type');
const lengthInput = document.getElementById('lorem-length');
const flavorSelect = document.getElementById('lorem-flavor');
const formatSelect = document.getElementById('lorem-format');
const btnGenerate = document.getElementById('btn-generate');
const btnCopy = document.getElementById('btn-copy');
const outputArea = document.getElementById('lorem-output');
const wordCountEl = document.getElementById('word-count');
// Helper functions for generation
function capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
function rndWord(dict) {
return dict[Math.floor(Math.random() * dict.length)];
}
function generateWords(count, dict) {
const words = [];
for (let i = 0; i < count; i++) {
words.push(rndWord(dict));
}
return words.join(' ');
}
function generateSentence(dict) {
// Sentences are 5 to 12 words long
const length = Math.floor(Math.random() * 8) + 5;
let words = [];
for (let i = 0; i < length; i++) {
words.push(rndWord(dict));
}
let sentence = words.join(' ');
// Add punctuation sometimes
if (Math.random() > 0.8) sentence += ',';
else if (Math.random() > 0.9) sentence += ';';
// End sentence
const ends = ['.', '.', '.', '!', '?'];
const end = ends[Math.floor(Math.random() * ends.length)];
return capitalize(sentence) + end;
}
function generateParagraph(dict) {
// Paragraphs are 3 to 7 sentences long
const length = Math.floor(Math.random() * 5) + 3;
let sentences = [];
for (let i = 0; i < length; i++) {
sentences.push(generateSentence(dict));
}
return sentences.join(' ');
}
function generate() {
const type = typeSelect.value;
let length = parseInt(lengthInput.value) || 1;
const flavor = flavorSelect.value;
const format = formatSelect.value;
const dict = dicts[flavor];
let textBlocks = [];
// Always start classic with standard phrase if paragraph mode
if (flavor === 'classic' && type === 'paragraphs' && length >= 1) {
textBlocks.push("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
length--;
}
for (let i = 0; i < length; i++) {
if (type === 'paragraphs') textBlocks.push(generateParagraph(dict));
else if (type === 'sentences') textBlocks.push(generateSentence(dict));
else if (type === 'words') textBlocks.push(generateWords(1, dict));
}
let finalOutput = "";
if (format === 'html') {
outputArea.classList.add('html-format');
if (type === 'paragraphs' || type === 'sentences') {
finalOutput = textBlocks.map(block => `<p>${block}</p>`).join('\n\n');
} else {
// Just wrap words in a span or p
finalOutput = `<p>${textBlocks.join(' ')}</p>`;
}
} else {
outputArea.classList.remove('html-format');
if (type === 'paragraphs') {
finalOutput = textBlocks.join('\n\n');
} else {
finalOutput = textBlocks.join(' ');
}
}
outputArea.value = finalOutput;
// Update word count
let rawText = finalOutput.replace(/<[^>]*>?/gm, ''); // strip HTML tags for word count
const words = rawText.trim() === "" ? 0 : rawText.trim().split(/\s+/).length;
wordCountEl.textContent = `(${words} words)`;
// Trigger 3D Waterfall
if (window.triggerDrop) window.triggerDrop();
}
btnGenerate.addEventListener('click', generate);
btnCopy.addEventListener('click', () => {
if (!outputArea.value) return;
navigator.clipboard.writeText(outputArea.value);
const orig = btnCopy.textContent;
btnCopy.textContent = 'Copied!';
setTimeout(() => btnCopy.textContent = orig, 1500);
});
// Initialize
generate();
// --- 3D Background Setup (Text Block Waterfall) ---
let scene, camera, renderer, textGroup;
let blocks = [];
const maxBlocks = 60;
// Canvas texture function for "blocks of text" effect
const createTextLinesTexture = (flavorIdx) => {
const canvas = document.createElement('canvas');
canvas.width = 128;
canvas.height = 128;
const ctx = canvas.getContext('2d');
ctx.fillStyle = '#2d2d2d';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Different colors for flavors
const lineColors = ['#BB86FC', '#03DAC6', '#ff5252'];
const color = lineColors[flavorIdx % lineColors.length];
ctx.fillStyle = color;
// Draw faux lines of text
for (let i = 0; i < 5; i++) {
const y = 20 + (i * 20);
// varying line lengths
const w = 40 + Math.random() * 60;
ctx.fillRect(10, y, w, 8);
// second block on same line sometimes
if (Math.random() > 0.5) {
const startX = 10 + w + 10;
const w2 = Math.random() * (canvas.width - startX - 10);
if (w2 > 5) ctx.fillRect(startX, y, w2, 8);
}
}
return new THREE.CanvasTexture(canvas);
};
const init3D = () => {
const container = document.getElementById('canvas-container');
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.z = 30;
renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
container.appendChild(renderer.domElement);
const ambientLight = new THREE.AmbientLight(0xffffff, 0.8);
scene.add(ambientLight);
const dirLight = new THREE.DirectionalLight(0xffffff, 0.5);
dirLight.position.set(5, 5, 5);
scene.add(dirLight);
textGroup = new THREE.Group();
scene.add(textGroup);
// Textures
const tex1 = createTextLinesTexture(0);
const tex2 = createTextLinesTexture(1);
const tex3 = createTextLinesTexture(2);
const textures = [tex1, tex2, tex3];
const geo = new THREE.BoxGeometry(4, 4, 0.2);
for (let i = 0; i < maxBlocks; i++) {
const matInfo = [
new THREE.MeshBasicMaterial({ color: 0x222222 }), // sides
new THREE.MeshBasicMaterial({ color: 0x222222 }),
new THREE.MeshBasicMaterial({ color: 0x222222 }),
new THREE.MeshBasicMaterial({ color: 0x222222 }),
new THREE.MeshBasicMaterial({ map: textures[i % 3] }), // front text
new THREE.MeshBasicMaterial({ color: 0x222222 }) // back
];
const mesh = new THREE.Mesh(geo, matInfo);
// Start high above
resetBlockPath(mesh);
// Add edges
const edges = new THREE.EdgesGeometry(geo);
const line = new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0x000000, transparent: true, opacity: 0.5 }));
mesh.add(line);
blocks.push(mesh);
textGroup.add(mesh);
}
function resetBlockPath(mesh) {
mesh.position.set(
(Math.random() - 0.5) * 40,
20 + Math.random() * 20, // start high
(Math.random() - 0.5) * 20 - 5
);
mesh.rotation.set(
(Math.random() - 0.5) * 0.5, // slight tilt x
(Math.random() - 0.5) * 0.5, // slight tilt y
0
);
// Add velocity data
mesh.userData = {
speedY: 0.1 + (Math.random() * 0.15),
rotSpeedZ: (Math.random() - 0.5) * 0.02
};
}
// Waterfall Animation Trigger
window.triggerDrop = () => {
// Jolt all blocks downwards slightly to signify new blocks falling
blocks.forEach((b, i) => {
// Speed up temporarily
b.userData.speedY += 0.3;
// Random flash of edge color
b.children[0].material.color.setHex(0xBB86FC);
setTimeout(() => { b.children[0].material.color.setHex(0x000000); }, 500);
});
};
const animate = () => {
requestAnimationFrame(animate);
// Continuous waterfall
blocks.forEach(b => {
b.position.y -= b.userData.speedY; // fall
b.rotation.z += b.userData.rotSpeedZ; // drift spin
// Recover normal speed if jolted by clicking generate
if (b.userData.speedY > 0.3) {
b.userData.speedY *= 0.95; // dampening
}
// Reset if falls below screen
if (b.position.y < -30) {
resetBlockPath(b);
}
});
// Slow camera pan
camera.position.x = Math.sin(Date.now() * 0.0002) * 5;
camera.lookAt(0, 0, 0);
renderer.render(scene, camera);
};
animate();
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
if (window.innerWidth < 900) {
camera.position.z = 45; // pull back to see more blocks
} else {
camera.position.z = 30;
}
});
window.dispatchEvent(new Event('resize'));
};
if (document.getElementById('canvas-container')) {
init3D();
}
</script>
</body>
</html>