Last active
April 27, 2024 06:10
-
-
Save azizur/259b1bd6f6bbd24a424493335f6a2bf1 to your computer and use it in GitHub Desktop.
Manage LinkedIn Invitations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var duration = " month"; // withdraw invites older than x month. | |
var timeago = document.querySelectorAll(".time-badge"); | |
var inviteActionables = document.querySelectorAll(".invitation-card__action-btn"); | |
var nameNodes = document.querySelectorAll(".invitation-card__tvm-title"); | |
var names = []; | |
function cancel_invite(cancelId, inviteNode) { | |
setTimeout(function () { | |
console.info("Withdrawing invite for", cancelId, names[cancelId]); | |
inviteNode.click(); | |
setTimeout(function () { | |
var confirmWithdraw = document.querySelectorAll(".artdeco-modal__confirm-dialog-btn"); | |
console.log("confirm withdrawing", cancelId, names[cancelId]); | |
confirmWithdraw[1].click(); | |
}, 1000); | |
}, 1000 * cancelId); | |
} | |
function go() { | |
for (let i = 0; i < nameNodes.length; i++) { | |
names.push(nameNodes[i].textContent.trim()); | |
} | |
for (var i = 0; i < timeago.length; i++) { | |
if (timeago[i].textContent.includes(duration)) { | |
console.info("Withdraw invite for", i, names[i]); | |
cancel_invite(i, inviteActionables[i]); | |
} | |
} | |
} | |
setTimeout(go, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment