|
28 | 28 | width = $(this).attr("data-coderwall-badge-width") || opts.width,
|
29 | 29 | orientation = $(this).attr("data-coderwall-orientation") || opts.orientation,
|
30 | 30 | url = CODERWALL_API_URL.replace(/:username/, username);
|
| 31 | + if (!jQuery.isEmptyObject(username)) { |
| 32 | + root.addClass("coderwall-root").addClass(orientation); |
31 | 33 |
|
32 |
| - root.addClass("coderwall-root").addClass(orientation); |
| 34 | + $.getJSON(url, function (response) { |
| 35 | + $(response.data.badges).each(function () { |
| 36 | + var link = $("<a/>").attr({ href: CODERWALL_USER_URL.replace(/:username/, username) }), |
| 37 | + img = $("<img/>") |
| 38 | + .addClass("coderwall-badge") |
| 39 | + .attr({ src: this.badge, width: width, height: width, alt: this.description }); |
33 | 40 |
|
34 |
| - $.getJSON(url, function (response) { |
35 |
| - $(response.data.badges).each(function () { |
36 |
| - var link = $("<a/>").attr({ href: CODERWALL_USER_URL.replace(/:username/, username) }), |
37 |
| - img = $("<img/>") |
38 |
| - .addClass("coderwall-badge") |
39 |
| - .attr({ src: this.badge, width: width, height: width, alt: this.description }); |
| 41 | + link.append(img); |
| 42 | + root.append(link); |
| 43 | + }); |
40 | 44 |
|
41 |
| - link.append(img); |
42 |
| - root.append(link); |
| 45 | + root.append(LOGO_HTML); |
43 | 46 | });
|
44 |
| - |
45 |
| - root.append(LOGO_HTML); |
46 |
| - }); |
| 47 | + } |
47 | 48 | });
|
48 |
| - } |
| 49 | + }; |
49 | 50 |
|
50 | 51 | $(function () {
|
51 | 52 | $(".coderwall").coderwall();
|
|
0 commit comments