Twitchtv Status

Developer
Size
4,663 Kb
Views
26,312

How do I make an twitchtv status?

Objective: Build a CodePen.io app that is functionally similar to this: http://codepen.io/FreeCodeCamp/full/adBpOw.. What is a twitchtv status? How do you make a twitchtv status? This script and codes were developed by Sam Koshy on 06 November 2022, Sunday.

Twitchtv Status Previews

Twitchtv Status - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Twitchtv Status</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <link href='https://fonts.googleapis.com/css?family=Sonsie+One|Roboto' rel='stylesheet' type='text/css'>
<div class="wrapper container-fluid"> <div class="titleBlock"> <div class="titleContainer"> <a href='https://www.twitch.tv'><img src="https://s3-us-west-1.amazonaws.com/pictureholder/Twitch_logo_(wordmark_only).svg.png" height='55px' width='140px'></a><span class="bar1"><span class="bar2"><span class="bar3"></span></span> </span><span class="titleText"> Streamers</span> <span class="all"><i class="fa fa-circle"></i>All&nbsp</span> <br> <span class="online"><i class="fa fa-circle" ></i>Online&nbsp</span> <br> <span class="offline"><i class="fa fa-circle" ></i>Offline&nbsp</span> </div> <div class="streamers"></div>
<!-- Revisit later <div class="changeChannels"> <span class="addChannels"><i class="fa fa-plus fa-lg"></i> <p>Add more channels</p></span> <span class="deleteChannels"><i class="fa fa-trash-o fa-lg"></i> <p>Delete channel</p></span> </div>
--> <div class="bottomBorder"></div> <br> </div>
</div>
<!--Revisit later
<div class="container-fluid" id="addStream" style="" title=""> <input type="text" id="streamName" placeholder="Stream Name"/>
</div>
--> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Twitchtv Status - Script Codes CSS Codes

.wrapper { text-align: center;
}
.bottomBorder { border-bottom: 10px solid #569F93;
}
.titleBlock { position: relative; margin-top: 20px; border-top: 10px solid #569F93; border-bottom: 3px solid #569F93; width: 500px; height: 79px; display: inline-block; text-align: left; background-color: #F89D2D; //#F37A20;
}
.titleContainer { overflow: hidden;
}
.titleBlock a img { float: left; padding: 10px 6px 0 5px;
}
.titleBlock img { float: left; padding: 4px 3px 0 5px;
}
.bar1 { position: relative; display: inline-block; width: 8px; height: 2px; background-color: rgba(55, 55, 55, 0.7); top: 14px; left: 18px;
}
.bar2 { position: relative; display: inline-block; width: 15px; height: 2px; background-color: rgba(55, 55, 55, 0.85); top: 8px; left: -9px;
}
.bar3 { position: relative; display: inline-block; width: 25px; height: 2px; background-color: rgb(55, 55, 55); top: -5px; left: -11px;
}
.titleText { position: relative; font-size: 200%; font-weight: 600; top: 17px; left: 7px; font-family: 'Sonsie One', cursive;
}
.fa-circle { float: left; margin-top: 2px; margin-left: 4px;
}
.all { color: rgb(255, 255, 255); float: right; text-align: right; font-family: 'Roboto', sans-serif; width: 67px; height: 18px; background-color: #694AD9; margin-top: 3px; cursor: default;
}
.online { color: #AEC965; //rgb(215, 247, 149); text-align: right; margin-top: -16px; float: right; font-family: 'Roboto', sans-serif; width: 67px; height: 18px; background-color: #694AD9; //blue; margin-right: -48px; cursor: default;
}
.offline { color: rgb(255, 195, 154); float: right; text-align: right; margin-top: -15px; font-family: 'Roboto', sans-serif; width: 67px; height: 18px; background-color: #694AD9; //green; margin-right: -48px; cursor: default;
}
.streamers { margin-top: 5px; line-height: 400%; font-family: 'Roboto', sans-serif;
}
.indivStreamers { border-bottom: 2px solid #569F93;
}
.streamers a { display: inline-block; text-align: center; width: 24%; margin-left: 1%;
}
.status { display: inline-block; text-align: center; width: 63%;
}
/**** Revisit later ****
.changeChannels { line-height: 270%; text-align: center; background-color: #569F93; width: 100%;
}
.addChannels { margin-top: 8px; margin-right: 4px; display: inline-block; box-shadow: 0px 0px 3px 3px rgba(0, 0, 0, 0.5); width: 48%;
}
.deleteChannels { display: inline-block; box-shadow: 0px 0px 3px 3px rgba(0, 0, 0, 0.5); width: 48%;
}
.addChannels p { position: relative; display: inline-block; top: 6px;
}
.fa-plus { position: relative; top: 7px;
}
.fa-trash-o { position: relative; top: 7px;
}
.deleteChannels p { position: relative; display: inline-block; top: 7px;
}
#addStream{ text-align:center;
}
#streamName{ position:fixed; top: 50%; left: 50%; margin-top: -60px; margin-left: -180px; border-radius: 10px; height: 120px; width: 360px; border: none; background: rgb(25, 25, 50); z-index:-1; opacity:0;
}
***/

Twitchtv Status - Script Codes JS Codes

