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="navbar" id="navbar-top">
  <div class = "container">
    <i id = "logo" class = "fa fa-twitch white floatl" aria-hidden="true">
    </i>
    <div class = "title floatl">
      Tw@tch
    </div>
    <div id = "controls" class = "floatr">
      <form id = "addFormId" name = "addFormName" action = "" method = "GET" class = "iblock floatl" autocomplete= "off" onSubmit = "return false">
        <input id = "addField" type = "text" name = "searchbox" class = "searchfield" value = "" placeholder = "Add Streamer">
      </form>
      <i id = "addbtn" class="fa fa-plus formbtns" aria-hidden="true" onClick = "addStreamer(addFormName)">
      </i>
      <i id = "reqbtn" class="fa fa-refresh formbtns" aria-hidden="true">
      </i>
    </div>
  </div>
</div>

<div id = "content">
</div>

            
          
!
            
              body {
  background-color: #faf9fa;
  font-family: ubuntu;
}
.navbar {
  height: 80px;
  background-color: #4b367c;
  overflow: hidden;
  margin: -10px;
  Padding: 10px;
}
.navbar .navbuttons{
  float: left;
  display: block;
  color: #fff;
  text-align: center;
  padding: 5px 16px;
  text-decoration: none;
  font-size: 17px;
  font-family: trebuchet MS;
  left: 20%;
}
.title {
  font-size: 46px;
  color: white;
  margin-left: 20px;
  width: auto;
}
.shell {
  max-width: 940px;
  margin: 0 auto;
  margin-top: -10px;
  box-shadow:0 2px 2px #ccc;
  background-color: #fff;
  
}
.shell:hover {
  background-color: #eee;
  
}
a {
  text-decoration: none !important;
  color: black !important;
}
.strmr {
  font-size: 24px;
}
.online {
  color: green;
}
.offline {
  color: red
}
.pic {
  height: 60px;
  margin-top: 10px;
  margin-left: 10px;
}
.shell > div {
  height: 80px;
}.shell {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: minmax(80px, auto);
}
.g0 {
  grid-column: 1;
  max-width: 100px;
  min-width: 80px;
  grid-row: 1;
}
.g1 {
  grid-column: 2 / 5;
  grid-row: 1;
  overflow: hidden;
  white-space: nowrap;
}
.g2 {
  grid-column: 5 / 6;
  grid-row: 1;
}
.strmr {
  margin-top: px;
}
.set:activate {
  background-color: purple;
}
.green {
  background-color: green;
}
#logo {
  font-size: 60px;
  margin-top: 5px;
}
.formbtns {
  margin-top: 20px;
  margin-left: 10px;
  color: white;
  font-size: 32px;
  cursor: pointer;
  cursor: hand;
  margin-right: 10px;
}
.formbtns:hover {
  text-shadow: 0px 0px 30px #09060e;
}
.buttons {
  font-family: ubuntu;
  background-color: #4b367c;
  color: white;
  border: solid white;
}
input[type=text] {
  background-color: white;
  color: #4b367c;
  border: solid white;
  outline: none;
  font-size: 20px;
  width: 300px;
  border: none;
  margin-left: 20px;
  margin-right: 10px;
  padding-left: 10px;
}
input::placeholder {
  color: #4b367c;
}
#addFormId {
  margin-top: 20px;
  margin-left: 4px;
}
.white {
  color: white;
}
.floatl {
  display: block;
  float: left;
}
.floatr {
  display: block;
  float: right;
}
#content {
  margin-top: 20px;
}

.notDropped {
  text-align: center;
  margin: auto;
  visibility: collapse;
  height: 0;
}
.dropped {
  text-align: center;
  margin: auto;
  visibility: visible;
  height: 200px;
}
.DD_overtext {
  margin-top: -100px;
  color: white;
  text-shadow: 0px 0px 3px #4b367c, 0px 0px 5px white;
  font-size: 20px;
}
.topbar {
  grid-column: 1 / 6;
  grid-row: 1;
  background-color: ;
  z-index: 2;
}

@media screen and (max-width: 740px) {
  .title {
    margin-left: 0px;
    opacity: 0;
    visibility: hidden;
    width: 0px;
  }
}
@media screen and (max-width: 550px) {
  input[type=text] {
    width: 160px;
    margin-left: 10px;
  }
  .formbtns {
  margin-top: 20px;
  margin-left: 0px;
  }
}
            
          
!
            
              var streamers = ['angryjoeshow', 'myre_test', 'starcitizen', 'freecodecamp', 'drdisrespectlive', 'kamet0', 'gmart', 'shroud'];
