cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

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 j">
	
  <div id="app">
    
      <header>
				 <h1>Twitch <i class="fa fa-twitch"></i>  Streamers</h1><br>
      <div class="buttons ">
        <button class="btn  btn-primary" id="all">All</button>
        <button class="btn  btn-success" id="online">Online</button>
        <button class="btn  btn-danger" id="offline">Offline</button>
      </div>
    </header>
		<ul class="list-group tx"><li class="list-group-item">
			<div class="channelList"></div></li></ul>
  </div>
</div>

<div class="me">
	<h5>
Made with  <i class="fa fa-heart fa-2x"></i> by Vani Ananthuni &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://vaniananthuni.com" target="_blank" class="paw">
    <i class="fa fa-paw fa-4x"></i> visit my portfolio
			</a></div>
	</div>
            
          
!
            
              body {
 background: url("http://wallpoper.com/images/00/41/83/28/abstract-purple_00418328.jpg");
}
#app {
	twitchbg;
background: rgba(255, 255, 255, 0.5);  margin: 50px auto;
  padding: 20px;
  padding-bottom: 10px;
}
.j{
	width:65%;
}

header {
  height: 100px;
	color:rgb(60,0,100);
	
}

header h1 {
  float: left;
  margin: 8px 10px 10px;
}
header .buttons {
 float: right;
  margin: 2px;
}

.channel {
  position: relative;
  height: 4.375em;
	overlistbg;
  background: #CCCCCC;
  margin-bottom: 10px;

}
.channel:hover {
	padding: 0.1%;
	 border-left: 5px solid rgb(60,0,120);
}
.channel a {
  color: rgb(60,0,120);
	
}
.channel .status {
  float: right;
  margin: 1.6em 2.3em 0 0;
}
.channel .name {
  float: left;
  margin: 1.4em 0 0 0.2em;
}
.channel .round {
  position: absolute;
  top: 1.8em;
  right: 0.6em;
  height: 15px;
  width: 15px;
  border-radius: 50%;
}
.channel .image {
  float: left;
  height: 3.125em;
  width: 3.125em;
  margin: 0.625em;
  overflow: hidden;
	 border-radius: 50%;
}
.channel .image img {
  height: 3.125em;
}

.red {
  background: red;
}

.green {
  background: green;
}

.off, {
  background: yellow;
}

.me {
	font-size: 100%;
	text-align: center;
	/*position: absolute;
right:0px;*/
	bottom: 0px;
	background: rgba(250, 250, 250, 0.2);
	color: white !important;
}
.fa-paw,.paw{
	color:white !important;
}

            
          
!
            
              $(document).ready(function() {
	getAllData();
	//display only online
	$("#online").click(function() {
		$(".online").show();
		$(".offline").hide();
	});
	//display only offline
	$("#offline").click(function() {
		$(".online").hide();
		$(".offline").show();
	});
	//display both online and offline
	$("#all").click(function() {
		$(".online").show();
		$(".offline").show();
	});

});
//get channel info from twitch
function channelInfo(channel) {
	return $.getJSON('https://api.twitch.tv/kraken/channels/' + channel + '?client_id=3ayqtffruo2goxf0cvyp75wjm28g4pq&callback=?');
}
//get streaming info from twitch

function streamInfo(channel) {
	return $.getJSON('https://api.twitch.tv/kraken/streams/' + channel + '?client_id=3ayqtffruo2goxf0cvyp75wjm28g4pq&callback=?');
}

//get data for these channels 

function getAllData() {
	var channels = [
		"Xydara", "ESL_SC2","summit1g", "freecodecamp",
		"FORMAL", "medrybw", "CapcomFighters",
		"brunofin", "mendokusaii", "noobs2ninjas",
		"sparcmaclived", "HSdogdog", "monstercat", "creative", "YoDa", "IWillDominate", "CobaltStreak", "DansGaming", "Maximilian_DOOD", "wiizaav", "alisonquinn", "Scarra", "Vinesauce","ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"
	];
	//do what for each channels
	channels.forEach(function(channel) {
		$.when(channelInfo(channel), streamInfo(channel))
			.done(function(channelData, streamData) {
				var player = createPlayerObject(channel, channelData[0], streamData[0]);
				addPlayerToPage(player);
			})
			//do this if above fails
			.fail(function() {
				var player = createPlayerObject(channel);
				addPlayerToPage(player);
			});
	});
}
//interpreting channel info
function createPlayerObject(channel, channelData, streamData) {
	var player = {};

	if (channelData) {
		player.name = channelData.display_name;
		player.url = channelData.url;
		player.logo = channelData.logo || "https://dummyimage.com/50x50/ecf0e7/5c5457.jpg&text=0x3F";
		if (streamData.stream == null) {
			player.game = "Offline";
			player.state = "offline";
			player.color = "red";
		} else {
			player.game = "<strong>" + streamData.stream.game + "</strong>";
			player.state = "online";
			player.color = "green";
		}
	} else {
		player.name = channel;
		player.game = "Player Deativated";
		player.logo = "https://pbs.twimg.com/profile_images/2349866958/m9pjwl1x1n3nvzf8x8rc.png";
		player.url = "#";
		player.state = "offline";
		player.color = "off";
	}

	return player;
}
//displaying channel info
function addPlayerToPage(player) {
	var channelTemplate = "<div class='channel " + player.state + "'><a href='" + player.url + "' target='_blank'><div class='round " + player.color + "'></div><div class='image'><img src='" + player.logo + "' /></div><h5 class='name'>" + player.name + "</h5><p class='status'>" + player.game + "</p></a></div>";

	$(".channelList").append(channelTemplate);
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console