-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
141 lines (135 loc) · 4.55 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BTC Price Checker</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #333;
}
.container {
text-align: center;
background-color: rgba(255, 255, 255, 0.9);
padding: 3rem;
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
max-width: 400px;
width: 90%;
}
h1 {
color: #4a4a4a;
margin-bottom: 2rem;
}
button {
background-color: #6c5ce7;
border: none;
color: white;
padding: 12px 24px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 10px 5px;
cursor: pointer;
border-radius: 50px;
transition: all 0.3s ease;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
button:hover {
background-color: #5b4cdb;
transform: translateY(-2px);
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}
#oneMinBtn {
display: none;
background-color: #00b894;
}
#oneMinBtn:hover {
background-color: #00a885;
}
.loader {
border: 4px solid #f3f3f3;
border-top: 4px solid #3498db;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 20px auto;
display: none;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
#result {
margin-top: 20px;
font-size: 18px;
background-color: #f0f0f0;
padding: 15px;
border-radius: 10px;
box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
</style>
</head>
<body>
<div class="container">
<h1>BTC Price Checker</h1>
<button id="btcBtn">Check BTC Price</button>
<button id="oneMinBtn">Get 1min Forecast</button>
<div class="loader" id="loader"></div>
<div id="result"></div>
</div>
<script>
const btcBtn = document.getElementById('btcBtn');
const oneMinBtn = document.getElementById('oneMinBtn');
const loader = document.getElementById('loader');
const result = document.getElementById('result');
btcBtn.addEventListener('click', () => {
oneMinBtn.style.display = 'inline-block';
btcBtn.style.display = 'none';
});
oneMinBtn.addEventListener('click', async () => {
oneMinBtn.style.display = 'none';
loader.style.display = 'block';
result.textContent = 'Please wait...';
try {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 30000);
const response = await fetch('https://hook.eu2.make.com/bdkltd07dtfz9oo51861tpqu7h7ed81d', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({
action: 'getBTCPrice',
timestamp: new Date().toISOString()
}),
signal: controller.signal
});
clearTimeout(timeoutId);
const text = await response.text();
result.innerHTML = text.replace(/\n/g, '<br>');
} catch (error) {
console.error('Detailed error:', error);
if (error.name === 'AbortError') {
result.textContent = 'Error: Request timed out';
} else {
result.textContent = `Error: ${error.message}`;
}
} finally {
loader.style.display = 'none';
btcBtn.style.display = 'inline-block';
}
});
</script>
</body>
</html>