diff --git a/README.md b/README.md index a12a74f..6411813 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,13 @@ ist auch offline verfügbar und kann ohne Internetverbindung genutzt werden (Ser Einrichtung wird eine Internetverbindung empfohlen (das einmalige Aufrufen der Seite im Browser mit einer Internetverbindung genügt). +## Installation + +```bash +# Installieren der Abhängigkeiten +pnpm install +``` + ## Entwicklung ```bash diff --git a/favicon/android-chrome-192x192.png b/assets/favicon/android-chrome-192x192.png similarity index 100% rename from favicon/android-chrome-192x192.png rename to assets/favicon/android-chrome-192x192.png diff --git a/favicon/android-chrome-512x512.png b/assets/favicon/android-chrome-512x512.png similarity index 100% rename from favicon/android-chrome-512x512.png rename to assets/favicon/android-chrome-512x512.png diff --git a/favicon/apple-touch-icon.png b/assets/favicon/apple-touch-icon.png similarity index 100% rename from favicon/apple-touch-icon.png rename to assets/favicon/apple-touch-icon.png diff --git a/favicon/favicon-16x16.png b/assets/favicon/favicon-16x16.png similarity index 100% rename from favicon/favicon-16x16.png rename to assets/favicon/favicon-16x16.png diff --git a/favicon/favicon-32x32.png b/assets/favicon/favicon-32x32.png similarity index 100% rename from favicon/favicon-32x32.png rename to assets/favicon/favicon-32x32.png diff --git a/favicon/favicon.ico b/assets/favicon/favicon.ico similarity index 100% rename from favicon/favicon.ico rename to assets/favicon/favicon.ico diff --git a/manifest.json b/assets/manifest.json similarity index 100% rename from manifest.json rename to assets/manifest.json diff --git a/assets/script/all.js b/assets/script/all.js new file mode 100644 index 0000000..fc8e4da --- /dev/null +++ b/assets/script/all.js @@ -0,0 +1,11 @@ +import './theme.js' +import './calculator.js' +import './../../node_modules/bootstrap/dist/js/bootstrap.min.js' + +if ('serviceWorker' in navigator) { + window.addEventListener('load', () => { + navigator.serviceWorker.register('./assets/script/service-worker.js') + .then(reg => console.log('Service Worker installiert', reg)) + .catch(err => console.error('Service Worker fehlgeschlagen', err)); + }); +} \ No newline at end of file diff --git a/script/calculator.js b/assets/script/calculator.js similarity index 89% rename from script/calculator.js rename to assets/script/calculator.js index 35f763e..93425ad 100644 --- a/script/calculator.js +++ b/assets/script/calculator.js @@ -48,17 +48,12 @@ class CartLine { class ProductList { constructor() { this.products = []; - this.products.push(new Product('Product 1', 10, 'https://placehold.co/250x250/000000/FFF?text=Product 1')); - this.products.push(new Product('Product 2', 5, 'https://placehold.co/250x250/000000/FFF?text=Product 2')); - this.products.push(new Product('Product 3', 2.5, 'https://placehold.co/250x250/000000/FFF?text=Product 3')); - this.products.push(new Product('Product 4', 1, 'https://placehold.co/250x250/000000/FFF?text=Product 4')); + for (let i = 1; i < 50; i++) { + this.products.push(new Product(`Product ${i}`, 1, `https://placehold.co/250x250?text=Product ${i}`)); + } this.renderProductList(); } - getProductJson() { - return JSON.stringify(this.products); - } - getProductListElement() { return document.querySelector('.product-list'); } diff --git a/service-worker.js b/assets/script/service-worker.js similarity index 63% rename from service-worker.js rename to assets/script/service-worker.js index 643032e..d6e3d7d 100644 --- a/service-worker.js +++ b/assets/script/service-worker.js @@ -3,23 +3,23 @@ const CACHE_NAME = 'durst-rechner-v2'; const FILES_TO_CACHE = [ '/', '/index.html', - '/manifest.json', - '/service-worker.js', - '/stylesheet.css', - '/script/all.js', - '/script/calculator.js', - '/script/theme.js', + '/assets/manifest.json', + '/assets/script/service-worker.js', + '/assets/style/stylesheet.css', + '/assets/script/all.js', + '/assets/script/calculator.js', + '/assets/script/theme.js', '/node_modules/bootstrap/dist/css/bootstrap.min.css', '/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js', '/node_modules/bootstrap-icons/font/bootstrap-icons.min.css', '/node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff2', '/node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff', - '/favicon/android-chrome-192x192.png', - '/favicon/android-chrome-512x512.png', - '/favicon/apple-touch-icon.png', - '/favicon/favicon-16x16.png', - '/favicon/favicon-32x32.png', - '/favicon/favicon.ico', + '/assets/favicon/android-chrome-192x192.png', + '/assets/favicon/android-chrome-512x512.png', + '/assets/favicon/apple-touch-icon.png', + '/assets/favicon/favicon-16x16.png', + '/assets/favicon/favicon-32x32.png', + '/assets/favicon/favicon.ico', ]; self.addEventListener('install', event => { diff --git a/script/theme.js b/assets/script/theme.js similarity index 100% rename from script/theme.js rename to assets/script/theme.js diff --git a/stylesheet.css b/assets/style/stylesheet.css similarity index 93% rename from stylesheet.css rename to assets/style/stylesheet.css index 126af62..c660671 100644 --- a/stylesheet.css +++ b/assets/style/stylesheet.css @@ -8,6 +8,9 @@ min-width: 3em; } } +.product-list { + padding-bottom: 1em; +} .currency-value::after { content: ' €'; } diff --git a/index.html b/index.html index 554bd3a..d4012b2 100644 --- a/index.html +++ b/index.html @@ -4,13 +4,13 @@ - - - - + + + + - +