cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <html lang="en">
    <meta charset="utf-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <!-- Bootstrap says:  The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Twitch Streamers</title>
    <!-- Bootstrap -->
    <link href=
    <link href="main.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>

	<div class = "container">
		<h1>Twitch TV Viewer</h1>
		<div id="results">
			<!-- Use this for testing w/o the app.js
			<div class = "row">
				<div class = "col-sm-1 col-xs-3 avatar"><img src = "https://placekitten.com/40/40"></div>
				<div class = "col-sm-3 col-xs-9 screenname">hard coded title</div>
				<div class = "col-sm-8 col-xs-12 description">hard coded to test format -- will put the description here, but it mustn't be too many characters, needs to fit on a mobile phone in 1, maybe two lines</div>
			</div> -->

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src=
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src=
    <script src="app.js">

	height: 60px;
	border-radius: 45%;
	padding: 0px;
	margin: 0px;
	border : 0px;
.avatar img{
	height: 60px;
	border-radius: 45%;
	padding: 10px;
	margin: 0px;
	border : 0px;

	padding: 1em 0em 0em 4em;
	margin:  5px 5px 5px 5px;
	padding: 1.3em 0em 0em 4em;
	background-color: #cbd6de;
	border: 3px solid #b4b9bd;
	background-color: #cfd9df;

              //Thanks http://stackoverflow.com/questions/1093568/scope-problem-with-nested-getjson

var streams = ["OgamingSC2","ESL_SC2","freecodecamp", "storbeck", "terakilobyte", "habathcx","RobotCaleb","thomasballinger","noobs2ninjas","beohoff", "brunofin", "comster404"];
var i = 0;
var gotStream,
var twitchRow = {
	image : 'https://placekitten.com/40/40',
	title : 'Title goes here',
	description : 'description goes here',
	online : '"https://api.twitch.tv/"',

function getData(stream){

	gotStream = false;
	gotChannel = false;
	$.getJSON('https://api.twitch.tv/kraken/streams/'+ streams[i] +'?callback=?', haveStream );
    $.getJSON('https://api.twitch.tv/kraken/channels/'+ streams[i] +'?callback=?', haveChannel);

function haveStream(data){
	streamData = data;
	gotStream = true;
	if (gotChannel){
function haveChannel(data){
	channelData = data;
	gotChannel = true;
	if (gotStream){

function makeRowData(){
	console.log(streamData + channelData);
	twitchRow.title = streams[i];
	if (channelData.error){
		twitchRow.image = '<img src = "https://placekitten.com/140/140">';
		twitchRow.description = 'Not a valid channel';
		console.log(channelData.error + channelData.status + channelData.message);
	} else {
		if (channelData.logo == null){
						twitchRow.image = '<img src = "https://placekitten.com/140/140">';
					}else {
						twitchRow.image = '<img src = "' + channelData.logo +'">';
		if (streamData.stream === null){
				twitchRow.description = 'Station Offline';
				console.log(' inside null' + ' ' + twitchRow.title +' ' + twitchRow.description);
			}else {
				//if (data.stream.game == true){
					twitchRow.description = streamData.stream.game + ' -- ' + streamData.stream.channel.status;
					console.log(' inside stream' + ' ' + twitchRow.title +' ' + twitchRow.description);
	makeRow(twitchRow.image, twitchRow.title, twitchRow.description);

function makeRow(image, title, description){
	//function to append rows to results div
	$('#results').append('<div class = "row"><div class = "col-sm-1 col-xs-3 avatar">'+
	image + '</div><div class = "col-sm-3 col-xs-9 screenname"><h4>' + title + '</h4></div><div class = "col-sm-8 col-xs-12 description">'+ description + '</div>');
	i = i + 1;
	console.log('i is incremented' + i);
	if (i < streams.length){
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................