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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div class="container topper">
	<div class="row head" id="head">
		<div class="col-sm-8">
			<h1>Twitch.tv Guide</h1> 
		</div>
		<div class="col-sm-4 switch">
			<p class="topper"><button class="btn btn-active" id="all">ALL</button>&nbsp;&nbsp;<button class="btn btn-primary" id="online">ONLINE</button>&nbsp;&nbsp;<button class="btn btn-primary" id="offline">OFFLINE</button></p>
		</div>
	</div>
	<div id="online-channels">
		<!-- live channels will go here --> 
	</div>
	<div id="offline-channels">
		<!-- offline channels will go here --> 		
	</div>
	<div id="dead-channels">
		<!-- dead channels will go here --> 		
	</div>	
	<div class="row footer" id="footer">
		<div class="col-sm-12">
			<p>Developed by Mike Morkes</p>
		</div>
	</div>

</div>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Titillium+Web:400,400italic,700,700italic,600italic,600);
body {
	background: #010d19, #1c344c;
	background: linear-gradient(90deg, #010d19, #1c344c);
	font-family: 'Titillium Web', sans-serif;
	text-shadow: 0 0 2px #333;
}

h1 {
	font-weight: 700;
}

h3 {
	font-weight: 600;
}

.topper {
	margin-top: 15px;
}


/* header stuff */

.head {
	background: #1c344c;
	background: linear-gradient(90deg, #32587f, #1c344c);
	color: #fff;
	border: 1px solid #666;
	border-radius: 5px 15px 0 0;
}

.switch {
	text-align: right;
}

.btn-active {
	background: #c6e070;
	color: #333;
	outline: none;
}

.btn {
	border-radius: 5px 10px 5px 10px;
	outline: none;
}


/* channel stuff */

.hideIt {
	display: none;
}

.channel:hover {
	box-shadow: inset 0 0 100px rgba(255, 255, 255, .5);
}

.list-online {
	background: #c6e070;
	background: linear-gradient(90deg, #576c11, #c6e070);
	border-left: 1px solid #666;
	border-right: 1px solid #666;
	border-bottom: 1px solid #666;
}

.list-online a {
	color: #fff;
}

.list-offline {
	background: #ccc;
	background: linear-gradient(90deg, #666, #ccc);
	border-left: 1px solid #666;
	border-right: 1px solid #666;
	border-bottom: 1px solid #666;
}

.list-offline a {
	color: #fff;
}

.list-dead {
	background: #333;
	background: linear-gradient(90deg, #2e2e2e, #666);
	border-left: 1px solid #666;
	border-right: 1px solid #666;
	border-bottom: 1px solid #666;
	color: #000;
}

.logo {
	border-radius: 5px 10px 5px 10px;
	/* border: 5px solid #1c344c; */
	box-shadow: 0 0 7px #333;
}

.logo-bkgd {
	background: rgba(0, 0, 0, .2);
	padding: 2px 5px !important;
	text-align: center;
}

#stream {
	font-size: 17px;
}


/* footer stuff */

.footer {
	background: #1c344c;
	background: linear-gradient(90deg, #32587f, #1c344c);
	color: #fff;
	border-left: 1px solid #666;
	border-right: 1px solid #666;
	border-bottom: 1px solid #666;
	border-radius: 0 0 5px 15px;
	height: 40px;
	padding: 10px;
	text-align: right;
	margin-bottom: 20px;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
	outline: none !important;
}
            
          
!
            
              $(document).ready(function() {

	// switchIt buttons
	$('#all').click(function(evt) {
		evt.preventDefault();
		$(".list-online, .list-offline, .list-dead").removeClass("hideIt");
	})
	$('#online').click(function(evt) {
		evt.preventDefault();
		$(".list-online").removeClass("hideIt");
		$(".list-offline, .list-dead").addClass("hideIt");
	})
	$('#offline').click(function(evt) {
		evt.preventDefault();
		$(".list-offline, .list-dead").removeClass("hideIt");
		$(".list-online").addClass("hideIt");
	})

})

// channel list array
var channelList = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];

// slices the array into individual channels 
function channelSlice(value, index) {
	var broadcast;
	var switchIt;
	var timer;

	// grab data to find out if the channels are streaming, not streaming, or dead
	$.getJSON("https://wind-bow.gomix.me/twitch-api/streams/" + channelList[index] + "?callback=?", function(resultStreams) {
		
		console.log("https://wind-bow.gomix.me/twitch-api/streams/" + channelList[index] + "?callback=?");

		// assign variable based on stream status
		if (resultStreams.stream === undefined) {
			broadcast = "Dead";
		} else if (resultStreams.stream === null) {
			broadcast = "Offline";
		} else {
			broadcast = "Online";
		};

		// grab data about each channel
		$.getJSON("https://wind-bow.gomix.me/twitch-api/channels/" + channelList[index] + "?callback=?", function(result) {

			// check to see if channel has a logo - give custom logo based on offline or dead
			if (result.logo === undefined) {
				result.logo = "http://www.mikemorkes.com/codepen/twitch/dead_logo.png";
			} else if (result.logo === null) {
				result.logo = "http://www.mikemorkes.com/codepen/twitch/generic_logo.png";
			};

			// style and populate an online channel
			if (broadcast === "Online") {

					$("#online-channels").append('<div class="row list-online channel" id="list-online"><a href="https://www.twitch.tv/' + result.name + '" target="_blank"><div class="col-sm-1 logo-bkgd"><p class="topper" id="logo"><img class="logo" src="' + result.logo + '" width="50" height="50"></p></div><div class="col-sm-4"><h3 id="twitch-name">' + result.display_name + '</h3></div><div class="col-sm-6"><p class="topper" id="stream">' + result.game + ": " + result.status + '</p></div></a></div>');
					switchIt = "Online";


				// style and populate a dead channel					
			} else if (broadcast === "Dead") { // this helps make sure the dead channels display last if we have to wait for the data to come in on the channels that do exist

					$("#dead-channels").append('<div class="row list-dead" id="list-dead"><div class="col-sm-1 logo-bkgd"><p class="topper" id="logo"><img class="logo" src="' + result.logo + '" width="50" height="50"></p></div><div class="col-sm-4"><h3 id="twitch-name">' + value + '</h3></div><div class="col-sm-6"><p class="topper" id="stream">' + 'Account Closed/Does Not Exist' + '</p></div></div>');
					switchIt = "Offline";


			} else {

				// style and populate an offline channel	
											 
					$("#offline-channels").append('<div class="row list-offline channel" id="list-offline"><a href="https://www.twitch.tv/' + result.name + '" target="_blank"><div class="col-sm-1 logo-bkgd"><p class="topper" id="logo"><img class="logo" src="' + result.logo + '" width="50" height="50"></p></div><div class="col-sm-4"><h3 id="twitch-name">' + result.display_name + '</h3></div><div class="col-sm-6"><p class="topper" id="stream">' + 'Offline' + '</p></div></a></div>');
					switchIt = "Offline";


			}

		})
	})

}

// Using the forEach method, grab each channel name from the array and loop it in code above
channelList.forEach(channelSlice);
            
          
!
999px
Loading ..................

Console