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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML

              
                <nav class="navbar navbar-expand-lg navbar-light bg-light">
    <a class="navbar-brand"><img src="https://github.com/richRocksCodeBlocks/TwitchTV/blob/master/img/Twitch_Black_RGB.png?raw=true"style="width: auto; height: 1em;"> FCC Project</a>
</nav>
<div class="container-fluid">

    <div class="row">
        <div class="d-flex flex-wrap justify-content-center" id="app"></div>
    </div>
</div>

<noscript>
    For full functionality of this site it is necessary to enable JavaScript.
    Here are the <a href="https://www.enable-javascript.com/" target="_blank">
    instructions how to enable JavaScript in your web browser</a>.
</noscript>
              
            
!

CSS

              
                html {
            font-size: 1rem;
        }

        @include media-breakpoint-up(sm) {
            html {
                font-size: .8rem;
            }
        }

        @include media-breakpoint-up(md) {
            html {
                font-size: 1.4rem;
            }
        }

        @include media-breakpoint-up(lg) {
            html {
                font-size: 1.6rem;
            }
        }

        body {
            background-color: #6441A4;
        }

        .drop-shadow {
            box-shadow: 0 5px 9px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
        }
              
            
!

JS

              
                window.onload = function () {
    callEachUser()
};

/* User Stories
* 1. I can see whether Free Code Camp is currently streaming on Twitch.tv
* 2.  I can click the status output and be sent directly to the Free Code Camp's Twitch.tv channel.
* 3. If a Twitch user is currently streaming, I can see additional details about what they are streaming.
* */


// Global Variables
let i;
const app = document.getElementById('app');
const users = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];
const url = 'https://wind-bow.glitch.me/twitch-api';

// call each user
function callEachUser() {
    for (i = 0; i < users.length; i++) {
        let user = users[i];
        requestStream(user);
    }
}


function requestStream(user) {

    $.getJSON('https://wind-bow.glitch.me/twitch-api/streams/' + user.toLowerCase() + '?callback=?', function (data) {

        console.log(data);
        if (data.stream !== null) {
            let status = data.stream.channel.status;
            let game = data.stream.game;
            let channelURL = data.stream.channel.url;
            let imageMedium = data.stream.preview.medium;
            app.innerHTML += `
                    <div class="drop-shadow p-1  m-1 bg-white" style="width: 100%; max-width: 25em; min-height: 9em;">
                        <div class="text-left" style="float: left; height: 150px; width: 150px; background-size: cover; background-image: url(${imageMedium});">
                        </div>
                        <div style="">
                            <p class="h4 text-success text-center text-nowrap pt-4 pr-4 tex-center"><img class="mr-2" src="https://github.com/richRocksCodeBlocks/TwitchTV/blob/master/img/Glitch_Purple_RGB.png?raw=true" style="height: 25px; width: 25px;">${user}</p>          
                            <p class="text-primary text-center">Currently Streaming
                            <br>
                            <a href="${channelURL}"class="text-center">${game}</a></p>
                        </div>
                    </div>
                   
           `;
        } else {
            requestChannel(user)
        }
    })
}

function requestChannel(user) {

    $.getJSON('https://wind-bow.glitch.me/twitch-api/channels/' + user.toLowerCase() + '?callback=?', function (data) {
        console.log(data);
        let logo = data.logo;
        let videos = data._links.videos;
        app.innerHTML += `
                     <div class="drop-shadow p-1 m-1 bg-white" style="width: 100%; max-width: 25em; min-height: 9em;">
                        <div class="text-left" style="float: left; height: 150px; width: 150px; background-size: cover; background-image: url(${logo});">
            
                        </div>
                        <div style="">
                            <p class="h4 text-success text-center text-nowrap pt-4 pr-4 tex-center"><img class="mr-2" src="https://github.com/richRocksCodeBlocks/TwitchTV/blob/master/img/Glitch_Purple_RGB.png?raw=true" style="height: 25px; width: 25px;">${user}</p>
                            <p class="text-muted text-center">${user} is Offline
                            <br>
                            <p class="text-center text-muted">${status}</p>
                            </p>
            
                            <p class="text-center">View ${user}'s
                            <br>
                            <a href="${videos}"">Popular Videos</a></p>
                        </div>
                    </div>

                   
            `;
    })

}
              
            
!
999px

Console