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="container">
  <div class="outer">
   <div class="banner">
     <div class="inner"><img id="twitch_logo" src="https://www.filepicker.io/api/file/vL2cljiRdefa2gBxqsSV" alt="Twitch Logo">
     </div>
      
     <div id="button_cluster" class="inner">
        <ul>
          <li><button onclick="class="button">Add</button></li>
          <li><button class="button">Delete</button></li>
          
       </ul>
      </div>
     
     </div>
     <ul id="list">
     </ul>
</div>
            
          
!
            
              body, html {
  height:100%;
  width:100%;
  min-width:400px;
  background-color:#462a7a;
}
.container{
  display:flex;
  flex-flow:row;
  justify-content:center;
  min-height:100%;
  min-width:100%;
  border-style:solid;
}
.outer{
  align-self:flex-start;
  display:flex;
  flex-flow:column;
  border-style:solid;
  width:80%;
  max-width:600px;
}
.button{
  display:flex;
  flex-flow:row;
  justify-content:center;
  margin:0px;
  width:100%;
  border-radius:15%;
}
#button_cluster{
  margin:0px;
  padding:0px;
  width:auto;
}
.banner{
  padding-left:10px;
  display:flex;
  flex-flow:row;
  justify-content:center;
  align-items:center;
  width:100%;
  height:100px;
  background-color: #6441A4;
}
#twitch_logo{
  height:100px;
  width:auto;
}
.inner_row{
  padding:5px;
  display:flex;
  flex-flow:row; 
  align-items:center;
  width:100%;  
  border-top:solid;
  background-color:#c9b9e8;
}
.inner{
  display:flex;
  flex-flow:row;
  align-items: center;
  width:auto;
  height:auto;
  padding:5px;
}
.inner_row_mid{
  display:flex;
  flex-flow:row;
  justify-content:center;
  margin:0px;
  padding:0px;
  width:100%;
}
.twitch_name{
  padding-left:5px;
  max-width:100%;
  min-width:30%; 
}
.indicator{
  min-width:30px;
  min-height:30px;
  align-content:center;
}
.m_icon{
  min-width:45px;
  min-height:30px;
  align-content:center;
  max-height: 50px;
  max-width:auto;  
}
.game_title{
  padding-left:5px;
  width:100%;
  justify-content:flex-start;
}
ul {
  padding:0px;
  margin:0px;
  list-style-type: none;
}
.icon{
 max-height: 50px;
 max-width:auto;
 border-radius:50%; 
}
.led-red {
  margin: 0 auto;
  width: 24px;
  height: 24px;
  background-color: #F00;
  border-radius: 50%;
  box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #304701 0 -1px 9px, #FF0000 0 2px 12px;
}
.led-yellow {
  margin: 0 auto;
  width: 24px;
  height: 24px;
  background-color: #FF0;
  border-radius: 50%;
  box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #304701 0 -1px 9px, #FFFF00 0 2px 12px;
  
  -webkit-animation: blinkYellow 4s infinite;
  -moz-animation: blinkYellow 4s infinite;
  -ms-animation: blinkYellow 4s infinite;
  -o-animation: blinkYellow 4s infinite;
  animation: blinkYellow 4s infinite;
}

