Last active
May 30, 2016 00:38
-
-
Save reline/bef2c9d50833ad16d4de 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
function githubFeed($user) { // string param for GitHub username | |
$.ajax({ | |
type: "GET", | |
url: "http://cors.io/?u=https://github.com/" + $user + ".atom", | |
cache: false, | |
dataType: 'xml', | |
success: function(result) { | |
console.log($user + ".atom loaded"); | |
var atom = $("<span />", { html: result.firstChild }).text(); | |
var githubActivity = $("#githubActivity"); | |
githubActivity.html(atom); | |
var children = githubActivity.children(); | |
githubActivity.html(children); | |
$('.github a').each(function () { | |
var href = $(this).attr('href'); | |
if (href) { | |
href = "https://github.com" + href; | |
$(this).attr('href', href); | |
$(this).attr('target', "_blank"); | |
} | |
}); | |
$("#github-container").addClass("atom-container"); | |
}, | |
error: function (err) { | |
console.log("AJAX error in request: " + JSON.stringify(err, null, 2)); | |
}, | |
async: true | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment