From 81d01e621805c8c3519e02fec5a605d5e64b819e Mon Sep 17 00:00:00 2001 From: franck cuny Date: Sun, 19 Jun 2011 10:46:51 +0200 Subject: cleanup css, js, and update about + layout Signed-off-by: franck cuny --- public/javascripts/stargit.js | 48 ++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'public/javascripts') diff --git a/public/javascripts/stargit.js b/public/javascripts/stargit.js index 3dacb46..7932329 100644 --- a/public/javascripts/stargit.js +++ b/public/javascripts/stargit.js @@ -120,8 +120,10 @@ var stargit=(function(){ // This function refreshes the graph from the login of // a user: function getGithubGraph(user){ + $("#info_graph_desc").text("Loading a new graph for user "+ user); $("#user").hide(); $("#error").hide(); + url = "/graph/local/"+user; $.ajax({ url: url, @@ -142,6 +144,7 @@ var stargit=(function(){ resetGraph(json); if(document.getElementById("query_input").value) document.getElementById("query_input").value = user; + getNodeDescription(user); } }); } @@ -209,11 +212,32 @@ var stargit=(function(){ setLegend(colorAtts[0]["label"],colorAtts[0]); } } - + + function getNodeDescription(user){ + var url = "/profile/" + user; + $.ajax({ + url: url, + dataType: 'json', + success: + function(json){ + $("#error").hide(); + $("#user").show(); + var gravatar = "http://www.gravatar.com/avatar/" + json.gravatar; + $("#gravatared").attr("src", gravatar); + $("#gravatared").show(); + $("#user_name").text(json.name); + $("#user_website").text(json.website); + $("#user_indegree").text(json.indegree); + $("#user_country").text(json.country); + $("#user_language").text(json.language); + } + }); + } + // PUBLIC FUNCTIONS: return { loadUser: function(name){ - getGithubGraph(name); + getGithubGraph(name); }, setSize: function(e){ @@ -276,27 +300,9 @@ var stargit=(function(){ document.getElementById("query_input").value = query; } }, - onOverNodes: function(nodesArray){ if (nodesArray[0]){ - var url = "/profile/" + nodesArray[0]; - $.ajax({ - url: url, - dataType: 'json', - success: - function(json){ - $("#error").hide(); - $("#user").show(); - var gravatar = "http://www.gravatar.com/avatar/" + json.gravatar; - $("#gravatared").attr("src", gravatar); - $("#gravatared").show(); - $("#user_name").text(json.name); - $("#user_website").text(json.website); - $("#user_indegree").text(json.indegree); - $("#user_country").text(json.country); - $("#user_language").text(json.language); - } - }); + getNodeDescription(nodesArray[0]); } } }; -- cgit v1.2.3