blob: 7bad5ea37abfe8bb9e9b28fe7b4774101b3d4842 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
function setupGithub(url, el) {
var href = el.href;
if ($('#github-profile').length > 0) {
window.location = href;
return;
}
var params = url.attr('path').split('/').filter(function(w) {
if (w.length)
return true;
return false;
})
if (params.length == 1) {
var username = params[0];
var spinner = new Spinner(spin_opts).spin();
$('#github-link').append(spinner.el);
require(["json!/github/" + username, "text!templates/github-view.html"],
function(github_data, github_view) {
if (github_data.error || github_data.length == 0) {
window.location = href;
return;
}
var template = Handlebars.compile(github_view);
github_data.user.following_count = numberWithCommas(github_data.user.following_count)
github_data.user.followers_count = numberWithCommas(github_data.user.followers_count)
$(template(github_data)).modal().on('hidden', function () {
$(this).remove();
adjustSelection('home-link');
})
spinner.stop();
});
return;
}
window.location = href;
}
|