blob: 7c2ed596e6252eb7c0541529c8cf600e0fa2d211 (
plain)
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
47
48
49
50
51
52
53
|
function setupDribbble(url, el) {
var href = el.href;
if ($('#dribbble-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();
$('#dribbble-link').append(spinner.el);
require(["json!/dribbble/" + username, "text!templates/dribbble-view.html"],
function(dribbble_data, dribbble_view) {
if (dribbble_data.message || dribbble_data.length == 0) {
window.location = href;
return;
}
var template = Handlebars.compile(dribbble_view);
var user = dribbble_data.shots[0].player;
user.following_count = numberWithCommas(user.following_count);
user.followers_count = numberWithCommas(user.followers_count);
user.likes_count = numberWithCommas(user.likes_count);
var template_data = {
"user": user,
"shots": dribbble_data.shots
}
$(template(template_data)).modal().on('hidden', function () {
$(this).remove();
adjustSelection('home-link');
})
spinner.stop();
});
return;
}
window.location = href;
}
|