-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathembed_tool.html
More file actions
545 lines (466 loc) · 17.2 KB
/
Copy pathembed_tool.html
File metadata and controls
545 lines (466 loc) · 17.2 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>Embed Page Generator</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--primary: #022350;
--secondary: #ffffff;
--accent: #1a4fad;
--text-on-dark: #f5f7fa;
--text-on-light: #333;
--shadow: rgba(2, 35, 80, 0.15);
--light-bg: #f8fafc;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: var(--light-bg);
color: var(--text-on-light);
line-height: 1.6;
padding: 20px;
}
.container {
max-width: 1000px;
margin: 0 auto;
}
header {
text-align: center;
margin-bottom: 30px;
padding: 20px;
background: var(--primary);
color: var(--text-on-dark);
border-radius: 10px;
}
h1 {
margin-bottom: 10px;
}
.instructions {
background: var(--secondary);
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 12px var(--shadow);
margin-bottom: 30px;
}
.instructions h2 {
color: var(--primary);
margin-bottom: 15px;
}
.instructions ol {
margin-left: 20px;
margin-bottom: 15px;
}
.instructions li {
margin-bottom: 10px;
}
.form-container {
background: var(--secondary);
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 20px var(--shadow);
margin-bottom: 30px;
}
.form-section {
margin-bottom: 25px;
padding-bottom: 20px;
border-bottom: 1px solid #e2e8f0;
}
.form-section h3 {
color: var(--primary);
margin-bottom: 15px;
display: flex;
align-items: center;
gap: 10px;
}
.form-section h3 i {
font-size: 1.2rem;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: var(--primary);
}
input[type="text"], input[type="url"], textarea, select {
width: 100%;
padding: 12px 15px;
border: 2px solid #e2e8f0;
border-radius: 6px;
font-size: 16px;
transition: border-color 0.3s;
}
input[type="text"]:focus, input[type="url"]:focus, textarea:focus, select:focus {
border-color: var(--primary);
outline: none;
}
textarea {
min-height: 100px;
resize: vertical;
}
button {
background: var(--primary);
color: var(--secondary);
border: none;
padding: 14px 28px;
border-radius: 6px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: background 0.3s;
display: inline-flex;
align-items: center;
gap: 8px;
}
button:hover {
background: var(--accent);
}
.preview-container {
margin-top: 40px;
}
.preview-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.preview-header h2 {
color: var(--primary);
}
.copy-btn {
background: var(--primary);
color: white;
border: none;
padding: 10px 20px;
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
gap: 5px;
}
.copy-btn:hover {
background: var(--accent);
}
.embed-preview {
background: #f1f5f9;
border: 2px dashed #cbd5e1;
border-radius: 8px;
padding: 20px;
overflow-x: auto;
max-height: 400px;
overflow-y: auto;
}
pre {
white-space: pre-wrap;
word-break: break-all;
font-family: monospace;
font-size: 14px;
line-height: 1.5;
color: var(--text-on-light);
}
footer {
text-align: center;
margin-top: 50px;
padding: 20px;
color: #64748b;
font-size: 14px;
}
.notification {
position: fixed;
top: 20px;
right: 20px;
padding: 15px 20px;
background: var(--primary);
color: white;
border-radius: 6px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
display: flex;
align-items: center;
gap: 10px;
transform: translateX(150%);
transition: transform 0.3s ease;
z-index: 1000;
}
.notification.show {
transform: translateX(0);
}
@media (max-width: 768px) {
.form-container {
padding: 20px;
}
.preview-header {
flex-direction: column;
align-items: flex-start;
gap: 15px;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>Embed Page Generator</h1>
<p>Create a complete responsive HTML page with your embedded content</p>
</header>
<section class="instructions">
<h2>How to Use This Generator</h2>
<ol>
<li>Fill in all the details about your embedded content</li>
<li>Provide the URL you want to embed (video, map, calendar, etc.)</li>
<li>Customize the page title, description, and other metadata</li>
<li>Click "Generate Page" to create your HTML code</li>
<li>Copy the code and save it as an HTML file</li>
</ol>
</section>
<section class="form-container">
<h2>Page Details</h2>
<div class="form-section">
<h3><i class="fas fa-info-circle"></i> Basic Information</h3>
<div class="form-group">
<label for="page-title">Page Title</label>
<input type="text" id="page-title" placeholder="My Embedded Content" value="My Embedded Content">
</div>
<div class="form-group">
<label for="page-description">Page Description</label>
<textarea id="page-description" placeholder="Description of your embedded content">This page contains an embedded element that showcases important content.</textarea>
</div>
<div class="form-group">
<label for="favicon-url">Favicon URL (optional)</label>
<input type="url" id="favicon-url" placeholder="https://example.com/favicon.ico">
</div>
</div>
<div class="form-section">
<h3><i class="fas fa-link"></i> Embed Content</h3>
<div class="form-group">
<label for="embed-url">Content URL</label>
<input type="url" id="embed-url" placeholder="https://example.com/embed-content" value="https://www.youtube.com/embed/dQw4w9WgXcQ">
</div>
<div class="form-group">
<label for="embed-height">Embed Height</label>
<input type="text" id="embed-height" placeholder="600px" value="500px">
</div>
<div class="form-group">
<label for="embed-type">Content Type</label>
<select id="embed-type">
<option value="iframe">iFrame (general purpose)</option>
<option value="video">Video</option>
<option value="map">Map</option>
<option value="calendar">Calendar</option>
<option value="social">Social Media</option>
</select>
</div>
</div>
<div class="form-section">
<h3><i class="fas fa-palette"></i> Styling Options</h3>
<div class="form-group">
<label for="header-color">Header Background Color</label>
<input type="text" id="header-color" value="#022350">
</div>
<div class="form-group">
<label for="text-color">Text Color</label>
<input type="text" id="text-color" value="#ffffff">
</div>
</div>
<button id="generate-btn">
<i class="fas fa-code"></i> Generate Page
</button>
</section>
<section class="preview-container">
<div class="preview-header">
<h2>Generated HTML Page</h2>
<button class="copy-btn" id="copy-btn">
<i class="far fa-copy"></i> Copy Code
</button>
</div>
<div class="embed-preview">
<pre id="generated-html"><!-- Generated HTML will appear here --></pre>
</div>
</section>
<footer>
<p>Embed Page Generator © 2023 | Brand Colors: #022350 and #FFFFFF</p>
</footer>
</div>
<div class="notification" id="notification">
<i class="fas fa-check-circle"></i>
<span>Code copied to clipboard!</span>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const generateBtn = document.getElementById('generate-btn');
const copyBtn = document.getElementById('copy-btn');
const generatedHtml = document.getElementById('generated-html');
const notification = document.getElementById('notification');
generateBtn.addEventListener('click', generateHtml);
copyBtn.addEventListener('click', copyHtml);
function generateHtml() {
const pageTitle = document.getElementById('page-title').value;
const pageDescription = document.getElementById('page-description').value;
const faviconUrl = document.getElementById('favicon-url').value;
const embedUrl = document.getElementById('embed-url').value;
const embedHeight = document.getElementById('embed-height').value;
const embedType = document.getElementById('embed-type').value;
const headerColor = document.getElementById('header-color').value;
const textColor = document.getElementById('text-color').value;
if (!pageTitle || !embedUrl) {
alert('Please fill in at least the page title and embed URL');
return;
}
const htmlCode = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${escapeHtml(pageTitle)}</title>
<meta name="description" content="${escapeHtml(pageDescription)}">
${faviconUrl ? `<link rel="icon" href="${escapeHtml(faviconUrl)}" type="image/x-icon">` : ''}
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: #f8fafc;
color: #333;
line-height: 1.6;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
header {
background: ${headerColor};
color: ${textColor};
padding: 25px 20px;
text-align: center;
border-radius: 8px 8px 0 0;
}
h1 {
margin-bottom: 10px;
}
.description {
max-width: 800px;
margin: 0 auto;
opacity: 0.9;
}
.embed-wrapper {
background: white;
padding: 20px;
border-radius: 0 0 8px 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.embed-container {
position: relative;
overflow: hidden;
width: 100%;
border-radius: 6px;
margin: 0 auto;
}
iframe {
width: 100%;
height: ${embedHeight};
border: none;
border-radius: 6px;
}
.content-info {
max-width: 800px;
margin: 30px auto 0;
padding: 20px;
background: #f1f5f9;
border-radius: 8px;
}
.content-info h2 {
color: #022350;
margin-bottom: 15px;
}
footer {
text-align: center;
margin-top: 40px;
padding: 20px;
color: #64748b;
font-size: 14px;
}
@media (max-width: 768px) {
.container {
padding: 15px;
}
header {
padding: 20px 15px;
}
iframe {
height: 400px;
}
}
@media (max-width: 480px) {
iframe {
height: 300px;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>${escapeHtml(pageTitle)}</h1>
<p class="description">${escapeHtml(pageDescription)}</p>
</header>
<div class="embed-wrapper">
<div class="embed-container">
<iframe src="${escapeHtml(embedUrl)}" frameborder="0" allowfullscreen></iframe>
</div>
</div>
<div class="content-info">
<h2>About This Content</h2>
<p>This embedded content is hosted externally. Please ensure you have a stable internet connection to view it properly.</p>
<p>If the content does not appear, you might need to check your browser's security settings or try a different browser.</p>
</div>
<footer>
<p>Embedded Content Page © ${new Date().getFullYear()}</p>
</footer>
</div>
</body>
</html>`;
generatedHtml.textContent = htmlCode;
}
function copyHtml() {
if (!generatedHtml.textContent) {
alert('Please generate the HTML code first');
return;
}
const textArea = document.createElement('textarea');
textArea.value = generatedHtml.textContent;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
// Show notification
notification.classList.add('show');
setTimeout(() => {
notification.classList.remove('show');
}, 3000);
}
function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
}
// Generate initial code
generateHtml();
});
</script>
</body>
</html>