var rb = document.getElementById('reqbtn');
var ts = document.getElementById('test');
var ts2 = document.getElementById('test2');
var content = document.getElementById('content');
var content2 = document.getElementById('content2');
document.addEventListener("DOMContentLoaded", function() {
  getStreamData();
  });
function getStreamData() {
  content.innerHTML = "";
  streamers.forEach(function(streamer) {
    function getAddress (route, id) {
      return 'https://wind-bow.glitch.me/twitch-api/' + route + id + '?callback=';
    };
    var streamRequest = new XMLHttpRequest();
    streamRequest.open ('GET', getAddress('streams/', streamer), true);
    streamRequest.onload = function() {
      if (this.status >= 200 && this.status < 400) {
        var data = JSON.parse(this.response);
        console.log(data);
        var stat;
        var game;
        var preview;
        var previewText;
        if (data.stream === null) {
          stat = '<div class = "offline">Offline</div>';
          game = 'Offline';
          preview = 'https://image.ibb.co/jCfqbv/offline.jpg';
          previewText = 'Visit Channel'
        } else if (data.stream === undefined) {
          stat = '<div class = "offline">Offline</div>';
          game = 'Offline';
          preview = 'https://image.ibb.co/jCfqbv/offline.jpg';
          previewText = 'Visit Channel'
        } else {
          stat = '<div class = "online">Online</div>';
          game = data.stream.game;
          preview = data.stream.preview.medium;
          previewText = 'Go To Stream'
        };
        var channelRequest = new XMLHttpRequest();
        channelRequest.open ('GET', getAddress('channels/', streamer), true);
        channelRequest.onload = function() {
          if (this.status >= 200 && this.status < 400) {
            var data2 = JSON.parse(this.response);
            console.log(data2);
            var name;
            if (data2.display_name != null) {
              name = data2.display_name;
            } else {
              name = streamer;
            }
            var output = document.createElement("div");
            var shellFront = '<div class = "set"><div class = "shell" id = "shell">';
            var dropBar = '<div class = "topbar" onClick = "hey(' + streamer + ')"></div>';
            var left = '<div class = "g0"><img class = "img-responsive pic" src = "' + data2.logo + '"></div>';
            var middle = '<div class = "g1"><div class = "strmr">' + name + '</div><div class = "game">' + game + '</div><div class = "marquee"><marquee behavior="scroll" direction="left">' + data2.status + '</marquee></div></div>';
            var right = '<div class = "g2">' + stat + '</div>';
            var vidBox = '<div id = "' + streamer + '" class = "notDropped"><a href = "' + data2.url + '"><div id = "videobanner"><img src = "' + preview + '"><div class = "DD_overtext">' + previewText + '</div></div></a></div>'
            var shellEnd = '</div>' + vidBox + '</div><br>';
            output.innerHTML = shellFront + dropBar + left + middle + right + shellEnd;
            if (game === 'Offline') {
              content.append(output);
            } else {
              content.prepend(output);
            };
          } else {
          };
        };
        channelRequest.onerror = function() {
          console.log('channelRequest Error');
        };
        channelRequest.send();
      } else {
      };
    };
    streamRequest.onerror = function() {
      console.log('streamRequest Error');
    };
    streamRequest.send();
  });
};

rb.addEventListener('click', function() { 
  content.innerHTML = '';
  getStreamData();
});

function addStreamer(form) {
  var userRequest = new XMLHttpRequest();
  var search = form.searchbox.value.toLowerCase();
  var exists = streamers.includes(search);
  function getAddress (route, id) {
    return 'https://wind-bow.glitch.me/twitch-api/' + route + id + '?callback=';
  };
  userRequest.open ('GET', getAddress('users/', search), true);
  userRequest.onload = function() {
    if (this.status >= 200 && this.status < 400) {
      var data = JSON.parse(this.response);
      console.log(data);
      console.log('return');
      if (data.status > 399) {
        console.log('does not exist');
        alert('Streamer "' + search + '" Not Found');
      } else if (exists === true) {
        alert(search + ' Already Exists');
      } else {
        streamers.push(search);
        getStreamData();
      };
    } else {
    };
  };
  userRequest.onerror = function() {
    console.log('userRequest Error');
  };
  userRequest.send();
};
document.querySelector('#addField').addEventListener('keypress', function (e) {
  var key = e.which || e.keyCode;
  if (key === 13) { 
    addStreamer(this.form);
    console.log('enter');
  } else {     
  };
});

function hey(id) {
  if(id.className === 'notDropped') {
    id.className = 'dropped';
  } else {
    id.className = 'notDropped';
  }
}
            
          
!
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