-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
213 lines (183 loc) · 5.91 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<title>Конвертор</title>
<meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
<meta name="author" content="Vincent Garreau" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- верхня лінія -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link rel="stylesheet" media="screen" href="css/style.css"> -->
<link rel="stylesheet" href="main/css/main.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<style>
body {
/*margin-top: 100px;*/
background-color: #333;
color: #fff;
}
.card-block {padding: 10px};
<!-- верхня лінія -->
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.topnav {
overflow: hidden;
background-color: #333;
}
.topnav a {
float: center;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 23px;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.topnav a.active {
background-color: #4CAF50;
color: white;
}
</style>
</head>
<body>
<!-- верхня лінія -->
<div class="topnav">
<a class="active" href="#home">Home</a>
<!-- <a href="#news">News</a> -->
<a href="https://www.instagram.com/a.nd.r.a.x/" target="_blank">
<img src="img/1.png" alt="Сторінка Instagram" title="Сторінка Instagram" style="height: 25px"></a>
<!-- <a href="#about">About</a> -->
<a href="/ru">© 2019 - 2021 | AndraX</a>
</div>
<!-- <div style="padding-left:16px">
<h2>Top Navigation Example</h2>
<p>Some content..</p>
</div> -->
<!-- Вмикач партиклів 2 -->
<!-- count particles -->
<!-- <div class="count-particles">
//показ фпс
<span class="js-count-particles">--</span>particles
</div> -->
<!-- Вмикач партиклів 1 -->
<!-- particles.js container -->
<!-- <div id="particles-js"></div>
<div id="page-wrapper"> -->
<div class="comtainer">
<div class="row">
<!-- <div class="col-md-6 offset-md-3"> -->
<div class="col-xs-6 col-md-4">
<div class="col-xs-6 col-md-4">
<div class="col-xs-6 col-md-4">
<h1 class="display-3 text-center">Конвертор валюти </h1>
<form>
<div class="form-group">
<input type="number" id="kmInput" placeholder="Введіть сумму..." class="form-control form-control-lg">
</div>
</form>
<!--<h5>Р.S В копійках нерахуєм :)</h5> -->
<div id="output">
<div class="card alert-primary mb-2">
<div class="card-blok">
<h4> Доларів = </h4>
<div id="dolOutput"></div>
</div>
</div>
<div class="card alert-warning mb-2">
<div class="card-blok">
<h4> Євро = </h4>
<div id="eurOutput"></div>
</div>
</div>
<div class="card alert-success mb-2">
<div class="card-blok">
<h4> Рублів = </h4>
<div id="ruOutput"></div>
</div>
</div>
</div>
<div class="card alert-danger mb-2">
<div class="card-blok">
<h4>Гривень в долах = </h4>
<div id="grnOutput"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- scripts -->
<script src="main/particles.js"></script>
<script src="main/js/app.js"></script>
<!-- підключення фпс -->
<!-- stats.js -->
<!-- <script src="js/lib/stats.js"></script> -->
<script>
var count_particles, stats, update;
stats = new Stats;
stats.setMode(0);
stats.domElement.style.position = 'absolute';
stats.domElement.style.left = '0px';
stats.domElement.style.top = '0px';
document.body.appendChild(stats.domElement);
count_particles = document.querySelector('.js-count-particles');
update = function() {
stats.begin();
stats.end();
if (window.pJSDom[0].pJS.particles && window.pJSDom[0].pJS.particles.array) {
count_particles.innerText = window.pJSDom[0].pJS.particles.array.length;
}
requestAnimationFrame(update);
};
requestAnimationFrame(update);
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script>
var dol
var eur
var ru
$(document).ready(function(){
getRate();
});
function getRate(){
$.get(
"https://api.privatbank.ua/p24api/pubinfo?json&exchange&coursid=5",
function(data){
//data = JSON.parse(data);
//console.log(data[0]['buy']);
// dol = (data[0]['buy']);
// eur = (data[1]['buy'])
// bit = (data[3]['buy'])
dol = (data[0]['sale']);
eur = (data[1]['sale']);
ru = (data[2]['sale']);
}
);
}
document.getElementById('kmInput').addEventListener('input', function(e) {
let km = e.target.value;
//var dol = 39
var sumad = km / dol
var sumadolara = ( Math.floor(sumad * 100) / 100 );
document.getElementById('dolOutput').innerHTML = sumadolara;
//var eur = 30.04
var sumae = km / eur
var sumaeuro = ( Math.floor(sumae * 100) / 100 );
document.getElementById('eurOutput').innerHTML = sumaeuro;
//var ru = 0.0000039
var rubl = km / ru
var rublocrugleno = ( Math.floor(rubl * 100) / 100 );
document.getElementById('ruOutput').innerHTML = rublocrugleno;
var grn = km * dol
var grnocrugleno = ( Math.floor(grn * 100) / 100 );
document.getElementById('grnOutput').innerHTML = grnocrugleno;
});
</script>
</body>
</html>