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.

            
              <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">

<div class="container-fluid">
  <div class="row">
    <div class="col-xs-12">
      <h4 class="bold">Team Members</h4>
    </div>
  </div>

  <div class="row">
    <div class="col-lg-12 ">
      <div class="well overall">
        <div class="row">
          <div class="col-xs-12 header">
            <span class="btn btn-default" id="all">ALL</span>
            <span class="btn not-selected" id="online">ONLINE</span>
            <span class="btn not-selected" id="offline">OFFLINE</span>
            <span class="btn not-selected" id="badUser">BAD USER</span>
          </div>
        </div>

        <!--<div class='row normal'>
          <div class='col-sm-2'>
            <div class='vcenter'><img src='http://bdamar.com/adminbdamar.com/edu/coaching/upload/3011758078676434.png' alt='no-logo' class='img-circle'></div>
          </div>
        <div class='col-sm-10'>
          <div class='userName'>comster404 </div>
          <div class='bio'>
            <p>Status: User does not exist</p>
          </div>
        </div>
        </div>
        <div class="row other">
          <div class="col-sm-2">
            <div class="vcenter"><img src="https://static-cdn.jtvnw.net/jtv_user_pictures/noobs2ninjas-profile_image-34707f847a73d934-300x300.png" alt="user_logo" class="img-circle"> </div>
          </div>
          <div class="col-sm-10">
            <div class="userName">User Name</div>
            <div class="bio">
              <p>Bio: //text</p>
            </div>
            <div class="status">Live or Offline | <a href="#" class='click'>Watch Stream</a></div>

          </div>

        </div>

        <div class="row normal">
          <div class="col-sm-2">
            <div class="vcenter"><img src="https://static-cdn.jtvnw.net/jtv_user_pictures/noobs2ninjas-profile_image-34707f847a73d934-300x300.png" alt="user_logo" class="img-circle"> </div>
          </div>
          <div class="col-sm-10">
            <div>User Name: <span id="userName"></span></div>
            <div><span>Bio: //text <span id="bio"></span></div>
            <div>Status: //Live or Offline<span id="status"></span></div>
            <div><a href="#" class='click'>Watch Stream</a><span id="channelUrl"></span></div>
          </div>

        </div>-->
        <div id="append">


        </div>
        <div id="appendEnd">


        </div>
        
 

      </div>
    
 <div class="row"><div class="col-xs-12">Note: The Watch Stream doesn't work in codepen. It's a known issue with cross domain security. You have to right click to open you a new tab. </div></div>
    </div>
    
  </div>
  
</div>
            
          
!
            
              /* Design taken from Adam Darowski @ https://dribbble.com/shots/3161957-Team-Members ... I just coded it up
*/
.userName{
  color:#5A8BAF;
  font-size:16px;
  font-weight:bold;
  padding-bottom:5px;
}
.img-circle, .img-thumbnail{
  max-height:100px;
}
.vcenter {
    display: inline-block;
    vertical-align: middle;
    float: none;
  
  
}


.header{
  padding:0px 20px 20px 20px;
}
.btn{
  font-weight: bold;
  line-height: .8;
}

.btn.not-selected{
  color:#BBBBBB;
}
h4.bold{
  font-weight: bold;
}

.other {
  margin: 0 -18px;
  padding:20px 0px 20px 20px;
  background-color:#F2F2F2; 
}

.normal {
  margin: 0 -18px;
  padding:20px 0px 20px 20px;
}
.overall {
  background-color:#E9E9E9; 
  border-style: solid;
  border-color: #DDDDDD;
  border-width: 3px;
  border-radius: 10px;
}
.container-fluid{
  background-color:#F4F4F4;
  font-family: 'Roboto', sans-serif;
}

            
          
