-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
156 lines (139 loc) · 5.03 KB
/
script.js
File metadata and controls
156 lines (139 loc) · 5.03 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
document.getElementById('resumeForm').addEventListener('submit', function(e) {
e.preventDefault();
// Get form data
const name = document.getElementById('name').value.trim();
const email = document.getElementById('email').value.trim();
const phone = document.getElementById('phone').value.trim();
const location = document.getElementById('location').value.trim();
const summary = document.getElementById('summary').value.trim();
const skills = document.getElementById('skills').value.split(',').map(s => s.trim()).filter(s => s);
const education = document.getElementById('education').value.trim();
const experience = document.getElementById('experience').value.trim();
const awards = document.getElementById('awards').value.trim();
const output = document.getElementById('resumeOutput');
const resumeContent = document.getElementById('resumeContent');
// Show the resume section
output.classList.remove('hidden');
// Build the resume HTML with proper CSS classes
let resumeHTML = `
<div class="resume-header">
<h2>${name}</h2>
<div class="contact-info">
<span>📧 ${email}</span>
<span>📱 ${phone}</span>
${location ? `<span>📍 ${location}</span>` : ''}
</div>
</div>
`;
// Professional Summary
if (summary) {
resumeHTML += `
<div class="resume-section">
<h3>Professional Summary</h3>
<p>${summary}</p>
</div>
`;
}
// Skills
if (skills.length > 0) {
resumeHTML += `
<div class="resume-section">
<h3>Skills</h3>
<div class="skill-tags">
${skills.map(skill => `<span class="skill-tag">${skill}</span>`).join('')}
</div>
</div>
`;
}
// Education
if (education) {
const educationItems = education.split('\n').filter(item => item.trim());
resumeHTML += `
<div class="resume-section">
<h3>Education</h3>
<ul>
${educationItems.map(item => `<li>${item}</li>`).join('')}
</ul>
</div>
`;
}
// Work Experience
if (experience) {
const experienceItems = experience.split('\n').filter(item => item.trim());
resumeHTML += `
<div class="resume-section">
<h3>Work Experience</h3>
<ul>
${experienceItems.map(item => `<li>${item}</li>`).join('')}
</ul>
</div>
`;
}
// Awards & Achievements
if (awards) {
const awardItems = awards.split('\n').filter(item => item.trim());
resumeHTML += `
<div class="resume-section">
<h3>Awards & Achievements</h3>
<ul>
${awardItems.map(item => `<li>${item}</li>`).join('')}
</ul>
</div>
`;
}
// Generate suggestions
const suggestions = [];
if (skills.length < 4) {
suggestions.push("Add more skills to better showcase your abilities.");
}
if (!education.includes('\n') && !education.includes(',')) {
suggestions.push("Consider adding more educational details like graduation year, GPA, or relevant coursework.");
}
if (!experience.includes('\n') && !experience.includes(',')) {
suggestions.push("Consider adding internships, part-time jobs, or volunteer work for more experience.");
}
if (!awards || (!awards.includes('\n') && !awards.includes(','))) {
suggestions.push("Consider participating in competitions, obtaining certifications, or highlighting academic achievements.");
}
if (summary.length < 50) {
suggestions.push("Expand your professional summary to better highlight your career goals and key strengths.");
}
// Add suggestions if any
if (suggestions.length > 0) {
resumeHTML += `
<div class="resume-section" style="border-left: 4px solid var(--accent); background: var(--accent-light);">
<h3 style="color: var(--accent);">💡 Suggestions for Improvement</h3>
<ul style="color: var(--gray-600);">
${suggestions.map(suggestion => `<li>${suggestion}</li>`).join('')}
</ul>
</div>
`;
}
// Insert the HTML
resumeContent.innerHTML = resumeHTML;
// Scroll to the resume
output.scrollIntoView({ behavior: 'smooth' });
});
// PDF Download function
function downloadPDF() {
const resumeContent = document.getElementById('resumeContent');
const name = document.getElementById('name').value.trim() || 'Resume';
const opt = {
margin: 0.5,
filename: `${name.replace(/\s+/g, '_')}_Resume.pdf`,
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2 },
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
};
// Temporarily hide suggestions for PDF
const suggestions = resumeContent.querySelector('[style*="border-left: 4px solid var(--accent)"]');
if (suggestions) {
suggestions.style.display = 'none';
}
html2pdf().set(opt).from(resumeContent).save().then(() => {
// Show suggestions again
if (suggestions) {
suggestions.style.display = 'block';
}
});
}