123

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

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.

            
              <!--<span class="glyphicons glyphicons-wifi-alt"></span>
live icon

<span class="glyphicons glyphicons-moon"></span>
not live icon-->

<body>
    <a href="https://www.twitch.tv/freecodecamp">
    <div id="fccStatus"></div></a>
    <div class="box">
        <header>
            <div class="nav">
                <ul>
                    <li class="favs"><a href="#fav">Favs</a></li>
                    <li class="online"><a href="#on">Online</a></li>
                    <li class="offline"><a href="#off">Offline</a></li>
                </ul>
            </div>
        </header>
        <div class="list" id="followerInfo">
           
        </div>
    </div>
    <div class="divN"></div>
</body>
            
          
!
            
                      /*Colors
#6441A4 (navbar, footer, highlight)
#392E5C
#17141F(background)*/
    
    * {
        color: white
    }
    
    body {
        height: 100%;
        width: 100%;
        background: #17141f;
    }
    
    .box {
        height: 80%;
        width: 360px;
        background: #392E5C;
        position: absolute;
        margin-left: auto;
        margin-right: auto;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }
    
    .nav ul {
        width: 360px;
        margin: 0;
        padding: 0;
        background: #6441A4;
    }
    
    .nav li {
        font-family: 'Oswald', sans-serif;
        font-size: 1.2em;
        line-height: 40px;
        height: 40px;
        border-bottom: 1px solid #888;
        text-align: center;
    }
    
    .nav a {
        text-decoration: none;
        color: #fff;
        display: block;
        transition: .7s background-color;
    }
    
    .nav a:hover {
        background-color: white;
        color: #6441A4;
    }
    
    .nav a.active {
        background-color: #fff;
        color: #444;
        cursor: default;
    }
    
    @media screen and (min-width: 600px) {
        .nav li {
            width: 120px;
            border-bottom: none;
            height: 50px;
            line-height: 50px;
            font-size: 1.4em;
        }
        /* Option 1 - Display Inline */
        .nav li {
            display: inline-block;
            margin-right: -4px;
        }
        a {
            color: white;
        }
        a:hover {
            color: white;
        }
        .list{
            overflow-y: auto;
            height: calc(100% - 50px);
        }
        .list div {
            list-style: none;
            overflow: hidden;
            position: relative;
            padding: 0;
            background:
        }
        .list div {
            width: 380px;
            height: 50px;
            transition: .7s background-color;
        }
        .list div:hover {
            background-color: white;
            color: #6441A4;
        }
}

.list div {
    height: 60px;
    width: 100%; 
    display: inline;
}

.list img {
    height: 50px;
}
            
          
!
            
              //Run our jQuery
$(document).ready(function() {
  //Array to store FCC followers
  var following = [];
  //FreeCodeCamp Stream Info and Status API Call
  $.getJSON('https://api.twitch.tv/kraken/streams/freecodecamp', function(data1) {
    //If stream parameter is null then it is offline
    if (data1.stream === null) {
      //FCC Offline
      $("#fccStatus").html("Free Code Camp is currently OFFLINE");
    } else {
      //FCC Online
      $("#fccStatus").html("Free Code Camp is currently LIVE");
    }
  });
  //List the FCC people they follow API Call
  $.getJSON('https://api.twitch.tv/kraken/users/freecodecamp/follows/channels/', function(data) {
    //Gets follower's display name for a getJSON call below
    for (var i = 0; i < data.follows.length; i++) {
      //gets displayName
      var displayName = data.follows[i].channel.display_name;
      //Adds displayName to an
      following.push(displayName);
    }
    //Add 3 people for testing to array
    following.push('comster404');
    following.push('brunofin');
    following.push('ESL_SC2');

    for (var i = 0; i < following.length; i++) {
      var url2 = 'https://api.twitch.tv/kraken/streams/' + following[i] + '/?callback=?';

        
  
  $.getJSON(url2).done(function(data2){
        //console.log(data2)
        var logo;
        var name;
        var status;
        
       if(data2.error){
         logo= 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSeF9yiuuOJBNO8VpXsVp2VQIpBSTPdLKW6uB3AI-jmSX9G74bX1g';
       $("#followerInfo").prepend("<div class ='row'>" + "<div class='col-md-4'>" +
              "<img src='" + logo + "'>"
              // + img
              +
              "</div>" + "<div class='col-md-4'>" + data2.message + "</div>" + "<div class='col-md-4'>" + data2.error + "</div></div>");
        }
        
        //Checks if they are online
         if (data2.stream === null) {
          // console.log(data2.stream.channel.display_name);
          //console.log(data2.stream.channel.logo);
          //  status = "OFFLINE";
          //  console.log(data2);
          //offlineFollowing.push(data2._links.channel);

          $.getJSON(data2._links.channel, function(data3) {

            var status = "OFFLINE";
            var logo = data3.logo;
            var name = data3.display_name;
            if (logo === null) {
              logo = 'http://web.vmc3.com/projects/bufs/branch/marines/logos/NoLogo.jpg';
            }
            $("#followerInfo").prepend("<div class ='row'>" + "<div class='col-md-4'>" +
              "<img src='" + logo + "'>"
              // + img
              +
              "</div>" + "<div class='col-md-4'>" + name + "</div>" + "<div class='col-md-4'>" + status + "</div></div>");

          });

        }
        
      
        //Channels Currently Streaming
        else {
          status = data2.stream.channel.status;
          logo = data2.stream.channel.logo;
          name = data2.stream.channel.display_name;
          //Channels without a logo
      
          if (logo === null) {
            logo = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSeF9yiuuOJBNO8VpXsVp2VQIpBSTPdLKW6uB3AI-jmSX9G74bX1g';

          }
          //Channels streaming which may or may not have a logo
          $("#followerInfo").prepend("<div class ='row'>" + "<div class='col-md-4'>" +
            "<img src='" + logo + "'>"
            // + img
            +
            "</div>" + "<div class='col-md-4'>" + name + "</div>" + "<div class='col-md-4'>" + status + "</div></div>");

        }
       
      });
    }
  });
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console