From eb2c0776c90cf7c29269b792b82afc7246b62067 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Fri, 25 Jul 2014 05:13:58 +0000 Subject: [PATCH] [fix] /.json error --- public/javascripts/jquery.coderwall.js | 27 +++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/public/javascripts/jquery.coderwall.js b/public/javascripts/jquery.coderwall.js index 60df594c..2e860eed 100644 --- a/public/javascripts/jquery.coderwall.js +++ b/public/javascripts/jquery.coderwall.js @@ -28,24 +28,25 @@ width = $(this).attr("data-coderwall-badge-width") || opts.width, orientation = $(this).attr("data-coderwall-orientation") || opts.orientation, url = CODERWALL_API_URL.replace(/:username/, username); + if (!jQuery.isEmptyObject(username)) { + root.addClass("coderwall-root").addClass(orientation); - root.addClass("coderwall-root").addClass(orientation); + $.getJSON(url, function (response) { + $(response.data.badges).each(function () { + var link = $("").attr({ href: CODERWALL_USER_URL.replace(/:username/, username) }), + img = $("") + .addClass("coderwall-badge") + .attr({ src: this.badge, width: width, height: width, alt: this.description }); - $.getJSON(url, function (response) { - $(response.data.badges).each(function () { - var link = $("").attr({ href: CODERWALL_USER_URL.replace(/:username/, username) }), - img = $("") - .addClass("coderwall-badge") - .attr({ src: this.badge, width: width, height: width, alt: this.description }); + link.append(img); + root.append(link); + }); - link.append(img); - root.append(link); + root.append(LOGO_HTML); }); - - root.append(LOGO_HTML); - }); + } }); - } + }; $(function () { $(".coderwall").coderwall();