-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmoney.html
More file actions
139 lines (126 loc) · 4.78 KB
/
Copy pathmoney.html
File metadata and controls
139 lines (126 loc) · 4.78 KB
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
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Geldmengen M2 / M3 – Übersicht</title>
<style>
body { background-color: black; color: #00ff00; font-family: monospace; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #00ff00; padding: 6px; text-align: left; }
input, button { background-color: black; color: #00ff00; border: 1px solid #00ff00; font-family: monospace; margin: 4px; }
.btn { cursor: pointer; padding: 6px 12px; margin: 2px; }
.nav { display: flex; gap: 8px; margin-bottom: 12px; }
.nav a { border: 1px solid #00ff00; background-color: black; color: #00ff00; text-decoration: none; padding: 6px 12px; }
.infobox { border: 1px solid #00ff00; padding: 10px; margin: 12px 0; background-color: #111; color: #00ff00; font-family: monospace; }
</style>
</head>
<body>
<h1>Geldmengen M2 / M3 – Übersicht</h1>
<div class="nav">
<a href="#" onclick="toggleTheme()">☀️🌙</a>
<a href="index.html">🕳 bond_calculator</a>
<a href="README.html">🕹 README.md</a>
<a href="money.html">🐈 M2 / M3</a>
<a href="stats.html">📊 Stats</a>
<a href="Wallet.html">🎫 Wallet</a>
<a href="#" onclick="downloadJSON()">💾 Download</a>
<label for="uploadFile" style="cursor:pointer;">Upload</label>
<input type="file" id="uploadFile" accept=".json" onchange="uploadJSON()" style="display:none;" />
</div>
<!-- Infobox -->
<div class="infobox">
<p><strong>Hinweis:</strong> Alle M2- und M3-Werte sind in <em>Milliarden</em> angegeben, jeweils in der <em>Landeswährung</em> des Eintrags
(z. B. USD für USA, EUR für Eurozone, TRY für Türkei, JPY für Japan, GBP für England).</p>
</div>
<form id="entryForm">
<label>Datum: <input type="date" id="date"></label>
<label>Land: <input type="text" id="land"></label>
<label>M2: <input type="number" step="0.01" id="m2"></label>
<label>M3: <input type="number" step="0.01" id="m3"></label>
<label>Status/Event: <input type="text" id="status"></label>
<button type="button" class="btn" onclick="addEntry()">Eintrag hinzufügen</button>
</form>
<table id="dataTable">
<thead>
<tr>
<th>Datum</th><th>Land</th><th>M2</th><th>M3</th><th>Status/Event</th><th>Löschen</th>
</tr>
</thead>
<tbody id="tableBody"></tbody>
</table>
<script>
let data = [];
async function loadData() {
try {
const res = await fetch("data/money.json");
data = await res.json();
renderTable();
} catch (e) {
console.error("Konnte data/money.json nicht laden:", e);
}
}
function renderTable() {
const tbody = document.getElementById("tableBody");
tbody.innerHTML = "";
data.forEach((entry, index) => {
const row = document.createElement("tr");
["date","land","m2","m3","status"].forEach(key => {
const cell = document.createElement("td");
if (key === "m2" || key === "m3") {
cell.textContent = entry[key] + " Milliarden " + entry.land;
} else {
cell.textContent = entry[key];
}
row.appendChild(cell);
});
const delCell = document.createElement("td");
const delBtn = document.createElement("button");
delBtn.textContent = "X";
delBtn.onclick = () => { data.splice(index,1); renderTable(); };
delCell.appendChild(delBtn);
row.appendChild(delCell);
tbody.appendChild(row);
});
}
function addEntry() {
const newEntry = {
date: document.getElementById("date").value,
land: document.getElementById("land").value,
m2: parseFloat(document.getElementById("m2").value),
m3: parseFloat(document.getElementById("m3").value),
status: document.getElementById("status").value
};
data.push(newEntry);
renderTable();
}
function downloadJSON() {
const blob = new Blob([JSON.stringify(data, null, 2)], {type: "application/json"});
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "money.json";
a.click();
URL.revokeObjectURL(url);
}
function uploadJSON() {
const file = document.getElementById("uploadFile").files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = e => {
try {
data = JSON.parse(e.target.result);
renderTable();
} catch (err) {
alert("Ungültige JSON-Datei!");
}
};
reader.readAsText(file);
}
function toggleTheme() {
document.body.style.backgroundColor =
document.body.style.backgroundColor === "black" ? "#111" : "black";
}
loadData();
</script>
</body>
</html>