cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <main ng-app="twitch">
  <section ng-controller="StreamController">
    <header class="container col-md-4 col-md-offset-4">
      <h2 class="text-center">Coders on <i class="fa fa-twitch"></i> Twitch</h2>

      <div class="btn-group btn-group-justified" role="group">
        <div class="btn-group">
          <button type="button" class="btn btn-default selected" ng-click='toggleSelectedClass($event); showAll()'>ALL
        </div>
        <div class="btn-group">
          <button type="button" class="btn btn-default" ng-click='toggleSelectedClass($event); showOnline()'>Online</button>
        </div>
        <div class="btn-group">
          <button type="button" class="btn btn-default" ng-click='toggleSelectedClass($event); showOffline()'>Offline</button>
        </div>
      </div>
      <div class='streams'>
        <div class="input-group">
          <input type="text" ng-model="searchText.name" class="input-lg" placeholder="Filter" />
          <i class="fa fa-search-plus fa-4x filter-glass"></i>
        </div>
        <div class="row" >
          <a ng-repeat="user in currentView | filter:searchText" href="https://www.twitch.tv/{{user.name}}">
            <div class="col-sm-4 portfolio-item">
            <div class='stream'>
              <img class="user-logo img-circle" ng-src={{user.logo}} />
              <div class='stream-text'>
                <span class='username'>{{user.name}}<span class="online-icon glyphicon {{user.onlineIcon}}"></span></span>
                <span class='description'>{{user.desc}}</span>
              </div>
            </div>
            </div>
          </a>
        </div>
    </header>
  </section>
</main>
            
          
!
            
              * {
   /* border:1px solid black; */ 
  
  font-family: 'Montserrat', sans-serif;
}

body {
  background-color: white;
}

.clearfix {
  overflow: auto;
}

.description {
  display: block;
  margin: 0px 0px 10px 30px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 80%;
  color: grey;
}

.user-logo {
  width: 35%;
  margin: 20px 20px 0px 20px;
}
.green {
  color: green;
}
.red {
  color:red;
}
.username {
  display: block;
  font-size: 20px;
  text-align: center;
}
.stream-text {
  display: inline-block;
  width: 30%;
  position: absolute;
  top: 20px;
}
.input-lg {
  width: 100%;
  padding-left: 40px;
}

.input-group {
  width: 100%;
}

.btn-group .selected, .btn-group .selected:hover{
  background-color:#2780e3;
  color:white;
}

.filter-glass {
  float: left;
  position: absolute;
  left: 10px;
  top: 15px;
  font-size: 1.95em;
}


            
          
!
            
              var app = angular.module('twitch', []);

var usernames = ["jtbricker","freecodecamp", "storbeck", "terakilobyte", "noobs2ninjas", "beohoff", 'faceittv', 'medrybw']; //usernames to grab from API
var api_url = "https://api.twitch.tv/kraken/"; //base API url
var blank_logo = 'http://trythenaturalway.com/how-to-increase-height/sites/all/themes/business/images/anonymous.png'; //location of image for profiles without profile images
var onIcon = "glyphicon-ok green"
var offIcon = "glyphicon-remove red"

app.controller('StreamController', function($scope, $http) {
  $scope.toggleSelectedClass = function(event) {
    $('.selected').removeClass('selected');
    $(event.currentTarget).addClass('selected');
  }
  $scope.showAll = function() {
    $scope.currentView = $scope.all;
  }
  $scope.showOnline = function() {
    $scope.currentView = $scope.online;
  }
  $scope.showOffline = function() {
    $scope.currentView = $scope.offline;
  }

  $scope.online = [];
  $scope.offline = [];
  $scope.all = [];

usernames.forEach(function(username) {
    var temp = {};
//    var username = usernames[i];
    $.getJSON(api_url + 'streams/' + username + '?callback=?', function(data) {
      var isOnline = (data.stream !== null);
      temp.desc = isOnline ? data.stream.channel.status : "";
      $.getJSON(api_url + 'users/' + username + '?callback=?', function(data) {
        temp.name = data.display_name;
        temp.logo = data.logo !== null ? data.logo : blank_logo;
        //console.log(temp);
        if(isOnline){
          temp.onlineIcon = onIcon;
          $scope.online.push(temp);
        }else{
          temp.onlineIcon = offIcon;
          $scope.offline.push(temp);
        }
        $scope.all.push(temp);
        $scope.currentView = $scope.all;
        $scope.$apply();
      });
    });

  });


});
            
          
!
999px
Loading ..................

Console