This repository was archived by the owner on Sep 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
added login with linkedin #7
Open
imylyanyk
wants to merge
10
commits into
awalgarg:master
Choose a base branch
from
imylyanyk:linkedin
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e4f28b0
add example
awalgarg d9eeb8b
add stack edit url
awalgarg 2ecda03
fix line break
awalgarg 9aac814
add different rendering links
awalgarg 90dfeb9
add markdownshare link
awalgarg 4ddd90d
switch to htmlhouse as jsbin expires
awalgarg 2c1f706
Implemented button for JSON export
0d9a509
modularize the downloading logic
awalgarg e246613
switch to cdn
awalgarg 366bd27
added login with linkedin
imylyanyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,25 @@ var config = { | |
| divider: '\n---' | ||
| }; | ||
|
|
||
| function onLinkedInLoad() { | ||
| IN.Event.on(IN, "auth", getProfileData); | ||
| } | ||
|
|
||
| // Handle the successful return from the API call | ||
| function onSuccess(data) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @awalgarg OK, you are right. I will be happy to improve my PR. |
||
| console.log(data); | ||
| } | ||
|
|
||
| // Handle an error response from the API call | ||
| function onError(error) { | ||
| console.log(error); | ||
| } | ||
|
|
||
| // Use the API call wrapper to request the member's basic profile data | ||
| function getProfileData() { | ||
| IN.API.Raw("/people/~").result(onSuccess).error(onError); | ||
| } | ||
|
|
||
| var reducers = [[function avatar(u) { | ||
| return u.avatar ? ' ![avatar][]' : ''; | ||
| }, function fullName(u) { | ||
|
|
@@ -173,6 +192,20 @@ var utils = { | |
| return since + ' - ' + till; | ||
| } | ||
| return ''; | ||
| }, | ||
| downloadFromData: function downloadFromData(data, type, filename) { | ||
| var blob = new Blob([data], { type: type }); | ||
| var url = URL.createObjectURL(blob); | ||
| var a = document.createElement('a'); | ||
| a.download = filename; | ||
| a.href = url; | ||
| a.classList.add('hidden'); | ||
| document.body.appendChild(a); | ||
| a.click(); | ||
| document.body.removeChild(a); | ||
| setTimeout(function () { | ||
| return URL.revokeObjectURL(url); | ||
| }, 0); | ||
| } | ||
| }; | ||
|
|
||
|
|
@@ -183,16 +216,14 @@ way.watch('inputData', function (val) { | |
| }); | ||
|
|
||
| document.getElementById('btnDownload').addEventListener('click', downloadRaw); | ||
| document.getElementById('btnExport').addEventListener('click', downloadJSON); | ||
|
|
||
| function downloadJSON() { | ||
| utils.downloadFromData(JSON.stringify(way.get('inputData'), null, ' '), 'application/json', 'cv.json'); | ||
| } | ||
|
|
||
| function downloadRaw() { | ||
| var a = document.createElement('a'); | ||
| a.download = 'cv.md'; | ||
| var blob = new Blob([renderer(way.get('inputData'), reducers)], { type: 'text/plain' }); | ||
| var url = URL.createObjectURL(blob); | ||
| a.href = url; | ||
| document.body.appendChild(a); | ||
| a.click(); | ||
| document.body.removeChild(a); | ||
| utils.downloadFromData(renderer(way.get('inputData'), reducers), 'text/plain', 'cv.md'); | ||
| } | ||
|
|
||
| document.getElementById('btnMd').addEventListener('click', function () { | ||
|
|
@@ -213,3 +244,4 @@ function switchTab(to) { | |
| prev.classList.add('hidden'); | ||
| } | ||
| } | ||
|
|
||
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any special reason to have this in the head? It would block page rendering until it loads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the way it's stated in the documentation: https://developer.linkedin.com/docs/getting-started-js-sdk (in the "Initialize the SDK in your webpage" section).