FCC: Twitch Viewer

Developer
Size
5,508 Kb
Views
24,288

How do I make an fcc: twitch viewer?

What is a fcc: twitch viewer? How do you make a fcc: twitch viewer? This script and codes were developed by Jeanine on 12 September 2022, Monday.

FCC: Twitch Viewer Previews

FCC: Twitch Viewer - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>FCC: Twitch Viewer</title> <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Lakki+Reddy|Raleway'>
<link rel='stylesheet prefetch' href='https://ghinda.net/css-toggle-switch/dist/toggle-switch.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="filter"> <p>Filter:</p> <div class="switch-toggle switch-3 switch-candy"> <input id="on" value="all" name="state-d" type="radio" checked=""> <label for="on" checked="checked" onclick="">All</label> <input id="na" value="online" name="state-d" type="radio"> <label for="na" onclick="">Online</label> <input id="off" value="offline" name="state-d" type="radio"> <label for="off" onclick="">Offline</label> <a></a> </div>
</div>
<div class="wrapper"> <h1><img src="//i21.photobucket.com/albums/b297/unizoo/Twitch_BlackLogo_zps1i3l6p3m.png" alt="Twitch"> viewer</h1> <!--<div class="results vid clear"><script src= "//player.twitch.tv/js/embed/v1.js"></script>
<div id="{PLAYER_DIV_ID}"></div>
<script type="text/javascript"> var options = { width: 854, height: 480, channel: "{freecodecamp}", //video: "{VIDEO_ID}" }; var player = new Twitch.Player("{PLAYER_DIV_ID}", options); player.setVolume(0.5);
</script> </div>--> <code id="results2"></code> <div class="players" id="listonline"> <h2>Online Players</h2> <ul></ul> </div> <div class="players" id="listoffline"> <h2>Offline Players</h2> <ul></ul> </div> <div class="clear"></div>
</div>
<div class="attr"> <a target="_blank" href='//satinflame.com'>Design & Development by satinflame design</a> &bull; <a target="_blank" href='//www.freepik.com/free-vector/sunrise-landscape-in-the-forest_793673.htm'>Background by Freepik</a></div> <script src='https://code.jquery.com/jquery-2.2.4.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

FCC: Twitch Viewer - Script Codes CSS Codes

* { box-sizing: border-box;
}
html { background: url("//i21.photobucket.com/albums/b297/unizoo/13296-NP3T2U_zpsj3bupmmy.jpg"); background-size: cover; background-position: middle;
}
html,
body { margin: 0; padding: 0; color: #003f7f; font-family: 'Raleway', sans-serif;
}
.wrapper { position: relative; margin: 40px auto; -webkit-box-shadow: 0px 0px 5px 0px #4254cc; -moz-box-shadow: 0px 0px 5px 0px #4254cc; box-shadow: 0px 0px 5px 0px #4254cc; background: #fff; padding: 15px; max-width: 700px;
}
h1,
h2,
h3,
h4 { letter-spacing: .03rem; color: #000;
}
h1 { text-align: center;
}
.attr { color: #fff; background: #000; width: 100%; padding: 0; bottom: 0; position: fixed; margin: 0; padding: 5px 8px; left: auto; right: auto;
}
.attr a { color: #fff; font-size: .8rem; font-weight: 600; text-decoration: none; padding: 10px; border-bottom: 0;
}
.attr a:hover { color: #ccc; border-bottom: 0;
}
.filter { text-align: right;
}
.filter p { display: inline; color: #585858; padding: 0; margin: 0;
}
.filter p { margin-right: 15px; margin-top: 3px; display: none;
}
.clear { clear: both; display: block;
}
label,
input { cursor: pointer;
}
.filter { position: absolute; top: 0; right: 0; text-transform: uppercase; width: 100%; font-family: Arial; font-size: .9rem;
}
h1 img { width: 100px; height: auto; position: relative; top: 5px;
}
.vid,
.responsive-object { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;
}
.vid iframe,
.vid object,
.vid embed,
.responsive-object iframe,
.responsive-object object,
.responsive-object embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
a { font-weight: bold; text-decoration: none; color: #000; border-bottom: 1px dashed #000;
}
a:focus, a:hover { border-bottom: 1px solid #000;
}
ul,
li,
h2 { clear: both; list-style: none; margin: 0; padding: 0; margin-top: 10px; line-height: 1.5rem; color: #333;
}
h2 { text-transform: uppercase; font-size: 1rem; background: #000; color: #fff; padding: 5px 8px; margin-top: 20px;
}
.logo { border: 1px solid #fff; float: left; width: 70px; margin: 0 10px 10px 0;
}
.players li { padding: 10px; clear: both; min-height: 90px; margin: 4px 0 11px 0;
}
#listonline li { background-color: #eafde9; border: 1px solid #7FCC7B;
}
#listoffline li { background-color: #ddd; width: 50%; float: left; clear: right; margin-top: 0px;
}
#listoffline li .logo { width: 50px;
}
#listoffline li .statusinfo { display: none;
}
#listoffline li:nth-of-type(2n+1) { border-right: 7px solid #fff; clear: both;
}
#listoffline li:nth-of-type(2n) { border-left: 8px solid #fff;
}
#listoffline li.inactive { background-color: #585858; color: #ddd;
}
.unavailable,
#listonline,
#listoffline { display: none;
}

