css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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="row min-width">
    <div class="header-top">
      <div class="text-center header-prop">
        <h2 id="headerTitle">Twitch<i class="fa fa-gamepad" aria-hidden="true"></i></h2>
      </div>
      <div class="text-center btn-section-prop">
        <div>
          <i id="allBtn" class="all-btn fa fa-3x fa-globe" aria-hidden="true" title="All streamers"></i>
        </div>
        <div>
          <i id="onBtn" class="online-btn fa fa-3x fa-power-off" aria-hidden="true" title="All online streamers"></i>
        </div>
        <div>
          <i id="offBtn" class="offline-btn fa fa-3x fa-power-off" aria-hidden="true" title="All offline streamers"></i>
        </div>
      </div>
    </div>
  </div>
  <div id="appendContent" class="row min-width">
    <!-- Content Aquired Goes Here!-->
  </div>
</div>
            
          
!
            
              body {
  margin: 0;
  background-color: #9D75CB;
}

.header-top {
  background-color: #8C1A6A;
  margin: auto;
  margin-top: 1em;
  height: 15em;
  border-radius: 10px;
}

.results-content {
  background-color: #A657AE;
  margin: auto;
  margin-top: 1em;
  border-radius: 10px;
}

.results-content:hover {
  background-color: #A657AE;
  border-left: 0.2em solid #fff;
  border-right: 0.2em solid #fff;
  margin-top: 1em;
  border-radius: 10px;
}

.min-width {
  min-width: 320px;
}

#headerTitle {
  font-family: 'Press Start 2P', cursive;
  font-size: 4em;
  color: #fff;
  padding-top: 0.5em;
}

.header-prop {
  width: 100%;
}

.btn-section-prop {
  padding-top: 2em;
}

.all-btn {
  float: left;
  width: 33.3%;
  color: #fff;
}

.all-btn:hover {
  color: #9D75CB;
}

.online-btn {
  float: left;
  width: 33.3%;
  color: #23ff3d;
}

.online-btn:hover {
  color: #9D75CB;
}

.offline-btn {
  float: left;
  width: 33.3%;
  color: #ff1717;
}

.offline-btn:hover {
  color: #9D75CB;
}

.results-header {
  width: 100%;
}

.streamName {
  padding-top: 0.3em;
  font-family: 'Lato', sans-serif;
  font-size: 1.6em;
  color: #fff;
}

.logo {
  width: 5em;
  height: 5em;
  margin-left: 1em;
  margin-bottom: 1em;
  border: 0.3em solid #8C1A6A;
}

.streamDescription {
  padding-top: 0.8em;
  font-family: 'Lato', sans-serif;
  font-size: 1.2em;
  color: #fff;
}

.streamStatus {
  padding-top: 0.5em;
  padding-right: 3em;
  font-family: 'Press Start 2P', cursive;
  font-size: 1.2em;
  color: #fff;
}

a:link {
  text-decoration: none;
}

