Spaces:
Running
Running
Replace app.js with clean location-aware version
Browse files
app.js
CHANGED
|
@@ -1,26 +1,4 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
| 4 |
-
|
| 5 |
-
/* =========================================================
|
| 6 |
-
JOBALIGN
|
| 7 |
-
A product by John_D
|
| 8 |
-
|
| 9 |
-
LOCATION-AWARE FREE JOB SEARCH
|
| 10 |
-
- The Muse: local/city/state/country listings
|
| 11 |
-
- Jobicy: remote jobs with geographic eligibility
|
| 12 |
-
- Remote OK: additional remote jobs
|
| 13 |
-
|
| 14 |
-
IMPORTANT:
|
| 15 |
-
This free build can only show jobs exposed by these public
|
| 16 |
-
feeds. It does not scrape LinkedIn, Indeed, or Glassdoor.
|
| 17 |
-
========================================================= */
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
/* =========================================================
|
| 21 |
-
ELEMENTS
|
| 22 |
-
========================================================= */
|
| 23 |
-
|
| 24 |
const searchButton = document.getElementById("searchJobsBtn");
|
| 25 |
const keywordInput = document.getElementById("jobKeyword");
|
| 26 |
const locationInput = document.getElementById("jobLocation");
|
|
@@ -55,409 +33,456 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 55 |
const interviewCheck = document.getElementById("interviewCheck");
|
| 56 |
|
| 57 |
let currentMatches = [];
|
| 58 |
-
let selectedJob = null;
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
/* =========================================================
|
| 62 |
-
US STATE MAP
|
| 63 |
-
========================================================= */
|
| 64 |
|
| 65 |
const US_STATES = {
|
| 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 |
"new hampshire": "NH",
|
| 95 |
"new jersey": "NJ",
|
| 96 |
"new mexico": "NM",
|
| 97 |
"new york": "NY",
|
| 98 |
"north carolina": "NC",
|
| 99 |
"north dakota": "ND",
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
"rhode island": "RI",
|
| 105 |
"south carolina": "SC",
|
| 106 |
"south dakota": "SD",
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
"west virginia": "WV",
|
| 114 |
-
|
| 115 |
-
|
| 116 |
};
|
| 117 |
|
| 118 |
-
const
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
/* =========================================================
|
| 122 |
-
LOAD SAVED MASTER RESUME
|
| 123 |
-
========================================================= */
|
| 124 |
|
| 125 |
const savedResume = localStorage.getItem("jobalign_master_resume");
|
| 126 |
|
| 127 |
if (savedResume) {
|
| 128 |
resumeText.value = savedResume;
|
| 129 |
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
</span>
|
| 135 |
-
`;
|
| 136 |
}
|
| 137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
keywordInput.addEventListener("keydown", function (event) {
|
| 146 |
-
if (event.key === "Enter") {
|
| 147 |
-
searchJobs();
|
| 148 |
}
|
| 149 |
-
|
| 150 |
|
| 151 |
-
locationInput.addEventListener(
|
| 152 |
-
|
| 153 |
-
|
|
|
|
|
|
|
|
|
|
| 154 |
}
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
/* =========================================================
|
| 159 |
-
MAIN SEARCH
|
| 160 |
-
========================================================= */
|
| 161 |
|
| 162 |
async function searchJobs() {
|
|
|
|
|
|
|
| 163 |
|
| 164 |
-
const
|
| 165 |
-
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
if (!keyword) {
|
| 169 |
-
alert(
|
|
|
|
|
|
|
|
|
|
| 170 |
keywordInput.focus();
|
|
|
|
| 171 |
return;
|
| 172 |
}
|
| 173 |
|
| 174 |
if (!location) {
|
| 175 |
alert(
|
| 176 |
-
"Enter
|
| 177 |
);
|
|
|
|
| 178 |
locationInput.focus();
|
|
|
|
| 179 |
return;
|
| 180 |
}
|
| 181 |
|
| 182 |
-
searchButton.disabled =
|
| 183 |
-
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
resultsBox.innerHTML = `
|
| 186 |
<div class="empty-state">
|
|
|
|
| 187 |
<div>
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
<br><br>
|
|
|
|
| 190 |
${escapeHTML(keyword)}
|
|
|
|
| 191 |
<br>
|
|
|
|
| 192 |
${escapeHTML(location)}
|
|
|
|
| 193 |
</div>
|
|
|
|
| 194 |
</div>
|
| 195 |
`;
|
| 196 |
|
| 197 |
try {
|
|
|
|
|
|
|
| 198 |
|
| 199 |
-
const
|
| 200 |
-
|
|
|
|
| 201 |
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
|
| 208 |
-
if (requestPlan.useJobicy) {
|
| 209 |
requests.push(
|
| 210 |
-
fetchJobicyJobs(
|
|
|
|
|
|
|
|
|
|
| 211 |
);
|
| 212 |
}
|
| 213 |
|
| 214 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 215 |
requests.push(
|
| 216 |
fetchRemoteOKJobs()
|
| 217 |
);
|
| 218 |
}
|
| 219 |
|
| 220 |
-
const
|
|
|
|
|
|
|
|
|
|
| 221 |
|
| 222 |
-
let jobs =
|
|
|
|
| 223 |
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
} else {
|
| 228 |
-
console.warn(
|
|
|
|
|
|
|
|
|
|
| 229 |
}
|
| 230 |
-
}
|
| 231 |
|
| 232 |
-
jobs =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
|
|
|
|
|
|
| 245 |
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
jobs = jobs.filter(function (job) {
|
| 252 |
-
return locationMatches(job, location);
|
| 253 |
-
});
|
| 254 |
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
|
|
|
|
|
|
| 263 |
|
| 264 |
-
|
| 265 |
-
|
|
|
|
|
|
|
|
|
|
| 266 |
|
| 267 |
-
|
| 268 |
|
| 269 |
-
|
|
|
|
|
|
|
| 270 |
|
| 271 |
-
|
| 272 |
|
| 273 |
-
|
|
|
|
|
|
|
| 274 |
|
| 275 |
-
resultsBox.innerHTML = `
|
| 276 |
-
<div class="empty-state" style="color:#ff7777;">
|
| 277 |
-
<div>
|
| 278 |
-
<strong>Job search failed.</strong>
|
| 279 |
-
<br><br>
|
| 280 |
-
${escapeHTML(error.message)}
|
| 281 |
</div>
|
|
|
|
| 282 |
</div>
|
| 283 |
`;
|
| 284 |
|
| 285 |
} finally {
|
|
|
|
|
|
|
| 286 |
|
| 287 |
-
searchButton.
|
| 288 |
-
|
| 289 |
-
}
|
| 290 |
-
}
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
/* =========================================================
|
| 294 |
-
SEARCH PLAN
|
| 295 |
-
========================================================= */
|
| 296 |
-
|
| 297 |
-
function buildRequestPlan(location, sourceMode) {
|
| 298 |
-
|
| 299 |
-
const normalized = normalizeSimple(location);
|
| 300 |
-
const remote = normalized.includes("remote");
|
| 301 |
-
const broadUS = isBroadUSLocation(location);
|
| 302 |
-
const broadEurope = isBroadEuropeLocation(location);
|
| 303 |
-
|
| 304 |
-
if (sourceMode === "remote") {
|
| 305 |
-
return {
|
| 306 |
-
useMuse: true,
|
| 307 |
-
useJobicy: true,
|
| 308 |
-
useRemoteOK: true,
|
| 309 |
-
jobicyGeo: "",
|
| 310 |
-
remoteOnly: true
|
| 311 |
-
};
|
| 312 |
-
}
|
| 313 |
-
|
| 314 |
-
if (sourceMode === "usa") {
|
| 315 |
-
return {
|
| 316 |
-
useMuse: true,
|
| 317 |
-
useJobicy: true,
|
| 318 |
-
useRemoteOK: remote || broadUS,
|
| 319 |
-
jobicyGeo: "usa",
|
| 320 |
-
remoteOnly: remote
|
| 321 |
-
};
|
| 322 |
-
}
|
| 323 |
-
|
| 324 |
-
if (sourceMode === "europe") {
|
| 325 |
-
return {
|
| 326 |
-
useMuse: true,
|
| 327 |
-
useJobicy: true,
|
| 328 |
-
useRemoteOK: remote,
|
| 329 |
-
jobicyGeo: "europe",
|
| 330 |
-
remoteOnly: remote
|
| 331 |
-
};
|
| 332 |
-
}
|
| 333 |
-
|
| 334 |
-
if (remote) {
|
| 335 |
-
return {
|
| 336 |
-
useMuse: true,
|
| 337 |
-
useJobicy: true,
|
| 338 |
-
useRemoteOK: true,
|
| 339 |
-
jobicyGeo:
|
| 340 |
-
looksLikeUSLocation(location)
|
| 341 |
-
? "usa"
|
| 342 |
-
: looksLikeEuropeLocation(location)
|
| 343 |
-
? "europe"
|
| 344 |
-
: "",
|
| 345 |
-
remoteOnly: true
|
| 346 |
-
};
|
| 347 |
-
}
|
| 348 |
-
|
| 349 |
-
if (broadUS) {
|
| 350 |
-
return {
|
| 351 |
-
useMuse: true,
|
| 352 |
-
useJobicy: true,
|
| 353 |
-
useRemoteOK: true,
|
| 354 |
-
jobicyGeo: "usa",
|
| 355 |
-
remoteOnly: false
|
| 356 |
-
};
|
| 357 |
-
}
|
| 358 |
-
|
| 359 |
-
if (broadEurope) {
|
| 360 |
-
return {
|
| 361 |
-
useMuse: true,
|
| 362 |
-
useJobicy: true,
|
| 363 |
-
useRemoteOK: false,
|
| 364 |
-
jobicyGeo: "europe",
|
| 365 |
-
remoteOnly: false
|
| 366 |
-
};
|
| 367 |
}
|
| 368 |
-
|
| 369 |
-
/*
|
| 370 |
-
* City, state, or country search:
|
| 371 |
-
* local source first. No unrelated fallback.
|
| 372 |
-
*/
|
| 373 |
-
return {
|
| 374 |
-
useMuse: true,
|
| 375 |
-
useJobicy: false,
|
| 376 |
-
useRemoteOK: false,
|
| 377 |
-
jobicyGeo: "",
|
| 378 |
-
remoteOnly: false
|
| 379 |
-
};
|
| 380 |
}
|
| 381 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 382 |
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
LOCATION-AWARE LOCAL JOBS
|
| 386 |
-
========================================================= */
|
| 387 |
-
|
| 388 |
-
async function fetchMuseJobs(location, plan) {
|
| 389 |
-
|
| 390 |
-
const locationsToTry = buildMuseLocationQueries(location, plan);
|
| 391 |
-
const seenUrls = new Set();
|
| 392 |
-
let jobs = [];
|
| 393 |
|
| 394 |
-
|
|
|
|
| 395 |
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
|
| 401 |
-
|
| 402 |
-
"
|
|
|
|
| 403 |
);
|
| 404 |
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
"location",
|
| 410 |
queryLocation
|
| 411 |
);
|
| 412 |
}
|
| 413 |
|
| 414 |
-
|
|
|
|
|
|
|
|
|
|
| 415 |
|
| 416 |
-
|
| 417 |
-
response
|
| 418 |
-
|
| 419 |
-
console.warn("Muse request failed:", error);
|
| 420 |
break;
|
| 421 |
}
|
| 422 |
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
* 403 usually means keyless test rate limit.
|
| 426 |
-
*/
|
| 427 |
-
if (response.status === 403) {
|
| 428 |
-
break;
|
| 429 |
-
}
|
| 430 |
-
|
| 431 |
-
continue;
|
| 432 |
-
}
|
| 433 |
-
|
| 434 |
-
const data = await response.json();
|
| 435 |
-
|
| 436 |
-
if (!Array.isArray(data.results)) {
|
| 437 |
-
break;
|
| 438 |
-
}
|
| 439 |
|
| 440 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
break;
|
| 442 |
}
|
| 443 |
|
| 444 |
-
for (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 445 |
|
| 446 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
|
| 448 |
-
if (
|
| 449 |
-
|
| 450 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 451 |
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
}
|
| 456 |
}
|
| 457 |
|
| 458 |
if (
|
| 459 |
data.page_count &&
|
| 460 |
-
page >=
|
|
|
|
|
|
|
|
|
|
| 461 |
) {
|
| 462 |
break;
|
| 463 |
}
|
|
@@ -467,264 +492,443 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 467 |
return jobs;
|
| 468 |
}
|
| 469 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
}
|
| 476 |
-
|
| 477 |
-
if (isBroadUSLocation(location)) {
|
| 478 |
-
/*
|
| 479 |
-
* Empty query lets us read current listings and then
|
| 480 |
-
* JobAlign keeps only US locations locally.
|
| 481 |
-
*/
|
| 482 |
-
return [""];
|
| 483 |
-
}
|
| 484 |
-
|
| 485 |
-
if (isBroadEuropeLocation(location)) {
|
| 486 |
-
return [""];
|
| 487 |
-
}
|
| 488 |
-
|
| 489 |
-
const values = [location.trim()];
|
| 490 |
|
| 491 |
-
const
|
| 492 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 493 |
|
| 494 |
-
if (
|
| 495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 496 |
}
|
| 497 |
|
| 498 |
-
if (
|
| 499 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 500 |
}
|
| 501 |
|
| 502 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
| 503 |
}
|
| 504 |
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
const locations =
|
| 509 |
-
Array.isArray(
|
|
|
|
|
|
|
| 510 |
? job.locations
|
| 511 |
-
.map(
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 515 |
: [];
|
| 516 |
|
| 517 |
-
const
|
| 518 |
-
|
| 519 |
-
? job.categories
|
| 520 |
-
.map(function (item) {
|
| 521 |
-
return item.name;
|
| 522 |
-
})
|
| 523 |
-
.filter(Boolean)
|
| 524 |
-
: [];
|
| 525 |
|
| 526 |
-
|
| 527 |
-
Array.isArray(
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 534 |
|
| 535 |
return {
|
| 536 |
-
title:
|
|
|
|
|
|
|
|
|
|
| 537 |
company_name:
|
| 538 |
-
job.company &&
|
|
|
|
| 539 |
? job.company.name
|
| 540 |
: "",
|
| 541 |
-
|
| 542 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 543 |
url:
|
| 544 |
-
job.refs &&
|
|
|
|
| 545 |
? job.refs.landing_page
|
| 546 |
: "",
|
|
|
|
| 547 |
remote:
|
| 548 |
-
locations.some(
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
|
|
|
|
|
|
| 555 |
|
|
|
|
|
|
|
| 556 |
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
|
| 562 |
-
async function fetchJobicyJobs(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 563 |
|
| 564 |
-
|
| 565 |
-
"
|
|
|
|
| 566 |
);
|
| 567 |
|
| 568 |
-
|
| 569 |
-
|
|
|
|
|
|
|
| 570 |
|
| 571 |
-
if (
|
| 572 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 573 |
}
|
| 574 |
|
| 575 |
-
const response =
|
|
|
|
|
|
|
|
|
|
| 576 |
|
| 577 |
-
if (
|
|
|
|
|
|
|
| 578 |
throw new Error(
|
| 579 |
"Jobicy returned HTTP " +
|
| 580 |
response.status
|
| 581 |
);
|
| 582 |
}
|
| 583 |
|
| 584 |
-
const data =
|
| 585 |
-
|
| 586 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 587 |
? data.jobs
|
| 588 |
: [];
|
| 589 |
|
| 590 |
-
return
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
description:
|
| 597 |
-
job.jobDescription ||
|
| 598 |
-
job.jobExcerpt ||
|
| 599 |
-
"",
|
| 600 |
-
url: job.url || "",
|
| 601 |
-
remote: true,
|
| 602 |
-
tags:
|
| 603 |
-
[]
|
| 604 |
-
.concat(job.jobIndustry || [])
|
| 605 |
-
.concat(job.jobType || [])
|
| 606 |
-
.concat(
|
| 607 |
-
job.jobLevel
|
| 608 |
-
? [job.jobLevel]
|
| 609 |
-
: []
|
| 610 |
-
),
|
| 611 |
-
source: "Jobicy"
|
| 612 |
-
};
|
| 613 |
-
});
|
| 614 |
-
}
|
| 615 |
|
|
|
|
|
|
|
|
|
|
| 616 |
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
|
| 621 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
|
| 623 |
-
|
| 624 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 625 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 626 |
|
| 627 |
-
if (
|
|
|
|
|
|
|
| 628 |
throw new Error(
|
| 629 |
"Remote OK returned HTTP " +
|
| 630 |
response.status
|
| 631 |
);
|
| 632 |
}
|
| 633 |
|
| 634 |
-
const data =
|
|
|
|
| 635 |
|
| 636 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
| 637 |
return [];
|
| 638 |
}
|
| 639 |
|
| 640 |
return data
|
| 641 |
-
.filter(
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
remote: true,
|
| 659 |
-
tags:
|
| 660 |
-
Array.isArray(job.tags)
|
| 661 |
-
? job.tags
|
| 662 |
-
: [],
|
| 663 |
-
source: "Remote OK"
|
| 664 |
-
};
|
| 665 |
-
});
|
| 666 |
-
}
|
| 667 |
|
|
|
|
|
|
|
|
|
|
| 668 |
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
|
| 672 |
|
| 673 |
-
|
|
|
|
|
|
|
| 674 |
|
| 675 |
-
|
| 676 |
-
|
| 677 |
-
|
| 678 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 679 |
|
| 680 |
-
const search =
|
|
|
|
|
|
|
|
|
|
| 681 |
|
| 682 |
-
const ignored =
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
|
| 689 |
-
|
|
|
|
| 690 |
|
| 691 |
const words =
|
| 692 |
search
|
| 693 |
.split(" ")
|
| 694 |
-
.filter(
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 700 |
|
| 701 |
-
if (
|
|
|
|
|
|
|
| 702 |
return 0;
|
| 703 |
}
|
| 704 |
|
| 705 |
-
let score =
|
| 706 |
-
|
| 707 |
|
| 708 |
-
|
| 709 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 710 |
}
|
| 711 |
|
| 712 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 713 |
|
| 714 |
-
|
| 715 |
-
|
| 716 |
-
score += 55;
|
| 717 |
}
|
| 718 |
|
| 719 |
-
if (
|
| 720 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 721 |
}
|
| 722 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 723 |
|
| 724 |
-
/*
|
| 725 |
-
* Avoid "Influencer Marketing Manager"
|
| 726 |
-
* appearing for "Product Manager".
|
| 727 |
-
*/
|
| 728 |
if (
|
| 729 |
words.length === 2 &&
|
| 730 |
titleMatches < 2
|
|
@@ -732,249 +936,232 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 732 |
return 0;
|
| 733 |
}
|
| 734 |
|
| 735 |
-
if (
|
| 736 |
-
|
|
|
|
| 737 |
const requiredMatches =
|
| 738 |
Math.ceil(
|
| 739 |
-
words.length *
|
|
|
|
| 740 |
);
|
| 741 |
|
| 742 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 743 |
return 0;
|
| 744 |
}
|
| 745 |
}
|
| 746 |
|
| 747 |
-
if (
|
| 748 |
-
words.length === 1 &&
|
| 749 |
-
titleMatches === 0
|
| 750 |
-
) {
|
| 751 |
-
return 0;
|
| 752 |
-
}
|
| 753 |
-
|
| 754 |
return score;
|
| 755 |
}
|
| 756 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 757 |
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
|
| 762 |
-
|
| 763 |
-
|
| 764 |
-
const requested = normalizeLocationForMatch(
|
| 765 |
-
requestedLocation
|
| 766 |
-
);
|
| 767 |
-
|
| 768 |
-
const actual = normalizeLocationForMatch(
|
| 769 |
-
job.location || ""
|
| 770 |
-
);
|
| 771 |
|
| 772 |
-
|
| 773 |
-
|
| 774 |
-
|
| 775 |
-
|
| 776 |
-
|
|
|
|
|
|
|
|
|
|
| 777 |
}
|
| 778 |
|
| 779 |
-
|
| 780 |
-
|
| 781 |
-
|
| 782 |
-
|
| 783 |
-
|
| 784 |
-
return (
|
| 785 |
-
|
| 786 |
-
(
|
| 787 |
-
job.remote &&
|
| 788 |
-
normalizeSimple(job.location)
|
| 789 |
-
.includes("usa")
|
| 790 |
-
)
|
| 791 |
);
|
| 792 |
}
|
| 793 |
|
| 794 |
-
|
| 795 |
-
|
| 796 |
-
|
| 797 |
-
|
| 798 |
-
|
| 799 |
-
return (
|
| 800 |
-
|
| 801 |
-
(
|
| 802 |
-
job.remote &&
|
| 803 |
-
normalizeSimple(job.location)
|
| 804 |
-
.includes("europe")
|
| 805 |
-
)
|
| 806 |
);
|
| 807 |
}
|
| 808 |
|
| 809 |
-
|
| 810 |
-
|
| 811 |
-
|
| 812 |
-
|
| 813 |
-
* UT
|
| 814 |
-
* California
|
| 815 |
-
* CA
|
| 816 |
-
*/
|
| 817 |
-
const requestedState =
|
| 818 |
-
detectUSStateCode(requestedLocation);
|
| 819 |
-
|
| 820 |
-
if (requestedState) {
|
| 821 |
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
)
|
| 827 |
-
) {
|
| 828 |
-
return true;
|
| 829 |
-
}
|
| 830 |
|
|
|
|
|
|
|
|
|
|
| 831 |
const stateName =
|
| 832 |
-
|
| 833 |
-
|
| 834 |
-
|
|
|
|
| 835 |
|
| 836 |
-
|
| 837 |
-
|
|
|
|
|
|
|
|
|
|
| 838 |
actual.includes(
|
| 839 |
-
|
| 840 |
stateName
|
| 841 |
)
|
| 842 |
-
)
|
| 843 |
-
) {
|
| 844 |
-
return true;
|
| 845 |
-
}
|
| 846 |
-
|
| 847 |
-
/*
|
| 848 |
-
* If the user typed a city + state,
|
| 849 |
-
* state alone is not enough.
|
| 850 |
-
*/
|
| 851 |
-
const requestedCity =
|
| 852 |
-
extractRequestedCity(
|
| 853 |
-
requestedLocation
|
| 854 |
);
|
| 855 |
|
| 856 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
| 857 |
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
(
|
| 865 |
-
locationContainsState(
|
| 866 |
-
job.location,
|
| 867 |
-
requestedState
|
| 868 |
-
) ||
|
| 869 |
-
actual.includes(
|
| 870 |
-
normalizeLocationForMatch(
|
| 871 |
-
stateNameFromCode(
|
| 872 |
-
requestedState
|
| 873 |
-
)
|
| 874 |
-
)
|
| 875 |
-
)
|
| 876 |
)
|
| 877 |
);
|
| 878 |
}
|
| 879 |
|
| 880 |
-
return
|
| 881 |
}
|
| 882 |
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
* represented in the returned job location.
|
| 888 |
-
*/
|
| 889 |
-
if (!requested || !actual) {
|
| 890 |
return false;
|
| 891 |
}
|
| 892 |
|
| 893 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
| 894 |
return true;
|
| 895 |
}
|
| 896 |
|
| 897 |
-
const
|
| 898 |
-
getLocationTokens(
|
| 899 |
-
|
| 900 |
-
|
| 901 |
-
return false;
|
| 902 |
-
}
|
| 903 |
|
| 904 |
-
return
|
| 905 |
-
|
| 906 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 907 |
}
|
| 908 |
|
| 909 |
-
|
| 910 |
-
|
| 911 |
-
|
| 912 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 913 |
return 0;
|
| 914 |
}
|
| 915 |
|
| 916 |
const requested =
|
| 917 |
-
|
| 918 |
requestedLocation
|
| 919 |
);
|
| 920 |
|
| 921 |
const actual =
|
| 922 |
-
|
| 923 |
-
job.location ||
|
|
|
|
| 924 |
);
|
| 925 |
|
| 926 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 927 |
return 300;
|
| 928 |
}
|
| 929 |
|
| 930 |
-
if (actual.includes(requested)) {
|
| 931 |
-
return 250;
|
| 932 |
-
}
|
| 933 |
-
|
| 934 |
-
const requestedState =
|
| 935 |
-
detectUSStateCode(
|
| 936 |
-
requestedLocation
|
| 937 |
-
);
|
| 938 |
-
|
| 939 |
if (
|
| 940 |
-
|
| 941 |
-
|
| 942 |
-
|
| 943 |
-
requestedState
|
| 944 |
)
|
| 945 |
) {
|
| 946 |
-
return
|
| 947 |
}
|
| 948 |
|
| 949 |
-
if (
|
| 950 |
-
|
|
|
|
|
|
|
| 951 |
}
|
| 952 |
|
| 953 |
-
return
|
| 954 |
}
|
| 955 |
|
| 956 |
-
|
| 957 |
-
|
| 958 |
-
|
| 959 |
-
|
| 960 |
-
|
| 961 |
-
|
| 962 |
-
|
| 963 |
-
if (currentMatches.length === 0) {
|
| 964 |
-
|
| 965 |
resultsBox.innerHTML = `
|
| 966 |
<div class="empty-state">
|
|
|
|
| 967 |
<div>
|
|
|
|
| 968 |
No matching
|
| 969 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 970 |
jobs were found for
|
| 971 |
-
|
| 972 |
-
<
|
| 973 |
-
|
| 974 |
-
|
|
|
|
| 975 |
<br><br>
|
| 976 |
-
|
|
|
|
|
|
|
|
|
|
| 977 |
</div>
|
|
|
|
| 978 |
</div>
|
| 979 |
`;
|
| 980 |
|
|
@@ -983,18 +1170,25 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 983 |
|
| 984 |
const cards =
|
| 985 |
currentMatches
|
| 986 |
-
.map(
|
| 987 |
-
|
| 988 |
job,
|
| 989 |
index
|
| 990 |
-
)
|
| 991 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 992 |
.join("");
|
| 993 |
|
| 994 |
resultsBox.innerHTML = `
|
| 995 |
<div style="margin-bottom:18px;">
|
|
|
|
| 996 |
<strong style="font-size:18px;">
|
| 997 |
-
${currentMatches.length}
|
|
|
|
| 998 |
</strong>
|
| 999 |
|
| 1000 |
<div style="
|
|
@@ -1006,6 +1200,7 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1006 |
·
|
| 1007 |
${escapeHTML(location)}
|
| 1008 |
</div>
|
|
|
|
| 1009 |
</div>
|
| 1010 |
|
| 1011 |
<div style="
|
|
@@ -1017,62 +1212,76 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1017 |
`;
|
| 1018 |
|
| 1019 |
resultsBox
|
| 1020 |
-
.querySelectorAll(
|
| 1021 |
-
|
| 1022 |
-
|
| 1023 |
-
|
| 1024 |
-
|
| 1025 |
-
|
| 1026 |
-
|
| 1027 |
-
|
| 1028 |
-
|
| 1029 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1030 |
);
|
| 1031 |
-
|
| 1032 |
-
|
| 1033 |
-
|
| 1034 |
-
|
| 1035 |
-
}
|
| 1036 |
-
);
|
| 1037 |
-
});
|
| 1038 |
}
|
| 1039 |
|
| 1040 |
-
|
| 1041 |
-
|
| 1042 |
-
|
|
|
|
| 1043 |
const description =
|
| 1044 |
stripHTML(
|
| 1045 |
-
job.description ||
|
|
|
|
| 1046 |
);
|
| 1047 |
|
| 1048 |
const excerpt =
|
| 1049 |
description.length > 300
|
| 1050 |
-
? description.
|
| 1051 |
0,
|
| 1052 |
300
|
| 1053 |
-
) +
|
|
|
|
| 1054 |
: description;
|
| 1055 |
|
| 1056 |
const tags =
|
| 1057 |
-
Array.isArray(
|
| 1058 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1059 |
: [];
|
| 1060 |
|
| 1061 |
const tagHTML =
|
| 1062 |
tags
|
| 1063 |
-
.map(
|
| 1064 |
-
|
| 1065 |
-
|
| 1066 |
-
|
| 1067 |
-
|
| 1068 |
-
|
| 1069 |
-
|
| 1070 |
-
|
| 1071 |
-
|
| 1072 |
-
|
| 1073 |
-
|
| 1074 |
-
|
| 1075 |
-
|
|
|
|
|
|
|
| 1076 |
.join("");
|
| 1077 |
|
| 1078 |
return `
|
|
@@ -1114,7 +1323,10 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1114 |
font-size:18px;
|
| 1115 |
margin-bottom:8px;
|
| 1116 |
">
|
| 1117 |
-
${escapeHTML(
|
|
|
|
|
|
|
|
|
|
| 1118 |
</strong>
|
| 1119 |
|
| 1120 |
<div style="
|
|
@@ -1161,7 +1373,10 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1161 |
margin-top:13px;
|
| 1162 |
">
|
| 1163 |
Source:
|
| 1164 |
-
${escapeHTML(
|
|
|
|
|
|
|
|
|
|
| 1165 |
</div>
|
| 1166 |
|
| 1167 |
</div>
|
|
@@ -1175,29 +1390,31 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1175 |
</button>
|
| 1176 |
|
| 1177 |
</div>
|
|
|
|
| 1178 |
</div>
|
| 1179 |
`;
|
| 1180 |
}
|
| 1181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1182 |
|
| 1183 |
-
/* =========================================================
|
| 1184 |
-
SELECT JOB
|
| 1185 |
-
========================================================= */
|
| 1186 |
-
|
| 1187 |
-
function fillSelectedJob(job) {
|
| 1188 |
-
|
| 1189 |
-
if (!job) {
|
| 1190 |
-
alert("Unable to load this job.");
|
| 1191 |
return;
|
| 1192 |
}
|
| 1193 |
|
| 1194 |
-
selectedJob = job;
|
| 1195 |
-
|
| 1196 |
selectedJobTitle.value =
|
| 1197 |
-
job.title ||
|
|
|
|
| 1198 |
|
| 1199 |
selectedCompany.value =
|
| 1200 |
-
job.company_name ||
|
|
|
|
| 1201 |
|
| 1202 |
selectedLocation.value =
|
| 1203 |
job.location ||
|
|
@@ -1209,61 +1426,85 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1209 |
|
| 1210 |
jobDescription.value =
|
| 1211 |
stripHTML(
|
| 1212 |
-
job.description ||
|
|
|
|
| 1213 |
);
|
| 1214 |
|
| 1215 |
jobUrlInput.value =
|
| 1216 |
-
job.url ||
|
|
|
|
| 1217 |
|
| 1218 |
resetAnalysis();
|
| 1219 |
|
| 1220 |
generationStatus.innerHTML = `
|
| 1221 |
<div class="status-dot"></div>
|
|
|
|
| 1222 |
<span class="success-text">
|
|
|
|
| 1223 |
Selected:
|
| 1224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1225 |
at
|
| 1226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1227 |
</span>
|
| 1228 |
`;
|
| 1229 |
|
| 1230 |
analysisResults.innerHTML = `
|
| 1231 |
<div class="empty-state">
|
|
|
|
| 1232 |
<div>
|
|
|
|
| 1233 |
Job loaded successfully.
|
|
|
|
| 1234 |
<br><br>
|
| 1235 |
-
|
|
|
|
|
|
|
|
|
|
| 1236 |
<strong>
|
| 1237 |
Analyze Selected Job
|
| 1238 |
</strong>.
|
|
|
|
| 1239 |
</div>
|
|
|
|
| 1240 |
</div>
|
| 1241 |
`;
|
| 1242 |
|
| 1243 |
selectedJobCard.scrollIntoView({
|
| 1244 |
-
behavior:
|
| 1245 |
-
|
|
|
|
|
|
|
|
|
|
| 1246 |
});
|
| 1247 |
}
|
| 1248 |
|
| 1249 |
-
|
| 1250 |
-
/* =========================================================
|
| 1251 |
-
ORIGINAL JOB
|
| 1252 |
-
========================================================= */
|
| 1253 |
-
|
| 1254 |
openOriginalJobBtn.addEventListener(
|
| 1255 |
"click",
|
| 1256 |
function () {
|
| 1257 |
-
|
| 1258 |
const url =
|
| 1259 |
jobUrlInput.value.trim();
|
| 1260 |
|
| 1261 |
-
if (
|
| 1262 |
-
|
| 1263 |
-
|
| 1264 |
-
|
| 1265 |
-
|
| 1266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1267 |
url,
|
| 1268 |
"_blank",
|
| 1269 |
"noopener,noreferrer"
|
|
@@ -1271,19 +1512,15 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1271 |
}
|
| 1272 |
);
|
| 1273 |
|
| 1274 |
-
|
| 1275 |
-
/* =========================================================
|
| 1276 |
-
RESUME UPLOAD + SAVE
|
| 1277 |
-
========================================================= */
|
| 1278 |
-
|
| 1279 |
resumeFile.addEventListener(
|
| 1280 |
"change",
|
| 1281 |
async function () {
|
| 1282 |
-
|
| 1283 |
const file =
|
| 1284 |
resumeFile.files[0];
|
| 1285 |
|
| 1286 |
-
if (
|
|
|
|
|
|
|
| 1287 |
return;
|
| 1288 |
}
|
| 1289 |
|
|
@@ -1293,18 +1530,18 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1293 |
.pop()
|
| 1294 |
.toLowerCase();
|
| 1295 |
|
| 1296 |
-
|
| 1297 |
-
|
| 1298 |
-
|
| 1299 |
-
|
| 1300 |
-
|
| 1301 |
-
|
| 1302 |
-
`;
|
| 1303 |
|
| 1304 |
try {
|
| 1305 |
-
|
| 1306 |
-
|
| 1307 |
-
|
|
|
|
| 1308 |
const content =
|
| 1309 |
await file.text();
|
| 1310 |
|
|
@@ -1316,8 +1553,10 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1316 |
return;
|
| 1317 |
}
|
| 1318 |
|
| 1319 |
-
if (
|
| 1320 |
-
|
|
|
|
|
|
|
| 1321 |
if (
|
| 1322 |
typeof mammoth ===
|
| 1323 |
"undefined"
|
|
@@ -1332,13 +1571,17 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1332 |
|
| 1333 |
const result =
|
| 1334 |
await mammoth.extractRawText({
|
| 1335 |
-
arrayBuffer:
|
|
|
|
| 1336 |
});
|
| 1337 |
|
| 1338 |
const content =
|
| 1339 |
result.value.trim();
|
| 1340 |
|
| 1341 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 1342 |
throw new Error(
|
| 1343 |
"Very little resume text was found in this DOCX."
|
| 1344 |
);
|
|
@@ -1352,7 +1595,10 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1352 |
return;
|
| 1353 |
}
|
| 1354 |
|
| 1355 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 1356 |
throw new Error(
|
| 1357 |
"PDF reading is not enabled yet. Upload DOCX or TXT."
|
| 1358 |
);
|
|
@@ -1363,33 +1609,40 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1363 |
);
|
| 1364 |
|
| 1365 |
} catch (error) {
|
|
|
|
|
|
|
|
|
|
| 1366 |
|
| 1367 |
-
|
| 1368 |
-
|
| 1369 |
-
|
| 1370 |
-
|
| 1371 |
-
|
| 1372 |
-
Could not read resume:
|
| 1373 |
-
${escapeHTML(error.message)}
|
| 1374 |
-
</span>
|
| 1375 |
-
`;
|
| 1376 |
}
|
| 1377 |
}
|
| 1378 |
);
|
| 1379 |
|
| 1380 |
-
|
| 1381 |
function saveExtractedResume(
|
| 1382 |
content,
|
| 1383 |
fileName
|
| 1384 |
) {
|
| 1385 |
-
|
| 1386 |
const clean =
|
| 1387 |
-
|
| 1388 |
-
|
| 1389 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1390 |
.trim();
|
| 1391 |
|
| 1392 |
-
resumeText.value =
|
|
|
|
| 1393 |
|
| 1394 |
localStorage.setItem(
|
| 1395 |
"jobalign_master_resume",
|
|
@@ -1401,27 +1654,27 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1401 |
fileName
|
| 1402 |
);
|
| 1403 |
|
| 1404 |
-
|
| 1405 |
-
|
| 1406 |
-
|
| 1407 |
-
|
| 1408 |
-
|
| 1409 |
-
</span>
|
| 1410 |
-
`;
|
| 1411 |
}
|
| 1412 |
|
| 1413 |
-
|
| 1414 |
saveResumeBtn.addEventListener(
|
| 1415 |
"click",
|
| 1416 |
function () {
|
| 1417 |
-
|
| 1418 |
const resume =
|
| 1419 |
resumeText.value.trim();
|
| 1420 |
|
| 1421 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 1422 |
alert(
|
| 1423 |
"Paste your complete master resume first."
|
| 1424 |
);
|
|
|
|
| 1425 |
return;
|
| 1426 |
}
|
| 1427 |
|
|
@@ -1430,20 +1683,13 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1430 |
resume
|
| 1431 |
);
|
| 1432 |
|
| 1433 |
-
|
| 1434 |
-
|
| 1435 |
-
|
| 1436 |
-
|
| 1437 |
-
</span>
|
| 1438 |
-
`;
|
| 1439 |
}
|
| 1440 |
);
|
| 1441 |
|
| 1442 |
-
|
| 1443 |
-
/* =========================================================
|
| 1444 |
-
ATS ANALYSIS
|
| 1445 |
-
========================================================= */
|
| 1446 |
-
|
| 1447 |
const skills = [
|
| 1448 |
"python",
|
| 1449 |
"sql",
|
|
@@ -1480,7 +1726,6 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1480 |
"ansible",
|
| 1481 |
"docker",
|
| 1482 |
"kubernetes",
|
| 1483 |
-
|
| 1484 |
"linux",
|
| 1485 |
"bash",
|
| 1486 |
|
|
@@ -1495,7 +1740,6 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1495 |
"kinesis",
|
| 1496 |
"rabbitmq",
|
| 1497 |
"sqs",
|
| 1498 |
-
|
| 1499 |
"etl",
|
| 1500 |
"elt",
|
| 1501 |
"cdc",
|
|
@@ -1506,7 +1750,6 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1506 |
"rest api",
|
| 1507 |
"microservices",
|
| 1508 |
"distributed systems",
|
| 1509 |
-
|
| 1510 |
"grafana",
|
| 1511 |
"prometheus",
|
| 1512 |
"opentelemetry",
|
|
@@ -1516,7 +1759,6 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1516 |
"tensorflow",
|
| 1517 |
"scikit-learn",
|
| 1518 |
"mlflow",
|
| 1519 |
-
|
| 1520 |
"generative ai",
|
| 1521 |
"genai",
|
| 1522 |
"llm",
|
|
@@ -1524,17 +1766,15 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1524 |
|
| 1525 |
"power bi",
|
| 1526 |
"tableau",
|
| 1527 |
-
|
| 1528 |
"jira",
|
| 1529 |
"confluence",
|
| 1530 |
-
|
| 1531 |
"roadmap",
|
| 1532 |
"product management",
|
| 1533 |
"stakeholder management",
|
|
|
|
| 1534 |
"backlog",
|
| 1535 |
"program management",
|
| 1536 |
"technical program management",
|
| 1537 |
-
|
| 1538 |
"agile",
|
| 1539 |
"scrum",
|
| 1540 |
|
|
@@ -1546,133 +1786,153 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1546 |
"indexing"
|
| 1547 |
];
|
| 1548 |
|
| 1549 |
-
|
| 1550 |
analyzeJobBtn.addEventListener(
|
| 1551 |
"click",
|
| 1552 |
-
|
| 1553 |
-
|
|
|
|
| 1554 |
|
|
|
|
|
|
|
| 1555 |
|
| 1556 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1557 |
|
| 1558 |
-
|
| 1559 |
-
|
| 1560 |
|
| 1561 |
-
|
| 1562 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1563 |
|
| 1564 |
-
|
| 1565 |
-
|
| 1566 |
-
"Search and select a job first."
|
| 1567 |
-
);
|
| 1568 |
-
return;
|
| 1569 |
-
}
|
| 1570 |
|
| 1571 |
-
|
| 1572 |
-
|
| 1573 |
-
|
| 1574 |
-
|
| 1575 |
-
|
| 1576 |
-
|
|
|
|
|
|
|
| 1577 |
|
| 1578 |
-
|
| 1579 |
-
|
| 1580 |
-
|
| 1581 |
-
|
| 1582 |
-
|
| 1583 |
-
|
| 1584 |
-
|
| 1585 |
-
|
| 1586 |
-
});
|
| 1587 |
-
|
| 1588 |
-
const gaps =
|
| 1589 |
-
required.filter(function (skill) {
|
| 1590 |
-
return !resume.includes(skill);
|
| 1591 |
-
});
|
| 1592 |
-
|
| 1593 |
-
const coverage =
|
| 1594 |
-
required.length
|
| 1595 |
-
? Math.round(
|
| 1596 |
-
(
|
| 1597 |
-
matched.length /
|
| 1598 |
-
required.length
|
| 1599 |
-
) * 100
|
| 1600 |
-
)
|
| 1601 |
-
: 50;
|
| 1602 |
-
|
| 1603 |
-
const calculatedAts =
|
| 1604 |
-
Math.min(
|
| 1605 |
-
97,
|
| 1606 |
-
Math.max(
|
| 1607 |
-
25,
|
| 1608 |
-
coverage
|
| 1609 |
-
)
|
| 1610 |
-
);
|
| 1611 |
|
| 1612 |
-
|
| 1613 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1614 |
|
| 1615 |
-
|
| 1616 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1617 |
|
| 1618 |
-
|
| 1619 |
-
|
|
|
|
| 1620 |
|
| 1621 |
-
|
| 1622 |
-
|
|
|
|
| 1623 |
|
| 1624 |
-
|
| 1625 |
-
|
| 1626 |
-
<strong>
|
| 1627 |
-
Matching experience
|
| 1628 |
-
</strong>
|
| 1629 |
|
| 1630 |
-
|
| 1631 |
-
|
| 1632 |
-
margin-top:8px;
|
| 1633 |
-
line-height:1.7;
|
| 1634 |
-
">
|
| 1635 |
-
${
|
| 1636 |
-
matched.length
|
| 1637 |
-
? escapeHTML(
|
| 1638 |
-
matched.join(", ")
|
| 1639 |
-
)
|
| 1640 |
-
: "No major keyword matches detected."
|
| 1641 |
-
}
|
| 1642 |
-
</p>
|
| 1643 |
-
</div>
|
| 1644 |
|
| 1645 |
-
|
| 1646 |
-
<
|
| 1647 |
-
Job priorities not currently visible
|
| 1648 |
-
</strong>
|
| 1649 |
|
| 1650 |
-
|
| 1651 |
-
|
| 1652 |
-
|
| 1653 |
-
|
| 1654 |
-
|
| 1655 |
-
|
| 1656 |
-
|
| 1657 |
-
|
| 1658 |
-
|
| 1659 |
-
|
| 1660 |
-
|
| 1661 |
-
|
| 1662 |
-
|
| 1663 |
-
|
| 1664 |
-
|
| 1665 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1666 |
|
|
|
|
|
|
|
|
|
|
| 1667 |
|
| 1668 |
-
|
| 1669 |
-
|
| 1670 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1671 |
|
| 1672 |
generateResumeBtn.addEventListener(
|
| 1673 |
"click",
|
| 1674 |
async function () {
|
| 1675 |
-
|
| 1676 |
const jd =
|
| 1677 |
jobDescription.value.trim();
|
| 1678 |
|
|
@@ -1688,21 +1948,31 @@ app_js = r'''document.addEventListener("DOMContentLoaded", function () {
|
|
| 1688 |
const location =
|
| 1689 |
selectedLocation.value.trim();
|
| 1690 |
|
| 1691 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 1692 |
alert(
|
| 1693 |
"Search for and select a job first."
|
| 1694 |
);
|
|
|
|
| 1695 |
return;
|
| 1696 |
}
|
| 1697 |
|
| 1698 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 1699 |
alert(
|
| 1700 |
"Add your master resume first."
|
| 1701 |
);
|
|
|
|
| 1702 |
return;
|
| 1703 |
}
|
| 1704 |
|
| 1705 |
-
generateResumeBtn.disabled =
|
|
|
|
|
|
|
| 1706 |
generateResumeBtn.textContent =
|
| 1707 |
"Generating Resume...";
|
| 1708 |
|
|
@@ -1713,19 +1983,17 @@ Target Role:
|
|
| 1713 |
${jobTitle}
|
| 1714 |
|
| 1715 |
Company:
|
| 1716 |
-
${company}
|
| 1717 |
-
|
| 1718 |
-
The first run may take longer because the local AI model must load in your browser.`;
|
| 1719 |
|
| 1720 |
try {
|
| 1721 |
-
|
| 1722 |
-
|
| 1723 |
|
| 1724 |
while (
|
| 1725 |
!window.JobAlignAI &&
|
| 1726 |
-
attempts <
|
|
|
|
| 1727 |
) {
|
| 1728 |
-
|
| 1729 |
await new Promise(
|
| 1730 |
function (resolve) {
|
| 1731 |
setTimeout(
|
|
@@ -1735,10 +2003,13 @@ The first run may take longer because the local AI model must load in your brows
|
|
| 1735 |
}
|
| 1736 |
);
|
| 1737 |
|
| 1738 |
-
attempts+
|
|
|
|
| 1739 |
}
|
| 1740 |
|
| 1741 |
-
if (
|
|
|
|
|
|
|
| 1742 |
throw new Error(
|
| 1743 |
"The local AI engine did not load. Refresh the page and try again."
|
| 1744 |
);
|
|
@@ -1747,11 +2018,20 @@ The first run may take longer because the local AI model must load in your brows
|
|
| 1747 |
const rewrittenResume =
|
| 1748 |
await window.JobAlignAI
|
| 1749 |
.generateResume({
|
| 1750 |
-
resume:
|
| 1751 |
-
|
| 1752 |
-
|
| 1753 |
-
|
| 1754 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1755 |
});
|
| 1756 |
|
| 1757 |
resumeOutput.textContent =
|
|
@@ -1764,16 +2044,27 @@ The first run may take longer because the local AI model must load in your brows
|
|
| 1764 |
|
| 1765 |
generationStatus.innerHTML = `
|
| 1766 |
<div class="status-dot"></div>
|
|
|
|
| 1767 |
<span class="success-text">
|
|
|
|
| 1768 |
Resume generated for
|
| 1769 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1770 |
at
|
| 1771 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1772 |
</span>
|
| 1773 |
`;
|
| 1774 |
|
| 1775 |
interviewCheck.innerHTML = `
|
| 1776 |
<div>
|
|
|
|
| 1777 |
<strong>
|
| 1778 |
Targeted resume generated.
|
| 1779 |
</strong>
|
|
@@ -1786,11 +2077,11 @@ The first run may take longer because the local AI model must load in your brows
|
|
| 1786 |
Review every technical claim
|
| 1787 |
before submitting.
|
| 1788 |
</p>
|
|
|
|
| 1789 |
</div>
|
| 1790 |
`;
|
| 1791 |
|
| 1792 |
} catch (error) {
|
| 1793 |
-
|
| 1794 |
console.error(
|
| 1795 |
"JobAlign generation error:",
|
| 1796 |
error
|
|
@@ -1798,9 +2089,15 @@ The first run may take longer because the local AI model must load in your brows
|
|
| 1798 |
|
| 1799 |
generationStatus.innerHTML = `
|
| 1800 |
<div class="status-dot"></div>
|
|
|
|
| 1801 |
<span class="danger-text">
|
|
|
|
| 1802 |
Resume generation failed:
|
| 1803 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1804 |
</span>
|
| 1805 |
`;
|
| 1806 |
|
|
@@ -1811,7 +2108,6 @@ Error:
|
|
| 1811 |
${error.message}`;
|
| 1812 |
|
| 1813 |
} finally {
|
| 1814 |
-
|
| 1815 |
generateResumeBtn.disabled =
|
| 1816 |
false;
|
| 1817 |
|
|
@@ -1821,15 +2117,9 @@ ${error.message}`;
|
|
| 1821 |
}
|
| 1822 |
);
|
| 1823 |
|
| 1824 |
-
|
| 1825 |
-
/* =========================================================
|
| 1826 |
-
COPY
|
| 1827 |
-
========================================================= */
|
| 1828 |
-
|
| 1829 |
copyResumeBtn.addEventListener(
|
| 1830 |
"click",
|
| 1831 |
async function () {
|
| 1832 |
-
|
| 1833 |
const text =
|
| 1834 |
resumeOutput.innerText.trim();
|
| 1835 |
|
|
@@ -1841,14 +2131,16 @@ ${error.message}`;
|
|
| 1841 |
alert(
|
| 1842 |
"Generate a resume first."
|
| 1843 |
);
|
|
|
|
| 1844 |
return;
|
| 1845 |
}
|
| 1846 |
|
| 1847 |
try {
|
| 1848 |
-
|
| 1849 |
await navigator
|
| 1850 |
.clipboard
|
| 1851 |
-
.writeText(
|
|
|
|
|
|
|
| 1852 |
|
| 1853 |
copyResumeBtn.textContent =
|
| 1854 |
"Copied";
|
|
@@ -1862,7 +2154,6 @@ ${error.message}`;
|
|
| 1862 |
);
|
| 1863 |
|
| 1864 |
} catch (error) {
|
| 1865 |
-
|
| 1866 |
alert(
|
| 1867 |
"Your browser blocked clipboard access."
|
| 1868 |
);
|
|
@@ -1870,15 +2161,9 @@ ${error.message}`;
|
|
| 1870 |
}
|
| 1871 |
);
|
| 1872 |
|
| 1873 |
-
|
| 1874 |
-
/* =========================================================
|
| 1875 |
-
DOWNLOAD
|
| 1876 |
-
========================================================= */
|
| 1877 |
-
|
| 1878 |
downloadResumeBtn.addEventListener(
|
| 1879 |
"click",
|
| 1880 |
function () {
|
| 1881 |
-
|
| 1882 |
const text =
|
| 1883 |
resumeOutput.innerText.trim();
|
| 1884 |
|
|
@@ -1890,25 +2175,33 @@ ${error.message}`;
|
|
| 1890 |
alert(
|
| 1891 |
"Generate a resume first."
|
| 1892 |
);
|
|
|
|
| 1893 |
return;
|
| 1894 |
}
|
| 1895 |
|
| 1896 |
const blob =
|
| 1897 |
new Blob(
|
| 1898 |
-
[
|
|
|
|
|
|
|
| 1899 |
{
|
| 1900 |
type:
|
| 1901 |
"text/plain;charset=utf-8"
|
| 1902 |
}
|
| 1903 |
);
|
| 1904 |
|
| 1905 |
-
const
|
| 1906 |
-
URL.createObjectURL(
|
|
|
|
|
|
|
| 1907 |
|
| 1908 |
const link =
|
| 1909 |
-
document.createElement(
|
|
|
|
|
|
|
| 1910 |
|
| 1911 |
-
link.href =
|
|
|
|
| 1912 |
|
| 1913 |
link.download =
|
| 1914 |
safeFileName(
|
|
@@ -1925,63 +2218,136 @@ ${error.message}`;
|
|
| 1925 |
link.click();
|
| 1926 |
|
| 1927 |
URL.revokeObjectURL(
|
| 1928 |
-
|
| 1929 |
);
|
| 1930 |
}
|
| 1931 |
);
|
| 1932 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1933 |
|
| 1934 |
-
|
| 1935 |
-
|
| 1936 |
-
|
| 1937 |
-
|
| 1938 |
-
|
| 1939 |
-
|
| 1940 |
-
|
| 1941 |
-
|
| 1942 |
-
|
| 1943 |
-
|
| 1944 |
-
|
| 1945 |
-
|
| 1946 |
-
|
| 1947 |
-
.trim();
|
| 1948 |
}
|
| 1949 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1950 |
|
| 1951 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1952 |
|
| 1953 |
-
const
|
| 1954 |
-
"
|
| 1955 |
-
"
|
| 1956 |
-
"
|
| 1957 |
-
"
|
| 1958 |
-
"
|
| 1959 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1960 |
|
| 1961 |
-
return
|
| 1962 |
-
|
| 1963 |
-
|
| 1964 |
-
|
| 1965 |
-
word.length > 1 &&
|
| 1966 |
-
!ignored.has(word)
|
| 1967 |
);
|
| 1968 |
-
}
|
|
|
|
| 1969 |
}
|
| 1970 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1971 |
|
| 1972 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1973 |
|
|
|
|
|
|
|
|
|
|
| 1974 |
const normalized =
|
| 1975 |
-
normalizeSimple(
|
|
|
|
|
|
|
| 1976 |
|
| 1977 |
for (
|
| 1978 |
-
const [
|
| 1979 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1980 |
) {
|
| 1981 |
if (
|
| 1982 |
-
normalized ===
|
|
|
|
| 1983 |
normalized.includes(
|
| 1984 |
-
|
| 1985 |
)
|
| 1986 |
) {
|
| 1987 |
return code;
|
|
@@ -1989,11 +2355,17 @@ ${error.message}`;
|
|
| 1989 |
}
|
| 1990 |
|
| 1991 |
const upper =
|
| 1992 |
-
String(
|
| 1993 |
-
|
| 1994 |
-
|
| 1995 |
-
|
| 1996 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1997 |
const pattern =
|
| 1998 |
new RegExp(
|
| 1999 |
"(^|[,\\s])" +
|
|
@@ -2001,7 +2373,11 @@ ${error.message}`;
|
|
| 2001 |
"($|[,\\s])"
|
| 2002 |
);
|
| 2003 |
|
| 2004 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2005 |
return code;
|
| 2006 |
}
|
| 2007 |
}
|
|
@@ -2009,53 +2385,31 @@ ${error.message}`;
|
|
| 2009 |
return "";
|
| 2010 |
}
|
| 2011 |
|
| 2012 |
-
|
| 2013 |
-
|
| 2014 |
-
|
| 2015 |
const code =
|
| 2016 |
-
detectUSStateCode(
|
| 2017 |
-
|
| 2018 |
-
|
| 2019 |
-
return "";
|
| 2020 |
-
}
|
| 2021 |
-
|
| 2022 |
-
return stateNameFromCode(code);
|
| 2023 |
-
}
|
| 2024 |
-
|
| 2025 |
-
|
| 2026 |
-
function stateNameFromCode(code) {
|
| 2027 |
-
|
| 2028 |
-
const match =
|
| 2029 |
-
Object.entries(US_STATES)
|
| 2030 |
-
.find(function (entry) {
|
| 2031 |
-
return entry[1] === code;
|
| 2032 |
-
});
|
| 2033 |
-
|
| 2034 |
-
return match
|
| 2035 |
-
? match[0]
|
| 2036 |
-
: "";
|
| 2037 |
-
}
|
| 2038 |
-
|
| 2039 |
-
|
| 2040 |
-
function extractRequestedCity(location) {
|
| 2041 |
-
|
| 2042 |
-
const raw =
|
| 2043 |
-
String(location || "")
|
| 2044 |
-
.trim();
|
| 2045 |
-
|
| 2046 |
-
const stateCode =
|
| 2047 |
-
detectUSStateCode(raw);
|
| 2048 |
|
| 2049 |
const stateName =
|
| 2050 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2051 |
|
| 2052 |
let city =
|
| 2053 |
-
|
|
|
|
|
|
|
|
|
|
| 2054 |
.replace(
|
| 2055 |
new RegExp(
|
| 2056 |
"\\b" +
|
| 2057 |
escapeRegExp(
|
| 2058 |
-
|
| 2059 |
) +
|
| 2060 |
"\\b",
|
| 2061 |
"i"
|
|
@@ -2077,13 +2431,24 @@ ${error.message}`;
|
|
| 2077 |
/united states|usa|u\.s\.a\.|u\.s\./gi,
|
| 2078 |
""
|
| 2079 |
)
|
| 2080 |
-
.replace(
|
| 2081 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2082 |
.trim();
|
| 2083 |
|
| 2084 |
if (
|
| 2085 |
-
|
| 2086 |
-
normalizeSimple(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2087 |
) {
|
| 2088 |
return "";
|
| 2089 |
}
|
|
@@ -2091,211 +2456,209 @@ ${error.message}`;
|
|
| 2091 |
return city;
|
| 2092 |
}
|
| 2093 |
|
| 2094 |
-
|
| 2095 |
function locationContainsState(
|
| 2096 |
location,
|
| 2097 |
-
|
| 2098 |
) {
|
| 2099 |
-
|
| 2100 |
const upper =
|
| 2101 |
-
String(
|
| 2102 |
-
|
|
|
|
|
|
|
| 2103 |
|
| 2104 |
const pattern =
|
| 2105 |
new RegExp(
|
| 2106 |
"(^|[,\\s])" +
|
| 2107 |
-
|
| 2108 |
"($|[,\\s])"
|
| 2109 |
);
|
| 2110 |
|
| 2111 |
-
return pattern.test(
|
| 2112 |
-
|
| 2113 |
-
|
| 2114 |
-
|
| 2115 |
-
function looksLikeUSLocation(location) {
|
| 2116 |
-
|
| 2117 |
-
const normalized =
|
| 2118 |
-
normalizeSimple(location);
|
| 2119 |
-
|
| 2120 |
-
if (
|
| 2121 |
-
[
|
| 2122 |
-
"us",
|
| 2123 |
-
"usa",
|
| 2124 |
-
"united states",
|
| 2125 |
-
"united states of america"
|
| 2126 |
-
].includes(normalized)
|
| 2127 |
-
) {
|
| 2128 |
-
return true;
|
| 2129 |
-
}
|
| 2130 |
-
|
| 2131 |
-
return Boolean(
|
| 2132 |
-
detectUSStateCode(location)
|
| 2133 |
);
|
| 2134 |
}
|
| 2135 |
|
| 2136 |
-
|
| 2137 |
-
|
| 2138 |
-
|
| 2139 |
-
|
| 2140 |
-
|
| 2141 |
-
|
| 2142 |
-
|
| 2143 |
-
|
| 2144 |
-
|
| 2145 |
-
|
| 2146 |
-
normalizeSimple(location);
|
| 2147 |
-
|
| 2148 |
-
return (
|
| 2149 |
-
normalized.includes(
|
| 2150 |
"united states"
|
| 2151 |
-
)
|
| 2152 |
-
|
| 2153 |
-
|
| 2154 |
-
|
| 2155 |
-
|
| 2156 |
-
|
| 2157 |
-
|
| 2158 |
-
|
| 2159 |
-
|
| 2160 |
-
|
| 2161 |
-
|
| 2162 |
-
|
| 2163 |
-
|
| 2164 |
-
|
| 2165 |
-
|
| 2166 |
-
|
| 2167 |
-
|
| 2168 |
-
|
| 2169 |
-
|
| 2170 |
-
function looksLikeEuropeLocation(location) {
|
| 2171 |
-
|
| 2172 |
-
const value =
|
| 2173 |
-
normalizeSimple(location);
|
| 2174 |
-
|
| 2175 |
-
const terms = [
|
| 2176 |
-
"europe",
|
| 2177 |
-
"germany",
|
| 2178 |
-
"france",
|
| 2179 |
-
"netherlands",
|
| 2180 |
-
"sweden",
|
| 2181 |
-
"switzerland",
|
| 2182 |
-
"ireland",
|
| 2183 |
-
"spain",
|
| 2184 |
-
"italy",
|
| 2185 |
-
"portugal",
|
| 2186 |
-
"poland",
|
| 2187 |
-
"denmark",
|
| 2188 |
-
"norway",
|
| 2189 |
-
"finland",
|
| 2190 |
-
"austria",
|
| 2191 |
-
"belgium",
|
| 2192 |
-
"united kingdom",
|
| 2193 |
-
"uk"
|
| 2194 |
-
];
|
| 2195 |
-
|
| 2196 |
-
return terms.some(function (term) {
|
| 2197 |
-
return value.includes(term);
|
| 2198 |
-
});
|
| 2199 |
}
|
| 2200 |
|
| 2201 |
-
|
| 2202 |
-
|
| 2203 |
-
|
| 2204 |
-
|
| 2205 |
-
|
| 2206 |
-
|
| 2207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2208 |
}
|
| 2209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2210 |
|
| 2211 |
-
|
| 2212 |
-
|
| 2213 |
-
|
| 2214 |
-
|
| 2215 |
-
|
| 2216 |
-
|
| 2217 |
-
|
| 2218 |
-
|
| 2219 |
-
return jobs.filter(function (job) {
|
| 2220 |
|
| 2221 |
-
|
| 2222 |
-
|
| 2223 |
-
"|" +
|
| 2224 |
-
normalizeSimple(
|
| 2225 |
-
job.company_name
|
| 2226 |
-
) +
|
| 2227 |
-
"|" +
|
| 2228 |
-
normalizeSimple(
|
| 2229 |
-
job.location
|
| 2230 |
);
|
| 2231 |
|
| 2232 |
-
|
| 2233 |
-
return false;
|
| 2234 |
}
|
| 2235 |
-
|
| 2236 |
-
seen.add(key);
|
| 2237 |
-
|
| 2238 |
-
return true;
|
| 2239 |
-
});
|
| 2240 |
}
|
| 2241 |
|
| 2242 |
-
|
| 2243 |
-
|
| 2244 |
-
|
| 2245 |
const element =
|
| 2246 |
-
document.createElement(
|
|
|
|
|
|
|
| 2247 |
|
| 2248 |
element.innerHTML =
|
| 2249 |
-
String(
|
|
|
|
|
|
|
|
|
|
| 2250 |
|
| 2251 |
return (
|
| 2252 |
element.textContent ||
|
| 2253 |
element.innerText ||
|
| 2254 |
""
|
| 2255 |
)
|
| 2256 |
-
.replace(
|
|
|
|
|
|
|
|
|
|
| 2257 |
.trim();
|
| 2258 |
}
|
| 2259 |
|
| 2260 |
-
|
| 2261 |
-
|
| 2262 |
-
|
| 2263 |
-
return String(
|
|
|
|
|
|
|
|
|
|
| 2264 |
.toLowerCase()
|
| 2265 |
.replace(
|
| 2266 |
/[^a-z0-9+#.]+/g,
|
| 2267 |
" "
|
| 2268 |
)
|
| 2269 |
-
.replace(
|
|
|
|
|
|
|
|
|
|
| 2270 |
.trim();
|
| 2271 |
}
|
| 2272 |
|
| 2273 |
-
|
| 2274 |
-
|
| 2275 |
-
|
| 2276 |
const element =
|
| 2277 |
-
document.createElement(
|
|
|
|
|
|
|
| 2278 |
|
| 2279 |
element.textContent =
|
| 2280 |
-
String(
|
|
|
|
|
|
|
|
|
|
| 2281 |
|
| 2282 |
return element.innerHTML;
|
| 2283 |
}
|
| 2284 |
|
| 2285 |
-
|
| 2286 |
-
|
| 2287 |
-
|
| 2288 |
-
return String(
|
| 2289 |
-
|
| 2290 |
-
|
| 2291 |
-
|
| 2292 |
-
)
|
|
|
|
|
|
|
| 2293 |
}
|
| 2294 |
|
| 2295 |
-
|
| 2296 |
-
|
| 2297 |
-
|
| 2298 |
-
return String(
|
|
|
|
|
|
|
|
|
|
| 2299 |
.replace(
|
| 2300 |
/[^a-z0-9]+/gi,
|
| 2301 |
"_"
|
|
@@ -2306,18 +2669,68 @@ ${error.message}`;
|
|
| 2306 |
);
|
| 2307 |
}
|
| 2308 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2309 |
|
| 2310 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2311 |
|
| 2312 |
-
|
| 2313 |
-
|
| 2314 |
-
|
| 2315 |
-
|
| 2316 |
}
|
| 2317 |
|
| 2318 |
-
|
| 2319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2320 |
|
| 2321 |
-
|
| 2322 |
-
|
| 2323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
const searchButton = document.getElementById("searchJobsBtn");
|
| 3 |
const keywordInput = document.getElementById("jobKeyword");
|
| 4 |
const locationInput = document.getElementById("jobLocation");
|
|
|
|
| 33 |
const interviewCheck = document.getElementById("interviewCheck");
|
| 34 |
|
| 35 |
let currentMatches = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
const US_STATES = {
|
| 38 |
+
alabama: "AL",
|
| 39 |
+
alaska: "AK",
|
| 40 |
+
arizona: "AZ",
|
| 41 |
+
arkansas: "AR",
|
| 42 |
+
california: "CA",
|
| 43 |
+
colorado: "CO",
|
| 44 |
+
connecticut: "CT",
|
| 45 |
+
delaware: "DE",
|
| 46 |
+
florida: "FL",
|
| 47 |
+
georgia: "GA",
|
| 48 |
+
hawaii: "HI",
|
| 49 |
+
idaho: "ID",
|
| 50 |
+
illinois: "IL",
|
| 51 |
+
indiana: "IN",
|
| 52 |
+
iowa: "IA",
|
| 53 |
+
kansas: "KS",
|
| 54 |
+
kentucky: "KY",
|
| 55 |
+
louisiana: "LA",
|
| 56 |
+
maine: "ME",
|
| 57 |
+
maryland: "MD",
|
| 58 |
+
massachusetts: "MA",
|
| 59 |
+
michigan: "MI",
|
| 60 |
+
minnesota: "MN",
|
| 61 |
+
mississippi: "MS",
|
| 62 |
+
missouri: "MO",
|
| 63 |
+
montana: "MT",
|
| 64 |
+
nebraska: "NE",
|
| 65 |
+
nevada: "NV",
|
| 66 |
"new hampshire": "NH",
|
| 67 |
"new jersey": "NJ",
|
| 68 |
"new mexico": "NM",
|
| 69 |
"new york": "NY",
|
| 70 |
"north carolina": "NC",
|
| 71 |
"north dakota": "ND",
|
| 72 |
+
ohio: "OH",
|
| 73 |
+
oklahoma: "OK",
|
| 74 |
+
oregon: "OR",
|
| 75 |
+
pennsylvania: "PA",
|
| 76 |
"rhode island": "RI",
|
| 77 |
"south carolina": "SC",
|
| 78 |
"south dakota": "SD",
|
| 79 |
+
tennessee: "TN",
|
| 80 |
+
texas: "TX",
|
| 81 |
+
utah: "UT",
|
| 82 |
+
vermont: "VT",
|
| 83 |
+
virginia: "VA",
|
| 84 |
+
washington: "WA",
|
| 85 |
"west virginia": "WV",
|
| 86 |
+
wisconsin: "WI",
|
| 87 |
+
wyoming: "WY"
|
| 88 |
};
|
| 89 |
|
| 90 |
+
const STATE_NAMES_BY_CODE = Object.fromEntries(
|
| 91 |
+
Object.entries(US_STATES).map(([name, code]) => [code, name])
|
| 92 |
+
);
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
const savedResume = localStorage.getItem("jobalign_master_resume");
|
| 95 |
|
| 96 |
if (savedResume) {
|
| 97 |
resumeText.value = savedResume;
|
| 98 |
|
| 99 |
+
setResumeStatus(
|
| 100 |
+
"Master resume loaded from this browser",
|
| 101 |
+
"success"
|
| 102 |
+
);
|
|
|
|
|
|
|
| 103 |
}
|
| 104 |
|
| 105 |
+
searchButton.addEventListener(
|
| 106 |
+
"click",
|
| 107 |
+
searchJobs
|
| 108 |
+
);
|
| 109 |
|
| 110 |
+
keywordInput.addEventListener(
|
| 111 |
+
"keydown",
|
| 112 |
+
function (event) {
|
| 113 |
+
if (event.key === "Enter") {
|
| 114 |
+
searchJobs();
|
| 115 |
+
}
|
|
|
|
|
|
|
|
|
|
| 116 |
}
|
| 117 |
+
);
|
| 118 |
|
| 119 |
+
locationInput.addEventListener(
|
| 120 |
+
"keydown",
|
| 121 |
+
function (event) {
|
| 122 |
+
if (event.key === "Enter") {
|
| 123 |
+
searchJobs();
|
| 124 |
+
}
|
| 125 |
}
|
| 126 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
async function searchJobs() {
|
| 129 |
+
const keyword =
|
| 130 |
+
keywordInput.value.trim();
|
| 131 |
|
| 132 |
+
const location =
|
| 133 |
+
locationInput.value.trim();
|
| 134 |
+
|
| 135 |
+
const mode =
|
| 136 |
+
jobSource
|
| 137 |
+
? jobSource.value
|
| 138 |
+
: "auto";
|
| 139 |
|
| 140 |
if (!keyword) {
|
| 141 |
+
alert(
|
| 142 |
+
"Enter a job title or keyword."
|
| 143 |
+
);
|
| 144 |
+
|
| 145 |
keywordInput.focus();
|
| 146 |
+
|
| 147 |
return;
|
| 148 |
}
|
| 149 |
|
| 150 |
if (!location) {
|
| 151 |
alert(
|
| 152 |
+
"Enter a location, for example San Francisco, CA, Utah, United States, Berlin, Germany, or Remote."
|
| 153 |
);
|
| 154 |
+
|
| 155 |
locationInput.focus();
|
| 156 |
+
|
| 157 |
return;
|
| 158 |
}
|
| 159 |
|
| 160 |
+
searchButton.disabled =
|
| 161 |
+
true;
|
| 162 |
+
|
| 163 |
+
searchButton.textContent =
|
| 164 |
+
"Searching...";
|
| 165 |
|
| 166 |
resultsBox.innerHTML = `
|
| 167 |
<div class="empty-state">
|
| 168 |
+
|
| 169 |
<div>
|
| 170 |
+
|
| 171 |
+
<strong>
|
| 172 |
+
Searching live jobs...
|
| 173 |
+
</strong>
|
| 174 |
+
|
| 175 |
<br><br>
|
| 176 |
+
|
| 177 |
${escapeHTML(keyword)}
|
| 178 |
+
|
| 179 |
<br>
|
| 180 |
+
|
| 181 |
${escapeHTML(location)}
|
| 182 |
+
|
| 183 |
</div>
|
| 184 |
+
|
| 185 |
</div>
|
| 186 |
`;
|
| 187 |
|
| 188 |
try {
|
| 189 |
+
const requests =
|
| 190 |
+
[];
|
| 191 |
|
| 192 |
+
const remoteSearch =
|
| 193 |
+
isRemoteQuery(location) ||
|
| 194 |
+
mode === "remote";
|
| 195 |
|
| 196 |
+
const broadUS =
|
| 197 |
+
isBroadUS(location) ||
|
| 198 |
+
mode === "usa";
|
| 199 |
+
|
| 200 |
+
const broadEurope =
|
| 201 |
+
isBroadEurope(location) ||
|
| 202 |
+
mode === "europe";
|
| 203 |
+
|
| 204 |
+
requests.push(
|
| 205 |
+
fetchMuseJobs(
|
| 206 |
+
location,
|
| 207 |
+
remoteSearch
|
| 208 |
+
)
|
| 209 |
+
);
|
| 210 |
+
|
| 211 |
+
if (
|
| 212 |
+
remoteSearch ||
|
| 213 |
+
broadUS ||
|
| 214 |
+
broadEurope
|
| 215 |
+
) {
|
| 216 |
+
const geo =
|
| 217 |
+
broadUS
|
| 218 |
+
? "usa"
|
| 219 |
+
: broadEurope
|
| 220 |
+
? "europe"
|
| 221 |
+
: "";
|
| 222 |
|
|
|
|
| 223 |
requests.push(
|
| 224 |
+
fetchJobicyJobs(
|
| 225 |
+
keyword,
|
| 226 |
+
geo
|
| 227 |
+
)
|
| 228 |
);
|
| 229 |
}
|
| 230 |
|
| 231 |
+
if (
|
| 232 |
+
remoteSearch ||
|
| 233 |
+
broadUS
|
| 234 |
+
) {
|
| 235 |
requests.push(
|
| 236 |
fetchRemoteOKJobs()
|
| 237 |
);
|
| 238 |
}
|
| 239 |
|
| 240 |
+
const settled =
|
| 241 |
+
await Promise.allSettled(
|
| 242 |
+
requests
|
| 243 |
+
);
|
| 244 |
|
| 245 |
+
let jobs =
|
| 246 |
+
[];
|
| 247 |
|
| 248 |
+
for (
|
| 249 |
+
const result
|
| 250 |
+
of settled
|
| 251 |
+
) {
|
| 252 |
+
if (
|
| 253 |
+
result.status ===
|
| 254 |
+
"fulfilled"
|
| 255 |
+
) {
|
| 256 |
+
jobs =
|
| 257 |
+
jobs.concat(
|
| 258 |
+
result.value
|
| 259 |
+
);
|
| 260 |
} else {
|
| 261 |
+
console.warn(
|
| 262 |
+
"One job source failed:",
|
| 263 |
+
result.reason
|
| 264 |
+
);
|
| 265 |
}
|
| 266 |
+
}
|
| 267 |
|
| 268 |
+
jobs =
|
| 269 |
+
dedupeJobs(jobs)
|
| 270 |
+
.map(
|
| 271 |
+
function (job) {
|
| 272 |
+
return {
|
| 273 |
+
...job,
|
| 274 |
+
|
| 275 |
+
roleScore:
|
| 276 |
+
calculateRoleScore(
|
| 277 |
+
job,
|
| 278 |
+
keyword
|
| 279 |
+
),
|
| 280 |
+
|
| 281 |
+
locationScore:
|
| 282 |
+
calculateLocationScore(
|
| 283 |
+
job,
|
| 284 |
+
location
|
| 285 |
+
)
|
| 286 |
+
};
|
| 287 |
+
}
|
| 288 |
+
)
|
| 289 |
+
.filter(
|
| 290 |
+
function (job) {
|
| 291 |
+
return (
|
| 292 |
+
job.roleScore > 0
|
| 293 |
+
);
|
| 294 |
+
}
|
| 295 |
+
)
|
| 296 |
+
.filter(
|
| 297 |
+
function (job) {
|
| 298 |
+
return locationMatches(
|
| 299 |
+
job,
|
| 300 |
+
location
|
| 301 |
+
);
|
| 302 |
+
}
|
| 303 |
+
)
|
| 304 |
+
.sort(
|
| 305 |
+
function (a, b) {
|
| 306 |
+
const scoreA =
|
| 307 |
+
(
|
| 308 |
+
a.roleScore *
|
| 309 |
+
4
|
| 310 |
+
) +
|
| 311 |
+
a.locationScore;
|
| 312 |
|
| 313 |
+
const scoreB =
|
| 314 |
+
(
|
| 315 |
+
b.roleScore *
|
| 316 |
+
4
|
| 317 |
+
) +
|
| 318 |
+
b.locationScore;
|
| 319 |
+
|
| 320 |
+
return (
|
| 321 |
+
scoreB -
|
| 322 |
+
scoreA
|
| 323 |
+
);
|
| 324 |
+
}
|
| 325 |
+
);
|
| 326 |
|
| 327 |
+
currentMatches =
|
| 328 |
+
jobs.slice(
|
| 329 |
+
0,
|
| 330 |
+
40
|
| 331 |
+
);
|
|
|
|
|
|
|
|
|
|
| 332 |
|
| 333 |
+
renderJobs(
|
| 334 |
+
keyword,
|
| 335 |
+
location
|
| 336 |
+
);
|
| 337 |
|
| 338 |
+
} catch (error) {
|
| 339 |
+
console.error(
|
| 340 |
+
"JobAlign search error:",
|
| 341 |
+
error
|
| 342 |
+
);
|
| 343 |
|
| 344 |
+
resultsBox.innerHTML = `
|
| 345 |
+
<div
|
| 346 |
+
class="empty-state"
|
| 347 |
+
style="color:#ff7777;"
|
| 348 |
+
>
|
| 349 |
|
| 350 |
+
<div>
|
| 351 |
|
| 352 |
+
<strong>
|
| 353 |
+
Job search failed.
|
| 354 |
+
</strong>
|
| 355 |
|
| 356 |
+
<br><br>
|
| 357 |
|
| 358 |
+
${escapeHTML(
|
| 359 |
+
error.message
|
| 360 |
+
)}
|
| 361 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 362 |
</div>
|
| 363 |
+
|
| 364 |
</div>
|
| 365 |
`;
|
| 366 |
|
| 367 |
} finally {
|
| 368 |
+
searchButton.disabled =
|
| 369 |
+
false;
|
| 370 |
|
| 371 |
+
searchButton.textContent =
|
| 372 |
+
"Search Jobs";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 373 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 374 |
}
|
| 375 |
|
| 376 |
+
async function fetchMuseJobs(
|
| 377 |
+
location,
|
| 378 |
+
remoteSearch
|
| 379 |
+
) {
|
| 380 |
+
const queries =
|
| 381 |
+
remoteSearch
|
| 382 |
+
? [
|
| 383 |
+
"Flexible / Remote"
|
| 384 |
+
]
|
| 385 |
+
: buildMuseLocationQueries(
|
| 386 |
+
location
|
| 387 |
+
);
|
| 388 |
|
| 389 |
+
const jobs =
|
| 390 |
+
[];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
|
| 392 |
+
const seen =
|
| 393 |
+
new Set();
|
| 394 |
|
| 395 |
+
for (
|
| 396 |
+
const queryLocation
|
| 397 |
+
of queries
|
| 398 |
+
) {
|
| 399 |
+
for (
|
| 400 |
+
let page = 1;
|
| 401 |
+
page <= 5;
|
| 402 |
+
page++
|
| 403 |
+
) {
|
| 404 |
+
const url =
|
| 405 |
+
new URL(
|
| 406 |
+
"https://www.themuse.com/api/public/jobs"
|
| 407 |
+
);
|
| 408 |
|
| 409 |
+
url.searchParams.set(
|
| 410 |
+
"page",
|
| 411 |
+
String(page)
|
| 412 |
);
|
| 413 |
|
| 414 |
+
if (
|
| 415 |
+
queryLocation
|
| 416 |
+
) {
|
| 417 |
+
url.searchParams.append(
|
| 418 |
"location",
|
| 419 |
queryLocation
|
| 420 |
);
|
| 421 |
}
|
| 422 |
|
| 423 |
+
const response =
|
| 424 |
+
await fetch(
|
| 425 |
+
url.toString()
|
| 426 |
+
);
|
| 427 |
|
| 428 |
+
if (
|
| 429 |
+
!response.ok
|
| 430 |
+
) {
|
|
|
|
| 431 |
break;
|
| 432 |
}
|
| 433 |
|
| 434 |
+
const data =
|
| 435 |
+
await response.json();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
|
| 437 |
+
if (
|
| 438 |
+
!Array.isArray(
|
| 439 |
+
data.results
|
| 440 |
+
) ||
|
| 441 |
+
data.results.length === 0
|
| 442 |
+
) {
|
| 443 |
break;
|
| 444 |
}
|
| 445 |
|
| 446 |
+
for (
|
| 447 |
+
const raw
|
| 448 |
+
of data.results
|
| 449 |
+
) {
|
| 450 |
+
const job =
|
| 451 |
+
normalizeMuseJob(
|
| 452 |
+
raw
|
| 453 |
+
);
|
| 454 |
|
| 455 |
+
const key =
|
| 456 |
+
job.url ||
|
| 457 |
+
(
|
| 458 |
+
job.company_name +
|
| 459 |
+
"|" +
|
| 460 |
+
job.title +
|
| 461 |
+
"|" +
|
| 462 |
+
job.location
|
| 463 |
+
);
|
| 464 |
|
| 465 |
+
if (
|
| 466 |
+
!seen.has(
|
| 467 |
+
key
|
| 468 |
+
)
|
| 469 |
+
) {
|
| 470 |
+
seen.add(
|
| 471 |
+
key
|
| 472 |
+
);
|
| 473 |
|
| 474 |
+
jobs.push(
|
| 475 |
+
job
|
| 476 |
+
);
|
| 477 |
}
|
| 478 |
}
|
| 479 |
|
| 480 |
if (
|
| 481 |
data.page_count &&
|
| 482 |
+
page >=
|
| 483 |
+
Number(
|
| 484 |
+
data.page_count
|
| 485 |
+
)
|
| 486 |
) {
|
| 487 |
break;
|
| 488 |
}
|
|
|
|
| 492 |
return jobs;
|
| 493 |
}
|
| 494 |
|
| 495 |
+
function buildMuseLocationQueries(
|
| 496 |
+
location
|
| 497 |
+
) {
|
| 498 |
+
const values =
|
| 499 |
+
[
|
| 500 |
+
location.trim()
|
| 501 |
+
];
|
| 502 |
|
| 503 |
+
const stateCode =
|
| 504 |
+
detectUSStateCode(
|
| 505 |
+
location
|
| 506 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 507 |
|
| 508 |
+
const stateName =
|
| 509 |
+
stateCode
|
| 510 |
+
? STATE_NAMES_BY_CODE[
|
| 511 |
+
stateCode
|
| 512 |
+
]
|
| 513 |
+
: "";
|
| 514 |
|
| 515 |
+
if (
|
| 516 |
+
stateName &&
|
| 517 |
+
!values.includes(
|
| 518 |
+
titleCase(
|
| 519 |
+
stateName
|
| 520 |
+
)
|
| 521 |
+
)
|
| 522 |
+
) {
|
| 523 |
+
values.push(
|
| 524 |
+
titleCase(
|
| 525 |
+
stateName
|
| 526 |
+
)
|
| 527 |
+
);
|
| 528 |
}
|
| 529 |
|
| 530 |
+
if (
|
| 531 |
+
stateCode &&
|
| 532 |
+
!values.includes(
|
| 533 |
+
stateCode
|
| 534 |
+
)
|
| 535 |
+
) {
|
| 536 |
+
values.push(
|
| 537 |
+
stateCode
|
| 538 |
+
);
|
| 539 |
}
|
| 540 |
|
| 541 |
+
return [
|
| 542 |
+
...new Set(
|
| 543 |
+
values
|
| 544 |
+
)
|
| 545 |
+
];
|
| 546 |
}
|
| 547 |
|
| 548 |
+
function normalizeMuseJob(
|
| 549 |
+
job
|
| 550 |
+
) {
|
| 551 |
const locations =
|
| 552 |
+
Array.isArray(
|
| 553 |
+
job.locations
|
| 554 |
+
)
|
| 555 |
? job.locations
|
| 556 |
+
.map(
|
| 557 |
+
function (item) {
|
| 558 |
+
return item.name;
|
| 559 |
+
}
|
| 560 |
+
)
|
| 561 |
+
.filter(
|
| 562 |
+
Boolean
|
| 563 |
+
)
|
| 564 |
: [];
|
| 565 |
|
| 566 |
+
const tags =
|
| 567 |
+
[];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 568 |
|
| 569 |
+
if (
|
| 570 |
+
Array.isArray(
|
| 571 |
+
job.categories
|
| 572 |
+
)
|
| 573 |
+
) {
|
| 574 |
+
tags.push(
|
| 575 |
+
...job.categories
|
| 576 |
+
.map(
|
| 577 |
+
function (item) {
|
| 578 |
+
return item.name;
|
| 579 |
+
}
|
| 580 |
+
)
|
| 581 |
+
.filter(
|
| 582 |
+
Boolean
|
| 583 |
+
)
|
| 584 |
+
);
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
if (
|
| 588 |
+
Array.isArray(
|
| 589 |
+
job.levels
|
| 590 |
+
)
|
| 591 |
+
) {
|
| 592 |
+
tags.push(
|
| 593 |
+
...job.levels
|
| 594 |
+
.map(
|
| 595 |
+
function (item) {
|
| 596 |
+
return item.name;
|
| 597 |
+
}
|
| 598 |
+
)
|
| 599 |
+
.filter(
|
| 600 |
+
Boolean
|
| 601 |
+
)
|
| 602 |
+
);
|
| 603 |
+
}
|
| 604 |
|
| 605 |
return {
|
| 606 |
+
title:
|
| 607 |
+
job.name ||
|
| 608 |
+
"",
|
| 609 |
+
|
| 610 |
company_name:
|
| 611 |
+
job.company &&
|
| 612 |
+
job.company.name
|
| 613 |
? job.company.name
|
| 614 |
: "",
|
| 615 |
+
|
| 616 |
+
location:
|
| 617 |
+
locations.join(
|
| 618 |
+
" · "
|
| 619 |
+
),
|
| 620 |
+
|
| 621 |
+
description:
|
| 622 |
+
job.contents ||
|
| 623 |
+
"",
|
| 624 |
+
|
| 625 |
url:
|
| 626 |
+
job.refs &&
|
| 627 |
+
job.refs.landing_page
|
| 628 |
? job.refs.landing_page
|
| 629 |
: "",
|
| 630 |
+
|
| 631 |
remote:
|
| 632 |
+
locations.some(
|
| 633 |
+
function (value) {
|
| 634 |
+
return normalizeSimple(
|
| 635 |
+
value
|
| 636 |
+
).includes(
|
| 637 |
+
"remote"
|
| 638 |
+
);
|
| 639 |
+
}
|
| 640 |
+
),
|
| 641 |
|
| 642 |
+
tags:
|
| 643 |
+
tags,
|
| 644 |
|
| 645 |
+
source:
|
| 646 |
+
"The Muse"
|
| 647 |
+
};
|
| 648 |
+
}
|
| 649 |
|
| 650 |
+
async function fetchJobicyJobs(
|
| 651 |
+
keyword,
|
| 652 |
+
geo
|
| 653 |
+
) {
|
| 654 |
+
const url =
|
| 655 |
+
new URL(
|
| 656 |
+
"https://jobicy.com/api/v2/remote-jobs"
|
| 657 |
+
);
|
| 658 |
|
| 659 |
+
url.searchParams.set(
|
| 660 |
+
"count",
|
| 661 |
+
"200"
|
| 662 |
);
|
| 663 |
|
| 664 |
+
url.searchParams.set(
|
| 665 |
+
"tag",
|
| 666 |
+
keyword
|
| 667 |
+
);
|
| 668 |
|
| 669 |
+
if (
|
| 670 |
+
geo
|
| 671 |
+
) {
|
| 672 |
+
url.searchParams.set(
|
| 673 |
+
"geo",
|
| 674 |
+
geo
|
| 675 |
+
);
|
| 676 |
}
|
| 677 |
|
| 678 |
+
const response =
|
| 679 |
+
await fetch(
|
| 680 |
+
url.toString()
|
| 681 |
+
);
|
| 682 |
|
| 683 |
+
if (
|
| 684 |
+
!response.ok
|
| 685 |
+
) {
|
| 686 |
throw new Error(
|
| 687 |
"Jobicy returned HTTP " +
|
| 688 |
response.status
|
| 689 |
);
|
| 690 |
}
|
| 691 |
|
| 692 |
+
const data =
|
| 693 |
+
await response.json();
|
| 694 |
+
|
| 695 |
+
const jobs =
|
| 696 |
+
Array.isArray(
|
| 697 |
+
data.jobs
|
| 698 |
+
)
|
| 699 |
? data.jobs
|
| 700 |
: [];
|
| 701 |
|
| 702 |
+
return jobs.map(
|
| 703 |
+
function (job) {
|
| 704 |
+
return {
|
| 705 |
+
title:
|
| 706 |
+
job.jobTitle ||
|
| 707 |
+
"",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 708 |
|
| 709 |
+
company_name:
|
| 710 |
+
job.companyName ||
|
| 711 |
+
"",
|
| 712 |
|
| 713 |
+
location:
|
| 714 |
+
job.jobGeo ||
|
| 715 |
+
"Remote",
|
| 716 |
|
| 717 |
+
description:
|
| 718 |
+
job.jobDescription ||
|
| 719 |
+
job.jobExcerpt ||
|
| 720 |
+
"",
|
| 721 |
+
|
| 722 |
+
url:
|
| 723 |
+
job.url ||
|
| 724 |
+
"",
|
| 725 |
|
| 726 |
+
remote:
|
| 727 |
+
true,
|
| 728 |
+
|
| 729 |
+
tags:
|
| 730 |
+
[]
|
| 731 |
+
.concat(
|
| 732 |
+
job.jobIndustry ||
|
| 733 |
+
[]
|
| 734 |
+
)
|
| 735 |
+
.concat(
|
| 736 |
+
job.jobType ||
|
| 737 |
+
[]
|
| 738 |
+
)
|
| 739 |
+
.concat(
|
| 740 |
+
job.jobLevel
|
| 741 |
+
? [
|
| 742 |
+
job.jobLevel
|
| 743 |
+
]
|
| 744 |
+
: []
|
| 745 |
+
),
|
| 746 |
+
|
| 747 |
+
source:
|
| 748 |
+
"Jobicy"
|
| 749 |
+
};
|
| 750 |
+
}
|
| 751 |
);
|
| 752 |
+
}
|
| 753 |
+
|
| 754 |
+
async function fetchRemoteOKJobs() {
|
| 755 |
+
const response =
|
| 756 |
+
await fetch(
|
| 757 |
+
"https://remoteok.com/api"
|
| 758 |
+
);
|
| 759 |
|
| 760 |
+
if (
|
| 761 |
+
!response.ok
|
| 762 |
+
) {
|
| 763 |
throw new Error(
|
| 764 |
"Remote OK returned HTTP " +
|
| 765 |
response.status
|
| 766 |
);
|
| 767 |
}
|
| 768 |
|
| 769 |
+
const data =
|
| 770 |
+
await response.json();
|
| 771 |
|
| 772 |
+
if (
|
| 773 |
+
!Array.isArray(
|
| 774 |
+
data
|
| 775 |
+
)
|
| 776 |
+
) {
|
| 777 |
return [];
|
| 778 |
}
|
| 779 |
|
| 780 |
return data
|
| 781 |
+
.filter(
|
| 782 |
+
function (job) {
|
| 783 |
+
return (
|
| 784 |
+
job &&
|
| 785 |
+
(
|
| 786 |
+
job.position ||
|
| 787 |
+
job.company
|
| 788 |
+
)
|
| 789 |
+
);
|
| 790 |
+
}
|
| 791 |
+
)
|
| 792 |
+
.map(
|
| 793 |
+
function (job) {
|
| 794 |
+
return {
|
| 795 |
+
title:
|
| 796 |
+
job.position ||
|
| 797 |
+
"",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 798 |
|
| 799 |
+
company_name:
|
| 800 |
+
job.company ||
|
| 801 |
+
"",
|
| 802 |
|
| 803 |
+
location:
|
| 804 |
+
job.location ||
|
| 805 |
+
"Remote",
|
| 806 |
|
| 807 |
+
description:
|
| 808 |
+
job.description ||
|
| 809 |
+
"",
|
| 810 |
|
| 811 |
+
url:
|
| 812 |
+
job.url ||
|
| 813 |
+
"",
|
| 814 |
+
|
| 815 |
+
remote:
|
| 816 |
+
true,
|
| 817 |
+
|
| 818 |
+
tags:
|
| 819 |
+
Array.isArray(
|
| 820 |
+
job.tags
|
| 821 |
+
)
|
| 822 |
+
? job.tags
|
| 823 |
+
: [],
|
| 824 |
+
|
| 825 |
+
source:
|
| 826 |
+
"Remote OK"
|
| 827 |
+
};
|
| 828 |
+
}
|
| 829 |
+
);
|
| 830 |
+
}
|
| 831 |
+
|
| 832 |
+
function calculateRoleScore(
|
| 833 |
+
job,
|
| 834 |
+
keyword
|
| 835 |
+
) {
|
| 836 |
+
const title =
|
| 837 |
+
normalizeSimple(
|
| 838 |
+
job.title
|
| 839 |
+
);
|
| 840 |
+
|
| 841 |
+
const description =
|
| 842 |
+
normalizeSimple(
|
| 843 |
+
stripHTML(
|
| 844 |
+
job.description ||
|
| 845 |
+
""
|
| 846 |
+
)
|
| 847 |
+
);
|
| 848 |
|
| 849 |
+
const search =
|
| 850 |
+
normalizeSimple(
|
| 851 |
+
keyword
|
| 852 |
+
);
|
| 853 |
|
| 854 |
+
const ignored =
|
| 855 |
+
new Set([
|
| 856 |
+
"and",
|
| 857 |
+
"the",
|
| 858 |
+
"for",
|
| 859 |
+
"with",
|
| 860 |
+
"remote",
|
| 861 |
+
"hybrid"
|
| 862 |
+
]);
|
| 863 |
|
| 864 |
const words =
|
| 865 |
search
|
| 866 |
.split(" ")
|
| 867 |
+
.filter(
|
| 868 |
+
function (word) {
|
| 869 |
+
return (
|
| 870 |
+
word.length > 2 &&
|
| 871 |
+
!ignored.has(
|
| 872 |
+
word
|
| 873 |
+
)
|
| 874 |
+
);
|
| 875 |
+
}
|
| 876 |
+
);
|
| 877 |
|
| 878 |
+
if (
|
| 879 |
+
!words.length
|
| 880 |
+
) {
|
| 881 |
return 0;
|
| 882 |
}
|
| 883 |
|
| 884 |
+
let score =
|
| 885 |
+
0;
|
| 886 |
|
| 887 |
+
let titleMatches =
|
| 888 |
+
0;
|
| 889 |
+
|
| 890 |
+
if (
|
| 891 |
+
title.includes(
|
| 892 |
+
search
|
| 893 |
+
)
|
| 894 |
+
) {
|
| 895 |
+
score +=
|
| 896 |
+
180;
|
| 897 |
}
|
| 898 |
|
| 899 |
+
for (
|
| 900 |
+
const word
|
| 901 |
+
of words
|
| 902 |
+
) {
|
| 903 |
+
if (
|
| 904 |
+
title.includes(
|
| 905 |
+
word
|
| 906 |
+
)
|
| 907 |
+
) {
|
| 908 |
+
titleMatches +=
|
| 909 |
+
1;
|
| 910 |
|
| 911 |
+
score +=
|
| 912 |
+
55;
|
|
|
|
| 913 |
}
|
| 914 |
|
| 915 |
+
if (
|
| 916 |
+
description.includes(
|
| 917 |
+
word
|
| 918 |
+
)
|
| 919 |
+
) {
|
| 920 |
+
score +=
|
| 921 |
+
3;
|
| 922 |
}
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
if (
|
| 926 |
+
words.length === 1 &&
|
| 927 |
+
titleMatches === 0
|
| 928 |
+
) {
|
| 929 |
+
return 0;
|
| 930 |
+
}
|
| 931 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 932 |
if (
|
| 933 |
words.length === 2 &&
|
| 934 |
titleMatches < 2
|
|
|
|
| 936 |
return 0;
|
| 937 |
}
|
| 938 |
|
| 939 |
+
if (
|
| 940 |
+
words.length >= 3
|
| 941 |
+
) {
|
| 942 |
const requiredMatches =
|
| 943 |
Math.ceil(
|
| 944 |
+
words.length *
|
| 945 |
+
0.6
|
| 946 |
);
|
| 947 |
|
| 948 |
+
if (
|
| 949 |
+
titleMatches <
|
| 950 |
+
requiredMatches
|
| 951 |
+
) {
|
| 952 |
return 0;
|
| 953 |
}
|
| 954 |
}
|
| 955 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 956 |
return score;
|
| 957 |
}
|
| 958 |
|
| 959 |
+
function locationMatches(
|
| 960 |
+
job,
|
| 961 |
+
requestedLocation
|
| 962 |
+
) {
|
| 963 |
+
const requested =
|
| 964 |
+
normalizeLocation(
|
| 965 |
+
requestedLocation
|
| 966 |
+
);
|
| 967 |
|
| 968 |
+
const actual =
|
| 969 |
+
normalizeLocation(
|
| 970 |
+
job.location ||
|
| 971 |
+
""
|
| 972 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 973 |
|
| 974 |
+
if (
|
| 975 |
+
isRemoteQuery(
|
| 976 |
+
requestedLocation
|
| 977 |
+
)
|
| 978 |
+
) {
|
| 979 |
+
return Boolean(
|
| 980 |
+
job.remote
|
| 981 |
+
);
|
| 982 |
}
|
| 983 |
|
| 984 |
+
if (
|
| 985 |
+
isBroadUS(
|
| 986 |
+
requestedLocation
|
| 987 |
+
)
|
| 988 |
+
) {
|
| 989 |
+
return looksLikeUSJobLocation(
|
| 990 |
+
job.location
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 991 |
);
|
| 992 |
}
|
| 993 |
|
| 994 |
+
if (
|
| 995 |
+
isBroadEurope(
|
| 996 |
+
requestedLocation
|
| 997 |
+
)
|
| 998 |
+
) {
|
| 999 |
+
return looksLikeEuropeLocation(
|
| 1000 |
+
job.location
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1001 |
);
|
| 1002 |
}
|
| 1003 |
|
| 1004 |
+
const stateCode =
|
| 1005 |
+
detectUSStateCode(
|
| 1006 |
+
requestedLocation
|
| 1007 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1008 |
|
| 1009 |
+
const city =
|
| 1010 |
+
extractRequestedCity(
|
| 1011 |
+
requestedLocation
|
| 1012 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1013 |
|
| 1014 |
+
if (
|
| 1015 |
+
stateCode
|
| 1016 |
+
) {
|
| 1017 |
const stateName =
|
| 1018 |
+
STATE_NAMES_BY_CODE[
|
| 1019 |
+
stateCode
|
| 1020 |
+
] ||
|
| 1021 |
+
"";
|
| 1022 |
|
| 1023 |
+
const stateMatches =
|
| 1024 |
+
locationContainsState(
|
| 1025 |
+
job.location,
|
| 1026 |
+
stateCode
|
| 1027 |
+
) ||
|
| 1028 |
actual.includes(
|
| 1029 |
+
normalizeLocation(
|
| 1030 |
stateName
|
| 1031 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1032 |
);
|
| 1033 |
|
| 1034 |
+
if (
|
| 1035 |
+
!stateMatches
|
| 1036 |
+
) {
|
| 1037 |
+
return false;
|
| 1038 |
+
}
|
| 1039 |
|
| 1040 |
+
if (
|
| 1041 |
+
city
|
| 1042 |
+
) {
|
| 1043 |
+
return actual.includes(
|
| 1044 |
+
normalizeLocation(
|
| 1045 |
+
city
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1046 |
)
|
| 1047 |
);
|
| 1048 |
}
|
| 1049 |
|
| 1050 |
+
return true;
|
| 1051 |
}
|
| 1052 |
|
| 1053 |
+
if (
|
| 1054 |
+
!requested ||
|
| 1055 |
+
!actual
|
| 1056 |
+
) {
|
|
|
|
|
|
|
|
|
|
| 1057 |
return false;
|
| 1058 |
}
|
| 1059 |
|
| 1060 |
+
if (
|
| 1061 |
+
actual.includes(
|
| 1062 |
+
requested
|
| 1063 |
+
)
|
| 1064 |
+
) {
|
| 1065 |
return true;
|
| 1066 |
}
|
| 1067 |
|
| 1068 |
+
const tokens =
|
| 1069 |
+
getLocationTokens(
|
| 1070 |
+
requested
|
| 1071 |
+
);
|
|
|
|
|
|
|
| 1072 |
|
| 1073 |
+
return (
|
| 1074 |
+
tokens.length > 0 &&
|
| 1075 |
+
tokens.every(
|
| 1076 |
+
function (token) {
|
| 1077 |
+
return actual.includes(
|
| 1078 |
+
token
|
| 1079 |
+
);
|
| 1080 |
+
}
|
| 1081 |
+
)
|
| 1082 |
+
);
|
| 1083 |
}
|
| 1084 |
|
| 1085 |
+
function calculateLocationScore(
|
| 1086 |
+
job,
|
| 1087 |
+
requestedLocation
|
| 1088 |
+
) {
|
| 1089 |
+
if (
|
| 1090 |
+
!locationMatches(
|
| 1091 |
+
job,
|
| 1092 |
+
requestedLocation
|
| 1093 |
+
)
|
| 1094 |
+
) {
|
| 1095 |
return 0;
|
| 1096 |
}
|
| 1097 |
|
| 1098 |
const requested =
|
| 1099 |
+
normalizeLocation(
|
| 1100 |
requestedLocation
|
| 1101 |
);
|
| 1102 |
|
| 1103 |
const actual =
|
| 1104 |
+
normalizeLocation(
|
| 1105 |
+
job.location ||
|
| 1106 |
+
""
|
| 1107 |
);
|
| 1108 |
|
| 1109 |
+
if (
|
| 1110 |
+
actual ===
|
| 1111 |
+
requested
|
| 1112 |
+
) {
|
| 1113 |
return 300;
|
| 1114 |
}
|
| 1115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1116 |
if (
|
| 1117 |
+
requested &&
|
| 1118 |
+
actual.includes(
|
| 1119 |
+
requested
|
|
|
|
| 1120 |
)
|
| 1121 |
) {
|
| 1122 |
+
return 250;
|
| 1123 |
}
|
| 1124 |
|
| 1125 |
+
if (
|
| 1126 |
+
job.remote
|
| 1127 |
+
) {
|
| 1128 |
+
return 180;
|
| 1129 |
}
|
| 1130 |
|
| 1131 |
+
return 200;
|
| 1132 |
}
|
| 1133 |
|
| 1134 |
+
function renderJobs(
|
| 1135 |
+
keyword,
|
| 1136 |
+
location
|
| 1137 |
+
) {
|
| 1138 |
+
if (
|
| 1139 |
+
!currentMatches.length
|
| 1140 |
+
) {
|
|
|
|
|
|
|
| 1141 |
resultsBox.innerHTML = `
|
| 1142 |
<div class="empty-state">
|
| 1143 |
+
|
| 1144 |
<div>
|
| 1145 |
+
|
| 1146 |
No matching
|
| 1147 |
+
|
| 1148 |
+
<strong>
|
| 1149 |
+
${escapeHTML(keyword)}
|
| 1150 |
+
</strong>
|
| 1151 |
+
|
| 1152 |
jobs were found for
|
| 1153 |
+
|
| 1154 |
+
<strong>
|
| 1155 |
+
${escapeHTML(location)}
|
| 1156 |
+
</strong>.
|
| 1157 |
+
|
| 1158 |
<br><br>
|
| 1159 |
+
|
| 1160 |
+
JobAlign will not substitute
|
| 1161 |
+
jobs from an unrelated location.
|
| 1162 |
+
|
| 1163 |
</div>
|
| 1164 |
+
|
| 1165 |
</div>
|
| 1166 |
`;
|
| 1167 |
|
|
|
|
| 1170 |
|
| 1171 |
const cards =
|
| 1172 |
currentMatches
|
| 1173 |
+
.map(
|
| 1174 |
+
function (
|
| 1175 |
job,
|
| 1176 |
index
|
| 1177 |
+
) {
|
| 1178 |
+
return createJobCard(
|
| 1179 |
+
job,
|
| 1180 |
+
index
|
| 1181 |
+
);
|
| 1182 |
+
}
|
| 1183 |
+
)
|
| 1184 |
.join("");
|
| 1185 |
|
| 1186 |
resultsBox.innerHTML = `
|
| 1187 |
<div style="margin-bottom:18px;">
|
| 1188 |
+
|
| 1189 |
<strong style="font-size:18px;">
|
| 1190 |
+
${currentMatches.length}
|
| 1191 |
+
matching jobs
|
| 1192 |
</strong>
|
| 1193 |
|
| 1194 |
<div style="
|
|
|
|
| 1200 |
·
|
| 1201 |
${escapeHTML(location)}
|
| 1202 |
</div>
|
| 1203 |
+
|
| 1204 |
</div>
|
| 1205 |
|
| 1206 |
<div style="
|
|
|
|
| 1212 |
`;
|
| 1213 |
|
| 1214 |
resultsBox
|
| 1215 |
+
.querySelectorAll(
|
| 1216 |
+
".select-job-btn"
|
| 1217 |
+
)
|
| 1218 |
+
.forEach(
|
| 1219 |
+
function (button) {
|
| 1220 |
+
button.addEventListener(
|
| 1221 |
+
"click",
|
| 1222 |
+
function () {
|
| 1223 |
+
const index =
|
| 1224 |
+
Number(
|
| 1225 |
+
button.dataset.index
|
| 1226 |
+
);
|
| 1227 |
+
|
| 1228 |
+
fillSelectedJob(
|
| 1229 |
+
currentMatches[
|
| 1230 |
+
index
|
| 1231 |
+
]
|
| 1232 |
);
|
| 1233 |
+
}
|
| 1234 |
+
);
|
| 1235 |
+
}
|
| 1236 |
+
);
|
|
|
|
|
|
|
|
|
|
| 1237 |
}
|
| 1238 |
|
| 1239 |
+
function createJobCard(
|
| 1240 |
+
job,
|
| 1241 |
+
index
|
| 1242 |
+
) {
|
| 1243 |
const description =
|
| 1244 |
stripHTML(
|
| 1245 |
+
job.description ||
|
| 1246 |
+
""
|
| 1247 |
);
|
| 1248 |
|
| 1249 |
const excerpt =
|
| 1250 |
description.length > 300
|
| 1251 |
+
? description.slice(
|
| 1252 |
0,
|
| 1253 |
300
|
| 1254 |
+
) +
|
| 1255 |
+
"..."
|
| 1256 |
: description;
|
| 1257 |
|
| 1258 |
const tags =
|
| 1259 |
+
Array.isArray(
|
| 1260 |
+
job.tags
|
| 1261 |
+
)
|
| 1262 |
+
? job.tags.slice(
|
| 1263 |
+
0,
|
| 1264 |
+
5
|
| 1265 |
+
)
|
| 1266 |
: [];
|
| 1267 |
|
| 1268 |
const tagHTML =
|
| 1269 |
tags
|
| 1270 |
+
.map(
|
| 1271 |
+
function (tag) {
|
| 1272 |
+
return `
|
| 1273 |
+
<span style="
|
| 1274 |
+
border:1px solid #292929;
|
| 1275 |
+
border-radius:999px;
|
| 1276 |
+
padding:5px 9px;
|
| 1277 |
+
font-size:11px;
|
| 1278 |
+
color:#aaa;
|
| 1279 |
+
">
|
| 1280 |
+
${escapeHTML(tag)}
|
| 1281 |
+
</span>
|
| 1282 |
+
`;
|
| 1283 |
+
}
|
| 1284 |
+
)
|
| 1285 |
.join("");
|
| 1286 |
|
| 1287 |
return `
|
|
|
|
| 1323 |
font-size:18px;
|
| 1324 |
margin-bottom:8px;
|
| 1325 |
">
|
| 1326 |
+
${escapeHTML(
|
| 1327 |
+
job.title ||
|
| 1328 |
+
"Untitled role"
|
| 1329 |
+
)}
|
| 1330 |
</strong>
|
| 1331 |
|
| 1332 |
<div style="
|
|
|
|
| 1373 |
margin-top:13px;
|
| 1374 |
">
|
| 1375 |
Source:
|
| 1376 |
+
${escapeHTML(
|
| 1377 |
+
job.source ||
|
| 1378 |
+
"Public feed"
|
| 1379 |
+
)}
|
| 1380 |
</div>
|
| 1381 |
|
| 1382 |
</div>
|
|
|
|
| 1390 |
</button>
|
| 1391 |
|
| 1392 |
</div>
|
| 1393 |
+
|
| 1394 |
</div>
|
| 1395 |
`;
|
| 1396 |
}
|
| 1397 |
|
| 1398 |
+
function fillSelectedJob(
|
| 1399 |
+
job
|
| 1400 |
+
) {
|
| 1401 |
+
if (
|
| 1402 |
+
!job
|
| 1403 |
+
) {
|
| 1404 |
+
alert(
|
| 1405 |
+
"Unable to load this job."
|
| 1406 |
+
);
|
| 1407 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1408 |
return;
|
| 1409 |
}
|
| 1410 |
|
|
|
|
|
|
|
| 1411 |
selectedJobTitle.value =
|
| 1412 |
+
job.title ||
|
| 1413 |
+
"";
|
| 1414 |
|
| 1415 |
selectedCompany.value =
|
| 1416 |
+
job.company_name ||
|
| 1417 |
+
"";
|
| 1418 |
|
| 1419 |
selectedLocation.value =
|
| 1420 |
job.location ||
|
|
|
|
| 1426 |
|
| 1427 |
jobDescription.value =
|
| 1428 |
stripHTML(
|
| 1429 |
+
job.description ||
|
| 1430 |
+
""
|
| 1431 |
);
|
| 1432 |
|
| 1433 |
jobUrlInput.value =
|
| 1434 |
+
job.url ||
|
| 1435 |
+
"";
|
| 1436 |
|
| 1437 |
resetAnalysis();
|
| 1438 |
|
| 1439 |
generationStatus.innerHTML = `
|
| 1440 |
<div class="status-dot"></div>
|
| 1441 |
+
|
| 1442 |
<span class="success-text">
|
| 1443 |
+
|
| 1444 |
Selected:
|
| 1445 |
+
|
| 1446 |
+
${escapeHTML(
|
| 1447 |
+
job.title ||
|
| 1448 |
+
""
|
| 1449 |
+
)}
|
| 1450 |
+
|
| 1451 |
at
|
| 1452 |
+
|
| 1453 |
+
${escapeHTML(
|
| 1454 |
+
job.company_name ||
|
| 1455 |
+
""
|
| 1456 |
+
)}
|
| 1457 |
+
|
| 1458 |
</span>
|
| 1459 |
`;
|
| 1460 |
|
| 1461 |
analysisResults.innerHTML = `
|
| 1462 |
<div class="empty-state">
|
| 1463 |
+
|
| 1464 |
<div>
|
| 1465 |
+
|
| 1466 |
Job loaded successfully.
|
| 1467 |
+
|
| 1468 |
<br><br>
|
| 1469 |
+
|
| 1470 |
+
Add your master resume
|
| 1471 |
+
and click
|
| 1472 |
+
|
| 1473 |
<strong>
|
| 1474 |
Analyze Selected Job
|
| 1475 |
</strong>.
|
| 1476 |
+
|
| 1477 |
</div>
|
| 1478 |
+
|
| 1479 |
</div>
|
| 1480 |
`;
|
| 1481 |
|
| 1482 |
selectedJobCard.scrollIntoView({
|
| 1483 |
+
behavior:
|
| 1484 |
+
"smooth",
|
| 1485 |
+
|
| 1486 |
+
block:
|
| 1487 |
+
"start"
|
| 1488 |
});
|
| 1489 |
}
|
| 1490 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1491 |
openOriginalJobBtn.addEventListener(
|
| 1492 |
"click",
|
| 1493 |
function () {
|
|
|
|
| 1494 |
const url =
|
| 1495 |
jobUrlInput.value.trim();
|
| 1496 |
|
| 1497 |
+
if (
|
| 1498 |
+
!url
|
| 1499 |
+
) {
|
| 1500 |
+
alert(
|
| 1501 |
+
"Select a job first."
|
| 1502 |
+
);
|
| 1503 |
+
|
| 1504 |
+
return;
|
| 1505 |
+
}
|
| 1506 |
+
|
| 1507 |
+
window.open(
|
| 1508 |
url,
|
| 1509 |
"_blank",
|
| 1510 |
"noopener,noreferrer"
|
|
|
|
| 1512 |
}
|
| 1513 |
);
|
| 1514 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1515 |
resumeFile.addEventListener(
|
| 1516 |
"change",
|
| 1517 |
async function () {
|
|
|
|
| 1518 |
const file =
|
| 1519 |
resumeFile.files[0];
|
| 1520 |
|
| 1521 |
+
if (
|
| 1522 |
+
!file
|
| 1523 |
+
) {
|
| 1524 |
return;
|
| 1525 |
}
|
| 1526 |
|
|
|
|
| 1530 |
.pop()
|
| 1531 |
.toLowerCase();
|
| 1532 |
|
| 1533 |
+
setResumeStatus(
|
| 1534 |
+
"Reading " +
|
| 1535 |
+
file.name +
|
| 1536 |
+
"...",
|
| 1537 |
+
"normal"
|
| 1538 |
+
);
|
|
|
|
| 1539 |
|
| 1540 |
try {
|
| 1541 |
+
if (
|
| 1542 |
+
extension ===
|
| 1543 |
+
"txt"
|
| 1544 |
+
) {
|
| 1545 |
const content =
|
| 1546 |
await file.text();
|
| 1547 |
|
|
|
|
| 1553 |
return;
|
| 1554 |
}
|
| 1555 |
|
| 1556 |
+
if (
|
| 1557 |
+
extension ===
|
| 1558 |
+
"docx"
|
| 1559 |
+
) {
|
| 1560 |
if (
|
| 1561 |
typeof mammoth ===
|
| 1562 |
"undefined"
|
|
|
|
| 1571 |
|
| 1572 |
const result =
|
| 1573 |
await mammoth.extractRawText({
|
| 1574 |
+
arrayBuffer:
|
| 1575 |
+
arrayBuffer
|
| 1576 |
});
|
| 1577 |
|
| 1578 |
const content =
|
| 1579 |
result.value.trim();
|
| 1580 |
|
| 1581 |
+
if (
|
| 1582 |
+
content.length <
|
| 1583 |
+
100
|
| 1584 |
+
) {
|
| 1585 |
throw new Error(
|
| 1586 |
"Very little resume text was found in this DOCX."
|
| 1587 |
);
|
|
|
|
| 1595 |
return;
|
| 1596 |
}
|
| 1597 |
|
| 1598 |
+
if (
|
| 1599 |
+
extension ===
|
| 1600 |
+
"pdf"
|
| 1601 |
+
) {
|
| 1602 |
throw new Error(
|
| 1603 |
"PDF reading is not enabled yet. Upload DOCX or TXT."
|
| 1604 |
);
|
|
|
|
| 1609 |
);
|
| 1610 |
|
| 1611 |
} catch (error) {
|
| 1612 |
+
console.error(
|
| 1613 |
+
error
|
| 1614 |
+
);
|
| 1615 |
|
| 1616 |
+
setResumeStatus(
|
| 1617 |
+
"Could not read resume: " +
|
| 1618 |
+
error.message,
|
| 1619 |
+
"error"
|
| 1620 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1621 |
}
|
| 1622 |
}
|
| 1623 |
);
|
| 1624 |
|
|
|
|
| 1625 |
function saveExtractedResume(
|
| 1626 |
content,
|
| 1627 |
fileName
|
| 1628 |
) {
|
|
|
|
| 1629 |
const clean =
|
| 1630 |
+
String(
|
| 1631 |
+
content ||
|
| 1632 |
+
""
|
| 1633 |
+
)
|
| 1634 |
+
.replace(
|
| 1635 |
+
/\r/g,
|
| 1636 |
+
""
|
| 1637 |
+
)
|
| 1638 |
+
.replace(
|
| 1639 |
+
/\n{3,}/g,
|
| 1640 |
+
"\n\n"
|
| 1641 |
+
)
|
| 1642 |
.trim();
|
| 1643 |
|
| 1644 |
+
resumeText.value =
|
| 1645 |
+
clean;
|
| 1646 |
|
| 1647 |
localStorage.setItem(
|
| 1648 |
"jobalign_master_resume",
|
|
|
|
| 1654 |
fileName
|
| 1655 |
);
|
| 1656 |
|
| 1657 |
+
setResumeStatus(
|
| 1658 |
+
fileName +
|
| 1659 |
+
" loaded and saved successfully",
|
| 1660 |
+
"success"
|
| 1661 |
+
);
|
|
|
|
|
|
|
| 1662 |
}
|
| 1663 |
|
|
|
|
| 1664 |
saveResumeBtn.addEventListener(
|
| 1665 |
"click",
|
| 1666 |
function () {
|
|
|
|
| 1667 |
const resume =
|
| 1668 |
resumeText.value.trim();
|
| 1669 |
|
| 1670 |
+
if (
|
| 1671 |
+
resume.length <
|
| 1672 |
+
100
|
| 1673 |
+
) {
|
| 1674 |
alert(
|
| 1675 |
"Paste your complete master resume first."
|
| 1676 |
);
|
| 1677 |
+
|
| 1678 |
return;
|
| 1679 |
}
|
| 1680 |
|
|
|
|
| 1683 |
resume
|
| 1684 |
);
|
| 1685 |
|
| 1686 |
+
setResumeStatus(
|
| 1687 |
+
"Master resume saved in this browser",
|
| 1688 |
+
"success"
|
| 1689 |
+
);
|
|
|
|
|
|
|
| 1690 |
}
|
| 1691 |
);
|
| 1692 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1693 |
const skills = [
|
| 1694 |
"python",
|
| 1695 |
"sql",
|
|
|
|
| 1726 |
"ansible",
|
| 1727 |
"docker",
|
| 1728 |
"kubernetes",
|
|
|
|
| 1729 |
"linux",
|
| 1730 |
"bash",
|
| 1731 |
|
|
|
|
| 1740 |
"kinesis",
|
| 1741 |
"rabbitmq",
|
| 1742 |
"sqs",
|
|
|
|
| 1743 |
"etl",
|
| 1744 |
"elt",
|
| 1745 |
"cdc",
|
|
|
|
| 1750 |
"rest api",
|
| 1751 |
"microservices",
|
| 1752 |
"distributed systems",
|
|
|
|
| 1753 |
"grafana",
|
| 1754 |
"prometheus",
|
| 1755 |
"opentelemetry",
|
|
|
|
| 1759 |
"tensorflow",
|
| 1760 |
"scikit-learn",
|
| 1761 |
"mlflow",
|
|
|
|
| 1762 |
"generative ai",
|
| 1763 |
"genai",
|
| 1764 |
"llm",
|
|
|
|
| 1766 |
|
| 1767 |
"power bi",
|
| 1768 |
"tableau",
|
|
|
|
| 1769 |
"jira",
|
| 1770 |
"confluence",
|
|
|
|
| 1771 |
"roadmap",
|
| 1772 |
"product management",
|
| 1773 |
"stakeholder management",
|
| 1774 |
+
|
| 1775 |
"backlog",
|
| 1776 |
"program management",
|
| 1777 |
"technical program management",
|
|
|
|
| 1778 |
"agile",
|
| 1779 |
"scrum",
|
| 1780 |
|
|
|
|
| 1786 |
"indexing"
|
| 1787 |
];
|
| 1788 |
|
|
|
|
| 1789 |
analyzeJobBtn.addEventListener(
|
| 1790 |
"click",
|
| 1791 |
+
function () {
|
| 1792 |
+
const jd =
|
| 1793 |
+
jobDescription.value.toLowerCase();
|
| 1794 |
|
| 1795 |
+
const resume =
|
| 1796 |
+
resumeText.value.toLowerCase();
|
| 1797 |
|
| 1798 |
+
if (
|
| 1799 |
+
jd.length <
|
| 1800 |
+
100
|
| 1801 |
+
) {
|
| 1802 |
+
alert(
|
| 1803 |
+
"Search and select a job first."
|
| 1804 |
+
);
|
| 1805 |
|
| 1806 |
+
return;
|
| 1807 |
+
}
|
| 1808 |
|
| 1809 |
+
if (
|
| 1810 |
+
resume.length <
|
| 1811 |
+
100
|
| 1812 |
+
) {
|
| 1813 |
+
alert(
|
| 1814 |
+
"Add your master resume first."
|
| 1815 |
+
);
|
| 1816 |
|
| 1817 |
+
return;
|
| 1818 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1819 |
|
| 1820 |
+
const required =
|
| 1821 |
+
skills.filter(
|
| 1822 |
+
function (skill) {
|
| 1823 |
+
return jd.includes(
|
| 1824 |
+
skill
|
| 1825 |
+
);
|
| 1826 |
+
}
|
| 1827 |
+
);
|
| 1828 |
|
| 1829 |
+
const matched =
|
| 1830 |
+
required.filter(
|
| 1831 |
+
function (skill) {
|
| 1832 |
+
return resume.includes(
|
| 1833 |
+
skill
|
| 1834 |
+
);
|
| 1835 |
+
}
|
| 1836 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1837 |
|
| 1838 |
+
const gaps =
|
| 1839 |
+
required.filter(
|
| 1840 |
+
function (skill) {
|
| 1841 |
+
return !resume.includes(
|
| 1842 |
+
skill
|
| 1843 |
+
);
|
| 1844 |
+
}
|
| 1845 |
+
);
|
| 1846 |
|
| 1847 |
+
const coverage =
|
| 1848 |
+
required.length
|
| 1849 |
+
? Math.round(
|
| 1850 |
+
(
|
| 1851 |
+
matched.length /
|
| 1852 |
+
required.length
|
| 1853 |
+
) *
|
| 1854 |
+
100
|
| 1855 |
+
)
|
| 1856 |
+
: 50;
|
| 1857 |
+
|
| 1858 |
+
const calculatedAts =
|
| 1859 |
+
Math.min(
|
| 1860 |
+
97,
|
| 1861 |
+
Math.max(
|
| 1862 |
+
25,
|
| 1863 |
+
coverage
|
| 1864 |
+
)
|
| 1865 |
+
);
|
| 1866 |
|
| 1867 |
+
atsScore.textContent =
|
| 1868 |
+
calculatedAts +
|
| 1869 |
+
"%";
|
| 1870 |
|
| 1871 |
+
keywordScore.textContent =
|
| 1872 |
+
coverage +
|
| 1873 |
+
"%";
|
| 1874 |
|
| 1875 |
+
matchedSkills.textContent =
|
| 1876 |
+
matched.length;
|
|
|
|
|
|
|
|
|
|
| 1877 |
|
| 1878 |
+
missingSkills.textContent =
|
| 1879 |
+
gaps.length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1880 |
|
| 1881 |
+
analysisResults.innerHTML = `
|
| 1882 |
+
<div>
|
|
|
|
|
|
|
| 1883 |
|
| 1884 |
+
<strong>
|
| 1885 |
+
Matching experience
|
| 1886 |
+
</strong>
|
| 1887 |
+
|
| 1888 |
+
<p style="
|
| 1889 |
+
color:#aaa;
|
| 1890 |
+
margin-top:8px;
|
| 1891 |
+
line-height:1.7;
|
| 1892 |
+
">
|
| 1893 |
+
${
|
| 1894 |
+
matched.length
|
| 1895 |
+
? escapeHTML(
|
| 1896 |
+
matched.join(
|
| 1897 |
+
", "
|
| 1898 |
+
)
|
| 1899 |
+
)
|
| 1900 |
+
: "No major keyword matches detected."
|
| 1901 |
+
}
|
| 1902 |
+
</p>
|
| 1903 |
+
|
| 1904 |
+
</div>
|
| 1905 |
+
|
| 1906 |
+
<div style="margin-top:20px;">
|
| 1907 |
|
| 1908 |
+
<strong>
|
| 1909 |
+
Job priorities not currently visible
|
| 1910 |
+
</strong>
|
| 1911 |
|
| 1912 |
+
<p style="
|
| 1913 |
+
color:#aaa;
|
| 1914 |
+
margin-top:8px;
|
| 1915 |
+
line-height:1.7;
|
| 1916 |
+
">
|
| 1917 |
+
${
|
| 1918 |
+
gaps.length
|
| 1919 |
+
? escapeHTML(
|
| 1920 |
+
gaps.join(
|
| 1921 |
+
", "
|
| 1922 |
+
)
|
| 1923 |
+
)
|
| 1924 |
+
: "No obvious technical keyword gaps detected."
|
| 1925 |
+
}
|
| 1926 |
+
</p>
|
| 1927 |
+
|
| 1928 |
+
</div>
|
| 1929 |
+
`;
|
| 1930 |
+
}
|
| 1931 |
+
);
|
| 1932 |
|
| 1933 |
generateResumeBtn.addEventListener(
|
| 1934 |
"click",
|
| 1935 |
async function () {
|
|
|
|
| 1936 |
const jd =
|
| 1937 |
jobDescription.value.trim();
|
| 1938 |
|
|
|
|
| 1948 |
const location =
|
| 1949 |
selectedLocation.value.trim();
|
| 1950 |
|
| 1951 |
+
if (
|
| 1952 |
+
jd.length <
|
| 1953 |
+
100
|
| 1954 |
+
) {
|
| 1955 |
alert(
|
| 1956 |
"Search for and select a job first."
|
| 1957 |
);
|
| 1958 |
+
|
| 1959 |
return;
|
| 1960 |
}
|
| 1961 |
|
| 1962 |
+
if (
|
| 1963 |
+
resume.length <
|
| 1964 |
+
100
|
| 1965 |
+
) {
|
| 1966 |
alert(
|
| 1967 |
"Add your master resume first."
|
| 1968 |
);
|
| 1969 |
+
|
| 1970 |
return;
|
| 1971 |
}
|
| 1972 |
|
| 1973 |
+
generateResumeBtn.disabled =
|
| 1974 |
+
true;
|
| 1975 |
+
|
| 1976 |
generateResumeBtn.textContent =
|
| 1977 |
"Generating Resume...";
|
| 1978 |
|
|
|
|
| 1983 |
${jobTitle}
|
| 1984 |
|
| 1985 |
Company:
|
| 1986 |
+
${company}`;
|
|
|
|
|
|
|
| 1987 |
|
| 1988 |
try {
|
| 1989 |
+
let attempts =
|
| 1990 |
+
0;
|
| 1991 |
|
| 1992 |
while (
|
| 1993 |
!window.JobAlignAI &&
|
| 1994 |
+
attempts <
|
| 1995 |
+
150
|
| 1996 |
) {
|
|
|
|
| 1997 |
await new Promise(
|
| 1998 |
function (resolve) {
|
| 1999 |
setTimeout(
|
|
|
|
| 2003 |
}
|
| 2004 |
);
|
| 2005 |
|
| 2006 |
+
attempts +=
|
| 2007 |
+
1;
|
| 2008 |
}
|
| 2009 |
|
| 2010 |
+
if (
|
| 2011 |
+
!window.JobAlignAI
|
| 2012 |
+
) {
|
| 2013 |
throw new Error(
|
| 2014 |
"The local AI engine did not load. Refresh the page and try again."
|
| 2015 |
);
|
|
|
|
| 2018 |
const rewrittenResume =
|
| 2019 |
await window.JobAlignAI
|
| 2020 |
.generateResume({
|
| 2021 |
+
resume:
|
| 2022 |
+
resume,
|
| 2023 |
+
|
| 2024 |
+
jobDescription:
|
| 2025 |
+
jd,
|
| 2026 |
+
|
| 2027 |
+
jobTitle:
|
| 2028 |
+
jobTitle,
|
| 2029 |
+
|
| 2030 |
+
company:
|
| 2031 |
+
company,
|
| 2032 |
+
|
| 2033 |
+
location:
|
| 2034 |
+
location
|
| 2035 |
});
|
| 2036 |
|
| 2037 |
resumeOutput.textContent =
|
|
|
|
| 2044 |
|
| 2045 |
generationStatus.innerHTML = `
|
| 2046 |
<div class="status-dot"></div>
|
| 2047 |
+
|
| 2048 |
<span class="success-text">
|
| 2049 |
+
|
| 2050 |
Resume generated for
|
| 2051 |
+
|
| 2052 |
+
${escapeHTML(
|
| 2053 |
+
jobTitle
|
| 2054 |
+
)}
|
| 2055 |
+
|
| 2056 |
at
|
| 2057 |
+
|
| 2058 |
+
${escapeHTML(
|
| 2059 |
+
company
|
| 2060 |
+
)}
|
| 2061 |
+
|
| 2062 |
</span>
|
| 2063 |
`;
|
| 2064 |
|
| 2065 |
interviewCheck.innerHTML = `
|
| 2066 |
<div>
|
| 2067 |
+
|
| 2068 |
<strong>
|
| 2069 |
Targeted resume generated.
|
| 2070 |
</strong>
|
|
|
|
| 2077 |
Review every technical claim
|
| 2078 |
before submitting.
|
| 2079 |
</p>
|
| 2080 |
+
|
| 2081 |
</div>
|
| 2082 |
`;
|
| 2083 |
|
| 2084 |
} catch (error) {
|
|
|
|
| 2085 |
console.error(
|
| 2086 |
"JobAlign generation error:",
|
| 2087 |
error
|
|
|
|
| 2089 |
|
| 2090 |
generationStatus.innerHTML = `
|
| 2091 |
<div class="status-dot"></div>
|
| 2092 |
+
|
| 2093 |
<span class="danger-text">
|
| 2094 |
+
|
| 2095 |
Resume generation failed:
|
| 2096 |
+
|
| 2097 |
+
${escapeHTML(
|
| 2098 |
+
error.message
|
| 2099 |
+
)}
|
| 2100 |
+
|
| 2101 |
</span>
|
| 2102 |
`;
|
| 2103 |
|
|
|
|
| 2108 |
${error.message}`;
|
| 2109 |
|
| 2110 |
} finally {
|
|
|
|
| 2111 |
generateResumeBtn.disabled =
|
| 2112 |
false;
|
| 2113 |
|
|
|
|
| 2117 |
}
|
| 2118 |
);
|
| 2119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2120 |
copyResumeBtn.addEventListener(
|
| 2121 |
"click",
|
| 2122 |
async function () {
|
|
|
|
| 2123 |
const text =
|
| 2124 |
resumeOutput.innerText.trim();
|
| 2125 |
|
|
|
|
| 2131 |
alert(
|
| 2132 |
"Generate a resume first."
|
| 2133 |
);
|
| 2134 |
+
|
| 2135 |
return;
|
| 2136 |
}
|
| 2137 |
|
| 2138 |
try {
|
|
|
|
| 2139 |
await navigator
|
| 2140 |
.clipboard
|
| 2141 |
+
.writeText(
|
| 2142 |
+
text
|
| 2143 |
+
);
|
| 2144 |
|
| 2145 |
copyResumeBtn.textContent =
|
| 2146 |
"Copied";
|
|
|
|
| 2154 |
);
|
| 2155 |
|
| 2156 |
} catch (error) {
|
|
|
|
| 2157 |
alert(
|
| 2158 |
"Your browser blocked clipboard access."
|
| 2159 |
);
|
|
|
|
| 2161 |
}
|
| 2162 |
);
|
| 2163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2164 |
downloadResumeBtn.addEventListener(
|
| 2165 |
"click",
|
| 2166 |
function () {
|
|
|
|
| 2167 |
const text =
|
| 2168 |
resumeOutput.innerText.trim();
|
| 2169 |
|
|
|
|
| 2175 |
alert(
|
| 2176 |
"Generate a resume first."
|
| 2177 |
);
|
| 2178 |
+
|
| 2179 |
return;
|
| 2180 |
}
|
| 2181 |
|
| 2182 |
const blob =
|
| 2183 |
new Blob(
|
| 2184 |
+
[
|
| 2185 |
+
text
|
| 2186 |
+
],
|
| 2187 |
{
|
| 2188 |
type:
|
| 2189 |
"text/plain;charset=utf-8"
|
| 2190 |
}
|
| 2191 |
);
|
| 2192 |
|
| 2193 |
+
const url =
|
| 2194 |
+
URL.createObjectURL(
|
| 2195 |
+
blob
|
| 2196 |
+
);
|
| 2197 |
|
| 2198 |
const link =
|
| 2199 |
+
document.createElement(
|
| 2200 |
+
"a"
|
| 2201 |
+
);
|
| 2202 |
|
| 2203 |
+
link.href =
|
| 2204 |
+
url;
|
| 2205 |
|
| 2206 |
link.download =
|
| 2207 |
safeFileName(
|
|
|
|
| 2218 |
link.click();
|
| 2219 |
|
| 2220 |
URL.revokeObjectURL(
|
| 2221 |
+
url
|
| 2222 |
);
|
| 2223 |
}
|
| 2224 |
);
|
| 2225 |
|
| 2226 |
+
function isRemoteQuery(
|
| 2227 |
+
location
|
| 2228 |
+
) {
|
| 2229 |
+
return normalizeSimple(
|
| 2230 |
+
location
|
| 2231 |
+
).includes(
|
| 2232 |
+
"remote"
|
| 2233 |
+
);
|
| 2234 |
+
}
|
| 2235 |
|
| 2236 |
+
function isBroadUS(
|
| 2237 |
+
location
|
| 2238 |
+
) {
|
| 2239 |
+
return [
|
| 2240 |
+
"us",
|
| 2241 |
+
"usa",
|
| 2242 |
+
"united states",
|
| 2243 |
+
"united states of america"
|
| 2244 |
+
].includes(
|
| 2245 |
+
normalizeSimple(
|
| 2246 |
+
location
|
| 2247 |
+
)
|
| 2248 |
+
);
|
|
|
|
| 2249 |
}
|
| 2250 |
|
| 2251 |
+
function isBroadEurope(
|
| 2252 |
+
location
|
| 2253 |
+
) {
|
| 2254 |
+
return (
|
| 2255 |
+
normalizeSimple(
|
| 2256 |
+
location
|
| 2257 |
+
) ===
|
| 2258 |
+
"europe"
|
| 2259 |
+
);
|
| 2260 |
+
}
|
| 2261 |
|
| 2262 |
+
function looksLikeEuropeLocation(
|
| 2263 |
+
location
|
| 2264 |
+
) {
|
| 2265 |
+
const value =
|
| 2266 |
+
normalizeSimple(
|
| 2267 |
+
location
|
| 2268 |
+
);
|
| 2269 |
|
| 2270 |
+
const terms = [
|
| 2271 |
+
"europe",
|
| 2272 |
+
"germany",
|
| 2273 |
+
"france",
|
| 2274 |
+
"netherlands",
|
| 2275 |
+
"sweden",
|
| 2276 |
+
"switzerland",
|
| 2277 |
+
"ireland",
|
| 2278 |
+
"spain",
|
| 2279 |
+
"italy",
|
| 2280 |
+
"portugal",
|
| 2281 |
+
"poland",
|
| 2282 |
+
"denmark",
|
| 2283 |
+
"norway",
|
| 2284 |
+
"finland",
|
| 2285 |
+
"austria",
|
| 2286 |
+
"belgium",
|
| 2287 |
+
"united kingdom",
|
| 2288 |
+
"uk"
|
| 2289 |
+
];
|
| 2290 |
|
| 2291 |
+
return terms.some(
|
| 2292 |
+
function (term) {
|
| 2293 |
+
return value.includes(
|
| 2294 |
+
term
|
|
|
|
|
|
|
| 2295 |
);
|
| 2296 |
+
}
|
| 2297 |
+
);
|
| 2298 |
}
|
| 2299 |
|
| 2300 |
+
function looksLikeUSJobLocation(
|
| 2301 |
+
location
|
| 2302 |
+
) {
|
| 2303 |
+
const stateCode =
|
| 2304 |
+
detectUSStateCode(
|
| 2305 |
+
location
|
| 2306 |
+
);
|
| 2307 |
|
| 2308 |
+
if (
|
| 2309 |
+
stateCode
|
| 2310 |
+
) {
|
| 2311 |
+
return true;
|
| 2312 |
+
}
|
| 2313 |
+
|
| 2314 |
+
const value =
|
| 2315 |
+
normalizeSimple(
|
| 2316 |
+
location
|
| 2317 |
+
);
|
| 2318 |
+
|
| 2319 |
+
return (
|
| 2320 |
+
value.includes(
|
| 2321 |
+
"united states"
|
| 2322 |
+
) ||
|
| 2323 |
+
value.includes(
|
| 2324 |
+
"usa"
|
| 2325 |
+
)
|
| 2326 |
+
);
|
| 2327 |
+
}
|
| 2328 |
|
| 2329 |
+
function detectUSStateCode(
|
| 2330 |
+
location
|
| 2331 |
+
) {
|
| 2332 |
const normalized =
|
| 2333 |
+
normalizeSimple(
|
| 2334 |
+
location
|
| 2335 |
+
);
|
| 2336 |
|
| 2337 |
for (
|
| 2338 |
+
const [
|
| 2339 |
+
name,
|
| 2340 |
+
code
|
| 2341 |
+
]
|
| 2342 |
+
of Object.entries(
|
| 2343 |
+
US_STATES
|
| 2344 |
+
)
|
| 2345 |
) {
|
| 2346 |
if (
|
| 2347 |
+
normalized ===
|
| 2348 |
+
name ||
|
| 2349 |
normalized.includes(
|
| 2350 |
+
name
|
| 2351 |
)
|
| 2352 |
) {
|
| 2353 |
return code;
|
|
|
|
| 2355 |
}
|
| 2356 |
|
| 2357 |
const upper =
|
| 2358 |
+
String(
|
| 2359 |
+
location ||
|
| 2360 |
+
""
|
| 2361 |
+
).toUpperCase();
|
| 2362 |
|
| 2363 |
+
for (
|
| 2364 |
+
const code
|
| 2365 |
+
of Object.values(
|
| 2366 |
+
US_STATES
|
| 2367 |
+
)
|
| 2368 |
+
) {
|
| 2369 |
const pattern =
|
| 2370 |
new RegExp(
|
| 2371 |
"(^|[,\\s])" +
|
|
|
|
| 2373 |
"($|[,\\s])"
|
| 2374 |
);
|
| 2375 |
|
| 2376 |
+
if (
|
| 2377 |
+
pattern.test(
|
| 2378 |
+
upper
|
| 2379 |
+
)
|
| 2380 |
+
) {
|
| 2381 |
return code;
|
| 2382 |
}
|
| 2383 |
}
|
|
|
|
| 2385 |
return "";
|
| 2386 |
}
|
| 2387 |
|
| 2388 |
+
function extractRequestedCity(
|
| 2389 |
+
location
|
| 2390 |
+
) {
|
| 2391 |
const code =
|
| 2392 |
+
detectUSStateCode(
|
| 2393 |
+
location
|
| 2394 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2395 |
|
| 2396 |
const stateName =
|
| 2397 |
+
code
|
| 2398 |
+
? STATE_NAMES_BY_CODE[
|
| 2399 |
+
code
|
| 2400 |
+
]
|
| 2401 |
+
: "";
|
| 2402 |
|
| 2403 |
let city =
|
| 2404 |
+
String(
|
| 2405 |
+
location ||
|
| 2406 |
+
""
|
| 2407 |
+
)
|
| 2408 |
.replace(
|
| 2409 |
new RegExp(
|
| 2410 |
"\\b" +
|
| 2411 |
escapeRegExp(
|
| 2412 |
+
code
|
| 2413 |
) +
|
| 2414 |
"\\b",
|
| 2415 |
"i"
|
|
|
|
| 2431 |
/united states|usa|u\.s\.a\.|u\.s\./gi,
|
| 2432 |
""
|
| 2433 |
)
|
| 2434 |
+
.replace(
|
| 2435 |
+
/,/g,
|
| 2436 |
+
" "
|
| 2437 |
+
)
|
| 2438 |
+
.replace(
|
| 2439 |
+
/\s+/g,
|
| 2440 |
+
" "
|
| 2441 |
+
)
|
| 2442 |
.trim();
|
| 2443 |
|
| 2444 |
if (
|
| 2445 |
+
!city ||
|
| 2446 |
+
normalizeSimple(
|
| 2447 |
+
city
|
| 2448 |
+
) ===
|
| 2449 |
+
normalizeSimple(
|
| 2450 |
+
stateName
|
| 2451 |
+
)
|
| 2452 |
) {
|
| 2453 |
return "";
|
| 2454 |
}
|
|
|
|
| 2456 |
return city;
|
| 2457 |
}
|
| 2458 |
|
|
|
|
| 2459 |
function locationContainsState(
|
| 2460 |
location,
|
| 2461 |
+
code
|
| 2462 |
) {
|
|
|
|
| 2463 |
const upper =
|
| 2464 |
+
String(
|
| 2465 |
+
location ||
|
| 2466 |
+
""
|
| 2467 |
+
).toUpperCase();
|
| 2468 |
|
| 2469 |
const pattern =
|
| 2470 |
new RegExp(
|
| 2471 |
"(^|[,\\s])" +
|
| 2472 |
+
code +
|
| 2473 |
"($|[,\\s])"
|
| 2474 |
);
|
| 2475 |
|
| 2476 |
+
return pattern.test(
|
| 2477 |
+
upper
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2478 |
);
|
| 2479 |
}
|
| 2480 |
|
| 2481 |
+
function normalizeLocation(
|
| 2482 |
+
value
|
| 2483 |
+
) {
|
| 2484 |
+
return String(
|
| 2485 |
+
value ||
|
| 2486 |
+
""
|
| 2487 |
+
)
|
| 2488 |
+
.toLowerCase()
|
| 2489 |
+
.replace(
|
| 2490 |
+
/\busa\b/g,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2491 |
"united states"
|
| 2492 |
+
)
|
| 2493 |
+
.replace(
|
| 2494 |
+
/\bu\.s\.a\.\b/g,
|
| 2495 |
+
"united states"
|
| 2496 |
+
)
|
| 2497 |
+
.replace(
|
| 2498 |
+
/\bu\.s\.\b/g,
|
| 2499 |
+
"united states"
|
| 2500 |
+
)
|
| 2501 |
+
.replace(
|
| 2502 |
+
/[^a-z0-9\s]/g,
|
| 2503 |
+
" "
|
| 2504 |
+
)
|
| 2505 |
+
.replace(
|
| 2506 |
+
/\s+/g,
|
| 2507 |
+
" "
|
| 2508 |
+
)
|
| 2509 |
+
.trim();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2510 |
}
|
| 2511 |
|
| 2512 |
+
function getLocationTokens(
|
| 2513 |
+
location
|
| 2514 |
+
) {
|
| 2515 |
+
const ignored =
|
| 2516 |
+
new Set([
|
| 2517 |
+
"the",
|
| 2518 |
+
"of",
|
| 2519 |
+
"area",
|
| 2520 |
+
"metro",
|
| 2521 |
+
"region"
|
| 2522 |
+
]);
|
| 2523 |
+
|
| 2524 |
+
return String(
|
| 2525 |
+
location ||
|
| 2526 |
+
""
|
| 2527 |
+
)
|
| 2528 |
+
.split(" ")
|
| 2529 |
+
.filter(
|
| 2530 |
+
function (word) {
|
| 2531 |
+
return (
|
| 2532 |
+
word.length > 1 &&
|
| 2533 |
+
!ignored.has(
|
| 2534 |
+
word
|
| 2535 |
+
)
|
| 2536 |
+
);
|
| 2537 |
+
}
|
| 2538 |
+
);
|
| 2539 |
}
|
| 2540 |
|
| 2541 |
+
function dedupeJobs(
|
| 2542 |
+
jobs
|
| 2543 |
+
) {
|
| 2544 |
+
const seen =
|
| 2545 |
+
new Set();
|
| 2546 |
+
|
| 2547 |
+
return jobs.filter(
|
| 2548 |
+
function (job) {
|
| 2549 |
+
const key =
|
| 2550 |
+
[
|
| 2551 |
+
normalizeSimple(
|
| 2552 |
+
job.title
|
| 2553 |
+
),
|
| 2554 |
+
normalizeSimple(
|
| 2555 |
+
job.company_name
|
| 2556 |
+
),
|
| 2557 |
+
normalizeSimple(
|
| 2558 |
+
job.location
|
| 2559 |
+
)
|
| 2560 |
+
].join(
|
| 2561 |
+
"|"
|
| 2562 |
+
);
|
| 2563 |
|
| 2564 |
+
if (
|
| 2565 |
+
seen.has(
|
| 2566 |
+
key
|
| 2567 |
+
)
|
| 2568 |
+
) {
|
| 2569 |
+
return false;
|
| 2570 |
+
}
|
|
|
|
|
|
|
| 2571 |
|
| 2572 |
+
seen.add(
|
| 2573 |
+
key
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2574 |
);
|
| 2575 |
|
| 2576 |
+
return true;
|
|
|
|
| 2577 |
}
|
| 2578 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2579 |
}
|
| 2580 |
|
| 2581 |
+
function stripHTML(
|
| 2582 |
+
html
|
| 2583 |
+
) {
|
| 2584 |
const element =
|
| 2585 |
+
document.createElement(
|
| 2586 |
+
"div"
|
| 2587 |
+
);
|
| 2588 |
|
| 2589 |
element.innerHTML =
|
| 2590 |
+
String(
|
| 2591 |
+
html ||
|
| 2592 |
+
""
|
| 2593 |
+
);
|
| 2594 |
|
| 2595 |
return (
|
| 2596 |
element.textContent ||
|
| 2597 |
element.innerText ||
|
| 2598 |
""
|
| 2599 |
)
|
| 2600 |
+
.replace(
|
| 2601 |
+
/\s+/g,
|
| 2602 |
+
" "
|
| 2603 |
+
)
|
| 2604 |
.trim();
|
| 2605 |
}
|
| 2606 |
|
| 2607 |
+
function normalizeSimple(
|
| 2608 |
+
value
|
| 2609 |
+
) {
|
| 2610 |
+
return String(
|
| 2611 |
+
value ||
|
| 2612 |
+
""
|
| 2613 |
+
)
|
| 2614 |
.toLowerCase()
|
| 2615 |
.replace(
|
| 2616 |
/[^a-z0-9+#.]+/g,
|
| 2617 |
" "
|
| 2618 |
)
|
| 2619 |
+
.replace(
|
| 2620 |
+
/\s+/g,
|
| 2621 |
+
" "
|
| 2622 |
+
)
|
| 2623 |
.trim();
|
| 2624 |
}
|
| 2625 |
|
| 2626 |
+
function escapeHTML(
|
| 2627 |
+
value
|
| 2628 |
+
) {
|
| 2629 |
const element =
|
| 2630 |
+
document.createElement(
|
| 2631 |
+
"div"
|
| 2632 |
+
);
|
| 2633 |
|
| 2634 |
element.textContent =
|
| 2635 |
+
String(
|
| 2636 |
+
value ||
|
| 2637 |
+
""
|
| 2638 |
+
);
|
| 2639 |
|
| 2640 |
return element.innerHTML;
|
| 2641 |
}
|
| 2642 |
|
| 2643 |
+
function escapeRegExp(
|
| 2644 |
+
value
|
| 2645 |
+
) {
|
| 2646 |
+
return String(
|
| 2647 |
+
value ||
|
| 2648 |
+
""
|
| 2649 |
+
).replace(
|
| 2650 |
+
/[.*+?^${}()|[\]\\]/g,
|
| 2651 |
+
"\\$&"
|
| 2652 |
+
);
|
| 2653 |
}
|
| 2654 |
|
| 2655 |
+
function safeFileName(
|
| 2656 |
+
value
|
| 2657 |
+
) {
|
| 2658 |
+
return String(
|
| 2659 |
+
value ||
|
| 2660 |
+
""
|
| 2661 |
+
)
|
| 2662 |
.replace(
|
| 2663 |
/[^a-z0-9]+/gi,
|
| 2664 |
"_"
|
|
|
|
| 2669 |
);
|
| 2670 |
}
|
| 2671 |
|
| 2672 |
+
function titleCase(
|
| 2673 |
+
value
|
| 2674 |
+
) {
|
| 2675 |
+
return String(
|
| 2676 |
+
value ||
|
| 2677 |
+
""
|
| 2678 |
+
)
|
| 2679 |
+
.split(
|
| 2680 |
+
" "
|
| 2681 |
+
)
|
| 2682 |
+
.map(
|
| 2683 |
+
function (word) {
|
| 2684 |
+
return word
|
| 2685 |
+
? word[0]
|
| 2686 |
+
.toUpperCase() +
|
| 2687 |
+
word.slice(
|
| 2688 |
+
1
|
| 2689 |
+
)
|
| 2690 |
+
: "";
|
| 2691 |
+
}
|
| 2692 |
+
)
|
| 2693 |
+
.join(
|
| 2694 |
+
" "
|
| 2695 |
+
);
|
| 2696 |
+
}
|
| 2697 |
|
| 2698 |
+
function setResumeStatus(
|
| 2699 |
+
message,
|
| 2700 |
+
type
|
| 2701 |
+
) {
|
| 2702 |
+
const className =
|
| 2703 |
+
type ===
|
| 2704 |
+
"success"
|
| 2705 |
+
? "success-text"
|
| 2706 |
+
: type ===
|
| 2707 |
+
"error"
|
| 2708 |
+
? "danger-text"
|
| 2709 |
+
: type ===
|
| 2710 |
+
"warning"
|
| 2711 |
+
? "warning-text"
|
| 2712 |
+
: "";
|
| 2713 |
+
|
| 2714 |
+
resumeStatus.innerHTML = `
|
| 2715 |
+
<div class="status-dot"></div>
|
| 2716 |
|
| 2717 |
+
<span class="${className}">
|
| 2718 |
+
${escapeHTML(message)}
|
| 2719 |
+
</span>
|
| 2720 |
+
`;
|
| 2721 |
}
|
| 2722 |
|
| 2723 |
+
function resetAnalysis() {
|
| 2724 |
+
atsScore.textContent =
|
| 2725 |
+
"--";
|
| 2726 |
+
|
| 2727 |
+
keywordScore.textContent =
|
| 2728 |
+
"--";
|
| 2729 |
|
| 2730 |
+
matchedSkills.textContent =
|
| 2731 |
+
"--";
|
| 2732 |
+
|
| 2733 |
+
missingSkills.textContent =
|
| 2734 |
+
"--";
|
| 2735 |
+
}
|
| 2736 |
+
});
|