Auslagerung der Dateien in den Assets-Folder

This commit is contained in:
Dennis Heinrich 2025-04-05 22:50:42 +02:00
parent 9296f456fc
commit 4dc591896f
15 changed files with 45 additions and 43 deletions

View file

@ -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 Einrichtung wird eine Internetverbindung empfohlen (das einmalige Aufrufen der Seite im Browser mit einer Internetverbindung
genügt). genügt).
## Installation
```bash
# Installieren der Abhängigkeiten
pnpm install
```
## Entwicklung ## Entwicklung
```bash ```bash

View file

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

Before

Width:  |  Height:  |  Size: 527 B

After

Width:  |  Height:  |  Size: 527 B

View file

Before

Width:  |  Height:  |  Size: 966 B

After

Width:  |  Height:  |  Size: 966 B

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

11
assets/script/all.js Normal file
View file

@ -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));
});
}

View file

@ -48,15 +48,10 @@ class CartLine {
class ProductList { class ProductList {
constructor() { constructor() {
this.products = []; this.products = [];
this.products.push(new Product('Product 1', 10, 'https://placehold.co/250x250/000000/FFF?text=Product 1')); for (let i = 1; i < 50; i++) {
this.products.push(new Product('Product 2', 5, 'https://placehold.co/250x250/000000/FFF?text=Product 2')); this.products.push(new Product(`Product ${i}`, 1, `https://placehold.co/250x250?text=Product ${i}`));
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'));
this.renderProductList();
} }
this.renderProductList();
getProductJson() {
return JSON.stringify(this.products);
} }
getProductListElement() { getProductListElement() {

View file

@ -3,23 +3,23 @@ const CACHE_NAME = 'durst-rechner-v2';
const FILES_TO_CACHE = [ const FILES_TO_CACHE = [
'/', '/',
'/index.html', '/index.html',
'/manifest.json', '/assets/manifest.json',
'/service-worker.js', '/assets/script/service-worker.js',
'/stylesheet.css', '/assets/style/stylesheet.css',
'/script/all.js', '/assets/script/all.js',
'/script/calculator.js', '/assets/script/calculator.js',
'/script/theme.js', '/assets/script/theme.js',
'/node_modules/bootstrap/dist/css/bootstrap.min.css', '/node_modules/bootstrap/dist/css/bootstrap.min.css',
'/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js', '/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js',
'/node_modules/bootstrap-icons/font/bootstrap-icons.min.css', '/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.woff2',
'/node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff', '/node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff',
'/favicon/android-chrome-192x192.png', '/assets/favicon/android-chrome-192x192.png',
'/favicon/android-chrome-512x512.png', '/assets/favicon/android-chrome-512x512.png',
'/favicon/apple-touch-icon.png', '/assets/favicon/apple-touch-icon.png',
'/favicon/favicon-16x16.png', '/assets/favicon/favicon-16x16.png',
'/favicon/favicon-32x32.png', '/assets/favicon/favicon-32x32.png',
'/favicon/favicon.ico', '/assets/favicon/favicon.ico',
]; ];
self.addEventListener('install', event => { self.addEventListener('install', event => {

View file

@ -8,6 +8,9 @@
min-width: 3em; min-width: 3em;
} }
} }
.product-list {
padding-bottom: 1em;
}
.currency-value::after { .currency-value::after {
content: ' €'; content: ' €';
} }

View file

@ -4,13 +4,13 @@
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="theme-color" content="#2196f3"/> <meta name="theme-color" content="#2196f3"/>
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="assets/manifest.json">
<link rel="apple-touch-icon" sizes="180x180" href="favicon/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="assets/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="assets/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="assets/favicon/favicon-16x16.png">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="node_modules/bootstrap-icons/font/bootstrap-icons.min.css"> <link rel="stylesheet" href="node_modules/bootstrap-icons/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="stylesheet.css"> <link rel="stylesheet" href="assets/style/stylesheet.css">
<title>Der Durstrechner</title> <title>Der Durstrechner</title>
</head> </head>
<body class="d-flex flex-column vh-100"> <body class="d-flex flex-column vh-100">
@ -24,7 +24,7 @@
</div> </div>
</nav> </nav>
<main class="container-fluid"> <main class="container-fluid flex-grow-1">
<div class="row"> <div class="row">
<div class="col-12 col-md-4"> <div class="col-12 col-md-4">
<li class="list-group-item d-flex justify-content-between" data-template="product-line-item"> <li class="list-group-item d-flex justify-content-between" data-template="product-line-item">
@ -43,10 +43,10 @@
</button> </button>
</div> </div>
<div class="col-12 col-md-8"> <div class="col-12 col-md-8">
<div class="row row-cols-4 row-gap-3 product-list"> <div class="row row-cols-4 row-gap-3 product-list h-100 overflow-auto">
<div class="col product-box" data-template="product" data-id="0"> <div class="col product-box" data-template="product" data-id="0">
<div class="card"> <div class="card">
<img data-attr="image" src="https://placehold.co/250x250" alt="Produktbild" class="card-img-top"> <img data-attr="image" src="https://placehold.co/250x250" alt="Produktbild" class="card-img-top" loading="lazy">
<div class="card-body"> <div class="card-body">
<span data-attr="name">Wasser mit Kohlensäure</span> <span data-attr="name">Wasser mit Kohlensäure</span>
</div> </div>
@ -57,18 +57,6 @@
</div> </div>
</main> </main>
<script src="assets/script/all.js" type="module"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="script/all.js" type="module"></script>
<script>
// Install the service worker for offline capabilities
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('service-worker.js')
.then(reg => console.log('Service Worker registered', reg))
.catch(err => console.error('SW registration failed', err));
});
}
</script>
</body> </body>
</html> </html>

View file

@ -1,2 +0,0 @@
import './theme.js'
import './calculator.js'