Auto-deploy: 2026-06-05 22:24:06
This commit is contained in:
@@ -4,6 +4,8 @@
|
|||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
console.log('[LJA] Search Analyzer Script Loaded');
|
||||||
|
|
||||||
// Prevent double injection
|
// Prevent double injection
|
||||||
if (window.__linkedinSearchAnalyzerLoaded) return;
|
if (window.__linkedinSearchAnalyzerLoaded) return;
|
||||||
window.__linkedinSearchAnalyzerLoaded = true;
|
window.__linkedinSearchAnalyzerLoaded = true;
|
||||||
@@ -29,7 +31,7 @@
|
|||||||
|
|
||||||
// ─── Find Result Container ───────────────────────────────────────────────
|
// ─── Find Result Container ───────────────────────────────────────────────
|
||||||
function getSearchResultsContainer() {
|
function getSearchResultsContainer() {
|
||||||
return document.querySelector('.search-results-container, .reusable-search__entity-result-list');
|
return document.querySelector('.search-results-container, .reusable-search__entity-result-list, ul.reusable-search__entity-result-list');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Extract Person Data ─────────────────────────────────────────────────
|
// ─── Extract Person Data ─────────────────────────────────────────────────
|
||||||
@@ -42,7 +44,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
const nameEl = cardEl.querySelector('.entity-result__title-text a span[dir="ltr"], .entity-result__title-line a span[dir="ltr"], span.entity-result__title-text');
|
const nameEl = cardEl.querySelector('.entity-result__title-text a span[dir="ltr"], .entity-result__title-line a span[dir="ltr"], span.entity-result__title-text, .app-aware-link span[dir="ltr"]');
|
||||||
if (nameEl) {
|
if (nameEl) {
|
||||||
data.name = nameEl.innerText.trim();
|
data.name = nameEl.innerText.trim();
|
||||||
}
|
}
|
||||||
@@ -99,6 +101,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
cardEl.appendChild(resultContainer);
|
cardEl.appendChild(resultContainer);
|
||||||
|
console.log('[LJA] Injected button for a profile');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Scan a Single Person ────────────────────────────────────────────────
|
// ─── Scan a Single Person ────────────────────────────────────────────────
|
||||||
@@ -201,7 +204,8 @@
|
|||||||
btn.title = 'Scan all loaded profiles on this page';
|
btn.title = 'Scan all loaded profiles on this page';
|
||||||
|
|
||||||
btn.addEventListener('click', async () => {
|
btn.addEventListener('click', async () => {
|
||||||
const cards = document.querySelectorAll('.reusable-search__result-container');
|
// Allow broader class matches for people cards
|
||||||
|
const cards = document.querySelectorAll('.reusable-search__result-container, li.search-result__occluded-item, li.search-result');
|
||||||
if (cards.length === 0) {
|
if (cards.length === 0) {
|
||||||
alert('No profiles found to scan.');
|
alert('No profiles found to scan.');
|
||||||
return;
|
return;
|
||||||
@@ -231,14 +235,20 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
container.parentNode.insertBefore(btn, container);
|
container.parentNode.insertBefore(btn, container);
|
||||||
|
console.log('[LJA] Injected Scan All button');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Process Page ────────────────────────────────────────────────────────
|
// ─── Process Page ────────────────────────────────────────────────────────
|
||||||
function processPage() {
|
function processPage() {
|
||||||
|
// Prevent running outside of search page just in case
|
||||||
|
if (!window.location.href.includes('linkedin.com/search/results/')) return;
|
||||||
|
|
||||||
injectScanAllButton();
|
injectScanAllButton();
|
||||||
const cards = document.querySelectorAll('li.reusable-search__result-container');
|
const cards = document.querySelectorAll('.reusable-search__result-container, li.search-result__occluded-item, li.search-result');
|
||||||
|
if (cards.length > 0) {
|
||||||
cards.forEach(injectScanButton);
|
cards.forEach(injectScanButton);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ─── MutationObserver: watch for new results (pagination/filters) ────────
|
// ─── MutationObserver: watch for new results (pagination/filters) ────────
|
||||||
let observerTimer;
|
let observerTimer;
|
||||||
@@ -252,10 +262,25 @@
|
|||||||
|
|
||||||
// ─── Initialize ──────────────────────────────────────────────────────────
|
// ─── Initialize ──────────────────────────────────────────────────────────
|
||||||
function init() {
|
function init() {
|
||||||
|
console.log('[LJA] Initializing Search Analyzer...');
|
||||||
processPage();
|
processPage();
|
||||||
observer.observe(document.body, { childList: true, subtree: true });
|
observer.observe(document.body, { childList: true, subtree: true });
|
||||||
|
|
||||||
|
// Listen for SPA navigation from background script if implemented,
|
||||||
|
// or just rely on MutationObserver for body changes when URL changes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle SPA navigation by checking URL changes
|
||||||
|
let lastUrl = window.location.href;
|
||||||
|
setInterval(() => {
|
||||||
|
if (window.location.href !== lastUrl) {
|
||||||
|
lastUrl = window.location.href;
|
||||||
|
if (lastUrl.includes('linkedin.com/search/results/')) {
|
||||||
|
setTimeout(processPage, 1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
if (document.readyState === 'loading') {
|
if (document.readyState === 'loading') {
|
||||||
document.addEventListener('DOMContentLoaded', init);
|
document.addEventListener('DOMContentLoaded', init);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user