-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
514 lines (480 loc) · 34.3 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<!--
Copyright (C) 2024 katerlol
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Discord Embed Generator by Kater</title>
<meta name="description"
content="Generate a valid Message Embed JSON String by using this Discord Embed Generator by Kater to set up your Message Embeds in no time.">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="apple-touch-icon" sizes="180x180" href="./img/apple-touch-icon.png?">
<link rel="icon" type="image/png" sizes="32x32" href="./img/favicon-32x32.png?">
<link rel="icon" type="image/png" sizes="16x16" href="./img/favicon-16x16.png?">
<link rel="manifest" href="./img/site.webmanifest?">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style/discord.css">
<link rel="stylesheet" href="style/main.css">
</head>
<body>
<div id="app">
<div class="container">
<div class="row">
<div class="col-12">
<h1>Discord Embed Generator <span class="primary">by Kater</span></h1>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-lg-6 offset-xl-2 col-xl-4">
<form v-on:submit.prevent>
<div class="accordion" id="accordionForm">
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button" type="button" data-bs-toggle="collapse"
data-bs-target="#collapseDefault" aria-expanded="true"
aria-controls="collapseDefault">
Basic
</button>
</h2>
<div id="collapseDefault" class="accordion-collapse collapse show"
aria-labelledby="headingOne" data-bs-parent="#accordionExample">
<div class="accordion-body">
<div class="form-group row">
<label for="color" class="col-3 col-form-label">Color</label>
<div class="col-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<input type="checkbox" @change="clearColor($event)"
v-model="cbxColor"
aria-label="Checkbox for following text input">
</div>
</div>
<input id="color" name="color" type="color" class="form-control"
v-model="embed.color" @change="updateColor">
</div>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label" for="title">Title</label>
<div class="col-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<i class="fa fa-header"></i>
</div>
</div>
<input id="title" name="title" placeholder="This is the title"
type="text" v-model="embed.title" class="form-control">
</div>
</div>
</div>
<div class="form-group row">
<label for="url" class="col-3 col-form-label">URL</label>
<div class="col-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<i class="fa fa-link"></i>
</div>
</div>
<input id="url" name="url" placeholder="https://riftq.com/euw/"
type="text" v-model="embed.url" class="form-control">
</div>
</div>
</div>
<div class="form-group row">
<label for="description" class="col-3 col-form-label">Description</label>
<div class="col-9">
<textarea id="description" ref="descriptionInput" name="description"
cols="40" rows="5" v-model="embed.description"
class="form-control"></textarea>
</div>
</div>
<div class="form-group row">
<label for="thumbnail.url" class="col-3 col-form-label">Thumbnail</label>
<div class="col-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<i class="fa fa-file-image-o"></i>
</div>
</div>
<input id="thumbnail.url" name="thumbnail.url"
placeholder="https://i.imgur.com/AfFp7pu.png" type="text"
class="form-control" v-model="embed.thumbnail.url">
</div>
</div>
</div>
<div class="form-group row">
<label for="image.url" class="col-3 col-form-label">Image</label>
<div class="col-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<i class="fa fa-file-image-o"></i>
</div>
</div>
<input id="image.url" name="image.url"
placeholder="https://i.imgur.com/AfFp7pu.png"
v-model="embed.image.url" type="text" class="form-control">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingTwo">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
data-bs-target="#collapseAuthor" aria-expanded="true"
aria-controls="collapseAuthor">
Author
</button>
</h2>
<div id="collapseAuthor" class="accordion-collapse collapse collapsed"
aria-labelledby="headingOne" data-bs-parent="#accordionExample">
<div class="accordion-body">
<div class="form-group row">
<label for="author.name" class="col-3 col-form-label">Author Name</label>
<div class="col-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<i class="fa fa-file-text"></i>
</div>
</div>
<input id="author.name" name="author.name" placeholder="Kater-Bot"
type="text" v-model="embed.author.name" class="form-control">
</div>
</div>
</div>
<div class="form-group row">
<label for="author.icon_url" class="col-3 col-form-label">Author
Icon</label>
<div class="col-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<i class="fa fa-file-image-o"></i>
</div>
</div>
<input id="author.icon_url" name="author.icon_url"
placeholder="img/katerbot-pfp.png" type="text"
class="form-control" v-model="embed.author.icon_url">
</div>
</div>
</div>
<div class="form-group row">
<label for="author.url" class="col-3 col-form-label">Author URL</label>
<div class="col-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<i class="fa fa-link"></i>
</div>
</div>
<input id="author.url" name="author.url"
placeholder="https://riftq.com/euw/" v-model="embed.author.url"
type="text" class="form-control">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
data-bs-target="#collapseFields" aria-expanded="true"
aria-controls="collapseFields">
Fields
</button>
</h2>
<div id="collapseFields" class="accordion-collapse collapse collapsed"
aria-labelledby="headingOne" data-bs-parent="#accordionExample">
<div class="accordion-body">
<div class="fields row">
<draggable v-model="embed.fields" @start="drag=true" @end="drag=false">
<template v-for="(field, index) in embed.fields" :key="index">
<div class="form-embed-field col-12" @mouseover="hoverField(index)"
@mouseleave="blurField(index)">
<div class="row">
<div class="col-12">
<div class="form-group row">
<label :for="`field-name-${index}`"
class="col-3 col-form-label">Field Name</label>
<div class="col-9">
<div class="input-group">
<input :name="`field-name-${index}`"
:id="`field-name-${index}`"
placeholder="Embed Name"
v-model="field.name" type="text"
class="form-control">
</div>
</div>
</div>
</div>
<div class="col-12">
<div class="form-group row">
<label :for="`field-value-${index}`"
class="col-3 col-form-label">Field Value</label>
<div class="col-9">
<div class="input-group">
<textarea :name="`field-value-${index}`"
:id="`field-value-${index}`" cols="40"
rows="2" v-model="field.value"
class="form-control">{{ field.value }}</textarea>
</div>
</div>
</div>
</div>
<div class="col-9 offset-3">
<div class="form-check">
<input class="form-check-input" type="checkbox"
:name="`field-inline-${index}`"
:id="`field-inline-${index}`"
v-model="field.inline">
<label class="form-check-label"
:for="`field-inline-${index}`">
Display inline
</label>
</div>
<button class="btn btn-link btn-sm text-danger"
type="submit"
@click="deleteField(index)">Delete</button>
</div>
</div>
</div>
</template>
</draggable>
</div>
<div class="row">
<button class="btn btn-primary field-add-button" @click="addField"
v-if="embed.fields.length <= 20">Add Field</button>
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingTwo">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
data-bs-target="#collapseFooter" aria-expanded="true"
aria-controls="collapseFooter">
Footer
</button>
</h2>
<div id="collapseFooter" class="accordion-collapse collapse collapsed"
aria-labelledby="headingOne" data-bs-parent="#accordionExample">
<div class="accordion-body">
<div class="form-group row">
<label for="footer.text" class="col-3 col-form-label">Footer Text</label>
<div class="col-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<i class="fa fa-file-text"></i>
</div>
</div>
<input id="footer.text" name="footer.text"
placeholder="This is the footer text"
v-model="embed.footer.text" type="text" class="form-control">
</div>
</div>
</div>
<div class="form-group row">
<label for="footer.icon_url" class="col-3 col-form-label">Footer
Icon</label>
<div class="col-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<i class="fa fa-file-image-o"></i>
</div>
</div>
<input id="footer.icon_url" name="footer.icon_url"
placeholder="img/katerbot-pfp.png" type="text"
class="form-control" v-model="embed.footer.icon_url">
</div>
</div>
</div>
<div class="form-group row">
<label for="timestamp" class="col-3 col-form-label">Timestamp</label>
<div class="col-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<input type="checkbox" @change="clearTimestamp($event)"
checked aria-label="Checkbox for following text input">
</div>
</div>
<input id="timestamp" name="timestamp" placeholder="now"
type="datetime-local" v-model="embed.timestamp"
class="form-control">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group form-buttons" role="group" aria-label="Basic example">
<button name="submit" class="btn btn-primary"
@click="() => {toEmbedStr()}">Generate</button>
<button name="submit" class="btn btn-danger" @click="clearEmbed">Clear</button>
</div>
<div class="output-wrapper" v-if="output">
<textarea class="output" v-model="output"></textarea>
<div class="output-button-wrapper">
<button class="output-btn btn btn-primary" @click="copyCommandToClipboard">!<i
class="fa fa-copy"></i></button>
<button class="output-btn btn btn-secondary" @click="copyToClipboard"><i
class="fa fa-copy"></i></button>
</div>
</div>
</div>
</form>
</div>
<div class="col-lg-6">
<div class="discord-messages">
<div class="discord-message">
<div class="discord-message-content">
<div class="discord-author-avatar">
<img src="https://katerlol.github.io/discord-embed-generator/img/katerbot-pfp.webp"
alt="">
</div>
<div class="discord-message-body">
<div>
<span class="discord-author-info">
<span class="discord-author-username" style="">Kater-Bot</span>
<span class="discord-author-bot-tag"> Bot </span>
</span>
<span class="discord-message-timestamp">{{ new Date().toDateString() }}</span>
</div>
<div class="discord-embed">
<div class="discord-embed-left-border"
style="background-color:var(--background-color);"></div>
<div class="discord-embed-container">
<div class="discord-embed-content">
<div>
<div class="discord-embed-author">
<img v-if="embed.author.icon_url"
class="discord-embed-author-icon"
:src="embed.author.icon_url" alt="">
<span v-if="!embed.author.url">{{embed.author.name}}</span>
<a v-if="embed.author.url" :href="embed.author.url"
target="_blank" rel="noopener noreferrer">
{{embed.author.name}}
</a>
</div>
<div class="discord-embed-title" v-if="embed.title">
<span v-if="!embed.url">{{embed.title}}</span>
<a v-if="embed.url" href="https://discord.js.org/"
target="_blank" rel="noopener noreferrer">
{{embed.title}}
</a>
</div>
<div v-if="embed.description" class="discord-embed-description"
v-html="fromMarkdown(embed.description)">
</div>
<div class="discord-embed-fields">
<template v-for="field in embed.fields">
<div class="discord-embed-field"
v-bind:class="{ 'discord-embed-field-inline': field.inline }">
<div class="discord-embed-field-title">{{field.name}}
</div>
<div class="discord-embed-field-value"
v-html="fromMarkdown(field.value)">
</div>
</div>
</template>
</div>
<img v-if="embed.image" class="discord-embed-image"
:src="embed.image.url" alt="">
</div>
<img v-if="embed.thumbnail" class="discord-embed-thumbnail"
:src="embed.thumbnail.url" alt="">
</div>
<div class="discord-embed-footer">
<img v-if="embed.footer.icon_url" class="discord-embed-footer-icon"
:src="embed.footer.icon_url" alt="">
<span>
<span>{{ embed.footer.text }}</span>
<span v-if="embed.timestamp" class="discord-embed-footer-separator">
• </span>
<span v-if="embed.timestamp">{{ printTimestamp(embed.timestamp)
}}</span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Success and Error Toasts -->
<div aria-live="polite" aria-atomic="true" class="position-relative">
<div class="toast-container position-fixed top-0 end-0 p-3">
<!-- Success Toast -->
<div class="toast align-items-center text-bg-success border-0" role="alert" aria-live="assertive"
aria-atomic="true" ref="successToast">
<div class="d-flex">
<div class="toast-body">
Successfully copied to clipboard!
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"
aria-label="Close"></button>
</div>
</div>
<!-- Command Success Toast -->
<div class="toast align-items-center text-bg-success border-0" role="alert" aria-live="assertive"
aria-atomic="true" ref="commandSuccessToast">
<div class="d-flex">
<div class="toast-body">
Bot-command successfully copied to clipboard!
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"
aria-label="Close"></button>
</div>
</div>
<!-- Error Toast -->
<div class="toast align-items-center text-bg-danger border-0" role="alert" aria-live="assertive"
aria-atomic="true" ref="errorToast">
<div class="d-flex">
<div class="toast-body">
Failed to copy!
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"
aria-label="Close"></button>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.8.4/Sortable.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Vue.Draggable/2.20.0/vuedraggable.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
<script src="index.js"></script>
</body>
</html>