Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acoyfellow/33972c5ecfde46661fa9107c15449a28 to your computer and use it in GitHub Desktop.
Save acoyfellow/33972c5ecfde46661fa9107c15449a28 to your computer and use it in GitHub Desktop.
Mass LinkedIn Connect (with limit)
var maximumTries= 200, runCount=0;
var timer= setInterval(e=>{
if(maximumTries==maximumTries){
clearInterval(timer)
}else{
runCount++
};
document.querySelectorAll('.search-result__actions--primary.button-secondary-medium.m5').forEach(btn=> {
if(btn.innerHTML.indexOf('Connect')==-1){
btn.parentNode.removeChild(btn);
};
});
var btn= document.querySelectorAll('.search-result__actions--primary.button-secondary-medium.m5')[0];
if(btn==null){
document.querySelector("button.next").click();
return false;
};
btn.click();
var s= btn.getAttribute('aria-label');
s= s.replace('Connect with ', '')
s= s.substring(0, s.indexOf(' '));
s= s.replace(/\s/g,'');
setTimeout(e=> {
var comment= document.querySelector('div.modal-wormhole-content > div > section > div > div.send-invite__actions > button.button-secondary-large');
comment.click();
setTimeout(e=>{
var textarea= document.querySelector('.send-invite__custom-message.mb3.ember-text-area.ember-view');
textarea.value= "Hey "+s+", I'd be honored if we could connect here on LinkedIn :)";
var send= document.querySelector('div.modal-wormhole-content > div > section > div > div.send-invite__actions > button.button-primary-large.ml3');
send.click();
btn.parentNode.removeChild(btn);
}, 500);
},500);
}, 2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment