Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
 <div class="row">
  <div class="col-md-6 col-md-offset-3">

   <header>
    <h1>Twitch Streamers</h1>
    <nav class="text-left">
     <ul class="nav nav-pills">
      <li id="all" role="presentation" class="active"><a href="#">All</a></li>
      <li id="online" role="presentation"><a href="#">Online</a></li>
      <li id="offline" role="presentation"><a href="#">Offline</a></li>
     </ul>
    </nav>
   </header>

   <section>
    <!-- User information loaded with JavaScript-->
   </section>
   <footer>
    <p class="text-center">
     Created by Danielle "Dani" Moss &copy; 2017
     <a href="https://twitter.com/danijmoss" target="_blank">
      <i class="fa fa-twitter-square" aria-hidden="true" aria-label="Twitter"></i>
     </a>
     <a href="https://github.com/danijmoss" target="_blank">
      <i class="fa fa-github-square" aria-hidden="true" aria-label="Github"></i>
     </a>
     <a href="https://www.freecodecamp.com/danijmoss" target="_blank">
      <i class="fa fa-free-code-camp" aria-hidden="true" aria-label="FreeCodeCamp"></i>
     </a>
     <a href="http://s.codepen.io/Qwicksilver/debug/NNopZQ/PNrvYLGbKaXM" target="_blank">
      <i class="fa fa-codepen" aria-hidden="true" aria-label="Codepen"></i>
     </a>
    </p>
   </footer>
  </div>
 </div>
</div>
              
            
!

CSS

              
                body {
	background: #d1c4e9;
	color: #f5f5f5;
}

header {
	background: #8e24aa;
	color: #fff;
	padding: 12px 0 12px 12px;
	border-bottom: 5px solid white;
	border-radius: 15px 15px 0 0;
	margin-top: 10px;
}

.nav.nav-pills > li {
	padding: 10px;
}

.offline {
	background: #6200ea;
}

.online {
	background: #b388ff;
}

dl {
	margin-bottom: 0px;
}
 
.dl-horizontal {
	padding: 8px;
	border-bottom: 5px solid white;
	margin-top: 0px;
}

.icon {
	padding: 10px;
}

h4, 
dd > h4 > a,
dd > h4 > a:hover {
	color: #fff;
}

dd > a:hover {
	color: #fff;
	text-decoration: underline;
}

.stream a {
	color: #fff;
}

.stream a:hover {
	color: #fff;
}

.nav>li#all>a {
    text-decoration: none;
	 color: #fff;
	 font-weight: 600;
}

.nav>li#offline>a {
    text-decoration: none;
    background-color: #6200ea;
	 color: #fff;
	 font-weight: 600;
}

.nav>li#online>a {
    text-decoration: none;
    background-color: #b388ff;
	 color: #fff;
	 font-weight: 600;
}

.nav>li>a:focus, .nav>li>a:hover {
    text-decoration: none;
    background-color: #7c4dff;
	 color: #fff;	
}

footer {
	background: #4a148c;
	color: #fff;
	padding: 20px;
	border-radius: 0 0 15px 15px;
}

footer p {
	font-size: 17px;
}

footer a {
	color: #fff;
}

footer a:hover {
	color: #fff;
	text-decoration: underline;
}
              
            
!

JS

              
                $(document).ready(function() {
	// All Button - View all streamers
	$("#all").click(function() {
		$(".online").show(1000);
		$(".offline").show(1000);
	});
	// END All Button

	// Online Button - View streamers currently online
	$("#online").click(function() {
		$(".offline").hide(1000);
		$(".online").show(1000);
	});
	// END Online Button

	// Offline Button - View streamers that are offline
	$("#offline").click(function() {
		$(".online").hide(1000);
		$(".offline").show(1000);
	});
	// END Offline Button

	/*--------------------------------------------------------------------*/

	//List of users
	var userList = [
		"ESL_SC2",
		"OgamingSC2",
		"cretetion",
		"freecodecamp",
		"storbeck",
		"habathcx",
		"RobotCaleb",
		"noobs2ninjas",
		"brunofin",
		"comster404"
	];

	//Parts of url
	var urlStart = "https://wind-bow.gomix.me/twitch-api/streams/";
	var urlEnd = "?callback=?";

	//Array to hold offlie users
	var channelUser = [];

	//Loop through user list
	for (i = 0; i < userList.length; i++) {
		//User in url
		var user = userList[i];

		//Full url
		var fullURL = urlStart + user + urlEnd;
		//console.log(fullURL);

		makeRequest(user, fullURL);

		function makeRequest(user, Url) {
			//JSON call for data
			$.getJSON(Url, function(data) {
				//If stream is active show stream info, have icon and stream name as links, show online status
				if (data.stream !== null) {
					//Stream Info
					var stream = data.stream.channel.status;
					var userName = data.stream.channel.display_name;
					var icon = data.stream.channel.logo;
					var url = data.stream.channel.url;

					$("section").append(
						'<dl class="dl-horizontal online"><dt><a href="' +
							url +
							'" target="_blank"><img class="icon img-responsive pull-left" width="100px" src="' +
							icon +
							'" alt="Icon for the Twitch channel of ' +
							userName +
							'"></a></dt><dd><h4><a class="user" href="' +
							url +
							'" target="_blank">' +
							userName +
							'</a></h4><p class="stream"><a href="' +
							url +
							'" target="_blank">' +
							stream +
							'</a></p><h4 class="status">Online</h4></dd></dl>'
					);
				} else {
					//URL for offline users
					var channelUrl =
						"https://wind-bow.gomix.me/twitch-api/channels/" + user + urlEnd;

					//JSON call for offline users
					$.getJSON(channelUrl, function(channels) {
						//Channel Info
						var channel_userName = channels.display_name;
						var channel_icon = channels.logo;
						var channel_url = channels.url;

						//Checking if the user's account can be found
						//If not, append the HTML code below saying the user cannot be found
						//and show the user as offline
						if (!channel_userName || channel_icon === null) {
							$("section").append(
								'<dl class="dl-horizontal offline"><dt><img class="icon img-responsive pull-left" width="100px" src="https://static-cdn.jtvnw.net/jtv_user_pictures/xarth/404_user_70x70.png" alt="Unknown Twitch channel"></dt><dd><h4>Channel for ' +
									user +
									" is Not Found</h4><h4 class='status'>Offline</h4></dl>"
							);
						} else {
							$("section").append(
								'<dl class="dl-horizontal offline"><dt><a href="' +
									channel_url +
									'" target="_blank"><img class="icon img-responsive pull-left" width="100px" src="' +
									channel_icon +
									'" alt="Icon for the Twitch channel of ' +
									channel_userName +
									'"></dt></a><dd><a class="user" href="' +
									channel_url +
									'" target="_blank"><h4>' +
									channel_userName +
									'</h4></a><h4 class="status">Offline</h4></dd></dl>'
							);
						} 
				// if(channel_icon === null && icon) {
				// 			$("dt").html('<img class="icon img-responsive pull-left" width="100px" src="https://static-cdn.jtvnw.net/jtv_user_pictures/xarth/404_user_70x70.png" alt="Unknown Twitch channel">');
				// 		}
						
					});
				}
			});
		}

		
	}
});

//Check if the image is null and use placeholder image if true
		// if(!$('img').attr('src')) {
		// 	$('img').attr('src','https://static-cdn.jtvnw.net/jtv_user_pictures/xarth/404_user_70x70.png');
		// }

// $.getJSON("https://wind-bow.gomix.me/twitch-api/channels/storbeck?callback=?", function(data) {
// 	console.log(data);
// });

              
            
!
999px

Console