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='navbar navbar-fixed-top text-center' id='titlebar'>
  <h1><i class="fa fa-twitch"></i> Twitch Streamers</h1>
</div>
<div class='container-fluid'>
<div class="row">
  <div class="text-center">
    <input type='text' name='search' placeholder='Add new channel'>
  </div>
</div>
</div>

<div class='container-fluid text-center' id='content'>
  <div id='online'>
    <h3>Online</h3>
  </div>
  <div id='offline'>
    <h3>Offline</h3>
  </div>
  <div id='inactive'>
    <h3>No Account</h3>
  </div>
</div>
              
            
!

CSS

              
                body {
  background: url('http://cdn0.dailydot.com/cache/32/91/3291d8032d20245571d4f02d3dc71317.jpg') fixed;
  background-size: cover;
}

#titlebar {
  background-color: #6441a5;
  color: white;
}

#content {
  margin-left: auto;
  margin-right: auto;
  width: 40%;
  color: white;
}

a, a:visited, a:focus {
  text-decoration: none !important;
  color: white;
}

a:hover  {
  color: black;
}

.account p, .account h4 {
  word-break: break-word;
  white-space: normal;
  text-align: left;
}

.img-circle {
  margin-top: 10px;
}

.btn {
  opacity: 1;
  color: white;
/*   margin-right: -10px; */
}

.account {
  margin-bottom: 10px;
  color: white;
  border: 1px solid rgb(128,128,128);
  border-radius : 4px;
}

.offline {
 background-color: #6441a5;
 opacity: 0.8;
}

.online {
  background-color: #737373;
}

.inactive {
  background-color: #9bbe5a;
  opacity: 0.8;
}

.offline:hover, .online:hover, .inactive:hover {
  opacity: 1;
}

input {
  margin-top: 100px;
  font-size: 26px;
  width: 50%;
}

.btn:active, .btn:focus {
  outline: none;
}

.container-fluid {
  width: 100%;
}

              
            
!

JS

              
                $(document).ready(function() {
  var added = []; 
  var del = '';
  var channels = ['freecodecamp', 'storbeck', 'terakilobyte', 'habathcx', 'RobotCaleb', 'thomasballinger', 'noobs2ninjas', 'beohoff', 'brunofin', 'comster404', 'frostty_','medrybw'];
  
  getData(channels,added,del);
  
  $('input').keypress(function(event) {
    if (event.which == 13) {
      added.push($(this).val().replace(/\s+/g, ''));
      $(this).val('');
      $('.account').remove();
      getData(channels,added,del);
    }
  })
}) // end of ready function

function getData(channels,added,del) {
  
  var url = 'https://api.twitch.tv/kraken/';
  var type1 = 'streams/'
  var type2 = 'channels/'
  var cb = '?callback=?'; 
  
  added.forEach(function(add) {
    channels.push(add) 
  });
  
  channels = $.unique(channels);
  
  channels.forEach(function(channel) {
    $.ajax({
      async: false,
      url:  url+type1+channel+cb, 
      dataType: 'jsonp',
      error: function() {
        alert('ERROR!'); },
      success: function(online) { 
        if (online.stream) {
          name = online.stream.channel.display_name;
          status = online.stream.channel.status;
          href = online.stream.channel.url;
          div = $('#online');
          state = 'online';
          pic = online.stream.channel.logo ? online.stream.channel.logo : "http://www.cpme.eu/wp-content/uploads/2015/07/blank-profile2.png";
          active = true;
          results(active,channels,del);
        }
        else if (online.error) {
          name = channel;
          status = 'NO ACCOUNT';
          href = '#';
          div = $('#inactive');
          state = 'inactive';
          pic = "http://www.cpme.eu/wp-content/uploads/2015/07/blank-profile2.png";
          active = false;
          results(active,channels,del);
        }
        else {
          $.ajax({
            async: false,
            url:  url+type2+channel+cb, 
            dataType: 'jsonp',
            error: function() {
              alert('ERROR!'); },
            success: function(offline) {            
              name = offline.display_name;
              status = 'OFFLINE';
              href = offline.url;
              div = $('#offline');
              state = 'offline';
              pic = offline.logo ? offline.logo : "http://www.cpme.eu/wp-content/uploads/2015/07/blank-profile2.png";
              active = true;
              results(active,channels,del);
            }, // end of success function
          }) // end of ajax call for offline
        } // end of else offline
      } // end of success function for all 
    }); // end of ajax call for all
  }) // end of channel loop
} // end of getData()

function results(active,channels,del) {  
  aStart = active ? '<a target="_blank" href="' + href + '">' : '';
  aEnd =  active ? '</a>' : '';
  div.append('<div class="account row ' + state + '"><div class="col-sm-3 col-lg-2"><img class="img-circle img-responsive" src="' + pic + '"/></div><div class="col-sm-7">' + aStart + '<h4><strong>' + name + '</strong></h4><p><i>' + status + '</i></p></div>' + aEnd + '<div class="col-sm-2 col-sm-offset-0 col-lg-offset-1"><button class="btn col-sm-2 close"><i class="fa fa-times"></i></button></div></div>');
  
  $('button').on('click',function() {
    $(this).closest('.account').slideUp();
    del = $(this).closest('.account').find('strong').html().toLowerCase().replace(/\s+/g, '');
    index = channels.indexOf(del);
    index > -1 ? channels.splice(index, 1) : null;
  });
  
}
              
            
!
999px

Console