Skip to content

Commit eb2c077

Browse files
committed
[fix] /.json error
1 parent 2f9ebc1 commit eb2c077

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

public/javascripts/jquery.coderwall.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,25 @@
2828
width = $(this).attr("data-coderwall-badge-width") || opts.width,
2929
orientation = $(this).attr("data-coderwall-orientation") || opts.orientation,
3030
url = CODERWALL_API_URL.replace(/:username/, username);
31+
if (!jQuery.isEmptyObject(username)) {
32+
root.addClass("coderwall-root").addClass(orientation);
3133

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 });
3340

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+
});
4044

41-
link.append(img);
42-
root.append(link);
45+
root.append(LOGO_HTML);
4346
});
44-
45-
root.append(LOGO_HTML);
46-
});
47+
}
4748
});
48-
}
49+
};
4950

5051
$(function () {
5152
$(".coderwall").coderwall();

0 commit comments

Comments
 (0)