Auto-deploy: 2026-06-05 22:24:06
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
console.log('[LJA] Search Analyzer Script Loaded');
|
||||
|
||||
// Prevent double injection
|
||||
if (window.__linkedinSearchAnalyzerLoaded) return;
|
||||
window.__linkedinSearchAnalyzerLoaded = true;
|
||||
@@ -29,7 +31,7 @@
|
||||
|
||||
// ─── Find Result Container ───────────────────────────────────────────────
|
||||
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 ─────────────────────────────────────────────────
|
||||
@@ -42,7 +44,7 @@
|
||||
};
|
||||
|
||||
// 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) {
|
||||
data.name = nameEl.innerText.trim();
|
||||
}
|
||||
@@ -99,6 +101,7 @@
|
||||
}
|
||||
|
||||
cardEl.appendChild(resultContainer);
|
||||
console.log('[LJA] Injected button for a profile');
|
||||
}
|
||||
|
||||
// ─── Scan a Single Person ────────────────────────────────────────────────
|
||||
@@ -201,7 +204,8 @@
|
||||
btn.title = 'Scan all loaded profiles on this page';
|
||||
|
||||
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) {
|
||||
alert('No profiles found to scan.');
|
||||
return;
|
||||
@@ -231,13 +235,19 @@
|
||||
});
|
||||
|
||||
container.parentNode.insertBefore(btn, container);
|
||||
console.log('[LJA] Injected Scan All button');
|
||||
}
|
||||
|
||||
// ─── Process Page ────────────────────────────────────────────────────────
|
||||
function processPage() {
|
||||
// Prevent running outside of search page just in case
|
||||
if (!window.location.href.includes('linkedin.com/search/results/')) return;
|
||||
|
||||
injectScanAllButton();
|
||||
const cards = document.querySelectorAll('li.reusable-search__result-container');
|
||||
cards.forEach(injectScanButton);
|
||||
const cards = document.querySelectorAll('.reusable-search__result-container, li.search-result__occluded-item, li.search-result');
|
||||
if (cards.length > 0) {
|
||||
cards.forEach(injectScanButton);
|
||||
}
|
||||
}
|
||||
|
||||
// ─── MutationObserver: watch for new results (pagination/filters) ────────
|
||||
@@ -252,10 +262,25 @@
|
||||
|
||||
// ─── Initialize ──────────────────────────────────────────────────────────
|
||||
function init() {
|
||||
console.log('[LJA] Initializing Search Analyzer...');
|
||||
processPage();
|
||||
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') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user