Last active
April 13, 2021 01:46
-
-
Save abhishekdubey1/0419674fbe42db0ecfb39879806f93b7 to your computer and use it in GitHub Desktop.
Scroll down to comments to see how to use this code snippet
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
function manageRequests(acceptAll, ignoreAll, acceptCount){ | |
let invitationsList = document.getElementsByClassName('mn-invitation-list')[0] | |
let requests = invitationsList.querySelectorAll('li') | |
let lengthOfRequests = requests.length | |
function alertUser(fnCall, count){ | |
alert(`Hey User, you are about to ${fnCall} - ${count} connection requests`) | |
} | |
function handleRequests(num, count) { | |
for(let i=0; i<count; i++) { | |
requests[i].querySelector('.invitation-card__action-container').querySelectorAll('button')[num].click() | |
} | |
} | |
if(acceptAll){ | |
handleRequests(1, lengthOfRequests); alertUser("ACCEPT", lengthOfRequests) | |
} else if(ignoreAll){ | |
handleRequests(0, lengthOfRequests); alertUser("IGNORE", lengthOfRequests) | |
} else if(acceptCount) { | |
let count = parseInt(acceptCount.split('-')[1], 10) || 10; | |
if(acceptCount[0] === "a"){ | |
handleRequests(1, count); alertUser("ACCEPT", count) | |
} else { | |
handleRequests(0, count); alertUser("IGNORE", count) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
manageRequests is function you have to run everytime to use this code snippet on Linkedin
To use this code go to Linkedin then Right click then console and then copy paste the code snippet given above then copy paste function examples below to manage your connection requests
manageRequests(true, false)
Accepts 100 requests at max, caution: doing this can lead to hit api limit, so 10-20 requests at a time is advised
manageRequests(false, true)
Ignores 100 requests at max, caution: doing this can lead to hit api limit, so 10-20 requests at a time is advised
manageRequests(false, false, "a-10")
Accepts 10 requests
manageRequests(false, false, "i-10")
Ignores 10 requests