Pen Settings

HTML

CSS

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

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <main>
  <div class="wrapper">
    <header class="header">Twitch Streamers</header>
    <ul class="navigation">
      <li><a href="#" onclick="clickedAll()">All</a></li>
      <li><a href="#" onclick="clickedOnline()">Online</a></li>
      <li><a href="#" onclick="clickedOffline()">Offline</a></li>
    </ul>
    <div class="" id="users">
      <div class="" id="user">
      </div>
    </div>
  </div>
  <div id="display"></div> 
</main>

              
            
!

CSS

              
                body {
  padding: 2em; 
  font-size: 1.2rem;
  color: #fff;
  background-color: #37ccc1;
}

p {text-shadow: 2px 2px #000; color: #ff00ccb3; line-height: 1.8rem;}
a {color: #ff00ccb3; text-decoration:underline;}
a:hover {color: #007bff;}
img {border: solid 4px black; box-shadow: 3px 3px #ff00ccb3; width: 200px;}

ul {padding:0; width:100%;}
ul li {list-style:none;}

.header {
  background-color: #4b367c;
  font-size: 3rem;
  margin-bottom: 10px;
  text-transform: uppercase;
  border: solid 4px black;
  text-shadow: 4px 0 0 #000, 
              -4px 0 0 #000, 
               0 4px 0 #000, 
              0 -4px 0 #000, 
               4px 4px #000, 
           -4px -4px 0 #000, 
            4px -4px 0 #000, 
            -4px 4px 0 #000;
}

.navigation {
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-flow: row wrap;
  justify-content: space-around;

  list-style: none;
  margin: 0;
  background: deepskyblue;
  border: solid 4px black;
}

.navigation a {
  text-decoration: none;
  display: block;
  padding: 0.4em;
  color: white;
}

.navigation li {
  background: #0b7193;
  width:30%;
  text-decoration: none;
  border: solid 4px black;
  text-transform: uppercase;
  text-shadow: 2px 0 0 #000, 
              -2px 0 0 #000, 
               0 2px 0 #000, 
              0 -2px 0 #000, 
               2px 2px #000, 
           -2px -2px 0 #000, 
            2px -2px 0 #000, 
            -2px 2px 0 #000;
}

.wrapper {
  display: flex;  
  flex-flow: row wrap;
  font-weight: bold;
  text-align: center;
}

.wrapper > * {padding: 10px; flex: 1 100%;}

#users {padding: 10px 0px;}

.row{
  margin: 10px 0px 20px 0px;
  padding: 0px;
  border: solid 4px black;
}

.row > .row{
  margin: 0px;
  border: none;
  width: 33%;
}

.main {
  background: linear-gradient(transparent, darkgrey);
  color: #fff;
  padding: 0px; 
  text-align: left;
}

.main a:hover {color: #fff;}

.aside-1 {
  padding: 20px;
  background: linear-gradient(transparent, darkgrey);
}

.aside-2 {
  background: #505dff;
  padding: 0px;
  margin: 0px;
  width: 33%;
  
  border: solid #f00ccb 6px;
  background-size: 100%;
  background: linear-gradient(transparent, darkgrey);
  line-height: 1.4rem;
}

.aside-2 a {color: #fff!important; text-decoration:none;width: 100%; height: 100%;}
.aside-2 a:hover {color: #fff;}
.aside-2 a i{font-size: 3rem!important;}
.aside-2 a p {margin-top: 14%;}

.online {background-color:#9f9f9f;}
.offline {background-color:#e1e1e1;}
.visible {display:flex!important;}
.hidden {display:none!important;}
.cursorNone {cursor:auto;};
.cursorPointer {cursor:pointer;}

@media (min-width: 280px) {
  body {font-size: 1.2rem;}
  img {width: 100px;}
  ul {margin: 1rem;}
  
  .row{
    display: flex;
    flex-wrap: wrap;
  }
  
  .row > .row {
    flex-grow: 1;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
  }
  
  .aside-2 a p {margin: 10% 0%; color: #fff;}
  
  .main    {order: 2; flex: 0 2 40%;}
  .aside-1 {order: 1; flex: 0 2 auto;}
  .aside-2 {order: 3; flex: 1 0 auto;}
}

@media (min-width: 600px) {
  body {
    padding: 2em; 
    font-size: 1.4rem;
  }
  
  img {width: 150px;}
  
  .row{
    display: flex;
    flex-wrap: nowrap;
    flex-direction: row;
    flex-grow: 1;
  }

  .row > .row {
    flex-grow: 1;
    justify-content: space-between;
    align-items: flex-end;
  }
  
  .aside-1 {padding: 20px;}
  .aside-2 a p {color: #fff;}

  
  .main    {order: 2; flex-grow: 1;}
  .aside-1 {order: 1; flex-grow: 0;}
  .aside-2 {order: 3; flex-grow: 0;}
}

              
            
!

JS

              
                var channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];
var i = 1;

function getChannelInfo() {
  channels.forEach(function(channel) {
    function makeURL(type, name) {
      return 'https://wind-bow.gomix.me/twitch-api/' + type + '/' + name + '?callback=?';
    };
    $.getJSON(makeURL("streams", channel), function(data) {
      var bgUser = "https://www.gamecupid.com/sites/default/files/styles/big_banner_980x280/public/games/banners/bubble_bobble_wallpaper_01_by_cybaBABE.jpg";
      var nobgVideo ="https://ak0.picdn.net/shutterstock/videos/33145690/thumb/10.jpg";
      var bgVideo = nobgVideo;
      var playButton = "<i class='fa fa-play-circle'></i>"
      var playText = "Click to view streaming transmission";
      var status = "offline";
      var frameVideo = "no";
      var gameUser = " ";
      var nameUser = " ";
      var channelUser = " ";        
      var channelIframe = " ";
      var game;
        
      nameUser = data._links.channel.substring(38);
      channelUser = "https://www.twitch.tv/" + nameUser;   
      channelIframe = "https://player.twitch.tv/?channel=" + nameUser;
       
      if (data.stream === null) {
        game = "Offline";
        gameUser = "Offline";
        playButton = "<i class='fa fa-ban'></i>";
        playText = "There is no transmission";
      } else if (data.stream === undefined) {
        game = "Account Closed";
        gameUser = "Offline";
        nameUser = data.stream.channel.name;
        playButton = "<i class='fa fa-ban'></i>";
        playText = "There is no transmission";
      } else {
        game = data.stream.game;
        status = "online";
        gameUser = data.stream.game;
        nameUser = data.stream.channel.name;
        bgVideo = data.stream.preview.large;
        bgUser = data.stream.channel.profile_banner;
        frameVideo = "si";
      };
        
      $.getJSON(makeURL("channels", channel), function(data) {
        var 
          logo = data.logo != null ? data.logo : "https://dummyimage.com/50x50/ecf0e7/5c5457.jpg&text=0x3F",
          name = data.display_name != null ? data.display_name : channel,
          description = status === "online" ? ' ' + data.status : "";
            
        if (frameVideo === "no") {
          html = '<div class="row '  + 
            status + '"style="background-image: url(' + bgUser + ');"><article class="main row"><ul><li><p>User: <a href="' + channelUser + '" target="_blank">' + 
            nameUser + '</a><br>Game: ' + gameUser + '</p><p>' + 
            description + '</p></li></a></ul></article><aside class="aside aside-1" id="idLogo"><img src="' + 
            logo + '"></aside><aside class="aside aside-2" style="background-image: url(' + 
            bgVideo + ');" id="frameVideo"><a href="#" class="cursorNone"><p>' + 
            playButton + '<br><span>' + playText + '</span></p></a></aside>';
        } else {
          html = '<div class="row '  + 
            status + '"style="background-image: url(' + bgUser + ');"><article class="main row"><ul><li><p>User: <a href="' + channelUser + '" target="_blank">' + 
            nameUser + '</a><br>Game: ' + gameUser + '</p><p>' + 
            description + '</p></li></a></ul></article><aside class="aside aside-1" id="idLogo"><img  src="' + 
            logo + '"></aside><aside class="aside aside-2" style="background-image: url(' + 
            bgVideo + ');" id="frameVideo' + i + '" onclick="clicked(this, \'' + channelIframe + '\')"><a href="#" class="cursorPointer"><p>' + playButton + '<br><span>' + playText + '</span></p></a></aside>';
            i = i + 1;
        };

        status === "online" ? $("#users").prepend(html) : $("#users").append(html);

      });
    });
  });
};

function clicked(frameId, chusr) {
  console.log(frameId.id);
  console.log(chusr);
  $("#" + frameId.id).html('<iframe src="' + chusr + '" frameborder="0" allowfullscreen="true" scrolling="no" height="100%" width="100%"></iframe>');
};

function clickedOnline() {
  $(".online").removeClass("hidden");
  $(".online").addClass("visible");
  $(".offline").addClass("hidden");
  $(".offline").removeClass("visible");
}

function clickedOffline() {
  $(".online").removeClass("visible");
  $(".online").addClass("hidden");
  $(".offline").addClass("visible");
  $(".offline").removeClass("hidden");
}

function clickedAll() {
  $(".online").addClass("visible");
  $(".online").removeClass("hidden");
  $(".offline").addClass("visible");
  $(".offline").removeClass("hidden");
}

$(document).ready(function() {
  getChannelInfo();
});
              
            
!
999px

Console