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.

            
              <div class="container-fluid">
   <div class="container out">
      <div class="jumbotron jmb">
         <img class="img-responsive" src="https://image.ibb.co/iuniBx/twitch_streamers.png" alt="twitch_logo">
      </div>
      <div class="page-header line"></div>
      <div class="row rw">
         <div class="btn-group btn-group-justified">
            <a href="#" class="btn btn-primary all">ALL</a>
            <a href="#" class="btn btn-primary on">ON-AIR</a>
            <a href="#" class="btn btn-primary off">OFF-AIR</a>
         </div>
      </div>
      <!--<div class="row rs">
         <form>
            <div class="input-group">
               <input type="text" class="form-control" placeholder="Search">
               <div class="input-group-btn">
                  <button class="btn btn-default" type="submit">
                                <i class="glyphicon glyphicon-search"></i>
                            </button>
               </div>
            </div>
         </form>
      </div>-->
      <!--<div class="row listing">
         <div class="col-sm-3 logo"></div>
          <div class="col-sm-8 details"> 
         <div class="row text">
            <div class="col-sm-12"></div>
         </div>
         <div class="row status">
            <div class="col-sm-12">
               <p>OFFLINE</p>
            </div>
         </div>
      </div>-->
   </div>
</div>
            
          
!
            
              .container-fluid{
    background-color: #623FA3;
    min-height: 630px;
   background-image: url('data:image/svg+xml,%3Csvg width="100" height="20" viewBox="0 0 100 20" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M21.184 20c.357-.13.72-.264 1.088-.402l1.768-.661C33.64 15.347 39.647 14 50 14c10.271 0 15.362 1.222 24.629 4.928.955.383 1.869.74 2.75 1.072h6.225c-2.51-.73-5.139-1.691-8.233-2.928C65.888 13.278 60.562 12 50 12c-10.626 0-16.855 1.397-26.66 5.063l-1.767.662c-2.475.923-4.66 1.674-6.724 2.275h6.335zm0-20C13.258 2.892 8.077 4 0 4V2c5.744 0 9.951-.574 14.85-2h6.334zM77.38 0C85.239 2.966 90.502 4 100 4V2c-6.842 0-11.386-.542-16.396-2h-6.225zM0 14c8.44 0 13.718-1.21 22.272-4.402l1.768-.661C33.64 5.347 39.647 4 50 4c10.271 0 15.362 1.222 24.629 4.928C84.112 12.722 89.438 14 100 14v-2c-10.271 0-15.362-1.222-24.629-4.928C65.888 3.278 60.562 2 50 2 39.374 2 33.145 3.397 23.34 7.063l-1.767.662C13.223 10.84 8.163 12 0 12v2z" fill="%239C92AC" fill-opacity="0.4" fill-rule="evenodd"/%3E%3C/svg%3E');
}

.all:hover{
   background-color: #623FA3;
}
.on:hover{
   background-color: #623FA3;
}

.off:hover{
   background-color: #623FA3;
}

.out{
    /*border: 1px solid brown;*/
    width: 500px;
    margin-top: 110px;
    margin-bottom: 30px;
    height: auto;
    background-color: rgba(0, 0, 0, 0.5);

}

.rw{
  margin-top: -15px;  
  width:470px;
  margin-left: -1px;
  margin-bottom: 5px;
}

.rs{
    height: 30px;
    margin-top: 5px;
    width:470px;
    margin-left: -1px;
}

.jmb{
   margin-top: 20px;
}

.line{
    margin-top: -25px;
}

.listing{
   /* border: 1px solid grey;*/
    width: 470px;
    height: 110px;  
    margin-left: -1px;
    margin-top: 10px;
    margin-bottom: 4px;
}

.logo{
    /*border: 1px solid whitesmoke;*/
    height: 104px;
    margin-left: 4px;
    margin-top: 2px;
    background-color: whitesmoke;
   
}

.logo img{
   padding-top:8px;
  
}

.text{
    /*border: 1px solid whitesmoke;*/
    height: 72px;
    width: 340px;
    margin-left: 123px;
    margin-top: 2px;
    background-color: black;
   
   
}

.status{
    border: 1px solid whitesmoke;
    height: 30px;
    width: 340px;
    margin-left: -1px;
    margin-top: 74px;
   /*color: #32CD32;*/
   /*color: #ff0101;*/
}

.neon{
   font-weight: bold;
   padding-top:5px;
}

.name>p{
   padding-top:20px;
   font-size:16px;
   
}

 span{
   text-decoration: none;
   font-size: small;
}

            
          
!
            
              $(document).ready(function() {
   users = [
      "ESL_SC2",
      "OgamingSC2",
      "freecodecamp",
      "RobotCaleb",
      "noobs2ninjas",
      "ZoomPC",
      "Xbox",
      "Wolsk",
      "silgarth"
   ];

   for (let i = 0; i < users.length; i++) {
      let baseUrl = "https://wind-bow.glitch.me/twitch-api/channels/";

      let tailUrl = users[i];

      let webLink = baseUrl + tailUrl;
      let stream = "https://wind-bow.glitch.me/twitch-api/streams/";

      let streamLink = stream + tailUrl;
      let pre = document.getElementsByClassName("out")[0];

      $.ajax({
         url: webLink,
         type: "GET",
         dataType: "json",
         success: function(data) {
            console.log(data);

            $.ajax({
               url: streamLink,
               type: "GET",
               dataType: "json",
               success: function(result) {
                  console.log(result._links);

                  if (result.stream === null) {
                     pre.innerHTML +=
                        "<div class='row listing offair'><div class='col-sm-3 logo'><img class = 'img-responsive' src=" +
                        data.logo +
                        "></div><div class='row text'><div class='col-sm-12 name'><p><a href=" +
                        data.url +
                        " target = '_blank'>" +
                        data.display_name + "<br><span class='deet'>" + data.game + "</span></a></p></div><div class='row status'><div class='col-sm-12 worx'><p class='neon' style='color:black;'> OFF-AIR </p></div></div></div>"
                  } else {
                     pre.innerHTML +=
                        "<div class='row listing onair'><div class='col-sm-3 logo'><img class = 'img-responsive' src=" +
                        data.logo +
                        "></div><div class='row text'><div class='col-sm-12 name'><p><a href=" +
                        data.url +
                        " target = '_blank'>" +
                        data.display_name + "<br><span class='deet'>" + data.game + "</span></a></p></div><div class='row status'><div class='col-sm-12 worx'><p class='neon' style='color:#32CD32;'> ON-AIR </p></div></div></div>"
                  }

                  $(".all").on("click", function() {
                     $(".listing").show();
                  });

                  $(".on").on("click", function() {
                     $(".listing").hide();
                     $(".onair").show();
                  });

                  $(".off").on("click", function() {
                     $(".listing").hide();
                     $(".offair").show();
                  });
               },
               error: function() {
                  alert("Something went wrong with the server...");
               }
            });
         },
         error: function() {
            alert("Something went wrong with the server....");
         }
      });
   }
});

            
          
!
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