-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
107 lines (102 loc) · 3.05 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<meta charset="utf-8">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<style>
.titre {
color: black;
font-size: 90px;
font-style: bold;
text-align: center;
font: Monospace;
font-style: italic;
font-weight: bold;
}
.button {
text-align: center;
font: Monospace;
font-size: 20px;
}
.random {
text-align: center;
font: Monospace;
}
th {
border: 1px solid black;
color: black;
text-decoration: none;
font-weight: normal;
text-align: center;
}
.header {
color: black;
text-decoration: none;
font-weight: normal;
text-align: center;
}
.sous-titre {
font-weight: bold;
text-decoration: underline;
font-style: italic;
font-size: 22px;
}
.online {
background-color: #00F000;
color: black;
}
.offline {
background-color: red;
color: black;
}
</style>
<head>
<title> Twitch TV </title>
</head>
<script>
function recursif(variable, tab, max, online, offline) {
if (variable == max) {
return;
}
$.getJSON("https://wind-bow.gomix.me/twitch-api/streams/" + tab[variable] + "?callback=?", function(reponse) {
if (reponse.stream != null) {
if (online) {
$(".tableau").append("<tr><th class='online'><a href=" + reponse.stream.channel.url + ">" +"We have " + tab[variable] + " playing at " + reponse.stream.game + ": " + reponse.stream.channel.status + "</a></th></tr><br>");
}
} else {
if (offline) {
$(".tableau").append("<tr><th class='offline'> No Stream from "+ tab[variable] +"</th></tr><br>");
}
}
});
recursif(variable + 1, tab, max, online, offline);
}
$(document).ready(function() {
var txt = "";
var tab = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];
$("#all").on("click", function(){
$(".tableau").html('');
recursif(0, tab, 8, true, true);
});
$("#online").on("click", function(){
$(".tableau").html('');
recursif(0, tab, 8, true, false);
});
$("#offline").on("click", function(){
$(".tableau").html('');
recursif(0, tab, 8, false, true);
});
});
</script>
<div class="page">
<div class="titre">
Twitch TV
</div>
<div class="header">
<button class="btn btn-primary" id="all"> All </button>
<button class="btn btn-info" id="online"> Online </button>
<button class="btn btn-danger" id="offline"> Offline </button>
</div>
<div class="table">
<br><center><table class="tableau" style="border-collapse:separate;">
</table></center>
</div>
</div>