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

              
                <div id="header">
  <h1>Who twitches the Twitchers?</h1>
  <h4>Sadly, the freeCodeCamp <a href="https://wind-bow.glitch.me" target='_blank'>Twitch API workaround</a> no longer works as of late 2019.</h4>
</div>

<div id="mainContainer">
  <div class="channel">
    <a id="logo0"></a>
    <h3 id="liveStatus0" class="live"></h3>
    <h3 id="name0" class="name"></h3>
    <h3 id="status0" class="details"></h3>
  </div>
  <div class="channel">
    <a id="logo1"></a>
    <h3 id="liveStatus1" class="live"></h3>
    <h3 id="name1" class="name"></h3>
    <h3 id="status1" class="details"></h3>
  </div>
  <div class="channel">
    <a id="logo2"></a>
    <h3 id="liveStatus2" class="live"></h3>
    <h3 id="name2" class="name"></h3>
    <h3 id="status2" class="details"></h3>
  </div>
  <div class="channel">
    <a id="logo3"></a>
    <h3 id="liveStatus3" class="live"></h3>
    <h3 id="name3" class="name"></h3>
    <h3 id="status3" class="details"></h3>
  </div>
  <div class="channel">
    <a id="logo4"></a>
    <h3 id="liveStatus4" class="live"></h3>
    <h3 id="name4" class="name"></h3>
    <h3 id="status4" class="details"></h3>
  </div>
  <div class="channel">
    <a id="logo5"></a>
    <h3 id="liveStatus5" class="live"></h3>
    <h3 id="name5" class="name"></h3>
    <h3 id="status5" class="details"></h3>
  </div>
  <div class="channel">
    <a id="logo6"></a>
    <h3 id="liveStatus6" class="live"></h3>
    <h3 id="name6" class="name"></h3>
    <h3 id="status6" class="details"></h3>
  </div>
  <div class="channel">
    <a id="logo7"></a>
    <h3 id="liveStatus7" class="live"></h3>
    <h3 id="name7" class="name"></h3>
    <h3 id="status7" class="details"></h3>
  </div>
  <div class="channel">
    <a id="logo8"></a>
    <h3 id="liveStatus8" class="live"></h3>
    <h3 id="name8" class="name"></h3>
    <h3 id="status8" class="details"></h3>
  </div>
  <div class="channel">
    <a id="logo9"></a>
    <h3 id="liveStatus9" class="live"></h3>
    <h3 id="name9" class="name"></h3>
    <h3 id="status9" class="details"></h3>
  </div>
</div>

<div id="footer">
  <h3>An app by Tom Corbin</h3>
</div>
              
            
!

CSS

              
                /*General*/
@import url("https://fonts.googleapis.com/css?family=Orbitron|Poppins");

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-width: 100vw;
  margin: 5px 0;
  background: rgb(250, 213, 248);
  color: #4b367c;
  font-family: "Poppins", sans-serif;
  font-size: 10px;
}

#header {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.5em;
  font-family: "Orbitron", sans-serif;
}

#header > h1 {
  margin: 10px 0 5px 0;
}

#header > h4 {
  margin: 5px 0 5px 0;
}

#mainContainer {
  display: flex;
  flex-direction: column;
  background: white;
  width: 800px;
  padding: 10px 10px;
  border: solid;
  border-radius: 5%;
}

.channel {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  padding: 10px 0px;
}

h3 {
  margin: 0;
}

img {
  width: 50px;
  height: 50px;
  border-radius: 20%;
}

a {
  text-decoration: none;
}

.live {
  padding: 0px 10px;
  color: rgb(234, 0, 255);
}

.name {
  padding: 0px 10px;
  font-size: 1.25em;
}

.details {
  margin-left: auto;
  margin-right: 10px;
  text-align: center;
  padding: 0;
  max-width: 300px;
  font-family: "Orbitron", sans-serif;
  color: #c487e2;
}

svg {
  color: rgb(5, 238, 149);
}

#eye_slash {
  color: rgb(248, 7, 139);
}

#footer {
  font-size: 1.5em;
  color: #c487e2;
}

