Auto-deploy: 2026-06-05 23:08:11

This commit is contained in:
Hamza-Ayed
2026-06-05 23:08:11 +03:00
parent 57784c790a
commit 97fac48bfd

View File

@@ -94,25 +94,29 @@
function findCards() {
let uniqueCards = new Set();
// The most bulletproof way to find a profile card is to find the main Action Button (Connect/Message/Follow)
// and then go up the DOM tree until we find the container that holds the whole profile
let actionElements = Array.from(document.querySelectorAll('button, a.artdeco-button')).filter(el => {
// Find the main Action Button (Connect/Message/Follow) which every profile card has
let actionElements = Array.from(document.querySelectorAll('button, a')).filter(el => {
if (!el.innerText) return false;
let txt = el.innerText.toLowerCase().trim();
// Must contain the word, but not be a huge paragraph
return txt.length < 30 && (txt.includes('connect') || txt.includes('message') || txt.includes('pending') || txt.includes('follow'));
if (txt.length === 0 || txt.length > 20) return false;
return txt.includes('connect') || txt.includes('message') || txt.includes('pending') || txt.includes('follow');
});
actionElements.forEach(btn => {
let container = btn.parentElement;
// Go up the DOM tree (max 15 levels) to find the list item
// Go up the DOM tree (max 15 levels) to find the list item wrapper
for(let i=0; i<15; i++) {
if (!container) break;
// A valid card container is usually an LI and contains an image and a profile link
if (container.tagName === 'LI' && container.querySelector('img') && container.querySelector('a[href*="/in/"]')) {
uniqueCards.add(container);
break;
// A valid card container is usually an LI
if (container.tagName === 'LI') {
// Ensure it has some text (a profile has name, headline, etc)
if (container.innerText && container.innerText.length > 30) {
uniqueCards.add(container);
break;
}
}
// Fallback if it's not an LI but a direct container div used by some LinkedIn versions
// Fallback for non-LI structures
if (container.classList && (container.classList.contains('reusable-search__result-container') || container.classList.contains('search-entity'))) {
uniqueCards.add(container);
break;