mirror of
https://github.com/JonasunderscoreJones/stats.jonasjones.dev.git
synced 2025-10-23 04:29:19 +02:00
Initial commit
This commit is contained in:
commit
fbc3528ce8
28 changed files with 298942 additions and 0 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# Output
|
||||||
|
.output
|
||||||
|
.vercel
|
||||||
|
/.svelte-kit
|
||||||
|
/build
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Env
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
!.env.test
|
||||||
|
|
||||||
|
# Vite
|
||||||
|
vite.config.js.timestamp-*
|
||||||
|
vite.config.ts.timestamp-*
|
||||||
|
|
||||||
|
.dev.vars
|
1
.npmrc
Normal file
1
.npmrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
engine-strict=true
|
38
README.md
Normal file
38
README.md
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
# create-svelte
|
||||||
|
|
||||||
|
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
|
||||||
|
|
||||||
|
## Creating a project
|
||||||
|
|
||||||
|
If you're seeing this, you've probably already done this step. Congrats!
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# create a new project in the current directory
|
||||||
|
npm create svelte@latest
|
||||||
|
|
||||||
|
# create a new project in my-app
|
||||||
|
npm create svelte@latest my-app
|
||||||
|
```
|
||||||
|
|
||||||
|
## Developing
|
||||||
|
|
||||||
|
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
|
||||||
|
# or start the server and open the app in a new browser tab
|
||||||
|
npm run dev -- --open
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
To create a production version of your app:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
You can preview the production build with `npm run preview`.
|
||||||
|
|
||||||
|
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
3144
package-lock.json
generated
Normal file
3144
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
26
package.json
Normal file
26
package.json
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"name": "stats.jonasjones.dev",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite dev",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@fontsource/fira-mono": "^5.0.0",
|
||||||
|
"@neoconfetti/svelte": "^2.0.0",
|
||||||
|
"@sveltejs/adapter-auto": "^3.0.0",
|
||||||
|
"@sveltejs/adapter-cloudflare": "^4.7.2",
|
||||||
|
"@sveltejs/kit": "^2.0.0",
|
||||||
|
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
||||||
|
"svelte": "^4.2.7",
|
||||||
|
"vite": "^5.0.3"
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"d3-scale": "^4.0.2",
|
||||||
|
"d3-scale-chromatic": "^3.1.0",
|
||||||
|
"svelte-geo": "^0.3.0",
|
||||||
|
"topojson-client": "^3.1.0"
|
||||||
|
}
|
||||||
|
}
|
107
src/app.css
Normal file
107
src/app.css
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
@import '@fontsource/fira-mono';
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--font-body: Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
|
||||||
|
Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||||
|
--font-mono: 'Fira Mono', monospace;
|
||||||
|
--color-bg-0: rgb(202, 216, 228);
|
||||||
|
--color-bg-1: hsl(209, 36%, 86%);
|
||||||
|
--color-bg-2: hsl(224, 44%, 95%);
|
||||||
|
--color-theme-1: #ff3e00;
|
||||||
|
--color-theme-2: #4075a6;
|
||||||
|
--color-text: rgba(0, 0, 0, 0.7);
|
||||||
|
--column-width: 42rem;
|
||||||
|
--column-margin-top: 4rem;
|
||||||
|
font-family: var(--font-body);
|
||||||
|
color: var(--color-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
min-height: 100vh;
|
||||||
|
margin: 0;
|
||||||
|
background-attachment: fixed;
|
||||||
|
background-color: var(--color-bg-1);
|
||||||
|
background-size: 100vw 100vh;
|
||||||
|
background-image: radial-gradient(
|
||||||
|
50% 50% at 50% 50%,
|
||||||
|
rgba(255, 255, 255, 0.75) 0%,
|
||||||
|
rgba(255, 255, 255, 0) 100%
|
||||||
|
),
|
||||||
|
linear-gradient(180deg, var(--color-bg-0) 0%, var(--color-bg-1) 15%, var(--color-bg-2) 50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
p {
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: var(--color-theme-1);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
font-size: 16px;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
background-color: rgba(255, 255, 255, 0.45);
|
||||||
|
border-radius: 3px;
|
||||||
|
box-shadow: 2px 2px 6px rgb(255 255 255 / 25%);
|
||||||
|
padding: 0.5em;
|
||||||
|
overflow-x: auto;
|
||||||
|
color: var(--color-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-column {
|
||||||
|
display: flex;
|
||||||
|
max-width: 48rem;
|
||||||
|
flex: 0.6;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
button {
|
||||||
|
font-size: inherit;
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:focus:not(:focus-visible) {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 720px) {
|
||||||
|
h1 {
|
||||||
|
font-size: 2.4rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.visually-hidden {
|
||||||
|
border: 0;
|
||||||
|
clip: rect(0 0 0 0);
|
||||||
|
height: auto;
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0;
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
12
src/app.html
Normal file
12
src/app.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
%sveltekit.head%
|
||||||
|
</head>
|
||||||
|
<body data-sveltekit-preload-data="hover">
|
||||||
|
<div style="display: contents">%sveltekit.body%</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
16
src/lib/images/github.svg
Normal file
16
src/lib/images/github.svg
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-3 -3 30 30">
|
||||||
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
d="M12 2C6.47715 2 2 6.47715 2 12C2 17.5229 6.47715 22 12 22C17.5229 22 22 17.5229 22 12C22 6.47715 17.5229 2 12 2ZM0 12C0 5.3726 5.3726 0 12 0C18.6274 0 24 5.3726 24 12C24 18.6274 18.6274 24 12 24C5.3726 24 0 18.6274 0 12Z"
|
||||||
|
fill="rgba(0,0,0,0.7)"
|
||||||
|
stroke="none"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
d="M9.59162 22.7357C9.49492 22.6109 9.49492 21.4986 9.59162 19.399C8.55572 19.4347 7.90122 19.3628 7.62812 19.1833C7.21852 18.9139 6.80842 18.0833 6.44457 17.4979C6.08072 16.9125 5.27312 16.8199 4.94702 16.6891C4.62091 16.5582 4.53905 16.0247 5.84562 16.4282C7.15222 16.8316 7.21592 17.9303 7.62812 18.1872C8.04032 18.4441 9.02572 18.3317 9.47242 18.1259C9.91907 17.9201 9.88622 17.1538 9.96587 16.8503C10.0666 16.5669 9.71162 16.5041 9.70382 16.5018C9.26777 16.5018 6.97697 16.0036 6.34772 13.7852C5.71852 11.5669 6.52907 10.117 6.96147 9.49369C7.24972 9.07814 7.22422 8.19254 6.88497 6.83679C8.11677 6.67939 9.06732 7.06709 9.73672 7.99999C9.73737 8.00534 10.6143 7.47854 12.0001 7.47854C13.386 7.47854 13.8777 7.90764 14.2571 7.99999C14.6365 8.09234 14.94 6.36699 17.2834 6.83679C16.7942 7.79839 16.3844 8.99999 16.6972 9.49369C17.0099 9.98739 18.2372 11.5573 17.4833 13.7852C16.9807 15.2706 15.9927 16.1761 14.5192 16.5018C14.3502 16.5557 14.2658 16.6427 14.2658 16.7627C14.2658 16.9427 14.4942 16.9624 14.8233 17.8058C15.0426 18.368 15.0585 19.9739 14.8708 22.6234C14.3953 22.7445 14.0254 22.8257 13.7611 22.8673C13.2924 22.9409 12.7835 22.9822 12.2834 22.9982C11.7834 23.0141 11.6098 23.0123 10.9185 22.948C10.4577 22.9051 10.0154 22.8343 9.59162 22.7357Z"
|
||||||
|
fill="rgba(0,0,0,0.7)"
|
||||||
|
stroke="none"
|
||||||
|
/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
1
src/lib/images/svelte-logo.svg
Normal file
1
src/lib/images/svelte-logo.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="107" height="128" viewBox="0 0 107 128"><title>svelte-logo</title><path d="M94.1566,22.8189c-10.4-14.8851-30.94-19.2971-45.7914-9.8348L22.2825,29.6078A29.9234,29.9234,0,0,0,8.7639,49.6506a31.5136,31.5136,0,0,0,3.1076,20.2318A30.0061,30.0061,0,0,0,7.3953,81.0653a31.8886,31.8886,0,0,0,5.4473,24.1157c10.4022,14.8865,30.9423,19.2966,45.7914,9.8348L84.7167,98.3921A29.9177,29.9177,0,0,0,98.2353,78.3493,31.5263,31.5263,0,0,0,95.13,58.117a30,30,0,0,0,4.4743-11.1824,31.88,31.88,0,0,0-5.4473-24.1157" style="fill:#ff3e00"/><path d="M45.8171,106.5815A20.7182,20.7182,0,0,1,23.58,98.3389a19.1739,19.1739,0,0,1-3.2766-14.5025,18.1886,18.1886,0,0,1,.6233-2.4357l.4912-1.4978,1.3363.9815a33.6443,33.6443,0,0,0,10.203,5.0978l.9694.2941-.0893.9675a5.8474,5.8474,0,0,0,1.052,3.8781,6.2389,6.2389,0,0,0,6.6952,2.485,5.7449,5.7449,0,0,0,1.6021-.7041L69.27,76.281a5.4306,5.4306,0,0,0,2.4506-3.631,5.7948,5.7948,0,0,0-.9875-4.3712,6.2436,6.2436,0,0,0-6.6978-2.4864,5.7427,5.7427,0,0,0-1.6.7036l-9.9532,6.3449a19.0329,19.0329,0,0,1-5.2965,2.3259,20.7181,20.7181,0,0,1-22.2368-8.2427,19.1725,19.1725,0,0,1-3.2766-14.5024,17.9885,17.9885,0,0,1,8.13-12.0513L55.8833,23.7472a19.0038,19.0038,0,0,1,5.3-2.3287A20.7182,20.7182,0,0,1,83.42,29.6611a19.1739,19.1739,0,0,1,3.2766,14.5025,18.4,18.4,0,0,1-.6233,2.4357l-.4912,1.4978-1.3356-.98a33.6175,33.6175,0,0,0-10.2037-5.1l-.9694-.2942.0893-.9675a5.8588,5.8588,0,0,0-1.052-3.878,6.2389,6.2389,0,0,0-6.6952-2.485,5.7449,5.7449,0,0,0-1.6021.7041L37.73,51.719a5.4218,5.4218,0,0,0-2.4487,3.63,5.7862,5.7862,0,0,0,.9856,4.3717,6.2437,6.2437,0,0,0,6.6978,2.4864,5.7652,5.7652,0,0,0,1.602-.7041l9.9519-6.3425a18.978,18.978,0,0,1,5.2959-2.3278,20.7181,20.7181,0,0,1,22.2368,8.2427,19.1725,19.1725,0,0,1,3.2766,14.5024,17.9977,17.9977,0,0,1-8.13,12.0532L51.1167,104.2528a19.0038,19.0038,0,0,1-5.3,2.3287" style="fill:#fff"/></svg>
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/lib/images/svelte-welcome.png
Normal file
BIN
src/lib/images/svelte-welcome.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 352 KiB |
BIN
src/lib/images/svelte-welcome.webp
Normal file
BIN
src/lib/images/svelte-welcome.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 113 KiB |
295137
src/lib/worldmaps/countries-land-10km.geo.json
Normal file
295137
src/lib/worldmaps/countries-land-10km.geo.json
Normal file
File diff suppressed because it is too large
Load diff
1
src/lib/worldmaps/custom.geo_large.json
Normal file
1
src/lib/worldmaps/custom.geo_large.json
Normal file
File diff suppressed because one or more lines are too long
1
src/lib/worldmaps/custom.geo_medium.json
Normal file
1
src/lib/worldmaps/custom.geo_medium.json
Normal file
File diff suppressed because one or more lines are too long
1
src/lib/worldmaps/custom.geo_small.json
Normal file
1
src/lib/worldmaps/custom.geo_small.json
Normal file
File diff suppressed because one or more lines are too long
22
src/lib/worldmaps/custom.map.json
Normal file
22
src/lib/worldmaps/custom.map.json
Normal file
File diff suppressed because one or more lines are too long
74
src/lib/worldmaps/uwu.py
Normal file
74
src/lib/worldmaps/uwu.py
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
import json
|
||||||
|
|
||||||
|
# Mapping of 3-letter country codes to 2-letter country codes
|
||||||
|
country_code_map = {
|
||||||
|
"CPV": "CV", "BES": "BQ", "LIE": "LI", "IMN": "IM", "PNG": "PG",
|
||||||
|
"MAR": "MA", "CMR": "CM", "GAB": "GA", "SGS": "GS", "SOM": "SO",
|
||||||
|
"PRY": "PY", "TLS": "TL", "SYR": "SY", "ALB": "AL", "PHL": "PH",
|
||||||
|
"GLP": "GP", "BRA": "BR", "MOZ": "MZ", "BGR": "BG", "ATG": "AG",
|
||||||
|
"QAT": "QA", "TCA": "TC", "GUM": "GU", "SRB": "RS", "JAM": "JM",
|
||||||
|
"GTM": "GT", "PRT": "PT", "TUR": "TR", "MYT": "YT", "COD": "CD",
|
||||||
|
"HKG": "HK", "MLT": "MT", "BDI": "BI", "CZE": "CZ", "PSE": "PS",
|
||||||
|
"BRB": "BB", "COG": "CG", "HRV": "HR", "KOR": "KR", "DNK": "DK",
|
||||||
|
"SVK": "SK", "ATF": "TF", "MYS": "MY", "SLE": "SL", "EGY": "EG",
|
||||||
|
"MNG": "MN", "TON": "TO", "FSM": "FM", "IRQ": "IQ", "SUR": "SR",
|
||||||
|
"WSM": "WS", "RWA": "RW", "CAN": "CA", "LVA": "LV", "PLW": "PW",
|
||||||
|
"SXM": "SX", "ESP": "ES", "LBN": "LB", "DMA": "DM", "COM": "KM",
|
||||||
|
"RUS": "RU", "PRI": "PR", "GEO": "GE", "PRK": "KP", "ISL": "IS",
|
||||||
|
"USA": "US", "NZL": "NZ", "KEN": "KE", "GRC": "GR", "DZA": "DZ",
|
||||||
|
"CIV": "CI", "BHR": "BH", "VEN": "VE", "UGA": "UG", "MTQ": "MQ",
|
||||||
|
"GUY": "GY", "BEL": "BE", "COL": "CO", "ERI": "ER", "ARG": "AR",
|
||||||
|
"MNP": "MP", "DOM": "DO", "MWI": "MW", "HTI": "HT", "DJI": "DJ",
|
||||||
|
"SJM": "SJ", "MKD": "MK", "PAN": "PA", "AFG": "AF", "BLR": "BY",
|
||||||
|
"AGO": "AO", "TTO": "TT", "AZE": "AZ", "CUW": "CW", "ROU": "RO",
|
||||||
|
"UZB": "UZ", "AUT": "AT", "TKM": "TM", "ALA": "AX", "SYC": "SC",
|
||||||
|
"BTN": "BT", "VCT": "VC", "MUS": "MU", "HMD": "HM", "BGD": "BD",
|
||||||
|
"ARE": "AE", "SWZ": "SZ", "ZWE": "ZW", "LUX": "LU", "PER": "PE",
|
||||||
|
"OMN": "OM", "MDA": "MD", "KWT": "KW", "KHM": "KH", "SLV": "SV",
|
||||||
|
"PYF": "PF", "URY": "UY", "TUN": "TN", "ISR": "IL", "STP": "ST",
|
||||||
|
"MAF": "MF", "MDG": "MG", "TCD": "TD", "GHA": "GH", "NCL": "NC",
|
||||||
|
"VUT": "VU", "JPN": "JP", "GNQ": "GQ", "NER": "NE", "AND": "AD",
|
||||||
|
"ARM": "AM", "MEX": "MX", "SGP": "SG", "CXR": "CX", "CHN": "CN",
|
||||||
|
"BIH": "BA", "SLB": "SB", "FLK": "FK", "BFA": "BF", "YEM": "YE",
|
||||||
|
"XKX": "XK", "IRL": "IE", "MNE": "ME", "SEN": "SN", "SVN": "SI",
|
||||||
|
"GMB": "GM", "IND": "IN", "GIN": "GN", "TWN": "TW", "CYP": "CY",
|
||||||
|
"SDN": "SD", "AUS": "AU", "IDN": "ID", "ECU": "EC", "GRD": "GD",
|
||||||
|
"REU": "RE", "MRT": "MR", "NIC": "NI", "HUN": "HU", "KGZ": "KG",
|
||||||
|
"JOR": "JO", "DEU": "DE", "FRA": "FR", "THA": "TH", "CAF": "CF",
|
||||||
|
"BHS": "BS", "CHL": "CL", "CUB": "CU", "KAZ": "KZ", "GNB": "GW",
|
||||||
|
"NLD": "NL", "LTU": "LT", "UKR": "UA", "BOL": "BO", "VNM": "VN",
|
||||||
|
"GRL": "GL", "BEN": "BJ", "NIU": "NU", "LAO": "LA", "SAU": "SA",
|
||||||
|
"ESH": "EH", "FRO": "FO", "NGA": "NG", "MLI": "ML", "LBY": "LY",
|
||||||
|
"CHE": "CH", "ASM": "AS", "ATA": "AQ", "LBR": "LR", "GUF": "GF",
|
||||||
|
"HND": "HN", "BRN": "BN", "SWE": "SE", "BWA": "BW", "FJI": "FJ",
|
||||||
|
"NOR": "NO", "LKA": "LK", "ETH": "ET", "ITA": "IT", "LCA": "LC",
|
||||||
|
"BLZ": "BZ", "EST": "EE", "KIR": "KI", "CRI": "CR", "LSO": "LS",
|
||||||
|
"TGO": "TG", "TZA": "TZ", "SSD": "SS", "NPL": "NP", "TJK": "TJ",
|
||||||
|
"PAK": "PK", "NAM": "NA", "IRN": "IR", "MMR": "MM", "GBR": "GB",
|
||||||
|
"ZMB": "ZM", "MHL": "MH", "FIN": "FI", "POL": "PL", "ZAF": "ZA"
|
||||||
|
}
|
||||||
|
|
||||||
|
def replace_country_codes(json_file_path, output_file_path):
|
||||||
|
# Read the JSON file
|
||||||
|
with open(json_file_path, 'r') as file:
|
||||||
|
data = json.load(file)
|
||||||
|
|
||||||
|
# Check if 'features' key is in the root object
|
||||||
|
if 'features' in data:
|
||||||
|
for feature in data['features']:
|
||||||
|
# Check if 'properties' and 'A3' key are in the feature
|
||||||
|
if 'properties' in feature and 'A3' in feature['properties']:
|
||||||
|
a3_code = feature['properties']['A3']
|
||||||
|
if a3_code in country_code_map:
|
||||||
|
feature['properties']['A3'] = country_code_map[a3_code]
|
||||||
|
else:
|
||||||
|
print(f'Warning: {a3_code} not found in the country code map.')
|
||||||
|
|
||||||
|
# Write the updated JSON to a new file
|
||||||
|
with open(output_file_path, 'w') as file:
|
||||||
|
json.dump(data, file, indent=4)
|
||||||
|
|
||||||
|
# Example usage
|
||||||
|
json_file_path = 'countries-land-10km.geo.json'
|
||||||
|
output_file_path = 'countries-land-10km.geo.json'
|
||||||
|
replace_country_codes(json_file_path, output_file_path)
|
44
src/routes/+layout.svelte
Normal file
44
src/routes/+layout.svelte
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<script>
|
||||||
|
import Header from './Header.svelte';
|
||||||
|
import Footer from './Footer.svelte';
|
||||||
|
import '../app.css';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="app">
|
||||||
|
<main>
|
||||||
|
<slot />
|
||||||
|
</main>
|
||||||
|
<Footer />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.app {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 100vh;
|
||||||
|
background-color: #303030;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer a {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 480px) {
|
||||||
|
footer {
|
||||||
|
padding: 12px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
3
src/routes/+page.js
Normal file
3
src/routes/+page.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
// since there's no dynamic data here, we can prerender
|
||||||
|
// it so that it gets served as a static asset in production
|
||||||
|
export const prerender = true;
|
111
src/routes/+page.svelte
Normal file
111
src/routes/+page.svelte
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
<script>
|
||||||
|
import { spring } from 'svelte/motion';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
|
let count = 1000;
|
||||||
|
|
||||||
|
const displayed_count = spring();
|
||||||
|
$: displayed_count.set(count);
|
||||||
|
$: offset = modulo($displayed_count, 1);
|
||||||
|
|
||||||
|
function modulo(n, m) {
|
||||||
|
// handle negative numbers
|
||||||
|
return ((n % m) + m) % m;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchCount() {
|
||||||
|
try {
|
||||||
|
const res = await fetch('https://analytics.jonasjones.dev/requests/get/count');
|
||||||
|
if (res.ok) {
|
||||||
|
const data = await res.json();
|
||||||
|
count = data.count;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching count:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
// Fetch initial count
|
||||||
|
fetchCount();
|
||||||
|
|
||||||
|
// Update the count every 3 seconds
|
||||||
|
const interval = setInterval(fetchCount, 10000);
|
||||||
|
|
||||||
|
// Cleanup when component is destroyed
|
||||||
|
return () => clearInterval(interval);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h1 class="counterheader">jonasjones.dev Ecosystem Requests</h1>
|
||||||
|
|
||||||
|
<div class="counter">
|
||||||
|
|
||||||
|
<div class="counter-viewport">
|
||||||
|
<div class="counter-digits" style="transform: translate(0, {100 * offset}%)">
|
||||||
|
<strong class="hidden" aria-hidden="true">{Math.floor($displayed_count + 1)}</strong>
|
||||||
|
<strong>{Math.floor($displayed_count)}</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.counterheader {
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 2rem;
|
||||||
|
margin-top: 40vh;
|
||||||
|
}
|
||||||
|
.counter {
|
||||||
|
display: flex;
|
||||||
|
border: 5px solid green;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin: 5rem;
|
||||||
|
margin-top: 0;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
width: 25%;
|
||||||
|
height: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
path {
|
||||||
|
vector-effect: non-scaling-stroke;
|
||||||
|
stroke-width: 2px;
|
||||||
|
stroke: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.counter-viewport {
|
||||||
|
width: 32em;
|
||||||
|
height: 8em;
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.counter-viewport strong {
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
font-weight: 400;
|
||||||
|
color: white;
|
||||||
|
font-size: 8rem;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.counter-digits {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
top: -100%;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
</style>
|
21
src/routes/Footer.svelte
Normal file
21
src/routes/Footer.svelte
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<div class="footer">
|
||||||
|
<p>Website by Jonas_Jones 2021 - 2024</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.footer {
|
||||||
|
height: 1rem;
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0px;
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
padding-top: 0.25rem;
|
||||||
|
padding-bottom: 0.5rem;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
129
src/routes/Header.svelte
Normal file
129
src/routes/Header.svelte
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
<script>
|
||||||
|
import { page } from '$app/stores';
|
||||||
|
import logo from '$lib/images/svelte-logo.svg';
|
||||||
|
import github from '$lib/images/github.svg';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header>
|
||||||
|
<div class="corner">
|
||||||
|
<a href="https://kit.svelte.dev">
|
||||||
|
<img src={logo} alt="SvelteKit" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<nav>
|
||||||
|
<svg viewBox="0 0 2 3" aria-hidden="true">
|
||||||
|
<path d="M0,0 L1,2 C1.5,3 1.5,3 2,3 L2,0 Z" />
|
||||||
|
</svg>
|
||||||
|
<ul>
|
||||||
|
<li aria-current={$page.url.pathname === '/' ? 'page' : undefined}>
|
||||||
|
<a href="/">Home</a>
|
||||||
|
</li>
|
||||||
|
<li aria-current={$page.url.pathname === '/about' ? 'page' : undefined}>
|
||||||
|
<a href="/about">About</a>
|
||||||
|
</li>
|
||||||
|
<li aria-current={$page.url.pathname.startsWith('/sverdle') ? 'page' : undefined}>
|
||||||
|
<a href="/sverdle">Sverdle</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<svg viewBox="0 0 2 3" aria-hidden="true">
|
||||||
|
<path d="M0,0 L0,3 C0.5,3 0.5,3 1,2 L2,0 Z" />
|
||||||
|
</svg>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="corner">
|
||||||
|
<a href="https://github.com/sveltejs/kit">
|
||||||
|
<img src={github} alt="GitHub" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.corner {
|
||||||
|
width: 3em;
|
||||||
|
height: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.corner a {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.corner img {
|
||||||
|
width: 2em;
|
||||||
|
height: 2em;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
--background: rgba(255, 255, 255, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
width: 2em;
|
||||||
|
height: 3em;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
path {
|
||||||
|
fill: var(--background);
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
position: relative;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
height: 3em;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
list-style: none;
|
||||||
|
background: var(--background);
|
||||||
|
background-size: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
li[aria-current='page']::before {
|
||||||
|
--size: 6px;
|
||||||
|
content: '';
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: calc(50% - var(--size));
|
||||||
|
border: var(--size) solid transparent;
|
||||||
|
border-top: var(--size) solid var(--color-theme-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
nav a {
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
color: var(--color-text);
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: color 0.2s linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: var(--color-theme-1);
|
||||||
|
}
|
||||||
|
</style>
|
BIN
static/favicon.png
Normal file
BIN
static/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
3
static/robots.txt
Normal file
3
static/robots.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# https://www.robotstxt.org/robotstxt.html
|
||||||
|
User-agent: *
|
||||||
|
Disallow:
|
19
svelte.config.js
Normal file
19
svelte.config.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import adapter from '@sveltejs/adapter-cloudflare';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
kit: {
|
||||||
|
adapter: adapter({
|
||||||
|
// See below for an explanation of these options
|
||||||
|
routes: {
|
||||||
|
include: ['/*'],
|
||||||
|
exclude: ['<all>']
|
||||||
|
},
|
||||||
|
platformProxy: {
|
||||||
|
configPath: 'wrangler.toml',
|
||||||
|
environment: undefined,
|
||||||
|
experimentalJsonConfig: false,
|
||||||
|
persist: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
6
vite.config.js
Normal file
6
vite.config.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import { sveltekit } from '@sveltejs/kit/vite';
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [sveltekit()]
|
||||||
|
});
|
0
wrangler.toml
Normal file
0
wrangler.toml
Normal file
Loading…
Add table
Add a link
Reference in a new issue