Auto-deploy: 2026-06-05 23:09:42

This commit is contained in:
Hamza-Ayed
2026-06-05 23:09:42 +03:00
parent 97fac48bfd
commit 3de45d7f43

View File

@@ -95,7 +95,10 @@
let uniqueCards = new Set();
// Find the main Action Button (Connect/Message/Follow) which every profile card has
let actionElements = Array.from(document.querySelectorAll('button, a')).filter(el => {
let allButtons = Array.from(document.querySelectorAll('button, a'));
console.log('[LJA] Total buttons/links on page:', allButtons.length);
let actionElements = allButtons.filter(el => {
if (!el.innerText) return false;
let txt = el.innerText.toLowerCase().trim();
// Must contain the word, but not be a huge paragraph
@@ -103,9 +106,12 @@
return txt.includes('connect') || txt.includes('message') || txt.includes('pending') || txt.includes('follow');
});
console.log('[LJA] Action buttons found (Connect/Message/etc):', actionElements.length, actionElements.map(e => e.innerText.trim()));
actionElements.forEach(btn => {
let container = btn.parentElement;
// Go up the DOM tree (max 15 levels) to find the list item wrapper
let found = false;
for(let i=0; i<15; i++) {
if (!container) break;
// A valid card container is usually an LI
@@ -113,16 +119,21 @@
// 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);
found = true;
break;
}
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);