@-webkit-keyframes blinkYellow {
    from { background-color: #FF0; }
    50% { background-color: #c7c715; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(0, 255, 0, 0.5) 0 2px 0;}
    to { background-color: #FF0; }
}
@-moz-keyframes blinkYellow {
    from { background-color: #FF0; }
    50% { background-color: #c7c715; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(0, 255, 0, 0.5) 0 2px 0;}
    to { background-color: #FF0; }
}
@-ms-keyframes blinkYellow {
    from { background-color: #Ff0; }
    50% { background-color: #c7c715; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(0, 255, 0, 0.5) 0 2px 0;}
    to { background-color: #FF0; }
}
@-o-keyframes blinkYellow {
    from { background-color: #FF0; }
    50% { background-color: #c7c715; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(0, 255, 0, 0.5) 0 2px 0;}
    to { background-color: #FF0; }
}
@keyframes blinkYellow {
    from { background-color: #FF0; }
    50% { background-color: #c7c715; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(0,255, 0, 0.5) 0 2px 0;}
    to { background-color: #FF0; }
}

.led-green {
  margin: 0 auto;
  width: 24px;
  height: 24px;
  background-color: #0F0;
  border-radius: 50%;
  box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(0, 255, 0, 0.5) 0 2px 12px;
  -webkit-animation: blinkGreen 1s infinite;
  -moz-animation: blinkGreen 1s infinite;
  -ms-animation: blinkGreen 1s infinite;
  -o-animation: blinkGreen 1s infinite;
  animation: blinkGreen 1s infinite;
}

@-webkit-keyframes blinkGreen {
    from { background-color: #0F0; }
    50% { background-color: #0A0; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(0, 255, 0, 0.5) 0 2px 0;}
    to { background-color: #0F0; }
}
@-moz-keyframes blinkGreen {
    from { background-color: #0F0; }
    50% { background-color: #0A0; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(0, 255, 0, 0.5) 0 2px 0;}
    to { background-color: #0F0; }
}
@-ms-keyframes blinkGreen {
    from { background-color: #F00; }
    50% { background-color: #0A0; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(0, 255, 0, 0.5) 0 2px 0;}
    to { background-color: #F00; }
}
@-o-keyframes blinkGreen {
    from { background-color: #0F0; }
    50% { background-color: #0A0; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(0, 255, 0, 0.5) 0 2px 0;}
    to { background-color: #0F0; }
}
@keyframes blinkGreen {
    from { background-color: #0F0; }
    50% { background-color: #0A0; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(0,255, 0, 0.5) 0 2px 0;}
    to { background-color: #0F0; }
}

            
          
!
            
              $(document).ready(function(){

//Call widthCheck() whenever resized
$(window).resize(function(){
  widthCheck();
});

//This updates CSS to stack certain items and change max width
function widthCheck(){
  if($( document ).width()<750){
    $(".inner_row_mid").css("flex-flow", "column");
    $(".twitch_name").css("max-width","100%");
    $(".twitch_name").css("width","100%");
    $(".twitch_name").css("align-content","flex-start");
  } else {
    $(".inner_row_mid").css("flex-flow", "row");
    $(".twitch_name").css("max-width","100%");
    $(".twitch_name").css("width","auto");
     $(".twitch_name").css("align-content","flex-start");
  }
}

//Array of Streamers
streamlist=["Wasted", "HyperRPG", "GeekandSundry", "Sacriel", "fcc"];

//For-loop to make the API call for each streamer
for(var i=0; i<streamlist.length; i++){
  var url="https://wind-bow.glitch.me/twitch-api/streams/"+streamlist[i];
  
  //append li to HTML
  $("#list").append('<li class="inner_row"><div class="inner"><div id = "indicator'+i+'" class="indicator"></div></div><div class="icon"><a id="link'+i+'" href =""><img id="user_icon'+i+'" class="icon" src="" Alt="Twitch Icon"></a></div><div class="inner inner_row_mid"><div class="twitch_name"><div id="twitch_name'+i+'" class="twitch_name"></div></div><div class="game_title"><div id= "game_title'+i+'" class="game_title"></div></div></div><div class="inner" id="m_container'+i+'"><img id="m_icon'+i+'" class="m_icon"  src="https://upload.wikimedia.org/wikipedia/commons/a/a9/ESRB_Everyone.svg" alt="Everyone"></div></li>');
  
  //AJAX call
  $.ajax({url, async: false,
    success:function(data){
    
    //**Assign data**
    
    //If data is null, streamer is offline
    if(data.stream == null){
      $("#game_title"+i).text("Offline");
      $("#indicator"+i).addClass("led-red");
      $("#twitch_name"+i).text(streamlist[i]);
      $("#user_icon"+i).attr("src", "http://res.cloudinary.com/mdrisk/image/upload/v1509456422/no-internet-required-at-all-300x300_kcfjc7.png");
      $("#link"+i).attr("href", "https://www.twitch.tv/"+streamlist[i]);
    } 
    else { //The streamer is online
      $("#game_title"+i).text(data.stream.game);
      $("#twitch_name"+i).text(data.stream.channel.name);
      $("#indicator"+i).addClass("led-green");
      $("#user_icon"+i).attr("src", data.stream.channel.logo);
      $("#link"+i).attr("href", data.stream.channel.url);
    
      //Checks for channel mature rating
      if(data.stream.channel.mature){
        $("#m_icon"+i).attr("src", "https://upload.wikimedia.org/wikipedia/commons/c/cb/ESRB_2013_Mature.svg");
        $("#m_icon"+i).attr("alt","Mature Icon");
      }
    }
   }
  });
}

//Calls function to verify and update based on window size
widthCheck();

});
            
          
!
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