Skip to content

Commit

Permalink
a testing: abort getJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
hit9 committed Feb 25, 2013
1 parent 97937b5 commit 6655c89
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 53 deletions.
12 changes: 7 additions & 5 deletions coffee/ghresume.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ if !username
desktoppr_api = "https://api.desktoppr.co/1/wallpapers/random"
$.getJSON(desktoppr_api,
(res)->
$("body").css("background-image","url("+res.response.image.url+")")
#$("body").css("background-image","url("+res.response.image.url+")")
)

# user information
$.getJSON(api_url+username,
(res)->
$.ajax({
url: api_url+username,
type: "get",
datatype: "json",
success: (res)->
$(document).attr("title", res.login+"'s "+ document.title)
# avatar size: 170
avatar_url = "https://secure.gravatar.com/avatar/" + res.gravatar_id + "?size=170"
Expand Down Expand Up @@ -65,7 +67,7 @@ $.getJSON(api_url+username,
hireable = "NO"
$("#hireable").css("background-color", "#555")
$("#hireable").text(hireable)
)
})

# get repos and display the first 5 repos

Expand Down
14 changes: 5 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@
<link href="http://fonts.googleapis.com/css?family=Open+Sans:regular,semibold,italic,italicsemibold|PT+Sans:400,700,400italic,700italic|PT+Serif:400,700,400italic,700italic" rel="stylesheet" />
<!-- rusume style sheet -->
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="vendors/js-url.min.js" type="text/javascript" charset="utf-8"></script>
<!-- application js -->
<script src="js/ghresume.js" type="text/javascript" charset="utf-8"></script>

<!--[IF IE]>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
alert("IE is not supported!");
window.location.href = "http://www.google.com/chrome";
$.noConflict();
</script>
<![endif]-->
<script src="vendors/js-url.min.js" type="text/javascript" charset="utf-8" language="javascript"></script>
</head>
<body>

Expand Down Expand Up @@ -88,5 +82,7 @@ <h2>Popular Repositories</h2>
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub">
</a>

<!-- application js-->
<script src="./js/ghresume.js" type="text/javascript" charset="utf-8" language="javascript"></script>
</body>
</html>
81 changes: 42 additions & 39 deletions js/ghresume.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,50 @@

desktoppr_api = "https://api.desktoppr.co/1/wallpapers/random";

$.getJSON(desktoppr_api, function(res) {
return $("body").css("background-image", "url(" + res.response.image.url + ")");
});
$.getJSON(desktoppr_api, function(res) {});

$.getJSON(api_url + username, function(res) {
var avatar_url, followers, hireable, name;
$(document).attr("title", res.login + "'s " + document.title);
avatar_url = "https://secure.gravatar.com/avatar/" + res.gravatar_id + "?size=170";
$("#avatar").attr("src", avatar_url);
if (res.name) {
name = res.name;
} else {
name = username;
}
$("#name").html("<a href=\"https://github.com/" + username + "\">" + name + "</a>");
if (res.location) {
$("ul#user-info").append(" <li> <i class=\"icon-map-marker icon-white\"></i> " + res.location + " </li> ");
}
if (res.email) {
$("ul#user-info").append(" <li> <i class=\"icon-envelope icon-white\"></i> " + res.email + " </li> ");
}
if (res.company) {
$("ul#user-info").append(" <li> <i class=\"icon-user icon-white\"></i> " + res.company + " </li> ");
}
if (res.blog) {
$("ul#user-info").append(" <li> <i class=\"icon-home icon-white\"></i> <a href=\"" + res.blog + "\" >" + res.blog + "</a> </li>");
}
if (res.followers >= 1000) {
followers = (res.followers / 1000).toFixed(1) + "k";
} else {
followers = res.followers;
}
$("#follower-number").text(followers);
if (res.hireable) {
hireable = "YES";
$("#hireable").css("background-color", "#199c4b");
} else {
hireable = "NO";
$("#hireable").css("background-color", "#555");
$.ajax({
url: api_url + username,
type: "get",
datatype: "json",
success: function(res) {
var avatar_url, followers, hireable, name;
$(document).attr("title", res.login + "'s " + document.title);
avatar_url = "https://secure.gravatar.com/avatar/" + res.gravatar_id + "?size=170";
$("#avatar").attr("src", avatar_url);
if (res.name) {
name = res.name;
} else {
name = username;
}
$("#name").html("<a href=\"https://github.com/" + username + "\">" + name + "</a>");
if (res.location) {
$("ul#user-info").append(" <li> <i class=\"icon-map-marker icon-white\"></i> " + res.location + " </li> ");
}
if (res.email) {
$("ul#user-info").append(" <li> <i class=\"icon-envelope icon-white\"></i> " + res.email + " </li> ");
}
if (res.company) {
$("ul#user-info").append(" <li> <i class=\"icon-user icon-white\"></i> " + res.company + " </li> ");
}
if (res.blog) {
$("ul#user-info").append(" <li> <i class=\"icon-home icon-white\"></i> <a href=\"" + res.blog + "\" >" + res.blog + "</a> </li>");
}
if (res.followers >= 1000) {
followers = (res.followers / 1000).toFixed(1) + "k";
} else {
followers = res.followers;
}
$("#follower-number").text(followers);
if (res.hireable) {
hireable = "YES";
$("#hireable").css("background-color", "#199c4b");
} else {
hireable = "NO";
$("#hireable").css("background-color", "#555");
}
return $("#hireable").text(hireable);
}
return $("#hireable").text(hireable);
});

$.getJSON(api_url + username + "/repos", function(res) {
Expand Down

0 comments on commit 6655c89

Please sign in to comment.