-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
187 lines (172 loc) · 7.89 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Stream Live Tool</title>
<!-- Include Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.rawgit.com/needim/noty/77268c46/lib/noty.css">
<link rel="stylesheet" href="https://thecursedgroup.github.io/css/gtatheme.css">
<link rel="icon" type="image/x-icon" href="default-favicon.ico" id="favicon">
<meta name="twitter:image" content="default-image-url.png" id="twitter-image">
<!-- Include Simple Notify JavaScript and CSS -->
<script src="https://thecursedgroup.github.io/joke/dad/noty.js"></script>
<link href="https://polyextended.github.io/live/poly.css" rel="stylesheet">
<script>
// Fetch the PolyExtended user's avatar from GitHub API
fetch('https://api.github.com/users/PolyExtended')
.then(response => response.json())
.then(data => {
// Extract the avatar URL from the API response
const avatarUrl = data.avatar_url;
const twitterImage = document.getElementById('twitter-image');
twitterImage.content = avatarUrl;
// Update the href attribute of the favicon link
const favicon = document.getElementById('favicon');
favicon.href = avatarUrl;
})
.catch(error => {
console.error('Error fetching avatar:', error);
});
</script>
<header class="z-depth-1">
<nav class="z-depth-0 backer-dark">
<div class="nav-wrapper container">
<ul class="left">
<li><a href="https://polyextended.github.io/">Home</a></li>
<li><a href="https://polyextended.github.io/live/">PolyLive</a></li>
<li><a href="https://polyextended.github.io/streamlookup/">PolyLookup</a></li>
<li><a href="https://polyextended.github.io/roleplay/">PolyRolePlay</a></li>
</ul>
</div>
</nav>
</header>
<!-- Custom Styles -->
<link rel="stylesheet" href="https://polyextended.github.io/nav.css">
<!-- Include Noty JavaScript -->
<script src="https://cdn.jsdelivr.net/gh/needim/noty@77268c46/lib/noty.min.js"></script>
</head>
<body>
<div class="container mt-5">
<div class="row">
<div class="col-md-6 offset-md-3">
<form id="twitchUsernameForm">
<div class="mb-3">
<label for="twitchUsername" class="form-label">Enter Twitch Username</label>
<input type="text" class="form-control" id="twitchUsername" required>
</div>
<button type="submit" class="btn btn-primary">Check Live Status</button>
</form>
</div>
</div>
</div>
<!-- Include Bootstrap JS and jQuery -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.1/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<!-- JavaScript to check Twitch status and show Noty notification -->
<script>
const clientId = '2oag632o0mp6n85h3mismr2ocsa1jip';
const accessToken = '62ly1aqjnymr30sn6yga5xpxuo4yi9';
// Function to check if the streamer is live on Twitch
function checkLiveStatus() {
const twitchUsername = document.getElementById('twitchUsername').value;
// Replace with your Twitch Client ID
// Make a request to the Twitch API
fetch(`https://api.twitch.tv/helix/streams?user_login=${twitchUsername}`, {
method: 'GET',
headers: {
'Client-ID': clientId,
'Authorization': `Bearer ${accessToken}` // Replace with your access token
}
})
.then(response => response.json())
.then(data => {
if (data.data.length > 0) {
// Streamer is live, get the game they are playing
const gameId = data.data[0].game_id;
getGameName(gameId, twitchUsername);
} else {
// Streamer is not live
showNotyNotification(`${twitchUsername} is not live on Twitch at the moment.`, 'error');
}
})
.catch(error => {
console.error('Error fetching Twitch data:', error);
});
}
// Function to get the game name based on game ID
function getGameName(gameId, twitchUsername) {
// Replace with your Twitch Client ID
// Make a request to the Twitch API to get game information
fetch(`https://api.twitch.tv/helix/games?id=${gameId}`, {
method: 'GET',
headers: {
'Client-ID': clientId,
'Authorization': `Bearer ${accessToken}` // Replace with your access token
}
})
.then(response => response.json())
.then(data => {
if (data.data.length > 0) {
const gameName = data.data[0].name;
// Streamer is live, show the Noty notification with the game name
new Notify({
status: 'success',
title: 'PolyExtended',
text: `${twitchUsername} is Now Live On Twitch - Playing ${gameName}`,
effect: 'slide',
speed: 300,
showIcon: false,
showCloseButton: false,
autoclose: true,
autotimeout: 3000,
gap: 20,
distance: 20,
type: 1, // You mentioned using type 1 here
position: 'right top'
}).show()
} else {
// Game information not available
new Notify({
status: 'success',
title: 'PolyExtended',
text: `${twitchUsername} is Now Live On Twitch`,
effect: 'slide',
speed: 300,
showIcon: false,
showCloseButton: false,
autoclose: true,
autotimeout: 3000,
gap: 20,
distance: 20,
position: 'right top'
}).show()
}
})
.catch(error => {
console.error('Error fetching Twitch game data:', error);
});
}
// Function to show Noty notification
function showNotyNotification(text, type) {
new Noty({
text: text,
type: type,
theme: 'gta', // GTA theme
layout: 'topRight', // Notification position
timeout: 5000 // Notification timeout (ms)
}).show();
}
// Attach form submit event
document.getElementById('twitchUsernameForm').addEventListener('submit', function (e) {
e.preventDefault(); // Prevent form submission
checkLiveStatus();
});
</script>
</body>
</html>