-
Notifications
You must be signed in to change notification settings - Fork 2
/
pop.js
38 lines (34 loc) · 1.14 KB
/
pop.js
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
// let previousCount = 0;
// let mainUrl;
// const handleSubmit = () => {
// const url = "https://leetcode-stats-api.herokuapp.com/";
// const username = document.getElementById("username").value;
// mainUrl = `${url}${username}`;
// console.log(mainUrl);
// const demo = document.getElementById("demo");
// demo.innerHTML = username;
// };
// const fetchData = () => {
// console.log(mainUrl);
// fetch(mainUrl)
// .then((response) => {
// if (!response.ok) {
// throw new Error("Network response was not ok");
// }
// return response.json();
// })
// .then((data) => {
// const newCount = JSON.stringify(data.totalSolved, null, 2);
// console.log("New Count:", newCount);
// if (newCount > previousCount) {
// const audioElement = document.getElementById("leetTuneAudio");
// audioElement.play();
// }
// previousCount = newCount;
// })
// .catch((error) => console.error("Error fetching data:", error));
// };
// setInterval(fetchData, 10000);
// window.onload = () => {
// document.getElementById("btn").addEventListener("click", handleSubmit);
// };