a:visited {
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

a:active {
  text-decoration: none;
}

/*Media Queries*/
@media screen and (min-width: 0px) {
  .header-top {
    height: 18em;
    width: 100%;
  }
  .results-content {
    width: 100%;
  }
}

@media screen and (min-width: 400px) {
  .header-top {
    height: 15em;
    width: 100%;
  }
  .results-content {
    width: 100%;
  }
}


@media screen and (min-width: 520px) {
  .header-top {
    height: 15em;
    width: 100%;
  }
  .results-content {
    width: 100%;
  }
}

@media screen and (min-width: 992px) {
  .header-top {
    height: 15em;
    width: 50%;
  }
  .results-content {
    width: 50%;
  }
}


            
          
!
            
              $(function() {
  //change this if you want to add or remove streamers
  var streamersArr = ["onscreenlol", "summit1g", "ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas", "starladder_cs_en", "syndicate", "riotgames", "esl_csgo", "Nightblue3", "LIRIK", "PhantomL0rd", "captainsparklez", "imaqtpie", "sodapoppin"];

  //caching DOM

  var insertContent = $("#appendContent");
  var allBtn = $("#allBtn");
  var offBtn = $("#offBtn");
  var onBtn = $("#onBtn");
  var content = $(".results-content");

  //Start offStreams

  function allStreams() {

    streamersArr.forEach(function(streamer) {

      var urlOnline = "https://api.twitch.tv/kraken/streams/" + streamer + "/?callback=?";
      var urlOffline = "https://api.twitch.tv/kraken/channels/" + streamer + "/?callback=?";

      $.getJSON(urlOnline, function(dataOnline) {

        var streamLogo = "";
        var streamURL = "";
        var game = "";
        var status = "";
        var streamName = "";

        if (dataOnline.stream === null) {

          $.getJSON(urlOffline, function(dataOffline) {

            if (dataOffline.error === "Not Found") {

            } else {

              streamName = dataOffline.display_name;
              streamLogo = dataOffline.logo;
              streamURL = dataOffline.url;
              game = dataOffline.game;
              status = dataOffline.status;

              if (game === null) {
                game = "No Specific Game";
              }

              if (status === null) {
                status = "";
              }

              insertContent.append('<a href="' + streamURL + '" target="_blank"><div class="results-content"><div class="results-header center-block"><h3 class="streamName text-center">' + streamName + ' | ' + game + '</h3></div><div class="row"><div class="col-xs-4"><img class="logo img-circle" src="' + streamLogo + '"></div><div class="col-xs-4"><p class="streamDescription text-center">' + status + '</p></div><div class="col-xs-4"><p class="streamStatus text-right">Offline</p></div></div></div></a>');
            }
          });

        } else if (dataOnline.error === "Not Found") {

          streamName = streamer;
          streamLogo = "http://theshoecompany.townshoes.ca/store/_ui/desktop/common/images/404a_prodNotFound_img.jpg";
          status = dataOnline.message;
          var errorType = dataOnline.status;

          insertContent.append('<div class="results-content"><div class="results-header center-block"><h3 class="streamName text-center">' + streamName + '</h3></div><div class="row"><div class="col-xs-4"><img class="logo img-circle" src="' + streamLogo + '"></div><div class="col-xs-4"><p class="streamDescription text-center">' + status + '</p></div><div class="col-xs-4"><p class="streamStatus text-right">Error ' + errorType + '</p></div></div></div>');

        } else {

          streamName = dataOnline.stream.channel.display_name;
          streamLogo = dataOnline.stream.channel.logo;
          streamURL = dataOnline.stream.channel.url;
          game = dataOnline.stream.game;
          status = dataOnline.stream.channel.status;

          if (game === null) {
            game = "No Specific Game";
          }

          if (status === null) {
            status = "No Specific Game";
          }

          insertContent.append('<a href="' + streamURL + '" target="_blank"><div class="results-content"><div class="results-header center-block"><h3 class="streamName text-center">' + streamName + ' | ' + game + '</h3></div><div class="row"><div class="col-xs-4"><img class="logo img-circle" src="' + streamLogo + '"></div><div class="col-xs-4"><p class="streamDescription text-center">' + status + '</p></div><div class="col-xs-4"><p class="streamStatus text-right">Online</p></div></div></div></a>');

        }

      });
    });
  }
  //end allStreams
  //Start onStreams

  function onStreams() {

    streamersArr.forEach(function(streamer) {

      var urlOnline = "https://api.twitch.tv/kraken/streams/" + streamer + "/?callback=?";
      var urlOffline = "https://api.twitch.tv/kraken/channels/" + streamer + "/?callback=?";

      $.getJSON(urlOnline, function(dataOnline) {

        var streamLogo = "";
        var streamURL = "";
        var game = "";
        var status = "";
        var streamName = "";

        if (dataOnline.stream === null) {

        } else if (dataOnline.error === "Not Found") {

        } else {

          streamName = dataOnline.stream.channel.display_name;
          streamLogo = dataOnline.stream.channel.logo;
          streamURL = dataOnline.stream.channel.url;
          game = dataOnline.stream.game;
          status = dataOnline.stream.channel.status;

          if (game === null) {
            game = "No Specific Game";
          }

          if (status === null) {
            status = "No Specific Game";
          }

          insertContent.append('<a href="' + streamURL + '" target="_blank"><div class="results-content"><div calss="results-header center-block"><h3 class="streamName text-center">' + streamName + ' | ' + game + '</h3></div><div class="row"><div class="col-xs-4"><img class="logo img-circle" src="' + streamLogo + '"></div><div class="col-xs-4"><p class="streamDescription text-center">' + status + '</p></div><div class="col-xs-4"><p class="streamStatus text-right">Online</p></div></div></div></a>');

        }

      });
    });
  }
  //end onStreams
  //Start offStreams
  function offStreams() {

    streamersArr.forEach(function(streamer) {

      var urlOnline = "https://api.twitch.tv/kraken/streams/" + streamer + "/?callback=?";
      var urlOffline = "https://api.twitch.tv/kraken/channels/" + streamer + "/?callback=?";

      $.getJSON(urlOnline, function(dataOnline) {

        var streamLogo = "";
        var streamURL = "";
        var game = "";
        var status = "";
        var streamName = "";

        if (dataOnline.stream === null) {

          $.getJSON(urlOffline, function(dataOffline) {

            if (dataOffline.error === "Not Found") {

            } else {

              streamName = dataOffline.display_name;
              streamLogo = dataOffline.logo;
              streamURL = dataOffline.url;
              game = dataOffline.game;
              status = dataOffline.status;

              if (game === null) {
                game = "No Specific Game";
              }

              if (status === null) {
                status = "";
              }

              insertContent.append('<a href="' + streamURL + '" target="_blank"><div class="results-content"><div calss="results-header center-block"><h3 class="streamName text-center">' + streamName + ' | ' + game + '</h3></div><div class="row"><div class="col-xs-4"><img class="logo img-circle" src="' + streamLogo + '"></div><div class="col-xs-4"><p class="streamDescription text-center">' + status + '</p></div><div class="col-xs-4"><p class="streamStatus text-right">Offline</p></div></div></div></a>');
            }
          });

        } else if (dataOnline.error === "Not Found") {

        } else {

        }

      });
    });
  }
  //end offStreams

  //init
  allStreams();

  //buttons

  allBtn.on("click", function() {
    $(".results-content").fadeOut(1000);
    allStreams();
  });

  onBtn.on("click", function() {
    $(".results-content").fadeOut(1000);
    onStreams();
  });

  offBtn.on("click", function() {
    $(".results-content").fadeOut(1000);
    offStreams();
  });

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

Console