Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Jonathan Schneider
Jonathan Schneider
2,686 Points

Treehouse badge API

Hey guys, it is possible to get all badges with a api call? I would like to have my badge show on my website. Thanks!

4 Answers

Brett Connolly
Brett Connolly
12,874 Points

I made a pen that uses the shadow DOM and a Javascript closure to build a Treehouse activity widget/component from the Treehouse API without JQuery or external libraries (only external stylesheets). Been wanting to learn more about the shadow DOM and how it works so this was a fun chance to give it a shot. Not sure if this will work in most browsers outside Chrome, though.

Gonna keep playing with it to get it responsive and maybe add some animations. Only requires you to add my code inline wherever you want it to appear in your HTML. Javascript needs to be placed after the template HTML in order for it to work. Added in the 'Varela Round' font from Google Fonts in the Javascript since it looked most similar to Treehouse's font. Also added the 'devIcon' CSS as an import in the template stylesheets to get the language icons (yes, I know the business icon is for Bootstrap, had to improvise from the icons I had). There are a few modifiable variables at the top of the Javascript. Obviously, you'll want to change the username to your own.

http://codepen.io/HaulinOats/pen/MaBZGL

Christopher Parke
Christopher Parke
21,978 Points

Is there any way to display the leaderboard?