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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

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.

HTML

            
              <div id="main" ng-app="myApp"  ng-controller="myCtrl">
  <h1>Using the Twitchtv JSON API</h1>
  <div id="tabs">
    <section>
      <ul>
        <li ng-class="{active: currentTab(1)}"><a href="#" ng-click="setTab(1)">All</a></li>
        <li ng-class="{active: currentTab(2)}"><a href="#" ng-click="setTab(2)">Online</a></li>
        <li ng-class="{active: currentTab(3)}"><a href="#" ng-click="setTab(3)">Offline</a></li>
      </ul>
    </section>
    <div id="search">
      <input type="text" placeholder="Start typing to search streamers" ng-model="search"/>
    </div>
    <div id="clr"></div>
    <div id="all" ng-show="currentTab(1)">
      <ul>
        <li ng-repeat="user in users | filter: search"><img ng-src="{{user.logo}}"/><a href ="{{user.url}}" target="blank">{{ user.display_name}}</a> <span id="status" style="color: {{user.color}};margin-left: 20%">{{user.stream}} {{user.game}}</li>
    </ul>
    </div>
    <div id="online" ng-show="currentTab(2)">
      <ul>
        <li ng-repeat="user in users | filter: online() | filter: search"><img ng-src="{{user.logo}}"/><a href ="{{user.url}}" target="blank">{{ user.display_name}}</a> <span id="status" style="color: {{user.color}};margin-left: 20%">{{user.stream}}</span></li>
    </ul>
    </div>
    <div id="offline" ng-show="currentTab(3)">
      <ul>
        <li ng-repeat="user in users | filter: offline() | filter: search"><img ng-src="{{user.logo}}"/><a href ="{{user.url}}" target="blank">{{ user.display_name}}</a> <span id="status" style="color: {{user.color}};margin-left: 20%">{{user.stream}}</span></li>
    </ul>
    </div>
  </div>
</div>
            
          
!

CSS

            
              body {
  background-color: #ffffff;
  background-image: url("https://www.transparenttextures.com/patterns/micro-carbon.png");
  color: black;
}

img {
  width: 7%;
  vertical-align: middle;
  border-radius: 100%;
  margin-right: 2%;
  margin-top: 1%;
  margin-bottom: 1%;
  transition: width 2s;
}

#main {
  width: 50%;
  border: 1px solid white;
  margin: 0 auto;
  text-align: center;
  box-shadow: 3px 3px 3px;
  border-radius: 5px;
  transition: width 2s;
}

#clr {
  clear: both;
}

#tabs section {
  width: 50%;
  float: left;
}

ul {
  list-style: none;
  text-align: left;
}

#tabs section li {
  display: inline;
  margin: -2px;
  padding: 2%;
  border-left: 1px solid gray;
  border-right: 1px solid gray;
}

.active {
  background-color: #FA6900;
}

#tabs .active a {
  color: white;
}

#tabs section a {
  text-decoration: none;
  color: black;
}

#tabs section a:hover {
  border-bottom: 5px solid #FA6900;
}

#search {
  width: 50%;
  margin: 0 auto;
  display: inline;
  width: 40%;
  float: left;
  line-height: 2.5em;
  border: 1px solid gray;
  border-radius: 5px;
  box-shadow: 3px 3px 3px;
}

#search input {
  width: 90%;
  margin: 0 auto;
  border-radius: 5px;
  box-shadow: inset 3px 3px 3px;
  padding-top: 2.5%;
  padding-left: 2.5%;
}

#all li {
  border-top: 1px solid white;
  border-bottom: 1px solid black;
  line-height: 2em;
}

@media only screen and (min-width: 768px) and (max-width: 960px) {
  #main {
    width: 60%;
    transition: width 2s;
  }
  img {
    width: 10%;
    transition: width 2s;
  }
}

@media only screen and (min-width: 569px) and (max-width: 767px) {
  #main {
    width: 80%;
    transition: width 2s;
  }
  img {
    width: 13%;
    transition: width 2s;
  }
}

@media only screen and (min-width: 0px) and (max-width: 568px) {
  #main {
    width: 95%;
    transition: width 2s;
  }
  #tabs section {
    width: 100%;
    float: left;
  }
  #search {
    width: 97%;
  }
  img {
    width: 15%;
    transition: width 2s;
  }

}
            
          
!

JS

            
                var app = angular.module("myApp", []);
  app.controller("myCtrl", function($http, $scope, $timeout) {
    $scope.users = [];
    $scope.tab = 1;
    $scope.regulars = ["freecodecamp", "ESL_SC2", "OgamingSC2", "cretetion", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas", "brunofin", "comster404"];
    $scope.setTab = function(number) {
      $scope.tab = number;
    };
    $scope.currentTab = function(number) {
      return $scope.tab === number;
    };
    $scope.online = function(){
      return function(user){
        return user.stream === "online";
      }
    }
    $scope.offline = function(){
      return function(user){
        return user.stream === "offline";
      }
    }
    var user = {};
    
    for (var i = 0; i < $scope.regulars.length; i++) {
      Promise.all([$http.get("https://api.twitch.tv/kraken/channels/" + $scope.regulars[i]), $http.get("https://api.twitch.tv/kraken/streams/" + $scope.regulars[i])]).then(function(arr){
        user.display_name = arr[0].data.display_name;
        user.logo = arr[0].data.logo;
        user.url = arr[0].data.url;
        user.message = arr[0].data.message;
        if (arr[1].data.stream == null) {
            user.stream = "offline";
            user.color = "black";
          } else {
            user.game = "( Playing: " + arr[0].data.game + " )";
            user.stream = "online";
            user.color = "red";
          }
           $scope.users.push(user);
           user = {};
        
      });
    }
 
  });
            
          
!
999px

Console