Created
May 23, 2012 22:28
-
-
Save andershaig/2778229 to your computer and use it in GitHub Desktop.
LinkedIn Autofill
This file contains hidden or 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
| <script type="text/javascript"> | |
| function onLinkedInAuth() { | |
| $('#linkedin_section').hide(); | |
| IN.API.Profile("me") | |
| .fields("id","first-name","last-name","location","public-profile-url") | |
| .result( function(me) { | |
| var user_id = me.values[0].id; | |
| var fname = me.values[0].firstName; | |
| var lname = me.values[0].lastName; | |
| var url = me.values[0].publicProfileUrl; | |
| var json_codes = [{"US":"232"},{"CA":"39"},{"AF":"1"},{"AL":"3"},{"DZ":"4"},{"DS":"5"},{"AD":"6"},{"AO":"7"},{"AI":"8"},{"AQ":"9"},{"AG":"10"},{"AR":"11"},{"AM":"12"},{"AW":"13"},{"AU":"14"},{"AT":"15"},{"AZ":"16"},{"BS":"17"},{"BH":"18"},{"BD":"19"},{"BB":"20"},{"BY":"21"},{"BE":"22"},{"BZ":"23"},{"BJ":"24"},{"BM":"25"},{"BT":"26"},{"BO":"27"},{"BA":"28"},{"BW":"29"},{"BV":"30"},{"BR":"31"},{"IO":"32"},{"BN":"33"},{"BG":"34"},{"BF":"35"},{"BI":"36"},{"KH":"37"},{"CM":"38"},{"CV":"40"},{"KY":"41"},{"CF":"42"},{"TD":"43"},{"CL":"44"},{"CN":"45"},{"CX":"46"},{"CC":"47"},{"CO":"48"},{"KM":"49"},{"CG":"50"},{"CK":"52"},{"CR":"53"},{"HR":"55"},{"CU":"56"},{"CY":"57"},{"CZ":"58"},{"DK":"59"},{"DJ":"60"},{"DM":"61"},{"DO":"62"},{"EC":"63"},{"EG":"64"},{"SV":"65"},{"GQ":"66"},{"ER":"67"},{"EE":"68"},{"ET":"69"},{"FK":"70"},{"FO":"71"},{"FJ":"72"},{"FI":"73"},{"FR":"74"},{"GF":"75"},{"PF":"76"},{"TF":"77"},{"GA":"78"},{"GM":"79"},{"GE":"80"},{"DE":"81"},{"GH":"82"},{"GI":"83"},{"GR":"84"},{"GL":"85"},{"GD":"86"},{"GP":"87"},{"GU":"88"},{"GT":"89"},{"GN":"91"},{"GW":"92"},{"GY":"93"},{"HT":"94"},{"HM":"95"},{"HN":"97"},{"HK":"98"},{"HU":"99"},{"IS":"100"},{"IN":"101"},{"ID":"102"},{"IR":"103"},{"IQ":"104"},{"IE":"105"},{"IL":"107"},{"IT":"108"},{"CI":"54"},{"JM":"109"},{"JP":"110"},{"JO":"112"},{"KZ":"113"},{"KE":"114"},{"KI":"115"},{"KP":"116"},{"KR":"117"},{"KW":"118"},{"KG":"119"},{"LA":"120"},{"LV":"121"},{"LB":"122"},{"LS":"123"},{"LR":"124"},{"LY":"125"},{"LI":"126"},{"LT":"127"},{"LU":"128"},{"MO":"129"},{"MK":"130"},{"MG":"131"},{"MW":"132"},{"MY":"133"},{"MV":"134"},{"ML":"135"},{"MT":"136"},{"MH":"137"},{"MQ":"138"},{"MR":"139"},{"MU":"140"},{"TY":"141"},{"MX":"142"},{"FM":"143"},{"MD":"144"},{"MC":"145"},{"MN":"146"},{"MS":"148"},{"MA":"149"},{"MZ":"150"},{"MM":"151"},{"NA":"152"},{"NR":"153"},{"NP":"154"},{"NL":"155"},{"AN":"156"},{"NC":"157"},{"NZ":"158"},{"NI":"159"},{"NE":"160"},{"NG":"161"},{"NU":"162"},{"NF":"163"},{"MP":"164"},{"NO":"165"},{"OM":"166"},{"PK":"167"},{"PW":"168"},{"PA":"170"},{"PG":"171"},{"PY":"172"},{"PE":"173"},{"PH":"174"},{"PN":"175"},{"PL":"176"},{"PT":"177"},{"PR":"178"},{"QA":"179"},{"RE":"180"},{"RO":"181"},{"RU":"182"},{"RW":"183"},{"KN":"186"},{"LC":"187"},{"VC":"189"},{"WS":"190"},{"SM":"191"},{"ST":"192"},{"SA":"193"},{"SN":"194"},{"SC":"196"},{"SL":"197"},{"SG":"198"},{"SK":"199"},{"SI":"200"},{"SB":"201"},{"SO":"202"},{"ZA":"203"},{"GS":"204"},{"ES":"205"},{"LK":"206"},{"SH":"185"},{"PM":"188"},{"SD":"207"},{"SR":"208"},{"SJ":"209"},{"SZ":"210"},{"SE":"211"},{"CH":"212"},{"SY":"213"},{"TW":"214"},{"TJ":"215"},{"TZ":"216"},{"TH":"217"},{"TG":"219"},{"TK":"220"},{"TO":"221"},{"TT":"222"},{"TN":"223"},{"TR":"224"},{"TM":"225"},{"TC":"226"},{"TV":"227"},{"UG":"228"},{"UA":"229"},{"AE":"230"},{"GB":"231"},{"UM":"233"},{"UY":"234"},{"UZ":"235"},{"VU":"236"},{"VA":"96"},{"VE":"237"},{"VN":"238"},{"VG":"239"},{"VI":"240"},{"WF":"241"},{"EH":"242"},{"YE":"243"},{"ZM":"244"},{"ZW":"245"}]; | |
| var country_num = me.values[0].location.country.code.toUpperCase(); | |
| var country_id = json_codes[0][country_num]; | |
| //$('').val(country_id); | |
| $('[name="entry[name][first_name]"]').val(fname); | |
| $('[name="entry[name][last_name]"]').val(lname); | |
| //$('').val(url); | |
| }); | |
| } | |
| </script> | |
| <div id="linkedin_section"> | |
| <script type="IN/Login" data-onAuth="onLinkedInAuth"></script> | |
| <span id="entry_page_linkedin_text">Sign in with LinkedIn to autofill your entry form.</span> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment