Last active
September 23, 2016 02:15
-
-
Save lostPixels/611cba987a1e7543c2d93d124df4c0c8 to your computer and use it in GitHub Desktop.
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 testData = { | |
'endorsedItemName-0':'Open Innovation', | |
'endorsedItemType-0':'skill', | |
'endorsedItemId-0':'7291', | |
'recipientType-0':'member', | |
'recipientId-0': userIDs[step], | |
'endorse':'Endorse', | |
'endorsementCount':'1' | |
}; | |
var testData = { | |
'endorsedItemName-0':'Bowhunting', | |
'endorsedItemType-0':'skill', | |
'endorsedItemId-0':'35690', | |
'recipientType-0':'member', | |
'recipientId-0': userIDs[step], | |
'endorse':'Endorse', | |
'endorsementCount':'1' | |
}; | |
///////////////////////////////////////////////////////////////////////////////////////////////////////// | |
(function(){ | |
'use_strict'; | |
const count = 10; | |
const dontEndorseIfTheyWorkHere = "Burton Snowboards"; | |
const csrf = LI.readCookie('JSESSIONID').replace(/"/gi,''); | |
let userIDs = []; | |
let step = 0; | |
$.ajax(`https://www.linkedin.com/connected/api/v2/contacts?start=0&count=${count}`, | |
{complete: data => parse(data)} | |
); | |
function parse(data) { | |
userIDs = data.responseJSON.values.filter(shouldWeEndorse); | |
endorseForBowhunting(); | |
} | |
function shouldWeEndorse(user) { | |
return user && user.company && user.company.name !== dontEndorseIfTheyWorkHere; | |
} | |
function endorseForBowhunting() { | |
var URL = `https://www.linkedin.com/profile/endorse?_ed=0_crpQwclsqh40t8SP-6xKj6Xa8ECCs2_PCAxX_TMp93v2_X1nEvjx2hy1Tjmyz49eU_nQPZuodD3JQTX0n0nv3Q6XGJLmk-V8LmDIS6J5BzQ&csrfToken=${csrf.toString()}`; | |
var testData = { | |
'endorsedItemName-0':'Open Innovation', | |
'endorsedItemType-0':'skill', | |
'endorsedItemId-0':'7291', | |
'recipientType-0':'member', | |
'recipientId-0': userIDs[step].memberId, | |
'endorse':'Endorse', | |
'endorsementCount':'1' | |
}; | |
$.ajax(URL, { | |
method: 'POST', | |
//processData: false, | |
//contentType:'application/x-www-form-urlencoded', | |
//contentType: false, | |
headers: { | |
'X-IsAJAXForm': 1, | |
'X-LinkedIn-traceDataContext': 'X-LI-ORIGIN-UUID=h41nhMJcdhSg53orlSsAAA==' | |
}, | |
data: testData, | |
complete: res => { | |
console.log(res); | |
step++; | |
if(step < userIDs.length) { | |
endorseForBowhunting(); | |
} | |
} | |
}); | |
} | |
}()); | |
function D(a, b, e, m, f, w, l, d) { | |
var g = {}, k; | |
k = function(a) { | |
var b, m; | |
a && a.responseText ? (b = a.responseText[x], -1 === b.nextOffset && (LI.hide(G), LI.hide(H)), b.connections && 0 < b.connections.length && (m = [], LI.each(b.connections, function(a) { | |
var b = a.memberId + "_" + a.skillId; | |
I[b] || (I[b] = !0, m.push(a)) | |
}), b.connections = m), b.skills && "string" === typeof b.skills && (b.skills = b.skills.split(",")), b.connections && | |
0 !== b.connections.length ? (p = b.nextOffset, b.displayContext = c.context, b.containsAvailableTasks = !! c.skipDestURL, y && (b.promoVariant = y, b.viewerEndorseCount = F, b.i18n_other_colleagues && (b.i18n_other_colleagues = b.i18n_other_colleagues.replace("{0}", F))), la(b), dust.render(e, a.responseText, function(a, e) { | |
var c = f || !J && !A ? void 0 : 2; | |
a || (q && Z(b, c), w && "function" === typeof w && w(e, b)) | |
})) : l && "function" === typeof l && (l(), n())) : n() | |
}; | |
if (!B) { | |
n(f, "start"); | |
q && (d && $(d), d = aa(b)); | |
if (d) { | |
k(d); | |
return | |
} | |
g.offset = a; | |
g.resultSetSize = q || | |
b; | |
g.activityType = m; | |
LI.asyncRequest("GET", LI.addParams(z, g), { | |
success: function(a) { | |
var e; | |
if (a && (e = (e = a.responseText && a.responseText[x]) && e[K]) && e[ba] === ca) { | |
f && (e[L] === da ? (M(c.i18nEndorseLimitExceeded), h("prof-endrs-multi-limit-endorse")) : e[L] === ma && (M(c.i18nSuggestionsLimitExceeded), h("prof-endrs-multi-limit-suggestions"))); | |
return | |
} | |
q && ($(a), a = aa(b)); | |
k(a) | |
}, | |
custom: { | |
error: N, | |
exception: N | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment