-
Notifications
You must be signed in to change notification settings - Fork 260
/
ats_score_finder.html
199 lines (178 loc) · 7.09 KB
/
ats_score_finder.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Resume ATS Score Finder</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" integrity="sha384-k6RqeWeci5ZR/Lv4MR0sA0FfDOMR5aN2eW1u1a1G6T8G6Fz2F4zS3z7P8S5f5WJ" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mammoth/1.4.2/mammoth.browser.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f4f4f4;
color: #333;
}
h1 {
text-align: center;
}
.heading{
background-color:#045D5D ;
height:200px;
margin-bottom:60px;
color:white;
width:100%;
justify-content:center;
}
.container {
max-width: 800px;
margin: auto;
background: #d9c79e;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
color:#2f4f4f;
}
button {
width: 100%;
padding: 10px;
background-color: #28a745;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #218838;
}
#score {
font-size: 24px;
font-weight: bold;
text-align: center;
margin-top: 20px;
}
#feedback {
text-align: center;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="heading">
<br><br><br>
<h1>Resume ATS Score Finder</h1>
</div>
<div class="container">
<h1>Resume ATS Score Finder</h1>
<label for="job-description">Enter Job Description:</label>
<textarea id="job-description" rows="4" style="width: 100%;" placeholder="Enter the job description here..."></textarea>
<label for="resume-upload">Upload Your Resume (PDF or Word):</label>
<input type="file" id="resume-upload" accept=".pdf, .docx" />
<label for="resume-text">Or Paste Your Resume Text Here:</label>
<textarea id="resume-text" rows="4" style="width: 100%;" placeholder="Paste your resume text..."></textarea>
<button id="analyze-button">Analyze Resume</button>
<div id="score">ATS Compatibility Score: 0%</div>
<div id="feedback"></div>
</div>
<script>
// Event listener for the analyze button
document.getElementById("analyze-button").addEventListener("click", function() {
const jobDescription = document.getElementById("job-description").value;
const resumeText = document.getElementById("resume-text").value.trim();
// Handle file upload
const fileInput = document.getElementById("resume-upload");
const file = fileInput.files[0];
// If both fields are empty, alert the user
if (!jobDescription || (!resumeText && !file)) {
alert("Please enter the job description and provide either a resume text or upload a file.");
return;
}
// If there's a file, process it
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
const arrayBuffer = event.target.result;
if (file.type === "application/pdf") {
// PDF file handling
pdfjsLib.getDocument(arrayBuffer).promise.then(function(pdf) {
pdf.getPage(1).then(function(page) {
page.getTextContent().then(function(textContent) {
const textItems = textContent.items;
const resumeTextFromFile = textItems.map(item => item.str).join(" ");
analyzeResume(jobDescription, resumeText || resumeTextFromFile);
});
});
});
} else if (file.type === "application/vnd.openxmlformats-officedocument.wordprocessingml.document") {
// Word file handling
mammoth.extractRawText({arrayBuffer: arrayBuffer})
.then(function(result) {
const resumeTextFromFile = result.value; // The plain text
analyzeResume(jobDescription, resumeText || resumeTextFromFile);
})
.catch(function(err) {
console.error("Error reading Word file:", err);
});
} else {
alert("Unsupported file type. Please upload a PDF or Word document.");
}
};
reader.readAsArrayBuffer(file);
} else {
analyzeResume(jobDescription, resumeText); // Analyze with pasted text
}
});
// Function to analyze resume text
function analyzeResume(jobDescription, resumeText) {
if (jobDescription && resumeText) {
const atsScore = calculateATSScore(jobDescription, resumeText);
const feedback = displayFeedback(atsScore);
const formatFeedback = checkFormattingAndStructure(resumeText);
document.getElementById("score").innerText = "ATS Compatibility Score: " + atsScore + "%";
document.getElementById("feedback").innerText = feedback + " " + formatFeedback;
} else {
document.getElementById("feedback").innerText = "Please enter both the job description and resume.";
}
}
// Function to calculate ATS score based on job description keywords
function calculateATSScore(jobDescription, resumeText) {
// Extract keywords from job description
const jobKeywords = jobDescription.toLowerCase().match(/\b\w+\b/g) || [];
const resumeKeywords = resumeText.toLowerCase().match(/\b\w+\b/g) || [];
let matchingKeywords = 0;
jobKeywords.forEach(keyword => {
if (resumeKeywords.includes(keyword)) {
matchingKeywords++;
}
});
// Calculate score based on matching keywords
return ((matchingKeywords / jobKeywords.length) * 100).toFixed(2);
}
// Function to display feedback based on ATS score
function displayFeedback(atsScore) {
if (atsScore >= 80) {
return "Great! Your resume matches well with the job description.";
} else if (atsScore >= 50) {
return "Good job! Consider adding more relevant keywords.";
} else {
return "Your resume needs improvement. Focus on matching key skills.";
}
}
// Function to check formatting and structure
function checkFormattingAndStructure(resumeText) {
const lines = resumeText.split('\n');
const hasHeading = lines.some(line => line.trim().toLowerCase().includes("education") || line.trim().toLowerCase().includes("experience"));
const hasBulletPoints = lines.some(line => line.trim().startsWith("-") || line.trim().startsWith("•"));
if (!hasHeading) {
return "Consider adding clear headings (e.g., Education, Experience).";
}
if (!hasBulletPoints) {
return "Using bullet points can improve readability.";
}
return "Your formatting looks good!";
}
</script>
</body>
</html>