@media all and (max-width: 810px) {
  #mainContainer {
    width: 400px;
    padding: 0;
    border-radius: 10px;
  }
  .channel {
    flex-direction: column;
    padding: 5px 10px;
    border-bottom: 2px solid #4b367c;
  }
  .details {
    margin: 0;
    padding: 0 10px;
  }
  img {
    border-radius: 15%;
  }
  #header,
  #footer {
    max-width: 350px;
    text-align: center;
  }
}

@media all and (max-width: 325px) {
  #mainContainer {
    max-width: 315px;
    padding: 0;
    border-top: solid;
    border-bottom: solid;
    border-right: none;
    border-left: none;
    border-radius: 0px;
  }
  .channel {
    flex-direction: column;
    padding: 5px 10px;
    border-bottom: 2px solid #4b367c;
  }
  .details {
    margin: 0;
    padding: 0 10px;
  }
  img {
    border-radius: 15%;
  }
  #header,
  #footer {
    max-width: 315px;
    text-align: center;
  }
}

              
            
!

JS

              
                let channelsArray = [
  "food",
  "thejustinwilsonshow",
  "contv",
  "bobross",
  "cosmos",
  "thecosmosmedia",
  "creativemusicfm",
  "monstercat",
  "epidemic_sound",
  "freecodecamp"
];

function error() {
  console.log("Error Axios");
}

function twitchLiveCheck() {
  for (let i = 0; i < channelsArray.length; i++) {
    let urlStreams = `https://wind-bow.glitch.me/helix/streams?game_id=488552`;
    // let urlStreams = `https://wind-bow.glitch.me/twitch-api/streams/${channelsArray[i]}`;
    let logoI = document.querySelector("#logo" + i);
    let liveStatusI = document.querySelector("#liveStatus" + i);
    let nameI = document.querySelector("#name" + i);
    let statusI = document.querySelector("#status" + i);
    axios
      .get(urlStreams)
      .then(function(response) {
        if (response.data.stream !== null) {
          let logo = response.data.stream.channel.logo;
          let displayName = response.data.stream.channel.display_name;
          let url = response.data.stream.channel.url;
          let status = response.data.stream.channel.status;
          logoI.innerHTML = `<a id='logo${i}' href=${url} target='_blank'><img src=${logo} alt='logo'></a>`;
          liveStatusI.innerHTML = `<h3 id='liveStatus${i}' class='live'><a><i class='fas fa-eye'></i> Live</a></h3>`;
          nameI.innerHTML = `<h3 id='name${i}' class='name' ><a href=${url} target='_blank'>${displayName}</a></h3>`;
          statusI.innerHTML = `<h3 id='status${i}' class='details'><a href=${url} target='_blank'>${status}</a></h3>`;
        } else {
          offline(i);
        }
      })
      .catch(error);
  }
}

function offline(i) {
  let urlChannels = `https://wind-bow.glitch.me/twitch-api/channels/${
    channelsArray[i]
  }`;
  let logoI = document.querySelector("#logo" + i);
  let liveStatusI = document.querySelector("#liveStatus" + i);
  let nameI = document.querySelector("#name" + i);
  let statusI = document.querySelector("#status" + i);
  axios
    .get(urlChannels)
    .then(function(response) {
      let logo = response.data.logo;
      let displayName = response.data.display_name;
      let url = response.data.url;
      let status = "Offline";
      logoI.innerHTML = `<a href=${url} target='_blank'><img id='logo${i}' src=${logo} alt='logo'></a>`;
      liveStatusI.innerHTML = `<h3 id='liveStatus${i}' class='live'><a><i class='fas fa-eye-slash' id='eye_slash'></i> Off</a></h3>`;
      nameI.innerHTML = `<h3 id='name${i}' class='name' ><a href=${url} target='_blank'>${displayName}</a></h3>`;
      statusI.innerHTML = `<h3 id='status${i}' class='details'><a href=${url} target='_blank'>${status}</a></h3>`;
    })
    .catch(error);
}
twitchLiveCheck();

              
            
!
999px

Console