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.

            
              <!--
TODO:

Display past videos below live stream √

Set default images√

-->
<html>

<head>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
  <meta name="viewport" content="width=device-width, initial-scale=1">

</head>

<body>

  <div id="searchResult">
    <section class="searchInput">
      <input type="text" id="searchTerm">
    </section>

    <ul id="resultUl">
      <section id="toClear">
      </section>

      <sections id="faveSection">
      <section class="favGroup">
        <li><i class="fa fa-star"></i>esl_csgo</li><span class="delete">x</span>
      </section>
      <section class="favGroup">
        <li><i class="fa fa-star"></i>freecodecamp</li><span class="delete">x</span>
      </section>
        </section>
    </ul>
  </div>

  <!--   <section class="userSearch">

    <input list="users" type="text" id="search" placeholder="username">
    <datalist id="users">
    <option value="OgamingSC2">
    <option value="cretetion">
    <option value="esl_csgo">
    <option value="habathcx">
    <option value="RobotCaleb">
    <option value="noobs2ninjas">
    <option value="freecodecamp">    
  </datalist>
    <button id="searchBtn"><i class="fa fa-search"></i></button>
  </section>
 -->
  <button type="button" class="searchBtn" id="searchBtn"><i class="fa fa-search"></i></button>

  <div class="header" id="header">
    <div class="overlay"></div>
  </div>

  <div class="logo" id="logo"></div>

  <section class="top">
    <div class="stream" id="stream"></div>
    <div class="totalViews" id="totalViews"></div>
    <div class="followers" id="followers"></div>
  </section>
  <div class="status" id="status"></div>

  <div class="bio" id="bio"></div>
  <div class="vid" id="vid"></div>
  <div class="streamInfo" id="streamInfo">
    <div id="title"></div>
    <div id="viewers"></div>
  </div>

  <section class="vidInformation">
    <span class="pastVids" id="pastVids">Recorded Videos</span><span class="vidCnt" id="vidCnt"></span>
  </section>

  <div class="hide">
    <div class="videos" id="videos"></div>
  </div>

  <section class="vidInformation">
    <span class="following" id="following">Following </span><span class="followCnt" id="followCnt"></span>
  </section>

  <div class="follows" id="follows"></div>

</body>

</html>
            
          
!
            
              html,
body {
  padding: 0;
  margin: 0;
  background: #fff;
  font-family: "Open Sans";
}

.searchBtn {
  position: absolute;
  height: 35px;
  width: 35px;
  right: 10px;
  top: 10px;
  border: none;
  border-radius: 50%;
  opacity: 0.4;
  transition: all 0.3s;
  cursor: pointer;
}

.searchBtn:hover {
  opacity: 1;
}

#searchResult {
  position: fixed;
  margin-top: 50px;
  margin-left: auto;
  margin-right: auto;
  background: #fff;
  height: 90%;
  width: 55%;
  left: 0;
  right: 0;
  z-index: 999;
  overflow-y: auto;
  box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.2);
  display: none;
  .searchInput {
    display: flex;
    justify-content: center;
    padding: 10px;
    background: #333;
    input {
      border: none;
      height: 25px;
      border-radius: 5px;
      background: rgba(255, 255, 255, 0.2);
      color: #fff;
      text-indent: 15px;
      font-size: 16px;
    }
  }
}

#searchResult::-webkit-scrollbar {
  background-color: #fff;
  width: 10px;
}

#searchResult::-webkit-scrollbar-thumb {
  background-color: #5C5C5C;
}

#searchResult::-webkit-scrollbar-track {
  background-color: #fff;
}

#resultUl {
  margin: 0;
  padding: 0;
}

#resultUl li {
  list-style-type: none;
  padding: 10px;
  margin: 2px;
  background: #fcfcfc;
  color: #888;
  .fa {
    padding-right: 5px;
  }
}

.favGroup {
  display: flex;
}

.delete {
  padding: 10px;
  margin: 2px;
  text-align: right;
  color: #ccc;
  font-weight: bold;
  display: block;
}

.delete:hover {
  background: #f2655e;
  color: #fcfcfc;
  cursor: pointer;
}

#resultUl li:hover {
  cursor: pointer;
}

