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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

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

Packages

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.

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

              
                <body>
<div class="container">
  
  <div class="heading" id="heading">
    <div class="row" id="headrow">
      
      <div class="col-md-1">
      </div>
           
      <div class="col-md-9">
        <h1> Who's twitching?</h1>
      </div>
      
      <div class="col-md-1">
        <span><h4>Online</h4>  </span><input id="online" name ="online" type="checkbox" data-toggle="toggle" checked="true">
      </div>
      
       <div class="col-md-1">
         <span><h4>Offline </h4> </span><input id="offline" name="offline" type="checkbox" data-toggle="toggle" checked="true">
      </div>
      
    </div>
    
  </div>
  
  <div id="content" class="content">
  <!--Content added here through javascript -->
  </div>

  
  </div>

</body>
              
            
!

CSS

              
                .mywell{
  overflow: auto;
}

#heading{
  font-family: Tahoma, Verdana, Segoe, sans-serif;
  color: #fffff0;
}

#headrow{
  background: #520054;
  margin-top: 30;
  margin-bottom: 30;
  padding-top: 40px;
  padding-bottom: 40px;
}
.icon{
  height:100px;
  width:100x;
 
   
}

.iconborder{
   display: block;
    border-radius: 200px;
    box-sizing: border-box;
    background-color: #DDD;
    border: 5px solid #cfd8dc;
}

.onlineWell{
  background: #92f446;
}

.offlineWell{
  background: #f4a82e;
}

.unknown{
  background: #f4514e;
}

.centertext{
 padding-top: 30px;
  padding-bottom: 30px;
  
}

.content
{
  font-family: "Lucida Console","Lucida Sans Typewriter",monaco,"Bitstream Vera Sans Mono",monospace;
  
  font-size: 20px;
}

.myrow
{
   margin-top: 0;
  margin-bottom: 0;
  padding-top: 1px;
  padding-bottom: 1px;
}

.well
{
   margin-top: 0;
  margin-bottom: 0;
  padding-top: 2px;
  padding-bottom: 2px;
}
              
            
!

JS

              
                var json =[
  {
    "stream": {
      "mature": false,
      "status": "Greg working on Electron-Vue boilerplate w/ Akira #programming #vuejs #electron",
      "broadcaster_language": "en",
      "display_name": "FreeCodeCamp",
      "game": "Creative",
      "language": "en",
      "_id": 79776140,
      "name": "freecodecamp",
      "created_at": "2015-01-14T03:36:47Z",
      "updated_at": "2016-09-17T05:00:52Z",
      "delay": null,
      "logo": "https://static-cdn.jtvnw.net/jtv_user_pictures/freecodecamp-profile_image-d9514f2df0962329-300x300.png",
      "banner": null,
      "video_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/freecodecamp-channel_offline_image-b8e133c78cd51cb0-1920x1080.png",
      "background": null,
      "profile_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/freecodecamp-profile_banner-6f5e3445ff474aec-480.png",
      "profile_banner_background_color": null,
      "partner": false,
      "url": "https://www.twitch.tv/freecodecamp",
      "views": 161989,
      "followers": 10048,
      "_links": {
        "self": "https://api.twitch.tv/kraken/channels/freecodecamp",
        "follows": "https://api.twitch.tv/kraken/channels/freecodecamp/follows",
        "commercial": "https://api.twitch.tv/kraken/channels/freecodecamp/commercial",
        "stream_key": "https://api.twitch.tv/kraken/channels/freecodecamp/stream_key",
        "chat": "https://api.twitch.tv/kraken/chat/freecodecamp",
        "subscriptions": "https://api.twitch.tv/kraken/channels/freecodecamp/subscriptions",
        "editors": "https://api.twitch.tv/kraken/channels/freecodecamp/editors",
        "teams": "https://api.twitch.tv/kraken/channels/freecodecamp/teams",
        "videos": "https://api.twitch.tv/kraken/channels/freecodecamp/videos"
      }
    },
    "_links": {
      "self": "https://api.twitch.tv/kraken/streams/freecodecamp",
      "channel": "https://api.twitch.tv/kraken/channels/freecodecamp"
    }
  },
  {
    "stream": null,
    "display_name": "OgamingSC2",
    "_links": {
      "self": "https://api.twitch.tv/kraken/streams/ogamingsc2",
      "channel": "https://api.twitch.tv/kraken/channels/ogamingsc2"
    }
  },
  {
    "stream": {
      "mature": false,
      "status": "RERUN: StarCraft 2 - Kane vs. HuK (ZvP) - WCS Season 3 Challenger AM - Match 4",
      "broadcaster_language": "en",
      "display_name": "ESL_SC2",
      "game": "StarCraft II",
      "language": "en",
      "_id": 30220059,
      "name": "esl_sc2",
      "created_at": "2012-05-02T09:59:20Z",
      "updated_at": "2016-09-17T06:02:57Z",
      "delay": null,
      "logo": "https://static-cdn.jtvnw.net/jtv_user_pictures/esl_sc2-profile_image-d6db9488cec97125-300x300.jpeg",
      "banner": null,
      "video_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/esl_sc2-channel_offline_image-5a8657f8393c9d85-1920x1080.jpeg",
      "background": null,
      "profile_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/esl_sc2-profile_banner-f8295b33d1846e75-480.jpeg",
      "profile_banner_background_color": "#050506",
      "partner": true,
      "url": "https://www.twitch.tv/esl_sc2",
      "views": 60843789,
      "followers": 135275,
      "_links": {
        "self": "https://api.twitch.tv/kraken/channels/esl_sc2",
        "follows": "https://api.twitch.tv/kraken/channels/esl_sc2/follows",
        "commercial": "https://api.twitch.tv/kraken/channels/esl_sc2/commercial",
        "stream_key": "https://api.twitch.tv/kraken/channels/esl_sc2/stream_key",
        "chat": "https://api.twitch.tv/kraken/chat/esl_sc2",
        "subscriptions": "https://api.twitch.tv/kraken/channels/esl_sc2/subscriptions",
        "editors": "https://api.twitch.tv/kraken/channels/esl_sc2/editors",
        "teams": "https://api.twitch.tv/kraken/channels/esl_sc2/teams",
        "videos": "https://api.twitch.tv/kraken/channels/esl_sc2/videos"
      }
    },
    "_links": {
      "self": "https://api.twitch.tv/kraken/streams/esl_sc2",
      "channel": "https://api.twitch.tv/kraken/channels/esl_sc2"
    }
  },
  {
    "stream": null,
    "display_name": "noobs2ninjas",
    "_links": {
      "self": "https://api.twitch.tv/kraken/streams/esl_sc2",
      "channel": "https://api.twitch.tv/kraken/channels/esl_sc2"
    }
  },
  {
    "error": "Not Found",
    "status": 404,
    "message": "Channel 'not-a-valid-account' does not exist"
  }
];



