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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <div class="container">
<div class="jumbotron">
  <div class="row centerBlock">
  <div class="heading">
  <h2>TwitchTV JSON API Project</h2>
  </div>
  <!-- top menu -->
   <ul>
  <li><button id="display-all">All</button></li>
  <li><button id="display-live">Live</button></li>
  <li><button id="display-offline">Off-line</button></li>
  </ul> 
       
   <div id="users"></div>
   </div>
 <footer>
  <div class="container">
    <div class="row">
      <p>Featuring Game Programmers and Coders</p>
    </div>
  </div>
</footer>
  
   </div>
</div>
            
          
!
            
              body {
    background: #c690ed;
    margin-top: 60px;
    font-family: arial, tahoma, helvetica;
}

.heading h2 {
    padding: 0em;
    margin: 0em;
    text-align: center;
    color: #560ca0;
}
/* ---- top menu  --*/
ul {
 list-style-type: none;
  border-radius: 10px 10px;
  margin: 1em;
  padding: 1em;
  background-color: #c690ed;
  color: #560ca0;
  text-align: center;
}

li {
   display: inline;
}

/*-- Channels --*/
.user-logo {
    margin: 1em 0em 1em 0em;
    padding: 0em;
    height: 50px;
    width: 50px;
}

.user-name {
    padding: 2em;
}

.game {
    padding: 2em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-live {
    background-color: #fcbaba;
    font-weight: bold;
    color: red;
    padding: 0em;
    margin: 0em;
  border-radius: 10px 10px;
}

.user-offline {
    background-color:#cbcbd6;
    font-weight: bold;
    padding: 0em;
    margin: 0em;
  border-radius: 10px 10px;
}


div {
    text-align: bottom
}

#display-all {
  background-color: #fff;
  color: purple;
  font-weight: bold;
}

#display-live {
  background-color: red;
  color: #fff;
  font-weight: bold;
}

#display-offline {
  background-color: #cbcbd6;
  color: #000;
  font-weight: bold;
}

img {
    vertical-align: bottom;
}

footer {
  background-color: #571096;
  color: #efefef;
  margin-top: 30px;
  padding: 10px;
  border-radius: 10px 10px;
}

footer>.container {
  text-align: center;
}
            
          
!
            
              //twitch client ID: 1u2zmd2l93atpbvslf0x9a4ofi8p0j
(function() {
    var d, r, f, c, l, m, h, n, g, p, k, q;
    c = [];
    f = "Freecodecamp Neticulis TheGypsyKnight MintArcade Wheeze202 Shmellyorc GameDevCompany RyanGPalmer Programming".split(" ");
    l = f.length;
    m = 0;
    g = [];
    k = [];
    h = [];
    n = q = p = 0;
    f.forEach(function(a) {
        c[a] = []
    });
    d = function() {
        m += 1;
        m === 2 * l && r()
    };
    r = function() {
        var a, b, e, d;
        for (a = 0; a < l;) b = c[f[a]][0], e = [c[f[a]][2], f[a], c[f[a]][1]], "Live" === b && (g.push(e), p += 1), "Offline" === b && (k.push(e), q += 1), "Inactive Account" === b && (h.push(e), n += 1), a += 1;
        b = [];  //live
        for (a = 0; a < p;) b.push('<div class="user-live row online"><span class="col-xs-2 col-sm-1"><img class="user-logo" src="' + g[a][0] + '"></span><span class="user-name col-xs-8 col-sm-3"><a href="https://www.twitch.tv/' + g[a][1].toLowerCase() + '" target="_blank">' + g[a][1] + '</a></span><span class="game col-xs-8 col-sm-3">' + g[a][2] + '</span></div><hr class="user-live">'), a += 1;
        b = b.join("\n");
        e = []; //off-line
        for (a = 0; a < q;) e.push('<div class="user-offline row online"><span class="col-xs-2 col-sm-1"><img class="user-logo" src="' + k[a][0] + '"></span><span class="user-name col-xs-8 col-sm-3"><a href="https://www.twitch.tv/' + k[a][1].toLowerCase() + '" target="_blank">' + k[a][1] + '</a></span><span class="game col-xs-8 col-sm-3">Offline</span></div><hr class="user-offline">'), a += 1;
        e = e.join("\n");
        d = [];

        for (a = 0; a < n;) d.push('<div class="user-deactivated row online"><span class="col-xs-2 col-sm-1"><img class="user-logo" src="' + h[a][0] + '"></span><span class="user-name col-xs-8 col-sm-3"><a href="https://www.twitch.tv/' + h[a][1].toLowerCase() + '" target="_blank">' + h[a][1] + '</a></span><span class="game col-xs-8 col-sm-3">Account Closed</span></div><hr class="user-deactivated">'), a += 1;
        a = d.join("\n");
$("#loading-message").css("display", "none");
$("#users").html(b + e + a)
    };
    
    f.forEach(function(a) {
        c[a][0] = "Inactive Account";
        c[a][1] = "";
        c[a][2] = "http://www.weezerpedia.com/wiki/images/archive/c/cc/20100330064232!Question_mark.jpg";
        $.ajax({
            type: "GET",
            url: "https://api.twitch.tv/kraken/streams/" + a,
            dataType: "json",
            headers: {
                "Client-ID": "1u2zmd2l93atpbvslf0x9a4ofi8p0j"
            },
            crossDomain: !0,
            success: function(b) {
                null !== b.stream ? c[a][0] = "Live" : null === b.stream && (c[a][0] = "Offline");
                d()
            },
            error: function() {
                d()
            }
        });
        $.ajax({
            type: "GET",
            url: "https://api.twitch.tv/kraken/channels/" + a,
            dataType: "json",
            headers: {
                "Client-ID": "1u2zmd2l93atpbvslf0x9a4ofi8p0j"
            },
            success: function(b) {
                b.game && (c[a][1] = b.game, b.status && (c[a][1] += ": " + b.status));
                !b.logo || "" === b.logo && null === b.logo && void 0 === b.logo || (c[a][2] = b.logo);
                d()
            },
            error: function() {
                d()
            }
        })
    })
})();
$("#display-all").click(function() {
    $(".user-live").css("display", "block");
    $(".user-offline").css("display", "block");
    $(".user-deactivated").css("display", "block")
});
$("#display-live").click(function() {
    $(".user-live").css("display", "block");
    $(".user-offline").css("display", "none");
    $(".user-deactivated").css("display", "none")
});
$("#display-offline").click(function() {
    $(".user-live").css("display", "none");
    $(".user-offline").css("display", "block");
    $(".user-deactivated").css("display", "none")
});

            
          
!
999px
Loading ..................

Console