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

This commit is contained in:
Hamza-Ayed
2026-06-05 23:12:11 +03:00
parent 3de45d7f43
commit 43c5f8d0a7

View File

@@ -96,44 +96,31 @@
// Find the main Action Button (Connect/Message/Follow) which every profile card has // Find the main Action Button (Connect/Message/Follow) which every profile card has
let allButtons = Array.from(document.querySelectorAll('button, a')); let allButtons = Array.from(document.querySelectorAll('button, a'));
console.log('[LJA] Total buttons/links on page:', allButtons.length);
let actionElements = allButtons.filter(el => { let actionElements = allButtons.filter(el => {
if (!el.innerText) return false; if (!el.innerText) return false;
let txt = el.innerText.toLowerCase().trim(); let txt = el.innerText.toLowerCase().trim();
// Must contain the word, but not be a huge paragraph
if (txt.length === 0 || txt.length > 20) return false; if (txt.length === 0 || txt.length > 20) return false;
return txt.includes('connect') || txt.includes('message') || txt.includes('pending') || txt.includes('follow'); // Exact match ONLY: avoid "8K followers" matching "follow"
return txt === 'connect' || txt === 'message' || txt === 'pending' || txt === 'follow' || txt === '+ connect';
}); });
console.log('[LJA] Action buttons found (Connect/Message/etc):', actionElements.length, actionElements.map(e => e.innerText.trim())); console.log('[LJA] Exact action buttons found:', actionElements.length, actionElements.map(e => e.innerText.trim()));
actionElements.forEach(btn => { actionElements.forEach(btn => {
// Go up and find the FIRST/SMALLEST ancestor with enough text to be a profile card
let container = btn.parentElement; let container = btn.parentElement;
// Go up the DOM tree (max 15 levels) to find the list item wrapper for(let i=0; i<25; i++) {
let found = false; if (!container || container === document.body) break;
for(let i=0; i<15; i++) { const txt = container.innerText;
if (!container) break; // A profile card has at least 100 chars (name + headline + location + button)
// A valid card container is usually an LI // and not too many (< 3000 so we don't grab the whole results list)
if (container.tagName === 'LI') { if (txt && txt.length > 100 && txt.length < 3000) {
// Ensure it has some text (a profile has name, headline, etc)
if (container.innerText && container.innerText.length > 30) {
uniqueCards.add(container);
found = true;
break;
}
}
// Fallback for non-LI structures
if (container.classList && (container.classList.contains('reusable-search__result-container') || container.classList.contains('search-entity'))) {
uniqueCards.add(container); uniqueCards.add(container);
found = true;
break; break;
} }
container = container.parentElement; container = container.parentElement;
} }
if (!found) {
console.log('[LJA] Button found but could not find card container for:', btn.innerText.trim());
}
}); });
const cards = Array.from(uniqueCards); const cards = Array.from(uniqueCards);