//Note: Twitch has changed their API and now requires an API key in order to run queries. Use https://wind-bow.gomix.me/twitch-api instead of twitch's API base URL (i.e. https://api.twitch.tv/kraken ) and you'll still be able to get account information, without needing to sign up for an API key.
var streamerList = ['freecodecamp', 'ogamingsc2', 'esl_sc2', 'storbeck', 'robotcaleb', 'habathcx', 'brunofin', 'terakilobyte', 'beohoff', 'noobs2ninjas', 'thomasballinger', 'comster404', 'sheevergaming', 'cretetion', 'tr7k'], offlineString = "", onlineString = "", inactiveString = "", mouseEnterVar = 500, mouseLeaveVar = 200;
var defaultImg = " onerror=\"this.src='https://upload.wikimedia.org/wikipedia/commons/f/f6/Lol_question_mark.png'\" "; //replace any broken image link with default image
$(document).ready(function() { for (var i = 0; i < streamerList.length; i++) { getTwitch(streamerList[i]); } function getTwitch(channel) { $.getJSON('https://wind-bow.gomix.me/twitch-api/streams/' + channel + '?callback=?', function(streamInfo) { if (streamInfo.stream === null) { $.getJSON('https://wind-bow.gomix.me/twitch-api/users/' + channel + '?callback=?', function(userInfo) { //console.log(userInfo.name); //}); //.getJson users if (typeof userInfo.name === "undefined") { inactiveChannels("<div class='indivStreamers' style='background:rgba(255, 241, 192, 1);'><img src='#' height='50px' width='53px'" + defaultImg + "><a href='https://www.twitch.tv'>&nbsp" + channel + "</a>&nbsp<span class='status'> &nbsp Inactive Channel</span></div>"); } else { offlineChannels("<div class='indivStreamers' style='background:rgba(255, 218, 192, 0.9);'><img src=" + userInfo.logo + " height='50px' width='53px'" + defaultImg + "><a href='https://www.twitch.tv/" + userInfo.name + "'>&nbsp" + userInfo.display_name + "</a>&nbsp<span class='status'> &nbsp Offline</span></div>"); } }); //.getJson users } else { var channelStatus = streamInfo.stream.channel.status; if (channelStatus.length > 40) { channelStatus = channelStatus.substring(0, 40) + "..."; } var channelDetails = "<div class='indivStreamers' style='background:rgba(224, 249, 169, 0.5);'><img src=" + streamInfo.stream.channel.logo + " height='50px' width='53px'" + defaultImg + "><a href='" + streamInfo.stream.channel.url + "'>&nbsp" + streamInfo.stream.channel.display_name + "</a><span class='status'> &nbsp" + channelStatus + "</span></div>"; $(".streamers").append(channelDetails); onlineChannels(channelDetails); } }); //.getJSON streams } //getTwitch() function onlineChannels(json) { onlineString += json; } function offlineChannels(json) { offlineString += json; } function inactiveChannels(json) { inactiveString += json; } $(window).load(function() { $(".streamers").append(offlineString); $(".streamers").append(inactiveString); $('.all').unbind("mouseleave"); }); $('.all').on({ mouseenter: function() { $(this).animate({ "margin-right": "0px" }, mouseEnterVar); }, mouseleave: function() { $(this).animate({ "margin-right": "-48px" }, mouseLeaveVar); } }) $('.online').on({ mouseenter: function() { $(this).animate({ "margin-right": "0px" }, mouseEnterVar); }, mouseleave: function() { $(this).animate({ "margin-right": "-48px" }, mouseLeaveVar); } }) $('.offline').on({ mouseenter: function() { $(this).animate({ "margin-right": "0px" }, mouseEnterVar); }, mouseleave: function() { $(this).animate({ "margin-right": "-48px" }, mouseLeaveVar); } }) $('.online').on("click", function() { $('.all').animate({ "margin-right": "-48px" }, mouseLeaveVar); $('.offline').animate({ "margin-right": "-48px" }, mouseLeaveVar); $(".streamers").html(onlineString); $(this).unbind("mouseleave"); $('.all').bind("mouseleave", function() { $('.all').animate({ "margin-right": "-48px" }, mouseLeaveVar); }) $('.offline').bind("mouseleave", function() { $('.offline').animate({ "margin-right": "-48px" }, mouseLeaveVar); }) }) $('.offline').on("click", function() { $('.all').animate({ "margin-right": "-48px" }, mouseLeaveVar); $('.online').animate({ "margin-right": "-48px" }, mouseLeaveVar); $(".streamers").html(offlineString + inactiveString); $(this).unbind("mouseleave"); $('.all').bind("mouseleave", function() { $('.all').animate({ "margin-right": "-48px" }, mouseLeaveVar); }) $('.online').bind("mouseleave", function() { $('.online').animate({ "margin-right": "-48px" }, mouseLeaveVar); }) }) $('.all').on("click", function() { $('.online').animate({ "margin-right": "-48px" }, mouseLeaveVar); $('.offline').animate({ "margin-right": "-48px" }, mouseLeaveVar); $(".streamers").html(onlineString + offlineString + inactiveString); $(this).unbind("mouseleave"); $('.online').bind("mouseleave", function() { $('.online').animate({ "margin-right": "-48px" }, mouseLeaveVar); }) $('.offline').bind("mouseleave", function() { $('.offline').animate({ "margin-right": "-48px" }, mouseLeaveVar); }) }) /****** Revisit later ***** $('.addChannels').on('click',function(){ $("#streamName").css('opacity',1).css('z-index',1); }); **/
}); //(document).ready
Twitchtv Status - Script Codes
Twitchtv Status - Script Codes
Home Page Home
Developer Sam Koshy
Username codinger
Uploaded November 06, 2022
Rating 3
Size 4,663 Kb
Views 26,312
Do you need developer help for Twitchtv Status?

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!

Sam Koshy (codinger) Script Codes
Create amazing blog posts 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!