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.

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

            
              <div class="container-fluid">
        <div class="col-md-4 col-md-offset-4" style="background-color: white">
            <div class="row">
                <ul class="nav nav-pills col-md-4 col-md-offset-4 center-pills">
                    <li class="active"><a data-toggle="pill" href="#all-channels">All</a></li>
                    <li><a data-toggle="pill" href="#online-channels">Online</a></li>
                    <li><a data-toggle="pill" href="#offline-channels">Offline</a></li>
                </ul>



                <div class="tab-content col-md-12 text-center">
                    <div class="row">
                        <div class="col-md-8 col-md-offset-2">
                            <div class="form-group has-feedback has-feedback-left">
                            <!--input type="text" class="form-control round" id="search-input" onkeyup="instantSearch()" placeholder="Search for streams.." title="Type in a stream" autofocus-->
                            <input type="text" class="form-control round " id="search-input" placeholder="Search for streams.." title="Type in a stream" autofocus>
                            <i class="form-control-feedback glyphicon glyphicon-search"></i>
                        </div>
                        </div>
                    </div>
                    <!-- All users -->
                    <div id="all-channels" class="tab-pane fade in active">
                        <div class="row">
                            <div class="col-md-8 col-md-offset-2 text-left">
                                <div class="list-group list-group-hover navList" id="users-list-all"></div>
                            </div>
                        </div>
                    </div>


                    <div id="online-channels" class="tab-pane fade">
                        <div class="row">
                            <div class="col-md-8 col-md-offset-2 text-left">
                                <ul class="list-group list-group-hover" id="users-list-on"></ul>
                            </div>
                        </div>
                    </div>

                    <div id="offline-channels" class="tab-pane fade">
                        <div class="row">
                            <div class="col-md-8 col-md-offset-2 text-left">
                                <ul class="list-group list-group-hover" id="users-list-off"></ul>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
            
          
!
            
              body {
    padding-top: 20px;
    background-color: #FFDAB9;
}

.center-pills {
    display: flex;
    justify-content: center;
}

.nav-pills>li {
    float: none;
    display: inline-block;
    *display: inline;
    /* ie7 fix */
    zoom: 1;
    /* hasLayout ie7 trigger */
}

.nav-pills {
    text-align: center;
}

.img-circle {
    border-radius: 50%;
    width: 50px;
    height: 50px;
}

.img-tick {
    margin-top: 15px;
    border-radius: 50%;
    width: 15px;
    height: 15px;
}

span {
    font-size: 11px;
    color: #ccc;
    ;
    display: flex;
}

.round {
    border-radius: 15px;
}
/*
#search-input {
    background-image: url('searchicon.png');
    background-position: 10px 12px;
    background-repeat: no-repeat;
    width: 100%;
    font-size: 16px;
    padding: 12px 20px 12px 40px;
    border: 1px solid #ddd;
    margin-bottom: 12px;
}*/

            
          
!
            
              //$('#users-list-all').html('');
var usersListAll = $('#users-list-all');
var $usersListOn = $('#users-list-on');
var $usersListOff = $('#users-list-off');

$(document).ready(function() {

    var usernames = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "so9beckster", "habathcx", "RobotCaleb", "noobs2ninjas"];
    var twitchStreamsUrl = 'https://wind-bow.glitch.me/twitch-api/streams/';
    var twitchUsersUrl = 'https://wind-bow.glitch.me/twitch-api/users/';
    var twitchUrl = 'https://www.twitch.tv/';
    var userObjects = [];

    usernames.forEach(function(user) {
        $.ajax({
            method: "get",
            dataType: "jsonp",
            url: twitchStreamsUrl + user,
            success: function(data) {
                if (data.stream != null) {
                    userObjects.push(new User(user, data.stream.channel.status, data.stream.channel.logo));
                    var newListElement = '<a href="' + twitchUrl + user + '"  target="_blank" class="list-group-item list-group-item-action"><div style="display:inline;"><img src="' + userObjects[userObjects.length - 1].logoUrl + '" class="img-circle" alt="user_logo"></div><div style="display:inline; white-space:nowrap; padding-left: 10px;">' + userObjects[userObjects.length - 1].userName + '<div style="display:inline;"><img src="http://www.iconsdb.com/icons/preview/green/checkmark-xxl.png" class="img-tick" alt="user_logo" align="right"></div></div></a>';
                    usersListAll.append(newListElement);

                    $usersListOn.append('<a href="' + twitchUrl + user + '" class="list-group-item list-group-item-action" target="_blank"><div style="display:inline;"><img src="' + userObjects[userObjects.length - 1].logoUrl + '" class="img-circle" alt="user_logo"></div><div style="display:inline; white-space:nowrap; padding-left: 10px;">' + userObjects[userObjects.length - 1].userName + '<div style="display:inline;"><img src="http://www.iconsdb.com/icons/preview/green/checkmark-xxl.png" class="img-tick" alt="user_logo" align="right"></div></div></a>');


                } else {
                    //console.log(user, data.stream, data.stream.channel);
                    $.ajax({
                        method: "get",
                        dataType: "jsonp",
                        url: twitchUsersUrl + user,
                        success: function(dataUsers) {
                            userObjects.push(new User(user, null, dataUsers.logo));
                            var newListElement = '<a href="' + twitchUrl + user + '" target="_blank" class="list-group-item list-group-item-action"><div style="display:inline;"><img src="' + userObjects[userObjects.length - 1].logoUrl + '" class="img-circle" alt="user_logo"></div><div style="display:inline; white-space:nowrap; padding-left: 10px;">' + userObjects[userObjects.length - 1].userName + '<div style="display:inline;"><img src="https://cdn.iconscout.com/public/images/icon/free/png-512/exclamation-mark-outlined-punctuation-red-3702d20ebbcfb6cd-512x512.png" class="img-tick" alt="user_logo" align="right"></div></div></a></li>';
                            usersListAll.append(newListElement);

                            $usersListOff.append('<a href="' + twitchUrl + user + '" class="list-group-item list-group-item-action" target="_blank"><div style="display:inline;"><img src="' + userObjects[userObjects.length - 1].logoUrl + '" class="img-circle" alt="user_logo"></div><div style="display:inline; white-space:nowrap; padding-left: 10px;">' + userObjects[userObjects.length - 1].userName + '<div style="display:inline;"><img src="https://cdn.iconscout.com/public/images/icon/free/png-512/exclamation-mark-outlined-punctuation-red-3702d20ebbcfb6cd-512x512.png" class="img-tick" alt="user_logo" align="right"></div></div></a>');

                        }
                    });

                }
            }
        });

    });


});

function User(userName, status, logoUrl) {
    this.userName = userName;
    this.status = status;
    this.logoUrl = logoUrl;
}

$('#search-input').keyup(function() {
    var valThis = this.value.toLowerCase();

    $('#users-list-all>a').each(function() {
        var text = $(this).text().toLowerCase();
        var textHtml = $(this).html();

        if (text.indexOf(valThis) == 0) {
            $(this).html(textHtml).show();
        } else {
            $(this).hide();
        }
    });

    $('#users-list-on>a').each(function() {
        var text = $(this).text().toLowerCase();
        var textHtml = $(this).html();

        if (text.indexOf(valThis) == 0) {
            $(this).html(textHtml).show();
        } else {
            $(this).hide();
        }
    });
    $('#users-list-off>a').each(function() {
        var text = $(this).text().toLowerCase();
        var textHtml = $(this).html();
        if (text.indexOf(valThis) == 0) {
            $(this).html(textHtml).show();
        } else {
            $(this).hide();
        }
    });
});

            
          
!
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