Auto-deploy: 2026-05-17 23:00:09

This commit is contained in:
Hamza-Ayed
2026-05-17 23:00:09 +03:00
parent 26fc873e85
commit a7a782c422

View File

@@ -230,16 +230,10 @@
const questions = [];
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]
const formElements = searchRoot.querySelectorAll(
'.fb-dash-form-element, [data-test-form-element]'
// Search the whole document to avoid getting trapped in the wrong dialog (like the messaging pane).
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 => {
@@ -268,25 +262,28 @@
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) {
const allLabels = searchRoot.querySelectorAll('label');
allLabels.forEach(label => {
const ariaSpan = label.querySelector('span[aria-hidden="true"]');
let text = (ariaSpan ? ariaSpan.textContent : label.textContent)
.replace(/\*/g, '').replace(/\n/g, ' ').replace(/\s+/g, ' ').trim();
const activeModals = document.querySelectorAll('.jobs-easy-apply-modal, .artdeco-modal, [role="dialog"]');
activeModals.forEach(modal => {
const allLabels = modal.querySelectorAll('label');
allLabels.forEach(label => {
const ariaSpan = label.querySelector('span[aria-hidden="true"]');
let text = (ariaSpan ? ariaSpan.textContent : label.textContent)
.replace(/\*/g, '').replace(/\n/g, ' ').replace(/\s+/g, ' ').trim();
if (!text || text.length < 8 || text.length > 300 || seen.has(text.toLowerCase())) return;
if (!text || text.length < 8 || text.length > 300 || seen.has(text.toLowerCase())) return;
const looksLikeQuestion = (
text.endsWith('?') ||
/^(how many|what|do you|are you|have you|will you|describe|tell us)/i.test(text) ||
/salary|experience|education|degree|visa|relocat|notice|certif/i.test(text)
);
if (!looksLikeQuestion) return;
const looksLikeQuestion = (
text.endsWith('?') ||
/^(how many|what|do you|are you|have you|will you|describe|tell us)/i.test(text) ||
/salary|experience|education|degree|visa|relocat|notice|certif/i.test(text)
);
if (!looksLikeQuestion) return;
seen.add(text.toLowerCase());
questions.push({ question: text, type: 'text' });
seen.add(text.toLowerCase());
questions.push({ question: text, type: 'text' });
});
});
}