-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
205 lines (186 loc) · 7.6 KB
/
script.js
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
function printpdf() {
var content = document.getElementById("resume");
// Clone the content to avoid modifying the original DOM
var contentClone = content.cloneNode(true);
// Remove unnecessary elements from the clone
var buttons = contentClone.querySelectorAll("#print button");
buttons.forEach(button => {
button.remove();
});
var checkboxes = contentClone.querySelectorAll(".input-checkbox");
checkboxes.forEach(checkbox => {
checkbox.remove();
});
html2pdf(contentClone, {
html2canvas: { scale: 1, logging: true, dpi: 500 }
});
}
function addedu() {
const head = document.createElement('div');
document.getElementById("education").appendChild(head);
head.innerHTML = ('<div class="edublock"><span><input type="checkbox" class="input-checkbox"></span><span class="education-head" contenteditable="true">YOUR DEGREE</span><div ><span contenteditable="true">Institute name</span> - <span contenteditable="true">Passing Year</span></div></div>');
saveresume();
}
function remedu(event) {
let val = 0;
let empty = true;
const allInputCheckboxes = event.target.parentElement.getElementsByClassName("input-checkbox");
const array = Array.from(allInputCheckboxes);
if (array.length === 0) {
alert("No fields are present to be deleted!")
}
else {
console.log(array);
array.forEach(element => {
if (element.checked === true) {
val = 1;
element.parentElement.parentElement.remove();
}
})
if (val === 0) alert("Please select the checkboxes to delete the required field!")
}
saveresume();
}
function addskill() {
const head = document.createElement('div');
document.getElementById("skills").appendChild(head);
head.innerHTML = ('<div class="skill"><span><input type="checkbox" class="input-checkbox"></span><span><i class="fas fa-chevron-circle-right"></i></span> <span contenteditable="true">write your skill here</span></div>');
saveresume();
}
function remskill(event) {
let val = 0;
const allInputCheckboxes = event.target.parentElement.getElementsByClassName("input-checkbox");
const array = Array.from(allInputCheckboxes);
if (array.length === 0) {
alert("No fields are present to be deleted!")
}
else {
console.log(array);
array.forEach(element => {
if (element.checked === true) {
val = 1;
element.parentElement.parentElement.remove();
}
})
if (val === 0) alert("Please select the checkboxes to delete the required field!")
}
saveresume();
}
function addLang() {
const head = document.createElement('div');
document.getElementById("languages").appendChild(head);
head.innerHTML = ('<div class="language"><span><input type="checkbox" class="input-checkbox"></span><span contenteditable="true">LANGNAME</span> - <span contenteditable="true">level u know</span></div>');
saveresume();
}
function remLang(event) {
let val = 0;
const allInputCheckboxes = event.target.parentElement.getElementsByClassName("input-checkbox");
const array = Array.from(allInputCheckboxes);
if (array.length === 0) {
alert("No fields are present to be deleted!")
}
else {
console.log(array);
array.forEach(element => {
if (element.checked === true) {
val = 1;
element.parentElement.parentElement.remove();
}
})
if (val === 0) alert("Please select the checkboxes to delete the required field!")
}
saveresume();
}
function addAch() {
const head = document.createElement('div');
document.getElementById("achievement").appendChild(head);
head.innerHTML = ('<div class="achieve" ><span><input type="checkbox" class="input-checkbox"></span><span contenteditable="true">Write your achievement</span></div>');
saveresume();
}
function remAch(event) {
let val = 0;
const allInputCheckboxes = event.target.parentElement.getElementsByClassName("input-checkbox");
const array = Array.from(allInputCheckboxes);
if (array.length === 0) {
alert("No fields are present to be deleted!")
}
else {
console.log(array);
array.forEach(element => {
if (element.checked === true) {
val = 1;
element.parentElement.parentElement.remove();
}
})
if (val === 0) alert("Please select the checkboxes to delete the required field!")
}
saveresume();
}
function addInt() {
const head = document.createElement('div');
document.getElementById("interest").appendChild(head);
head.innerHTML = ('<div class="achieve" ><span><input type="checkbox" class="input-checkbox"></span><span contenteditable="true">Write interest</span></div>');
saveresume();
}
function remInt(event) {
let val = 0;
const allInputCheckboxes = event.target.parentElement.getElementsByClassName("input-checkbox");
const array = Array.from(allInputCheckboxes);
if (array.length === 0) {
alert("No fields are present to be deleted!")
}
else {
array.forEach(element => {
if (element.checked === true) {
val = 1;
element.parentElement.parentElement.remove();
}
})
if (val === 0) alert("Please select the checkboxes to delete the required field!")
}
saveresume();
}
let maxNewSection = 1;
function addsec() {
if (maxNewSection < 2) {
const head = document.createElement('div');
document.getElementById("newsec").appendChild(head);
if (maxNewSection === 0) {
head.innerHTML = ('<div><span><input type="checkbox" class="input-checkbox"></span><span class="title" contenteditable="true">NEW SECTION</span><br><br><div contenteditable="true">This is the description part of your new section. Try to stay within limit and write something which has less than 400 characters. The spaces and symbols you use will also be included so use them for an indentation effect.</div></div>');
}
else {
head.innerHTML = ('<div><br><br><span><input type="checkbox" class="input-checkbox"></span><span class="title" contenteditable="true">NEW SECTION</span><br><br><div contenteditable="true">This is the description part of your new section. Try to stay within limit and write something which has less than 400 characters. The spaces and symbols you use will also be included so use them for an indentation effect.</div></div>');
}
maxNewSection = maxNewSection + 1;
}
else {
alert("Atmost 2 NEW SECTION can be added!")
}
saveresume();
}
function remsec(event) {
let val = 0;
const allInputCheckboxes = event.target.parentElement.getElementsByClassName("input-checkbox");
const array = Array.from(allInputCheckboxes);
if (array.length === 0) {
alert("No fields are present to be deleted!")
}
else {
console.log(array);
array.forEach(element => {
if (element.checked === true) {
val = 1;
maxNewSection = maxNewSection - 1;
element.parentElement.parentElement.remove();
}
})
if (val === 0) alert("Please select the checkboxes to delete the required field!")
}
saveresume();
}
function saveresume() {
var sec = document.getElementById("print");
value1 = sec.innerHTML;
var info = document.getElementById("custinfo");
info.value = value1;
}