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.

            
              <title>Twitch.TV</title>

<body>
  <!-- Testing buttons -->
  <!--  HEADER  -->

  <div class="fixed-nav-bar">
    <div class="logo"><span>&#160;&#160;Twitch&#160;</span><span id="tv">.tv &#160;&#160;</span>
    </div>

  </div>
  <!-- END OF NAVIGATION BAR -->

  <!-- END OF NAVIGATION BAR -->

  <!--   <h1>Twitch.tv</h1> -->

  <div id="test">
    <button class="btn btn-default" id="onlineButton">Online</button>
    <button class="btn btn-default" id="offlineButton">Offline</button>
    <button class="btn btn-default" id="allButton">All</button>
    <div id="headSection">

      <form class="search">
        <input class="searchTerm" id="searchBar" placeholder="Enter your search term ..." />
      </form>


    </div>
  </div>


  <!--  END OF HEADER  -->
  
<!--  START OF THE CONTAINER  -->
  <div class="container">
    <div id="showOnline"></div>
    
    <br>
  </div>
<!--END OF THE CONTAINER  -->

  <br>
</body>
            
          
!
            
              body {
  background: url("https://s13.postimg.org/ntabc3xc7/Unsplash_River_and_City_Yk_Vm_R2_A.jpg") center fixed;
  background-size: cover;
}



h1 {
  color: white;
  text-align: center;
  font-family: 'Exo', sans-serif;
  font-weight: 700;
  font-size: 5.5em;
  margin-top: 60px;
}

#test {
  text-align: center;
  margin: auto;
  width: auto;
}

#headSection {
  height: 120px;
  max-width: 666px;
  position: relative;
  margin: auto;
  background-color: rgba(93, 82, 177, 0.5);
}



#showOnline {
  color: black;
  font-size: 30px;
}

.userImage {
  width: 110px;
  height: 110px;
  padding: 0px;
  border-radius: 10px;
  border: 4px solid black;
  margin: 10px;
}

#offlineUser {
  color: red;
  font-size: 15px;
  float: right;
  padding-top: 50px;
  padding-right: 20px;
  font-weight: 800;
  font-family: 'Exo', sans-serif;
}

#onlineUser {
  color: green;
  font-size: 15px;
  float: right;
  padding-top: 50px;
  padding-right: 20px;
  font-weight: 800;
   font-family: 'Exo', sans-serif;
}

#onlineButton {
  color: green;
  font-family: 'Exo', sans-serif;
}

#offlineButton {
  color: red;
  font-family: 'Exo', sans-serif;
}

#allButton {
  color: black;
  font-family: 'Exo', sans-serif;
}

.container {
  /*   background:blue; */
  max-width: 700px;
  text-align: left;
  height: auto;
  /*   margin-top:130px; */
}

.userName {
  padding: 10px;
  text-transform: capitalize;
  font-family: 'Exo', sans-serif;
  font-weight: 700;
  font-size: 20px;
}

.userStatus{
  font-size:15px;
  padding:70px;
 text-align: justify;
}


.twitchUsers {
  background-color: white;
  margin: 0 auto;
  margin-top: 10px;
  padding: 0;
  color: black;
  font-weight: bold;
  border-radius: 5px;
  width: auto;
  overflow: hidden;
}

.btn-default {
  width: 11.5%;
  min-width: 116px;
  max-width: 300px;
  padding: 0px;
  font-size: 17px;
  font-weight: bold;
  margin-top: 250px;
  height: 70px;

}


/*  NAVIGATION BAR */

.fixed-nav-bar {
   /*   position: fixed; */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 50px;
  padding: 0 25px;
  box-sizing: border-box;
  background-color: rgba(255, 255, 255, 0.02);
  box-shadow: 0 0 15px 2px rgba(0, 0, 0, 0.5);
  z-index: 100;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transition: 0.35s ease;
  transition: 0.35s ease;
}

.fixed-nav-bar .logo {
  text-align: center;
  margin-top: 55px;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  font-size: 53px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Righteous', cursive;
  color: white;
}

#tv {
  color: white;
  font-size: 40px;
}