// .userSearch {
//   position: absolute;
//   display: flex;
//   right: 10px;
//   top: 10px;
//   opacity: 0.4;
//   transition: all 0.3s;
//   button {
//     height: 27px;
//     border: none;
//     color: #fff;
//     border-radius: 0 20px 20px 0;
//     background: #ccc;
//   }
//   input {
//     border: none;
//     height: 25px;
//     border-radius: 20px 0 0 20px;
//     text-indent: 10px;
//     background: #fff;
//   }
// }
// .userSearch:hover {
//   opacity: 1;
// }
.header {
  height: 170px;
  width: 100%;
  display: flex;
  align-items: center;
  background: #ccc;
  background-size: cover;
  background-position: center center;
}

.overlay {
  height: 100%;
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
}

.logo {
  display: flex;
  align-items: center;
  font-size: 28px;
  color: #fff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.9);
  img {
    height: 75px;
    border-radius: 50%;
    margin: 0 10px;
    position: absolute;
    top: 125px;
  }
  p {
    position: absolute;
    top: 105px;
    left: 95px;
  }
  a {
    text-decoration: none;
    color: #fff;
  }
  .fa-star {
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s;
  }
}

.sections {
  position: relative;
  margin: 0 auto;
  width: 65%;
}

.top {
  width: 65%;
  margin: 0 auto;
  margin-top: 50px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  font-weight: bold;
  color: #888;
}

.bio,
.status {
  @extend .sections;
  position: relative;
  margin: 40px auto;
  .fa {
    color: #888;
    font-size: 12px;
    position: relative;
    top: -5px;
  }
}

.vid {
  @extend .sections;
  margin-top: 40px;
  margin-bottom: 5px;
}

.streamInfo {
  @extend .sections;
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  color: #888;
  font-weight: bold;
  .fa {
    color: #888;
    font-size: 16px;
    position: relative;
  }
}

#viewers {
  display: flex;
  align-items: center;
}

.vid {
  display: flex;
  justify-content: center;
  background: black;
  height: auto;
}

.stream {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  .fa {
    font-size: 12px;
    padding-right: 5px;
  }
}

.green {
  color: green;
}

.videos {
  @extend .sections;
  display: flex;
  flex-direction: column;
  img {
    height: 75px;
    margin: 10px 10px 0 0;
  }
  section {
    display: flex;
    align-items: center;
  }
}

// .hide {
//   display: none;
// }
.vidInformation {
  display: flex;
  justify-content: center;
  a {
    text-decoration: underline;
    color: #888;
  }
}

.pastVids,
.vidCnt,
.following,
.followCnt {
  position: relative;
  font-size: 22px;
  font-weight: bold;
  color: #888;
  margin: 100px 5px 50px 5px;
}

.follows {
  @extend .sections;
  margin-bottom: 50px;
  img {
    height: 65px;
    border-radius: 50%;
    margin: 5px;
  }
}

@media only screen and (max-width: 768px) {
  .top {
    width: 90%;
    flex-direction: column;
    div {
      padding: 10px 0;
    }
  }
  .sections {
    width: 90%;
  }
  #searchResult {
    width: 95%;
  }
}
            
          
!
            
              function requestData(api, type, name) {
  var cb = '?callback=?',
        id = '&client_id=phpj3b779rpzcaoex3av4q6m8iiy9c',
        url = api == 'wind' ? 'https://wind-bow.gomix.me/twitch-api/' + type + '/' + name + cb:
        'https://api.twitch.tv/kraken/channels/' + name + cb + id;
  
  return $.getJSON(url);
}


function showIframe(name) {
  var url = 'https://player.twitch.tv/?autoplay=true&muted=true&channel=' + name;
  
  $('#vid').html('<iframe src="' + url + '" frameborder="0" scrolling="no" height="378" width="620" allowfullscreen="true"></iframe>');
}


function displayStream(data) {
    var name = data.name;

    $('#logo').html('<img src="' + data.logo + '"/><p>' + '<a href="https://www.twitch.tv/' + name + '"  target="_blank">' + data.display_name + '</a> <i class="fa fa-star" id="addfav"></i></p>');

    $('#bio').html(data.bio);
       
       
     $('#resultUl').append('<section class="favGroup"><li><i class="fa fa-star"></i>'+name+'</li><span class="delete">x</span></section>');

     localStorage.setItem('favorites', $('#resultUl').html());
  
    showIframe(name);
}

// Run stuff on page load
function init(name) {
  
  requestData('wind', 'users', name)
  .then(function(data) {
    displayStream(data);
  });
  
}

// Fire intialize function
init('freecodecamp');

            
          
!
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.

Console