0
我希望能夠顯示Twitchtv離線用戶與他們的標誌。在抽搐電視顯示離線用戶javascript
我能夠獲得有關在線用戶的信息,但是我仍然在努力讓離線用戶正確顯示。有什麼建議麼 ???
$(文件)。就緒(函數(){
VAR twitchAPI = 「https://api.twitch.tv/kraken/streams/」;
var users = [
'justin',
'syndicate',
'riotgames',
'captainsparklez',
'LIRIK',
'PhantomL0rd',
'esl_csgo',
'sodapoppin',
'summit1g',
'Nightblue3',
'goldglove',
'tsm_bjergsen',
'imaqtpie',
'tsm_theoddone',
'trick2g'
];
var index, len;
for (index = 0, len = users.length; index < len; ++index) {
$.getJSON("https://api.twitch.tv/kraken/streams/" + users[index], function(channels) {
if (channels["stream"] != null) {
$("#showOnline").append('<div>' + "  " + channels.stream.channel.name + "   " + ("<img src= '" + channels.stream.channel.logo + "'>") + '</div>');
$("#showOnline").css({color: 'green'}); //color green undicates ONLINE status
}
});
}
});