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. 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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 logo">
    <i class='fa fa-twitch col-xs-6 col-xs-offset-3 text-center'></i>
  </div>
  <div class="row header">
    <h1 class="text-center col-xs-6 col-xs-offset-3 hidden-xs">
      TwitchTV
    </h1>
  </div>

  <div class="row buttons">
    <div class='col-xs-4 col-xs-offset-4'>
    <button id='all' class='btn btn-block'>All</button>
    <button id='online' class='btn btn-block '>Online</button>
    <button id='offline' class='btn btn-block'>Offline</button>
    </div>
  </div>
  <div class='row'>
    <div class='col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2'>
    <table hidden class='table table-bordered table-responsive table-condensed'>
                          
    </table>
    </div>
  </div>
</div>

<div class="container-fluid footer " hidden>
  <div class='row text-center'><p class='text-center'>Made by Wo1v3r</p>
    <i class='fa fa-twitch col-xs-6 col-xs-offset-3'></i>

  </div>
</div>
              
            
!

CSS

              
                @import 'https://fonts.googleapis.com/css?family=Chewy';


$colors: #A8E0E1,
#5A96BB,
#75448C,
#C46CAA;
body {
  background-color: nth($colors, 2);
    margin-top: 1em;

}

.logo{
  color: nth($colors,3);
  font-size: 6em;
  position: relative;
  overflow:hidden;
  right: 10em;
  opacity: 0;
}
.logo > i {
  text-shadow: 2px 2px nth($colors,4);
}

h1{
  margin-bottom:0.5em;
  font-size:6em;
  font-family: 'Chewy', cursive;
  color: nth($colors,4);
    text-shadow: 2px 2px nth($colors,3);

}
table {
  margin-top: 1em;
}
.buttons{
  margin-top: 1em;
}
button{
  color:white;
}
#all{
  background-color: nth($colors,1);
      font-weight:bold;

}

#online{
  background-color: nth($colors,4);
    font-weight:bold;

}

#offline{
  background-color: nth($colors,3);
      font-weight:bold;

}
.image {
  max-width: 150px;
}

img {
    border: 2px solid nth($colors,1)

}
.table-bordered>tbody>tr>td{
 border: 1px  solid nth($colors,1);

}
.table-bordered>tbody>tr {
  background-color: nth($colors,3);
}

.table-bordered>tbody>.online {
  background-color: nth($colors,4);

}

.footer {
  background-color: nth($colors, 3);
  color: nth($colors,4);
}



a {
  color: white;
  font-weight:bold;
}

a:hover,a:active{
  color: nth($colors,1);
  text-decoration: none;
}

h4 {
  font-family: 'Chewy', cursive;
  color: nth($colors,4);
}
.online h4 {
  color: nth($colors,1);
}



              
            
!

JS

              
                var requestDone = false;
var results = [];

var getResults = function() {
  var streamer;
  var streamers = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas", "comster404"];

  streamers.forEach(function(name) {
    $.getJSON('https://api.twitch.tv/kraken/channels/' + name + '/?callback=?', function(data1) {
      $.getJSON('https://api.twitch.tv/kraken/streams/' + name + '/?callback=?', function(data2) {
        streamer = new Streamer(data2, data1, name);
        if (results.push(streamer) == streamers.length) {
          requestDone = true;
          sortResults();
          addResults();
              $(".logo").animate({
        left: '0em',opacity:1
               
    },'slow');
        }
      });

    });
  });
}

//on ready
$(document).ready(function() {

        getResults();

        $('.btn').click(function() {
          var action = $(this).attr('id');
          buttonClicked(action);
        });
      });

    //Defining functions used upon document.ready:

    var buttonClicked = function(button) {
      $('.table').fadeOut(function() {
        switch (button) {
          case 'all':
            $('tr').show();

            break;
          case 'online':
            $('tr').hide();

            $('.online').show();
            break;
          case 'offline':
            $('tr').show();
            $('.online').hide();

        }
        $('.table').fadeIn();

      });

    }

    var sortResults = function() {
      results.sort(function(a, b) {
        return (!a.online || b.online);
      })
    }

    var addResults = function() {
      results.forEach(function(curr) {
        $('.table').append(trHtml(curr));
      });

      $('.table').fadeIn(800);
      $('.footer').fadeIn();
    }

    //Streamer constructor
    function Streamer(resultStream, resultChannel, name) {
      if (resultChannel.status == 422) {
        this.name = name;
        this.image = 'https://placeholdit.imgix.net/~text?txtsize=33&txt=150%C3%97150&w=150&h=150';
        this.description = "Channel not available";
        this.online = null;

      } else {
        this.name = resultChannel.display_name;
        this.image = resultChannel.logo;
        this.description = resultChannel.game + ": " + resultChannel.status;
        this.online = (resultStream.stream != null);
      }
    }

    function trHtml(streamer) {
      var link = 'https://www.twitch.tv/' + streamer.name.toLowerCase();
      var anchorOpen = '<a href="' + link + '">';

      var trHtml = '<tr class="';

      if (streamer.online) {
        trHtml += 'online';
      }
      trHtml += '">';
      trHtml += '<td class="image">';
      trHtml += '<img class="img-responsive img-circle" src="';
      trHtml += streamer.image;
      trHtml += '">';
      trHtml += '</td><td class="name  hidden-xs">';
      trHtml += '<h4>';
      trHtml += streamer.name;
      trHtml += '</h4>';
      trHtml += '</td><td class="description">';
      trHtml += anchorOpen;
      trHtml += '<p>'
      if (streamer.online == null) {
        trHtml += streamer.description;
      } else if (streamer.online) {
        trHtml += "Streaming: " + streamer.description;
      } else {
        trHtml += "Channel currently not streaming.";
      }
      trHtml += '</a></p></td></tr>';
      return trHtml;
    }
              
            
!
999px

Console