This is a copy of a code i am looking to use on a website, however i have two username that i know are live and one that is not how ever it shows off line or account closed!!
Can you help
//I toggle this to alternate flip style
var flipX = true;
//This seems like it could be refactored into several smaller functions…
function addStreamer(name){
//Request channel data
var url = “https://api.twitch.tv/kraken/channels/”+name;
$.getJSON(url,function(response){
//Get channel info
var stream = response.stream,
pic = response.logo ? response.logo : "https://googledrive.com/host/0B4uAFl_t5LeDfm5GYXNBNlhIYjYtcVprM2sxSl9Ub3pUckhTcXN1UzZaSFJUd2R1QjV1Smc/static2.gif",
status = response.status,
link = response.url;
//Request streaming data
var url="https://api.twitch.tv/kraken/streams/"+name;
$.getJSON(url,function(response){
//Streaming status
var online = response.stream == null ? "offline" : "online";
//Build streamer card html & add to list
flipX = !flipX;
var flipType = flipX ? "flipper" : "flipperX";
var container = $("<div></div>",{title:status,class:"streamer "+flipType}),
l = $("<a>",{href:link}),
r = $("<div>",{class:"row"}),
n = "<div class='streamer-name'>"+name+"</div>",
p = "<img class='streamer-pic cell' src='"+pic+"'>",
o = $("<div>",{class:'streamer-online cell'}).append(online);
if (online != "online") o.css("color","#ccc");
$("#streamers").append(l.append(container.append(r.append([p,n,o]))));
})
}).fail(function(){
var container = $("
l = $("",{href:"#"}),
r = $("
n = “
p = “

o = $("
o.css(“color”,"#ccc");
$("#streamers").append(l.append(container.append(r.append([p,n,o]))));
});
}
function showAll(){
$(".streamer").each(function(){
$(this).show();
});
}
function showOnline(){
$(".streamer-online").each(function(i,v){
if ($(this).text() == “offline” || $(this).text() == “account closed”) $(this).parent().parent().hide();
else $(this).parent().parent().show();
});
}
function showOffline(){
$(".streamer-online").each(function(i,v){
if ($(this).text() == “offline” || $(this).text() == “account closed”) $(this).parent().parent().show();
else $(this).parent().parent().hide();
});
}
function search(str){
$(".streamer-name").each(function(){
var n = $(this).text().toLowerCase();
console.log(n);
if (n.indexOf(str.toLowerCase()) > -1){
$(this).parent().parent().show();
}else{
$(this).parent().parent().hide();
}
})
}
function initialStreamers(){
var streamers = [“MedryBW”,“freecodecamp”, “storbeck”, “johnnymccrum”, “habathcx”,“RobotCaleb”,“jax_macky”,“noobs2ninjas”,“NoCopyrightSounds”,“brunofin”,“comster404”];
var delay=400;
streamers.map(function(v,i,a){
setTimeout(function(){
addStreamer(v);
},i*delay);
});
}
$(document).ready(function(){
//Create Default streamers
setTimeout(function(){
initialStreamers();
},1000);
$("#search-bar").on(‘input’,function(){
search($(this).val());
});
})