Auto-deploy: 2026-05-17 23:00:09
This commit is contained in:
19
content.js
19
content.js
@@ -230,16 +230,10 @@
|
|||||||
const questions = [];
|
const questions = [];
|
||||||
const seen = new Set();
|
const seen = new Set();
|
||||||
|
|
||||||
// Find the Easy Apply modal using real LinkedIn selectors
|
|
||||||
const modal = document.querySelector(
|
|
||||||
'[role="dialog"].jobs-easy-apply-modal, .artdeco-modal.jobs-easy-apply-modal, ' +
|
|
||||||
'.artdeco-modal, [role="dialog"], #artdeco-modal-outlet'
|
|
||||||
);
|
|
||||||
const searchRoot = modal || document.body;
|
|
||||||
|
|
||||||
// LinkedIn wraps each form field in .fb-dash-form-element or [data-test-form-element]
|
// LinkedIn wraps each form field in .fb-dash-form-element or [data-test-form-element]
|
||||||
const formElements = searchRoot.querySelectorAll(
|
// Search the whole document to avoid getting trapped in the wrong dialog (like the messaging pane).
|
||||||
'.fb-dash-form-element, [data-test-form-element]'
|
const formElements = document.querySelectorAll(
|
||||||
|
'.jobs-easy-apply-modal .fb-dash-form-element, .jobs-easy-apply-modal [data-test-form-element], .fb-dash-form-element, [data-test-form-element]'
|
||||||
);
|
);
|
||||||
|
|
||||||
formElements.forEach(el => {
|
formElements.forEach(el => {
|
||||||
@@ -268,9 +262,11 @@
|
|||||||
questions.push({ question: text, type: inputType });
|
questions.push({ question: text, type: inputType });
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fallback: if the precise approach found nothing, scan broader
|
// Fallback: if the precise approach found nothing, scan broader inside modals
|
||||||
if (questions.length === 0) {
|
if (questions.length === 0) {
|
||||||
const allLabels = searchRoot.querySelectorAll('label');
|
const activeModals = document.querySelectorAll('.jobs-easy-apply-modal, .artdeco-modal, [role="dialog"]');
|
||||||
|
activeModals.forEach(modal => {
|
||||||
|
const allLabels = modal.querySelectorAll('label');
|
||||||
allLabels.forEach(label => {
|
allLabels.forEach(label => {
|
||||||
const ariaSpan = label.querySelector('span[aria-hidden="true"]');
|
const ariaSpan = label.querySelector('span[aria-hidden="true"]');
|
||||||
let text = (ariaSpan ? ariaSpan.textContent : label.textContent)
|
let text = (ariaSpan ? ariaSpan.textContent : label.textContent)
|
||||||
@@ -288,6 +284,7 @@
|
|||||||
seen.add(text.toLowerCase());
|
seen.add(text.toLowerCase());
|
||||||
questions.push({ question: text, type: 'text' });
|
questions.push({ question: text, type: 'text' });
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[LJA] Scraped questions:', questions);
|
console.log('[LJA] Scraped questions:', questions);
|
||||||
|
|||||||
Reference in New Issue
Block a user