First commit

This commit is contained in:
Win 2024-08-09 16:52:23 +07:00
commit ccbbab447c
5 changed files with 142 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
assets/.DS_Store vendored Normal file

Binary file not shown.

91
assets/css/style.css Normal file
View File

@ -0,0 +1,91 @@
:root {
color-scheme:light dark;
--light-bg-color: #fafafa;
--light-fg-color: rgba(0, 0, 0, 0.8);
--light-nav-bg-color: #ffffff;
--light-nav-fg-color: rgba(0, 0, 0, 0.8);
--light-nav-border-color: rgba(0, 0, 0, 0.8);
--light-nav-backdrop-color: #fafafa;
--light-nav-shade-color: rgba(0, 0, 0, 0.12);
--light-nav-darker-shade-color: rgba(0, 0, 0, 0.12);
--light-card-bg-color: #ffffff;
--light-card-fg-color: rgba(0, 0, 0, 0.8);
--light-card-shade-color: rgba(0, 0, 0, 0.20);
--dark-bg-color: #242424;
--dark-fg-color: #ffffff;
--dark-nav-bg-color: #303030;
--dark-nav-fg-color: #ffffff;
--dark-nav-border-color: #ffffff;
--dark-nav-backdrop-color: #242424;
--dark-nav-shade-color: rgba(0, 0, 0, 0.36);
--dark-nav-darker-shade-color: rgba(0, 0, 0, 0.9);
--dark-card-bg-color: rgba(255, 255, 255, 0.08);
--dark-card-fg-color: #ffffff;
--dark-card-shade-color: rgba(0, 0, 0, 0.36)
}
* {
font-family: 'Roboto', sans-serif;
font-weight: 500;
}
html, body {
margin: 0;
padding: 0;
box-sizing: border-box;
background-color: light-dark(var(--light-bg-color),var(--dark-bg-color));
}
h1, h2, h3, h4, h5, h6 {
font-weight: 900;
margin: 0;
padding: 0;
}
hr {
width: 100%;
border: 0;
height: 0;
border-top: 1px solid rgba(0, 0, 0, 0.1);
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
code {
font-family: 'Courier New', Courier, monospace;
background-color: light-dark(var(--light-nav-backdrop-color), var(--dark-nav-backdrop-color));
padding: 5px;
border-radius: 5px;
}
.container {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.content {
display: grid;
gap: 1rem;
color: light-dark(var(--light-card-fg-color),var(--dark-card-fg-color));
background-color: light-dark(var(--light-card-bg-color),var(--dark-card-bg-color));
box-shadow: 0px 0px 100px 0 light-dark(var(--light-card-shade-color),var(--dark-card-shade-color));
margin: 1.5rem;
padding: 3rem;
border-radius: 1.5rem;
}
.odometer {
font-size: 10vw;
font-weight: 400;
color: light-dark(var(--light-card-fg-color),var(--dark-card-fg-color));
margin: 0;
}
.odometer-inside:after {
margin-left: 10px;
font-size: 8vw;
content: "฿";
}

Binary file not shown.

51
index.html Normal file
View File

@ -0,0 +1,51 @@
<!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>