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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <div class="content">
  <div class="jumbotron">
    <div class="container">
      <div class="row">
        <div class="col-12 text-center headerTwitch">
<table class="table table-sm ">
  <thead class="thead-inverse">
          <tr>
            <th class="text-center"><h1>Twitch TV JSON</h1></th>
          </tr>
        </thead>
  <tbody><tr><td class="fccLink table-active">
  <a href="https://www.twitch.tv/freecodecamp" target="_blank">
          <h4 id="fccStatus"></h4>
          </a>  
    </td></tr>
    <tr>
      <td class="filterRow"><button type="button" class="btn btn-primary" id="allStream">All</button> <button type="button" class="btn btn-success" id="onStream">Online</button> <button type="button" class="btn btn-info" id="offStream">Offline</button></td>
    </tr>
  
  </tbody>
  
  
  
          </table>
        </div>
      </div>

      <div class="row">      
      <table class="table table-sm table-bordered">
        <thead class="thead-inverse ">
          <tr>
            <th class="text-center">Logo</th>
            <th class="text-center">Display Name</th>
            <th class="text-center">Current Status</th>
          </tr>
        </thead>
        <tbody id="channelInfo">
        
        </tbody>
      </table>
      </div>
    </div>
  </div>
</div>
            
          
!

CSS

            
              .jumbotron {
    background: rgba(0,0,0,0.0);
}


div.headerTwitch {
  background: rgba(0,0,0,.0);
  border-radius: 25px;
  font-variant: bold;
}

td.fccLink a{
  color: black;
}

td.filterRow{
  vertical-align: center;
}

img {
  width: 75px;
  border-radius: 100px;
}

td.logoCell {
  margin: auto;
  text-align: center;
  width: 100px;
}

tr.offlineCh td {
  background: rgba(0, 166, 255, 0.8);
  font-weight: 700;
  color: white;

}


tr.onlineCh td {
  background: rgba(0, 199, 40, 0.8);
  font-weight: 700;
  color: white;

}


tr.noUser td {
  background: rgba(255, 10, 39, 0.8);
  font-weight: 700;
  color: white;

}

td.twitchName {
  width: 125px;
}

td.twitchStatus {
  width: 275px;
}


td.twitchName,
td.twitchStatus {
  text-align: center;
  vertical-align: center;
    
}

td.twitchName a{
  color: white;
}
            
          
!

JS

            
              

$(document).ready(function() {
  var channels = [ "ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas", "brunofin", "comster404"];

  

  // https://wind-bow.gomix.me/twitch-api

  var url = "https://wind-bow.glitch.me/twitch-api/streams/freecodecamp";

  $.getJSON(url, function(datafcc) {
    if (datafcc.stream === null) {
      $("#fccStatus").html("FreeCodeCamp is OFFLINE!");
    } else {
      $("#fccStatus").html("FreeCodeCamp is ONLINE!");
    }
  });

  for(var a = 0; a<channels.length; a++){
    let chnUser = 'https://wind-bow.glitch.me/twitch-api/users/'+channels[a]+'/?callback=?';    
    let userName = chnUser.substring(44, chnUser.length-12);


    $.getJSON(chnUser).done(function(userData){
      var logo;
      var status;
      var name;

      if(userData._id == null && userData.status != null){
         logo = "https://static-cdn.jtvnw.net/jtv_user_pictures/xarth/404_user_150x150.png";
         status = userData.error;
         name = userData.message;
         $("#channelInfo").append("<tr class='noUser'>" + "<td class='logoCell'>" + "<img src='" + logo + "'>" + "</td>" + "<td class='twitchName align-middle'>" + name + "</td>" + "<td class='twitchStatus align-middle'>" + status + "</td>" + "</tr>");

      }
      

      
      
    }); 
    

  }
  
  
  
  
  for(var i = 0; i<channels.length; i++){

   let chnUrl =  'https://wind-bow.glitch.me/twitch-api/streams/'+channels[i];  

   
   
   
   $.getJSON(chnUrl, function(chnData){
     let logo; 
     let status;
     let name;
     let channel = chnData._links.channel;
     let channelURL = 'https://wind-bow.glitch.me/twitch-api/channels/'+channel.substring(38, chnData._links.channel.length);

     
        if(chnData.stream === null){
          $.getJSON(channelURL, function(chnCheck){

            
             if(chnCheck._id != null){
                if(chnCheck.logo == null){
                    logo = "https://static-cdn.jtvnw.net/jtv_user_pictures/xarth/404_user_150x150.png";
                   }
               else{
                  logo = chnCheck.logo;  
               }
               
              status = "OFFLINE";
              name = chnCheck.display_name;

                         $("#channelInfo").append("<tr class='offlineCh'>" + "<td class='logoCell'>" + "<a href='https://www.twitch.tv/"+name+"' target='blank'><img src='" + logo + "'>" + "</a></td>" + "<td class='twitchName align-middle'><a href='https://www.twitch.tv/"+name+"' target='blank'>" + name + "</a></td>" + "<td class='twitchStatus align-middle'>" + status + "</td>" + "</tr>");
               
             }
            
            
          });
          
       
        }

     
     else if(chnData.stream._id != null){
     
        logo = chnData.stream.channel.logo;
//        console.log("LOGO: " + logo);

        status = chnData.stream.channel.status;
//        console.log("STATUS: " + status);
     
        name = chnData.stream.channel.display_name;
//        console.log("DISPLAY NAME: " + name);
       
          $("#channelInfo").append("<tr class='onlineCh'>" + "<td class='logoCell'>" + "<a href='https://www.twitch.tv/"+name+"' target='blank'><img src='" + logo + "'>" + "</a></td>" + "<td class='twitchName align-middle'><a href='https://www.twitch.tv/"+name+"' target='blank'>" + name + "</a></td>" + "<td class='twitchStatus align-middle'>" + status + "</td>" + "</tr>");
        }

     
       
     
     else{
       
     }
   });
   
 }


});


$("#allStream").click(function(){
    $(".noUser").show("slow");
  $(".onlineCh").show("slow");
  $(".offlineCh").show("slow");
  
});

$("#onStream").click(function(){
  $(".noUser").hide("slow");
  $(".onlineCh").show("slow");
  $(".offlineCh").hide("slow");
});

$("#offStream").click(function(){
  $(".noUser").hide("slow");
  $(".onlineCh").hide("slow");
  $(".offlineCh").show("slow");
  
  
});
            
          
!
999px

Console