@import url(https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css);
.search {
  width: 100%;
  position: relative;
  margin: auto;
  padding: 30px;
}

.search:before {
  position: absolute;
  top: 30px;
  right: 30px;
  width: 40px;
  height: 40px;
  line-height: 40px;
  font-family: 'FontAwesome';
  content: '\f002';
  background: #100D3D;
  text-align: center;
  color: #fff;
  border-radius: 5px;
  -webkit-font-smoothing: subpixel-antialiased;
  font-smooth: always;
}

.searchTerm {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  width: 100%;
  border: 5px solid #100D3D;
  padding: 5px;
  height: 40px;
  border-radius: 5px;
  outline: none;
}


            
          
!
            
              $(document).ready(function() {

  var twitchAPI = "https://api.twitch.tv/kraken/streams/";

  var users = [
    ' brunofin',
    'justin',
    'syndicate',
    'riotgames',
    'LIRIK',
    'PhantomL0rd',
    'esl_csgo',
    'sodapoppin',
    'summit1g',
    'Nightblue3',
    'goldglove',
    'tsm_bjergsen',
    'imaqtpie',
    'tsm_theoddone',
    'trick2g',
    'freecodecamp',
    'captainsparklez'
  ];

  var offline_Users = [];

  //START ONLINE USER
  function showOnline_Users() {

    var index, index1, len1;

    for (index1 = 0, len1 = users.length; index1 < len1; ++index1) {

      $.getJSON("https://api.twitch.tv/kraken/streams/" + users[index1], function(channels) {

        if (channels["stream"] != null) {

          
          var truncatedWord = (channels.stream.channel.status).slice(0,16)  + "....";
          
          console.log(truncatedWord);
          
              $("#showOnline").append('<div class="twitchUsers">' + '</span>' + "<img class='userImage' src= '" + channels.stream.channel.logo + "'>" + '<span class="userName">'+ ' <a target="_blank" href="'+channels.stream.channel.url +'">' + channels.stream.channel.name + '</a> </span>' + 
   '<span class="userStatus">'+ truncatedWord + '</span>'+                                   
  "<span id ='onlineUser'>" + "OnLine" + "</span>" + '</div>');
          
          
          
        } 

      });

    }

  }
  // END OF ONLINE FUNCTION

  //START OF THE OFFLINE USER
  function showOffline_Users() {

    for (i = 0; i < users.length; i++) {

      (function(i) {

        var user = users[i];

        $.getJSON("https://api.twitch.tv/kraken/streams/" + user + "?callback=?", function(data1) {
          
          if (data1.stream == null) { //offline
            offline_Users.push(user);

            $.getJSON(" https://api.twitch.tv/kraken/channels/" + user, function(data) {
              
              $("#showOnline").append('<div class="twitchUsers">' + " <img class= 'userImage' src='" + data.logo + "'>" + '<span class ="userName">'+ 
              '<a target="_blank" href="'+ data.url+'">' 
                + data.display_name + '</a></span>' + "<span id ='offlineUser'>" + "Offline" + "</span>" + '</div>');
              
            });
            
          }
          //END OF SECOND JSON CALL
          console.log(offline_Users)

        });

      })(i)

    }

  }
  //END OF THE OFFLINE USER

  
  //showOnline_Users(); testing 
  //showOffline_Users(); //testing 

  //ONLINE BUTTON
  $("#onlineButton").click(function(e) {
    $("#showOnline").empty(); // empty the div before appending
    showOnline_Users();
  });
  //END OF THE ONLINE BUTTON
  
  //OFFLINE BUTTON
  $("#offlineButton").click(function(e) {
    $("#showOnline").empty(); // empty the div before appending
    showOffline_Users();
  });
//END OF THE OFFLINE BUTTON
  
 
//START OF ALL BUTTON
  
 $("#allButton").click(function(e){
   $("#showOnline").empty(); // empty the div before appending
   showOnline_Users(); 
   showOffline_Users();
 });
  
//END OF ALL BUTTON  
  
$("#searchBar").keypress(function(e){
  

  
});
//END OF THE SEARCH BOX  
  
  
});
            
          
!
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