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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <h1>Choose a Twitch.tv streamer</h1>
<p id="buttons" class="row">
<button id="all">All</button>
<button id="online">Online</button>
<button id="offline">Offline</button>
</p>
<div class="col-xs-7">
<div id="styler">
  <div id="esl_sc2_name">The first streamer</div>
  <div id="esl_sc2_gametime">The first streamer</div>
  <div id="esl_sc2_game"><b>The first streamer</b></div>
</div>
<div id="styler">
  <div id="freecodecamp_name">The second streamer</div>
  <div id="freecodecamp_gametime">The second streamer</div>
  <div id="freecodecamp_game">The second streamer</div>
</div>
<div id="styler">
  <div id="OgamingSC2_name">The thirdstreamer</div>
  <div id="OgamingSC2_gametime">The third streamer</div>
  <div id="OgamingSC2_game">The third streamer</div>
</div>
</div>
              
            
!

CSS

              
                body {
  background: url("https://i.ytimg.com/vi/bgWNw2Yr3SM/maxresdefault.jpg");
   background-repeat: no-repeat;
}
h1 {
  font-size:60px;
}
#buttons {
  margin-bottom:20px;
  margin-left:20px;
}
button {
  font-size:20px;
  border:solid blue 1px;
  border-radius:5px;
}
button:hover {
  border:solid gray 1px;
}
button:active {
  background-color:white;
}
a {
  color:blue;
}
#styler {
  display:block;
  border: solid black 1px;
  padding:0px;
  background-color:gray;
}
div {
  text-align:left;
  font-size: 20px;
  display: inline;
  margin-left: 30px;
}
#esl_sc2_game {
  color: black;
}
#OgamingSC2_game {
  color: black;
}
.onlinestuff {
  color:green;
}
.offlinestuff {
  color:red;
}
              
            
!

JS

              
                function twitcher(username) {
  var myURL = "https://wind-bow.glitch.me/twitch-api/streams/" + username;
  $.getJSON(myURL, function(data) {
    var info = data;
    var userlink =
      "<a target='_blank' href='https://go.twitch.tv/" +
      username +
      "'>" +
      username +
      "</a>";
    var gametime = "Offline";
    var game = "";
    document.getElementById(username + "_name").className = "offlinestuff";
    document.getElementById(username + "_gametime").className = "offlinestuff";
    document.getElementById(username + "_game").className = "offlinestuff";
    if (info.stream !== null) {
      userlink =
        "<a target='_blank' href='https://go.twitch.tv/" +
        username +
        "'>" +
        info.stream.channel.display_name +
        "</a>";
      gametime = info.stream.channel.status;
      game = info.stream.game;
      document.getElementById(username + "_name").className = "onlinestuff";
      document.getElementById(username + "_gametime").className = "onlinestuff";
      document.getElementById(username + "_game").className = "onlinestuff";
    }
    document.getElementById(username + "_name").innerHTML = userlink;
    document.getElementById(username + "_gametime").innerHTML = gametime;
    document.getElementById(username + "_game").innerHTML = game;
  });
}

twitcher("esl_sc2");
twitcher("freecodecamp");
twitcher("OgamingSC2");

// I am making here an online button

$("#online").click(function() {
  var x = document.querySelectorAll(".onlinestuff");
  for (var i = 0; i < x.length; i++) {
    x[i].style.display = "inline";
  }
  var y = document.querySelectorAll(".offlinestuff");
  for (var i = 0; i < y.length; i++) {
    y[i].style.display = "none";
  }
});

// I am making here an offline button

$("#offline").click(function() {
  var x = document.querySelectorAll(".offlinestuff");
  for (var i = 0; i < x.length; i++) {
    x[i].style.display = "inline";
  }
  var y = document.querySelectorAll(".onlinestuff");
  for (var i = 0; i < y.length; i++) {
    y[i].style.display = "none";
  }
});

// I am making here an all button

$("#all").click(function() {
  var x = document.querySelectorAll(".onlinestuff");
  var y = document.querySelectorAll(".offlinestuff");
  for (var i = 0; i < x.length; i++) {
    x[i].style.display = "inline";
  }
  for (var i = 0; i < y.length; i++) {
    y[i].style.display = "inline";
  }
});
              
            
!
999px

Console