FCC: Twitch Viewer - Script Codes JS Codes

$(function() { // Determine if channel is online or offline and print to page function getMode(user, html) { var twitchStream = "https://api.twitch.tv/kraken/streams/" + user; $.ajax({ async: false, type: 'GET', url: twitchStream, dataType: 'jsonp', crossDomain: true, success: function(data) { if (data['stream'] !== null) { // Online $("<li>" + html + "</li>").hide().appendTo("#listonline ul").fadeIn(1000); $("#listonline").show(); } else { // Offline $("<li>" + html + "</li>").hide().prependTo("#listoffline ul").fadeIn(1000); $("#listoffline").show(); } } }); } // Get channel data for given user function getTwitch(user) { var twitchURL = "https://api.twitch.tv/kraken/channels/" + user; $.ajax({ async: false, type: 'GET', url: twitchURL, dataType: 'jsonp', crossDomain: true, success: function(data) { // If user is not found, return error if ((data["error"]) != undefined) { $("<li class='inactive'>" + user + " - Account Unavailable (" + data["error"] + ")</li>").hide().appendTo("#listoffline ul").fadeIn(1000); } else { // Get channel data var username = data['display_name']; var userid = data['_id']; var status = data['status']; var logo = data['logo']; var game = data['game']; var link = data['url']; var userHTML = "<a target='_blank' href='" + link + "'><img class='logo' src='" + logo + "'/>" + username + "</a><span class='statusinfo'>"; /* If no game given */ if (game !== null) { userHTML += ' - <strong>' + game + '</strong>'; } /* If no status given */ if (status !== null) { userHTML += ': ' + status; } userHTML += '</span>'; // Get stream online/offline status getMode(user, userHTML); } } }); }
/* Initialize all usernames to be included */
var users = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "comster404", "RobotCaleb", "noobs2ninjas", "mew3223"]; var delayspeed = 0; users.forEach(function(e) { setTimeout(function() { getTwitch(e); }, delayspeed); delayspeed = 200; // Load them in at .2 seconds each });
/* Change display of Online/Offline players based on filter */ $('.filter input').click(function() { if ($(this).attr('value') === 'online') { $("#listonline").show(); $("#listoffline").hide(); } else if ($(this).attr('value') === 'offline') { $("#listonline").hide(); $("#listoffline").show(); } else { $("#listoffline").show(); $("#listonline").show(); } });
});
FCC: Twitch Viewer - Script Codes
FCC: Twitch Viewer - Script Codes
Home Page Home
Developer Jeanine
Username virtual
Uploaded September 12, 2022
Rating 3
Size 5,508 Kb
Views 24,288
Do you need developer help for FCC: Twitch Viewer?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Jeanine (virtual) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!