-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoolkit.html
190 lines (179 loc) · 6.75 KB
/
toolkit.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
188
189
190
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Toolkit</title>
<script src="https://kit.fontawesome.com/3412ef2576.js" crossorigin="anonymous"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.navbar {
background-color: #007bff;
color: white;
padding: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}
.navbar h1 {
margin: 0;
display: flex;
align-items: center;
}
.navbar h1 i {
margin-left: 10px;
}
.navbar a {
color: white;
text-decoration: none;
padding: 10px 15px;
border-radius: 4px;
transition: background-color 0.3s;
display: flex;
align-items: center;
}
.navbar a i {
margin-right: 5px;
}
.navbar a:hover {
background-color: #0056b3;
}
.container {
margin: 20px;
}
.toolkit-buttons {
margin-bottom: 20px;
}
.toolkit-buttons button {
padding: 10px 15px;
margin-right: 10px;
border: none;
border-radius: 4px;
background-color: #007bff;
color: white;
cursor: pointer;
font-size: 16px;
}
.toolkit-buttons button:hover {
background-color: #0056b3;
}
.iframe-container {
display: flex;
flex-direction: column;
}
.iframe-container iframe {
width: 100%;
height: 300px;
border: none;
margin-bottom: 20px;
}
.live-clock {
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
}
.footer {
background-color: #333;
color: white;
text-align: center;
padding: 10px;
position: fixed;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div class="navbar">
<h1>Raspberry Web <i class="fa-brands fa-raspberry-pi"></i></h1>
<div>
<a href="index.html"><i class="fa-solid fa-house"></i> Home</a>
<a href="login.html"><i class="fa-solid fa-right-to-bracket"></i> Login</a>
<a href="toolkit.html"><i class="fa-solid fa-screwdriver-wrench"></i> Toolkit</a>
</div>
</div>
<div class="container">
<h1>Toolkit</h1>
<div class="toolkit-buttons">
<button onclick="toggleSection('calculator')"><i class="fa-solid fa-calculator"></i> Open Calculator</button>
<button onclick="toggleSection('audio-player')"><i class="fa-solid fa-music"></i> Open Music Player</button>
<button onclick="toggleSection('youtube-player')"><i class="fa-solid fa-radio"></i> Radio</button>
<button onclick="toggleSection('live-clock')"><i class="fa-solid fa-clock"></i> Open Live Clock</button>
</div>
<div id="calculator" class="iframe-container" style="display: none;">
<iframe src="https://www.calculator.net/" title="Calculator"></iframe>
</div>
<div id="audio-player" class="iframe-container" style="display: none;">
<iframe src="/audio_player.html" title="Audio Player"></iframe>
</div>
<div id="youtube-player" class="iframe-container" style="display: none;">
<div id="youtube-video"></div>
</div>
<div id="live-clock" class="iframe-container" style="display: none;">
<div id="clock" class="live-clock"></div>
</div>
</div>
<div class="footer">
Made with ❤ by Snipe Co.🍀
</div>
<script>
const apiKey = 'AIzaSyB6PGXjSgveGnf1wiyzgd8NJu4SM1gFdnc'; // Replace with your YouTube Data API key
const livestreamId = 'oWW5TLrrbNo'; // Replace with your livestream video ID
// Function to toggle visibility of different sections
function toggleSection(id) {
const sections = ['calculator', 'audio-player', 'youtube-player', 'live-clock'];
sections.forEach(section => {
const element = document.getElementById(section);
if (section === id) {
element.style.display = (element.style.display === 'block' ? 'none' : 'block');
if (section === 'youtube-player') {
loadYouTubePlayer();
}
} else {
element.style.display = 'none';
}
});
if (id === 'live-clock') {
updateClock();
setInterval(updateClock, 1000); // Update the clock every second
}
}
// Load YouTube player using YouTube Data API
function loadYouTubePlayer() {
const youtubeVideo = document.getElementById('youtube-video');
fetch(`https://www.googleapis.com/youtube/v3/videos?part=snippet&id=${livestreamId}&key=${apiKey}`)
.then(response => response.json())
.then(data => {
if (data.items.length > 0) {
const video = data.items[0];
const title = video.snippet.title;
youtubeVideo.innerHTML = `
<h2>${title}</h2>
<iframe width="100%" height="315" src="https://www.youtube.com/embed/${livestreamId}?autoplay=1" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
`;
} else {
youtubeVideo.innerHTML = '<p>Livestream not found.</p>';
}
})
.catch(error => {
console.error('Error fetching YouTube video:', error);
youtubeVideo.innerHTML = '<p>Error loading livestream.</p>';
});
}
// Update live clock every second
function updateClock() {
const now = new Date();
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
const clock = document.getElementById('clock');
clock.textContent = `${hours}:${minutes}:${seconds}`;
}
</script>
</body>
</html>