peoples-party-counter/index.html

51 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>People's Party Thailand Donations Count</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="HandheldFriendly" content="true">
<link rel="stylesheet" href="assets/css/style.css">
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<link rel="stylesheet" href="http://github.hubspot.com/odometer/themes/odometer-theme-default.css" />
<script src="http://github.hubspot.com/odometer/odometer.js"></script>
</head>
<body>
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
</style>
<div class="container">
<div class="content">
<div>
<h1>People's Party Thailand Donation Count</h1>
<p>Updates every 10 seconds</p>
</div>
<p id="total" class="odometer">0</p></td>
</div>
</div>
<script>
var el = document.querySelector('.odometer');
od = new Odometer({
el: el,
value: 0,
format: '(,ddd).dd',
theme: 'default'
});
fetchData()
setInterval(fetchData, 10000);
function fetchData() {
$.getJSON('https://donation-api.peoplespartythailand.org/report/total', function(data) {
var totalAmount = data["data"]["totalAmount"];
el.innerHTML = totalAmount;
});
}
</script>
</body>
</html>