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


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


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.


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.


                <div class="container-fluid text-center">
    <h1><img src="" alt="twitch logo" width="7%"/>Twitch Streamers</h1>
    <article id="online_streams">
      <h2>Online Streamers</h2>
    <article id="featured_streams">
      <h2>Featured Streamers</h2>
      <ul id="online">
      <h3>Online featured streamers</h3>
      <ul id="offline">
      <h3>Offline featured streamers</h3>
      <ul id="closed">
        <h3>The following accounts have been closed or deleted :</h3>
  <footer class="pull-right">Coded by <a href="">Bernard Pagoaga</a></footer>


                .container-fluid {padding: 10vh 5vw;}
main { padding: 5vh 0;}
h1 {
  background: #64459B;
  color: white;
  margin: 0;
  padding-top: 2vh;
  padding-bottom: 1vh;
h1 img {margin-right: 10px;}

@media screen and(max-width: 768px) {
  hi img {width: 20%;}
h2 {
  color: #64459B;
  border-bottom: 1px solid #64459B;
  padding-bottom: 2vh;
h3 {
  color: white;
  background: #64459B;
  padding: 2vh;
ul {
  list-style: none;
  padding: 0;

article {
  clear: both;
  float: none;
  padding: 5vh 0;

a {
  color: #64459B;
  display: inline-block;
  width: 80%;

.btn {text-align: left;}
.btn:hover {
  color: #64459B;

li:hover {
  margin: -1px;
  border: 1px solid #64459B;
  border-radius: 0;
#offline li {
  display: inline-block;
  width: 100%;

li img {
  width: 20%;
  margin-right: 10px;

#closed {display: none;}

.plus {
  color: #64459B;
  margin-left: 10px;
  width: 15%;
  vertical-align: middle;
  cursor: pointer;



                // this function get details for featured streamers
function getStreamDetails(featured_channel){

    $.getJSON(''+channel+'?client_id=q4m6l1ubzqe21xq819bu08ohrfu1d00&callback=?', function(data) {
      var state =;
      if (data.status == 422){
      if (state == null) {
        //put a red background
        var channel =;
        $.getJSON(channel+'?client_id=q4m6l1ubzqe21xq819bu08ohrfu1d00&callback=?', function(channel){
          var stream = new OnlineStream(,, channel.url, channel.logo);
          var li = $('<li>').append($('<a>')
                              .prepend($('<img>').attr('src', stream.thumbnail))
                              .attr('href', channel.url).addClass('btn btn_link').append(;
        //put a green background
        var channel =;
        var stream = new OnlineStream(,, channel.url, channel.logo);
        var game_array = [];
        createUl(game_array, '#online');
        var stream=[stream];
        createLi(stream, "#online");


// Constructor for the OnlineStream Object
function OnlineStream(name, game, url, thumbnail){ = name; = game;
  this.url = url;
  this.thumbnail = thumbnail;

//get the online streams from the twitch API (default limit)
function getStreams(){
  $.getJSON('', function(data) {
    var streams = createObjects(data.streams);
    //Creating Games lists
    var game_array = gameArray(streams);
    createUl(game_array, "#online_streams");
    //Add li of each stream matching the game
    createLi(streams, "#online_streams");

// Create Ul
function createUl(streams, list_id){
    var row = $('<div>').addClass('row');
      var game_ = game.replace(/[\s:']/g,'_');
      var ul= $('<ul>').addClass("col-xs-12 col-sm-4 col-md-3")
                       .attr('id', game_);
      var h2 = $('<h3>').text(game);

// Create Li
function createLi(streams, list_id){
      var game_ =[\s:']/g,'_');
      var li = $('<li>');
      var ul = list_id +" "+ "ul#";
                        .prepend($('<img>').attr('src', element.thumbnail))
                        .attr({href : element.url, target : '_blank'})
                        .addClass('btn btn_link')
                        .attr({title:'Add to your featured streamers'})

//create an array to store all our objects
function createObjects(data){
  var streams = [];
  for(var i=0; i<data.length; i++){
    streams[i] = new OnlineStream(data[i], 
  return streams;

//Create an array listing all different games
function gameArray(array) {
	var game_array = []
	for(var i = 0; i < array.length; i++) {
    var game = array[i].game;
    //var is_in_array = $.inArray(game, game_array);
		if( game_array.indexOf(game) == -1 && game) {
	return game_array;

  //array of featured streams
  var featured_channels = ["freecodecamp", "storbeck", "terakilobyte", "habathcx","RobotCaleb","thomasballinger","noobs2ninjas","beohoff","riotgames", "mushisgosu", "c9sneaky","brunofin"];
  // we use the delegation event of jquery, without this we can't click an element generated by our functions
  $('article').on('click', '.plus',function(){
    var elem = $(this).prev();
    var name = [elem[0].innerText];