diff --git a/server.js b/server.js index 4ae4535..fb499d3 100644 --- a/server.js +++ b/server.js @@ -4210,39 +4210,30 @@ cache(function(data, match, sendBadge, request) { badgeData.colorscheme = '55ACEE'; badgeData.logo = badgeData.logo || logos.twitter; badgeData.links = [ - 'https://twitter.com/intent/follow?screen_name=' + user + 'https://twitter.com/intent/follow?screen_name=' + user, + 'https://twitter.com/' + user + '/followers' ]; - if (data.nobubble) { - badgeData.nobubble = data.nobubble; - sendBadge(format, badgeData); - return; - } - if (badgeData.template === 'social') { - badgeData.links[1] = 'https://twitter.com/' + user + '/followers'; - badgeData.text[1] = ''; - request(options, function(err, res, buffer) { - if (err != null) { - badgeData.text[1] = 'inaccessible'; - sendBadge(format, badgeData); - return; - } - try { - var data = JSON.parse(buffer); - // the data is formatted as an array - data = data[0]; - // data.followers_count could be zero...don't just check if falsey - if(!data.hasOwnProperty('followers_count')){ - badgeData.text[1] = 'invalid'; - } else { - badgeData.text[1] = metric(data.followers_count); - } - } catch(e) { - console.error(e); - badgeData.text[1] = 'invalid'; - } + badgeData.text[1] = ''; + request(options, function(err, res, buffer) { + if (err != null) { sendBadge(format, badgeData); - }); - } + return; + } + try { + var data = JSON.parse(buffer); + // the data is formatted as an array + data = data[0]; + // data.followers_count could be zero...don't just check if falsey + if(!data.hasOwnProperty('followers_count')){ + badgeData.text[1] = ''; + } else { + badgeData.text[1] = metric(data.followers_count); + } + } catch(e) { + console.error(e); + } + sendBadge(format, badgeData); + }); })); // Snap CI build integration. diff --git a/templates/social-template.svg b/templates/social-template.svg index 21c5c4b..386236e 100644 --- a/templates/social-template.svg +++ b/templates/social-template.svg @@ -14,7 +14,7 @@ - {{?!it.nobubble}} + {{?(it.text[1] && it.text[1].length)}} @@ -26,7 +26,7 @@ {{=it.escapeXml(it.capitalize(it.text[0]))}} {{=it.escapeXml(it.capitalize(it.text[0]))}} - {{?!it.nobubble}} + {{?(it.text[1] && it.text[1].length)}} {{=it.escapeXml(it.text[1])}} {{=it.escapeXml(it.text[1])}} diff --git a/try.html b/try.html index 932ee90..df131b9 100644 --- a/try.html +++ b/try.html @@ -502,10 +502,6 @@ Pixel-perfect   Retina-ready   Fast   Consistent   Hackable https://img.shields.io/twitter/follow/shields_io.svg?style=social - Twitter Follow (with no count): - - https://img.shields.io/twitter/follow/shields_io.svg?style=social&nobubble=true -

Miscellaneous