-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
223 lines (194 loc) · 8.59 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
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/css/neutral.min.css" />
<link rel="icon" type="image/x-icon" href="assest/favicon.ico" />
<meta name="theme-color" content="#0d0d0d" />
<link rel="stylesheet" href="style.css" />
<title>Certedit</title>
</head>
<body>
<div class="uk-position-fixed uk-width-1-1" style="z-index: 999">
<nav class="uk-navbar-container" id="navcolor">
<div class="uk-container">
<div uk-navbar>
<div class="uk-navbar-left">
<a class="uk-navbar-item uk-logo" href="#" id="reset" aria-label="Back to Home"><img
src="assest/ertedit.svg" alt="" class="nav_logo" id="favicon"/></a>
<ul class="uk-navbar-nav">
<li>
<a href="https://github.com/theajmalrazaq/certedit" class="uk-flex uk-flex-middle" target="_blank">
<span class="uk-icon uk-margin-small-right" uk-icon="icon: star" id="starlogo"></span>
<span style="margin-top: 5px" id="git"> Star on Github</span>
</a>
</li>
<li class="place">
<button id="themeToggle" class="uk-button uk-button-default "><img src="./assest/brightness (1).png" id="mode" alt="" class="bright"></button>
</li>
</ul>
</div>
</div>
</div>
</nav>
</div>
<div id="home" class="uk-height-1-1">
<div class="uk-container uk-height-1-1 uk-flex uk-flex-around uk-flex-middle uk-flex-wrap-reverse">
<div class="uk-flex uk-flex-column uk-height-large uk-flex-between uk-flex-middle">
<div >
<img src="assest/ertedit.svg" alt="" class="logo" id="favicon2" />
<h1 class="uk-margin-small-top">
Generate Certificate with different names at once
</h1>
<p>
Designed with 💖 By
<a class="uk-link" href="https://github.com/theajmalrazaq">AjmaL Razaq Bhatti</a>
</p>
</div>
<button class="uk-button uk-button-default btn uk-text-bold uk-text-large" id="generate">
Generate
</button>
</div>
</div>
</div>
<div id="st-1" class="uk-flex-center uk-flex-middle uk-padding uk-flex-wrap uk-height-1-1" style="display: none">
<div class="uk-section">
<div class="uk-container uk-container-xsmall">
<div class="uk-card uk-card-default box1" >
<div class="uk-card-header box2" >
<h3 class="uk-card-title">Step 1</h3>
<p class="uk-margin-small-top uk-text-small text-muted-foreground up" id="Upload">
Upload Certificate on which you want to add names
</p>
</div>
<div class="js-upload uk-form-custom uk-padding-small" uk-form-custom="" style="width: fit-content" id="dropArea">
<input type="file" accept="image/*" id="imageUpload1" style="display: none;" onchange="displayFileName()" />
<p id="dropMessage" style="margin: 0; cursor: pointer;">Drag and drop an image here or click to upload</p>
</div>
<div class="uk-card-footer uk-flex uk-flex-between box2">
<button class="uk-button uk-button-default letter" id="bck1">
Back
</button>
<button class="uk-button uk-button-default letter" id="confirmArea">
Confirm
</button>
</div>
</div>
</div>
</div>
<div class="uk-container uk-container-xsmall uk-flex uk-flex-center uk-remove-padding">
<canvas id="imageCanvas"></canvas>
</div>
</div>
<div id="st-2" class="uk-flex-center uk-flex-middle uk-padding uk-flex-wrap uk-height-1-1" style="display: none">
<div class="uk-section">
<div class="uk-card uk-card-default box1">
<div class="uk-card-header box2">
<h3 class="uk-card-title">Step 2</h3>
<p class="uk-margin-small-top uk-text-small text-muted-foreground up">
Select Name list txt/csv for which you want to generate
certificates
</p>
</div>
<div class="input_wrapper uk-flex uk-flex-column uk-padding-small uk-flex-between">
<div class="js-upload uk-form-custom" uk-form-custom="" style="width: fit-content">
<input type="file" accept=".csv,.txt" id="csvUpload" />
<button class="uk-button uk-button-default letter" type="button" tabindex="-1">
Select Name List
</button>
</div>
<div class="js-upload uk-form-custom uk-margin-small-top" uk-form-custom="" style="width: fit-content">
<input type="file" accept=".ttf,.otf" id="fontUpload" />
<button class="uk-button uk-button-default letter" type="button" tabindex="-1">
Select Custom Font
</button>
</div>
</div>
<div class="js-upload uk-form-custom uk-padding-small" uk-form-custom="">
<input type="color" id="colorPicker" style="display: none" />
<input type="range" id="fontSize" min="10" max="100" value="20" style="display: none" class="uk-margin" />
</div>
<div class="uk-card-footer uk-flex uk-flex-between box2">
<button class="uk-button uk-button-default letter" id="bck2">Back</button>
<button class="uk-button uk-button-default letter" id="saveImages">Download</button>
<button class="uk-button uk-button-default letter" id="exportPDF">Export as PDF</button>
<button class="uk-button uk-button-secondary " id="printButton">Print</button>
</div>
</div>
</div>
<div class="uk-container uk-container-xsmall uk-flex uk-flex-center">
<canvas id="previewCanvas"></canvas>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/uikit.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/uikit-icons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="script.js"></script>
<script>
const dropArea = document.getElementById('dropArea');
const = document.getElementById('imageupload1');
const dropMessage = document.getElementById('dropMessage');
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
dropArea.addEventListener(eventName, preventDefaults, false);
document.body.addEventListener(eventName, preventDefaults, false);
});
['dragenter', 'dragover'].forEach(eventName => {
dropArea.addEventListener(eventName, highlight, false);
});
['dragleave', 'drop'].forEach(eventName => {
dropArea.addEventListener(eventName, unhighlight, false);
});
dropArea.addEventListener('drop', handleDrop, false);
dropMessage.addEventListener('click', () => imageupload1.click(), false);
function preventDefaults(e) {
e.preventDefault();
e.stopPropagation();
}
function highlight() {
dropArea.classList.add('highlight');
dropMessage.style.display = 'block';
}
function unhighlight() {
dropArea.classList.remove('highlight');
dropMessage.style.display = 'block';
}
function handleDrop(e) {
const dt = e.dataTransfer;
const files = dt.files;
handleFiles(files);
}
function handleFiles(files) {
if (files.length > 0) {
const file = files[0];
const reader = new FileReader();
imageupload1.files = files;
dropMessage.textContent = `Selected file: ${file.name}`;
reader.onload = function(event) {
const img = new Image();
img.src = event.target.result;
img.onload = function() {
const imageCanvas = document.getElementById('imageCanvas');
const ctx1 = imageCanvas.getContext('2d');
imageCanvas.width = img.width;
imageCanvas.height = img.height;
ctx1.drawImage(img, 0, 0);
const previewCanvas = document.getElementById('previewCanvas');
const ctx2 = previewCanvas.getContext('2d');
previewCanvas.width = img.width;
previewCanvas.height = img.height;
ctx2.drawImage(img, 0, 0);
};
};
reader.readAsDataURL(file);
}
}
function displayFileName() {
const file = imageupload1.files[0];
if (file) {
dropMessage.textContent = `Selected file: ${file.name}`;
}
}
</script>
</body>
</html>