commit 9c1cf54622d9c21e18f2d7cda086aec81d54b695 Author: Borgal Date: Tue Jan 18 13:56:46 2022 +0100 initial diff --git a/app.js b/app.js new file mode 100755 index 0000000..1474794 --- /dev/null +++ b/app.js @@ -0,0 +1,36 @@ + +function appendOperation(operation) { + if (document.getElementById('resultArea').innerHTML == 0) { + document.getElementById('resultArea').innerHTML = ""; + document.getElementById('resultArea').innerHTML += operation; + } + else { + // mit += Zeichen anfügen + document.getElementById('resultArea').innerHTML += operation; + } + +} + +function calculateResult() { + let container = document.getElementById('resultArea'); + let result = eval(container.innerHTML); + container.innerHTML = result; +} + +function clearAll() { + document.getElementById('resultArea').innerHTML = 0; +} + +function deleteLast() { + let container = document.getElementById('resultArea'); + // wenn innerHTML mit Leerzeichen endet + if (container.innerHTML.endsWith(' ')) { + // von innerHTML am Ende 3 Zeichen löschen + container.innerHTML = container.innerHTML.slice(0, -3); + } + else { + // von innerHTML am Ende 1 Zeichen löschen + container.innerHTML = container.innerHTML.slice(0, -1); + } + +} \ No newline at end of file diff --git a/index.php b/index.php new file mode 100755 index 0000000..66ddb2e --- /dev/null +++ b/index.php @@ -0,0 +1,58 @@ + + + + + + + + Calculator + + + + + + + + + + + +
+ 0 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CEDEL
789/
456*
123+
0,=-
+ + + + \ No newline at end of file diff --git a/manifest.webmanifest b/manifest.webmanifest new file mode 100755 index 0000000..405a3b0 --- /dev/null +++ b/manifest.webmanifest @@ -0,0 +1,32 @@ +{ + "theme_color": "#141414", + "background_color": "#141414", + "display": "fullscreen", + "scope": "/", + "start_url": "/index.php", + "name": "Calculator", + "short_name": "Calculator", + "description": "Kleiner Taschenrechner", + "icons": [ + { + "src": "/manifest/icon-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/manifest/icon-256x256.png", + "sizes": "256x256", + "type": "image/png" + }, + { + "src": "/manifest/icon-384x384.png", + "sizes": "384x384", + "type": "image/png" + }, + { + "src": "/manifest/icon-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} \ No newline at end of file diff --git a/manifest/icon-192x192.png b/manifest/icon-192x192.png new file mode 100755 index 0000000..f0303ca Binary files /dev/null and b/manifest/icon-192x192.png differ diff --git a/manifest/icon-256x256.png b/manifest/icon-256x256.png new file mode 100755 index 0000000..9b5e8f2 Binary files /dev/null and b/manifest/icon-256x256.png differ diff --git a/manifest/icon-384x384.png b/manifest/icon-384x384.png new file mode 100755 index 0000000..9e80074 Binary files /dev/null and b/manifest/icon-384x384.png differ diff --git a/manifest/icon-512x512.png b/manifest/icon-512x512.png new file mode 100755 index 0000000..f14f80f Binary files /dev/null and b/manifest/icon-512x512.png differ diff --git a/style.css b/style.css new file mode 100755 index 0000000..d4a8fff --- /dev/null +++ b/style.css @@ -0,0 +1,57 @@ +body { + font-family: 'Montserrat', sans-serif; + margin: 0; +} + +table { + width: 100%; + height: 70vh; + color: white; + background-color: rgb(30, 30, 30); +} + +td { + width: 25%; + text-align: center; + font-size: 24px; + background-color: rgb(20, 20, 20); +} + +td:hover { + background-color: rgb(30, 30, 30); + /* Cursor als Hand */ + cursor: pointer; +} + +#resultArea { + height: 30vh; + background-color: rgb(40, 40, 40); + color: white; + font-size: 64px; + display: flex; + justify-content: end; + align-items: flex-end; + padding: 24px; + /* Ausbreitung duch Padding verhindern */ + box-sizing: border-box; +} + +#result { + background-color: rgb(67, 55, 236); +} + +#result:hover { + background-color: rgb(110, 101, 235); +} + +.red{ + background-color: rgb(212, 38, 38); +} + +.red:hover{ + background-color: rgb(212, 80, 85); +} + +.highlight { + background-color: rgb(25, 25, 25); +} \ No newline at end of file