$(document).ready(function() {
  
  go();
  
  $('#online').change(function() {
    go();
  });
     $('#offline').change(function() {
    go();
  });
  

  function go(){
var onlineCh = $('#online:checked').val();
var offlineChecked =$('#offline:checked').val();
var html= " ";
    
  json.forEach(function(val) {
                              if (val['error']!= null) {
                                html +="<div class='row myrow align-items-center'><div class='well unknown mywell'><div class='col-md-2'><img src='https://upload.wikimedia.org/wikipedia/commons/b/bc/Sadness.png' class='icon'></div><div class='col-md-4 centertext'>Unknown</div><div class='col-md-6 centertext'><i> An account you have requested does not exist</i></div></div></div>";
                              }
                              
                               else if (val['stream'] == null && offlineChecked=="on") 
                                {
                                  html += "<div class='row myrow align-items-center'><div class='well offlineWell mywell'><div class='col-md-2'><img src='https://upload.wikimedia.org/wikipedia/commons/5/5a/3D_TV_static.gif' class='icon img-thumbnail'></div><div class='col-md-4 centertext'>"+ val['display_name'] + "</div><div class='col-md-6 centertext'><i>Offline</i></div></div></div>";
                                }//end if stream is null
                              
                               else if (onlineCh =="on")//if stream not null
                           
                                {
                                 var L1 = Object.keys(val); //get keys for original json data
                                   L1.forEach(function(key) { //for eack key of json data
                                    
                                      var myValue = val[key] //get data from each key and put into myValue
                                       for (var i in myValue) { //for each index in myValue i.e. for each key
                                                               if (i=="status"){
                                                                        html += "<div class='row myrow'><div class='well mywell onlineWell'><div class='col-md-2 '><img src='" + myValue['logo']+"' class='icon img-circle iconborder'></div><div class='col-md-4 centertext'><a href='"+myValue['url']+"' style='color: inherit;'>"+myValue['display_name'] + "</a></div><div class='col-md-6 centertext'>" + myValue['status']+"</div></div></div>"; 
                                                                                }; //end if i is status
                                                              }; // end for i in my value
                                                      
                                                              }); // end for each key
                                              };//end if not stream equal to null
               
                               });//end for each json value

                              
  $('.content').html(html);
  };
 
})
              
            
!
999px

Console