Skip to content

Instantly share code, notes, and snippets.

@not-inept
Last active September 12, 2016 02:08
Show Gist options
  • Save not-inept/bdc9606e5b82c9229ae9fe4de471c89f to your computer and use it in GitHub Desktop.
Save not-inept/bdc9606e5b82c9229ae9fe4de471c89f to your computer and use it in GitHub Desktop.
Linked In Connector Script
"use strict";
var number_of_people = 1000;
var people_list = [];
var people_added = [];
function processList() {
for (var i = 0; i < people_list.length; ++i) {
var person = people_list[i];
var connect_button = person.getElementsByClassName('bt-request-buffed')[0];
var member_id = person.id.split('-')[1];
$(connect_button).click();
people_added.push(member_id);
}
}
function growList(target,tries,height) {
tries = tries === undefined ? 0 : tries;
people_list = $('.card').not('.promo').not('.guest').not('buffer');
var unmoving = false;
if (height == $(document).height()) {
tries += 1;
if (tries > 40) {
unmoving = true;
}
} else {
tries = 0;
}
if (people_list.length >= target || unmoving) {
processList(target);
} else {
height = $(document).height();
$(window).scrollTop($(document).height());
setTimeout(function() { growList(target,tries, height); }, 250);
}
}
growList(number_of_people);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment