cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <div class="container">
  <h1>Twitch Streamers</h1>
   <input id="search" placeholder="Who are you looking for?"></input>
<button id="searchbutton">Search</button>
<div id="buttons">
  <button id="on" class="button">Online</button>
   <button id="off" class="button">Offline</button>
   <button id="all" class="button">All</button>
</div>
  <div id="online"></div>
  <div id="offline"></div>
  <div id="offline2"></div>
</div>
            
          
!
            
              @import 'https://fonts.googleapis.com/css?family=Oswald|Patrick+Hand+SC';

body {
  margin: 0;
  padding: 0;
  font-family: 'Oswald', sans-serif;
  color: #2a0d45;
  background: repeating-linear-gradient(
  -45deg,
  #ffffff,
  #ffffff 100px,
  #44146f 100px,
  #44146f 200px
);
}

.container {
  text-align: center;
  width: 50%;
  background-color: rgba(0, 0, 0, 0.6);
  padding-left: 150px;
  padding-right: 150px;
  margin: 0 auto;
  margin-top: 50px;
  padding-bottom: 50px;
}

h1 {
  padding-top: 3vw;
  text-align: center;
  color: white;
  font-family: 'Patrick Hand SC', cursive;
  font-size: 4vw;
}

#online {
  background-color: #acfbac;

}

#offline {
  background-color: #acacfb;
}

#offline2 {
  background-color: #fbacac;
}

li {
  border-bottom: 10px solid #2a0d45;
  list-style: none;
  clear: both;
}

.logo {
  height: 6vw;
  float: left;
}

.name {
  float: left;
  padding-left: 20px;
  vertical-align: middle;
  font-size: 2vw;
  padding-top: 1.5vw;
  padding-right: 20vh;
}

.info {  
  padding-top: 1vw;
  display: block;
  font-size: 1vw;
  padding-left: 20%;
  text-align: right;
  padding-right: 2vw;
}

.info2 {  
  padding-top: 2.5vw;
  display: block;
  font-size: 1vw;
  padding-left: 20%;
  text-align: right;
  padding-right: 2vw;
}

a {
  text-decoration: none;
  color: #2a0d45;
}

button {
  width: 10vw;
  height: 2vw;
  background-color: white;
  color: #2a0d45;
  font-size: 1vw;
  opacity: 0.9;
  border-radius: 5px;
  display: inline-block;
}

.button {
  width: 30%;
  border-radius: 0;
  padding: 0;

}

input {
  margin-right: 1vw;
  padding: 0 2.5vw 0 2.5vw;
  display: inline;
  height: 2vw;
}

#searchbutton {
  margin-bottom: 1vw;
}

@media screen and (max-width: 1096px) {
  body {
  margin: 0;
  padding: 0;
  font-family: 'Oswald', sans-serif;
  color: #2a0d45;
  background: repeating-linear-gradient(
  -45deg,
  #ffffff,
  #ffffff 50px,
  #44146f 50px,
  #44146f 100px
);
}
  .container {
    width: 90%;
    padding-left: 5vw;
    padding-right: 5vw;
  }
  
  h1 {
    font-size: 10vw;
  }
  
  .logo {
    height: 20vw;
  }
  .name{
    font-size: 5vw;
    padding-top: 6.5vw;
    padding-right: 4px;
    padding-left: 10px;
  }
  .info, .info2 {
    font-size: 3vw;
    padding-left: 0%;
  }
  .info2 {
    padding-top: 8vw;
  }
  button {
    width: 30vw;
    height: 10vw;
    font-size: 5vw;
  }

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

  let channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas", "brunofin", "comster404"];

  $("#searchbutton").on("click", function() {
    
    

/*$("#search").keypress(function(e){
  if(e.which === 13){
    var searchinput = $("#search").val();
    jsonCall();
  }
});*/
  var searchinput = $("#search").val();

  if (channels.indexOf(searchinput) === -1) {
    channels.unshift(searchinput) 
    jsonCall(searchinput)
  }
});
 //for (let i=0; i<channels.length; i++) {
   function jsonCall(channels) {
       
      var url = 'https://api.twitch.tv/kraken/streams/' + channels + '?callback=?';

      $.getJSON(url, function(data) {

        var game, status, logo, displayURL, displayURL2, displayName, stream;
        if (data.stream === null) {

          status = "Offline";
          logo = data.logo;
          if (data.logo === undefined) {
            logo = "https://www.theyearinpictures.co.uk/images//image-placeholder.png";
          }
          displayURL = data._links.channel;
          displayName = displayURL.match(/\/([^\/]+)\/?$/)[1];
          displayURL2 = "https://www.twitch.tv/" + displayName;
          $('#offline').append("<a href='" + displayURL2 + "' target='_blank'> <img src='" + logo + "' class='logo'/>" + "<span class='name'>" + displayName + "</span>" + "<span class='info2'>" + status + "</span></a><li>");
        } else if (data.stream === undefined) {
          game = "Account Deleted";
          status = "offline";
          logo = "https://www.theyearinpictures.co.uk/images//image-placeholder.png";
          displayName = channels;

          $('#offline2').append("<img src='" + logo + "' class='logo'/>" + "<span class='name'>" + displayName + "</span>" + "<span class='info2'>" + game + "</span><li>");
        } else {
          game = data.stream.channel.status;
          logo = data.stream.channel.logo;
          displayName = data.stream.channel.display_name;
          stream = data.stream.game;
          displayURL = "https://www.twitch.tv/" + displayName;
          status = "online";
          $('#online').append("<a href='" + displayURL + "' target='_blank'> <img src='" + logo + "' class='logo'/>" + "<span class='name'>" + displayName + "</span>" + "<span class='info'>" + stream + "<br/>" + game + "</span><li></a>");
        }




$("#on").click(function(){
$("#on").css({"background-color": "#2a0d45", "color": "white"});
  $("#off").css({"background-color": "white", "color": "#2a0d45"});
  $("#all").css({"background-color": "white", "color": "#2a0d45"});
  $("#online").show();
    $("#offline").hide();
  $("#offline2").hide();
});

$("#off").click(function(){
$("#off").css({"background-color": "#2a0d45", "color": "white"});
   $("#on").css({"background-color": "white", "color": "#2a0d45"});
  $("#all").css({"background-color": "white", "color": "#2a0d45"});
  $("#online").hide();
    $("#offline").show();
  $("#offline2").hide();
});

$("#all").click(function(){
  $("#all").css({"background-color": "#2a0d45", "color": "white"});
   $("#off").css({"background-color": "white", "color": "#2a0d45"});
  $("#on").css({"background-color": "white", "color": "#2a0d45"});
  $("#online").show();
    $("#offline").show();
  $("#offline2").show();
        });
      });

    };
 // };
  for (let i = 0; i < channels.length; i++) {
  jsonCall(channels[i]);
  }
});
            
          
!
999px
Loading ..................

Console