-
-
Save maksii/e028dc8de7d42f12305911e53679d807 to your computer and use it in GitHub Desktop.
var inviter = {} || inviter; | |
inviter.userList = []; | |
inviter.className = 'button-secondary-small'; | |
inviter.refresh = function () { | |
window.scrollTo(0, document.body.scrollHeight); | |
window.scrollTo(document.body.scrollHeight, 0); | |
window.scrollTo(0, document.body.scrollHeight); | |
}; | |
inviter.initiate = function() | |
{ | |
inviter.refresh(); | |
var connectBtns = document.getElementsByClassName(inviter.className); | |
if (connectBtns == null) {var connectBtns = inviter.initiate();} | |
return connectBtns; | |
}; | |
inviter.invite = function () { | |
var connectBtns = inviter.initiate(); | |
var buttonLength = connectBtns.length; | |
for (var i = 0; i < buttonLength; i++) { | |
if (connectBtns != null && connectBtns[i] != null) {inviter.handleRepeat(connectBtns[i]);} | |
if (i == buttonLength - 1) { | |
console.log("done: " + i); | |
inviter.refresh(); | |
} | |
} | |
}; | |
inviter.handleRepeat = function(button) | |
{ | |
var nameValue = button.children[1].textContent | |
var name = nameValue.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); | |
if(inviter.arrayContains(name)) | |
{ | |
console.log("cancel"); | |
var cancel = button.parentNode.parentNode.children[0]; | |
cancel.click(); | |
} | |
else | |
{ | |
console.log("add"); | |
inviter.userList.push(name); | |
button.click(); | |
} | |
}; | |
inviter.arrayContains = function(item) | |
{ | |
return (inviter.userList.indexOf(item) > -1); | |
}; | |
inviter.usersJson = {}; | |
inviter.loadResult = function() | |
{ | |
var retrievedObject = localStorage.getItem('inviterList'); | |
var temp = JSON.stringify(retrievedObject); | |
inviter.userList = JSON.parse(temp); | |
}; | |
inviter.saveResult = function() | |
{ | |
inviter.usersJson = JSON.stringify(inviter.userList); | |
localStorage.setItem('inviterList', inviter.usersJson); | |
}; | |
setInterval(function () { inviter.invite(); }, 5000); |
Simple version
setInterval(() => {
$('button[data-control-name="invite"]').each((i, el) => el.click())
window.scrollTo(0, document.body.scrollHeight)
window.scrollTo(document.body.scrollHeight, 0)
window.scrollTo(0, document.body.scrollHeight)
}, 5e3)
run it on https://www.linkedin.com/mynetwork/
@miguelmota It's simple but works like a champ :) Thanks!
@000011111111 not sure what this POST error is, I've been using this once in a while rather successfully. I plan to use this more frequently, will fix this sometime soon
@aero007 please check out jopetersen
's post, he seems to have implemented what you're asking for
I have tried the original code by the author and it worked well for me. Then I wanted to make sure that this script adds only the people who have "CEO" word in the profile headline. Then I have tried the solutions mentioned above in the comment and non of them work. So I have modified the original code to archive me goal. ( Add the strings(lowercase) you want to be existed in the headline to the "setOfStrings" variable - line 6 )
'var inviter = {} || inviter;
inviter.userList = [];
inviter.className = 'button-secondary-small';
//your strings here
var setOfStrings = ['ceo, '', 'founder',];
inviter.refresh = function () {
window.scrollTo(0, document.body.scrollHeight);
window.scrollTo(document.body.scrollHeight, 0);
window.scrollTo(0, document.body.scrollHeight);
};
inviter.initiate = function()
{
inviter.refresh();
var connectBtns = document.getElementsByClassName(inviter.className);
if (connectBtns == null) {var connectBtns = inviter.initiate();}
return connectBtns;
};
inviter.invite = function () {
var connectBtns = inviter.initiate();
var buttonLength = connectBtns.length;
for (var i = 0; i < buttonLength; i++) {
if (connectBtns != null && connectBtns[i] != null) {inviter.handleRepeat(connectBtns[i]);}
if (i == buttonLength - 1) {
console.log("done: " + i);
inviter.refresh();
}
}
};
inviter.handleRepeat = function(button)
{
var nameValue = button.children[1].textContent
var name = nameValue.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
var position = button.parentNode.parentNode.children[2].textContent;
var formatedPosition = position.replace(/^\s\s*/, '').replace(/\s\s*$/, '').toLowerCase();
console.log(formatedPosition);
var stringExists = false;
for(var i =0;i < setOfStrings.length; i++){
if(formatedPosition.indexOf(setOfStrings[i]) != -1)
stringExists = true;
}
if(inviter.arrayContains(name))
{
console.log("cancel");
var cancel = button.parentNode.parentNode.children[0];
cancel.click();
}
else
{
if(stringExists == true)
{
console.log("add");
inviter.userList.push(name);
button.click();
}
else
{
console.log("cancel");
var cancel = button.parentNode.parentNode.children[0];
cancel.click();
}
}
};
inviter.arrayContains = function(item)
{
return (inviter.userList.indexOf(item) > -1);
};
inviter.usersJson = {};
inviter.loadResult = function()
{
var retrievedObject = localStorage.getItem('inviterList');
var temp = JSON.stringify(retrievedObject);
inviter.userList = JSON.parse(temp);
};
inviter.saveResult = function()
{
inviter.usersJson = JSON.stringify(inviter.userList);
localStorage.setItem('inviterList', inviter.usersJson);
};
setInterval(function () { inviter.invite(); }, 5000);`
@miguelmota your script is amazing in the numbers but can you make one with a selection of keywords ?
obrigado
Looks like LinkedIn changed something over the last couple of weeks and the scripts on this page, except the one from @miguelmota, do not seem to work anymore and that one doesn't let you select keywords. I hope that someone who knows this script well can fix this. Thanks, guys!
Looks like LinkedIn changed something over the last couple of weeks and the scripts on this page, except the one from @miguelmota, do not seem to work anymore and that one doesn't let you select keywords. I hope that someone who knows this script well can fix this. Thanks, guys!
Try using this script.
Hello developers, see this script solution.
@dheerajbhaskar could you please add position CEO PRESIDENT? Thanks!