!
            
              $(document).ready(function() {
  var user = [];
  var counter = "other";
  const fixedUser = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas", "brunofin", "comster404 "];

  function isLive(val, val2) {
    $.ajax({
      url: "https://api.twitch.tv/kraken/streams/" + val,
      headers: {
        'Client-ID': "kl6e2ax14jwcai3btitoinz84s0kc6",
      },
      success: function(data) {
        //console.log(data);
        if (data.stream !== null) {
          val2.live = "Online";
          val2.game = data.stream.game;
          val2.views = data.stream.viewers;
          //console.log(val2.game);
        } else {
          val2.live = "Offline";
        }
        user.push(val2);
        //console.log(val2);
      }
    }).done(function() {
      var statusID = "";
      if (val2.live === "Online"){
        var statusID = "live";
      }else {
        var statusID = "dead";
      }
      var firstDiv = '<div class="row ' +counter+' '+statusID+'"><div class="col-sm-2"><div class="vcenter">';
      if (counter === "other") {
        counter = "normal";
      } else {
        counter = "other";
      }
      var img = '<img src="' + val2.logo + '"alt="' + val2.name + '"class="img-circle"></div></div>';
      var userName = '<div class="col-sm-10"><div class="userName">' + val2.name + '</div>';
      if (val2.bio === null) {
        val2.bio = "No Bio Provided"
      };
      var bio = '<div class="bio"><p>Bio: ' + val2.bio + '</p></div>';
      var status = '<div class="status">' + val2.live; 
      var viewers = ' | Viewers: ' + val2.views;
      console.log(viewers);
      var game = ' | Game: ' + val2.game;
      var watch =  ' | <a href="' + val2.url + '" target="_blank">Watch Stream</a>';
      var final = '</div></div></div>';
      if (val2.live === 'Online'){
        $("#append").append(firstDiv + img + userName + bio + status + game + viewers +  watch + final);  
          }
      else{
        $("#append").append(firstDiv + img + userName + bio + status + watch + final);  
      }
      

    });
  }

  function getChannel(val, val2) {
    //console.log('a')  
    $.ajax({
      url: "https://api.twitch.tv/kraken/channels/" + val,
      headers: {
        'Client-ID': "kl6e2ax14jwcai3btitoinz84s0kc6",
      }
    }).done(function(data) {
      val2.url = data.url
        //console.log(val2);
      isLive(val, val2);
    });
  }

  function getUser(val) {
    $.getJSON({
      url: "https://api.twitch.tv/kraken/users/" + val,
      headers: {
        'Client-ID': "kl6e2ax14jwcai3btitoinz84s0kc6",
      }
    }).done(function(data) {
      var temp = {
        name: val,
        active: true,
        bio: data.bio,
        logo: data.logo
      };
      //console.log(val);
      //console.log(temp);
      getChannel(val, temp);
    }).fail(function() {
      var firstDiv = '<div class="row noUser ' + counter + '"><div class="col-sm-2"><div class="vcenter">';

      if (counter === "other") {
        counter = "normal";
      } else {
        counter = "other";
      }
      var img = '<img src="http://bdamar.com/adminbdamar.com/edu/coaching/upload/3011758078676434.png" alt="no-logo" class="img-thumbnail"></div></div>';

      var userName = '<div class="col-sm-10"><div class="userName">' + val + '</div>';

      var status = '<div class="bio"><p>Status: User does not exist</p></div></div></div>';
      //console.log(firstDiv + img + userName + status)
      $("#appendEnd").append(firstDiv + img + userName + status);

    });
  }

  for (var i = 0; i < fixedUser.length; i++) {
    var userName = fixedUser[i];
    getUser(userName);
  }

  $('.click').click(function() {
    window.open("https://www.twitch.tv/robotcaleb");

  })

  function remove(val) {
    $("#all, #offline, #online, #badUser").removeClass("btn-default not-selected");
    //console.log('hit')
    $("#"+val).addClass("btn-default");
    switch (val) {
      case "all":
        $("#offline, #online, #badUser").addClass("not-selected");
        $(".live").show();
        $(".dead").show();
        $(".noUser").show();
        break;
      case "offline":
        $("#all, #online, #badUser").addClass("not-selected");
        $(".noUser").hide();
        $(".live").hide();
        $(".dead").show();
        break;
      case "online":
        $("#all, #offline, #badUser").addClass("not-selected");
        $(".noUser").hide();
        $(".dead").hide();
        $(".live").show();
        break;
      case "badUser":
        $("#all, #offline, #online").addClass("not-selected");
        $(".noUser").show();
        $(".dead").hide();
        $(".live").hide();
        break;
        
    }

  }
  
  $("#online, #all, #offline, #badUser").click(function() {
    var id = $(this).attr('id');
    remove(id);
  })

  
});
            
          
!
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