-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwellfound-monitor.js
36 lines (31 loc) · 1.66 KB
/
wellfound-monitor.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Function to monitor the Wellfound "Apply" button
function monitorWellfoundApplications() {
const applyButton = document.querySelector('button[data-test="JobDescriptionSlideIn--SubmitButton"]');
// console.log("🔍 Checking for apply button...");
if (applyButton && !applyButton.dataset.listenerAdded) {
applyButton.dataset.listenerAdded = "true"; // Prevent duplicate event listeners
// console.log("✅ Apply button found! Adding event listener...");
applyButton.addEventListener("click", () => {
// console.log("🔍 Apply button clicked! Adding event listener...");
const jobData = {
company: document.querySelector('.text-sm.font-semibold.text-black')?.textContent.trim() || "Unknown Company",
position: document.querySelector('.mt-4 h1.text-xl.font-semibold.text-black')?.textContent.trim() || "Unknown Position",
jobUrl: window.location.href,
platform: 'Wellfound',
status: 'Applied',
appliedDate: new Date().toISOString().split('T')[0]
};
// Store the application
chrome.storage.local.get('jobApplications', function(result) {
const applications = result.jobApplications || [];
applications.push(jobData);
chrome.storage.local.set({ 'jobApplications': applications });
});
});
}
}
// Use MutationObserver to detect new elements being added dynamically
const observer = new MutationObserver(() => {
monitorWellfoundApplications();
});
observer.observe(document.body, { childList: true, subtree: true });