diff --git a/Dockerfile b/Dockerfile index 140a195..dbf27d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,8 @@ COPY config/php-uploads.ini /usr/local/etc/php/conf.d/zz-karate-uploads.ini # Vereins-Logos & Favicon ins Image kopieren COPY assets/ /var/www/html/resources/assets/ +COPY assets/manifest.webmanifest /var/www/html/manifest.webmanifest +COPY assets/sw.js /var/www/html/sw.js # DB-Initialisierungshilfe & Tag-Migration fuer Deployments COPY scripts/ensure-db-schema.php /usr/local/bin/ensure-db-schema.php diff --git a/assets/icon.svg b/assets/icon.svg new file mode 100644 index 0000000..72711f9 --- /dev/null +++ b/assets/icon.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/manifest.webmanifest b/assets/manifest.webmanifest new file mode 100644 index 0000000..8f134ae --- /dev/null +++ b/assets/manifest.webmanifest @@ -0,0 +1,25 @@ +{ + "name": "Goju-Kai Dojo – Karate-Wiki", + "short_name": "Karate-Wiki", + "description": "Internes Vereins-Wiki & Technik-Videothek des Goju-Kai Dojo Heilbronn e.V.", + "start_url": "/index.php?title=Hauptseite", + "scope": "/", + "display": "standalone", + "orientation": "any", + "background_color": "#121314", + "theme_color": "#1a1a1a", + "lang": "de", + "icons": [ + { + "src": "/resources/assets/icon.svg", + "sizes": "any", + "type": "image/svg+xml", + "purpose": "any maskable" + }, + { + "src": "/resources/assets/favicon-32x32.png", + "sizes": "32x32", + "type": "image/png" + } + ] +} diff --git a/assets/sw.js b/assets/sw.js new file mode 100644 index 0000000..1540758 --- /dev/null +++ b/assets/sw.js @@ -0,0 +1,70 @@ +// Karate-Wiki Service Worker (PWA Offline-Cache & App Lifecycle) +const CACHE_NAME = 'karatewiki-cache-v1'; +const PRECACHE_ASSETS = [ + '/resources/assets/icon.svg', + '/resources/assets/favicon-32x32.png', + '/resources/assets/logo.svg', + '/resources/assets/logo-light.svg', + '/manifest.webmanifest' +]; + +self.addEventListener('install', (event) => { + self.skipWaiting(); + event.waitUntil( + caches.open(CACHE_NAME).then((cache) => { + return cache.addAll(PRECACHE_ASSETS).catch(() => {}); + }) + ); +}); + +self.addEventListener('activate', (event) => { + event.waitUntil( + Promise.all([ + self.clients.claim(), + caches.keys().then((keys) => { + return Promise.all( + keys.map((key) => { + if (key !== CACHE_NAME) { + return caches.delete(key); + } + }) + ); + }) + ]) + ); +}); + +// Network-first Strategie fuer dynamische Wiki-Inhalte +self.addEventListener('fetch', (event) => { + const request = event.request; + if (request.method !== 'GET') { + return; + } + + // Fuer statische Assets (Icons, SVGs) Cache mit Fallback + const url = new URL(request.url); + if (url.pathname.startsWith('/resources/assets/') || url.pathname.endsWith('.webmanifest')) { + event.respondWith( + caches.match(request).then((cached) => { + return ( + cached || + fetch(request).then((response) => { + if (response && response.status === 200) { + const clone = response.clone(); + caches.open(CACHE_NAME).then((cache) => cache.put(request, clone)); + } + return response; + }) + ); + }) + ); + return; + } + + // Fuer alle Wiki-Seiten: Direkt ueber Netzwerk + event.respondWith( + fetch(request).catch(() => { + return caches.match(request); + }) + ); +}); diff --git a/config/LocalSettings.php b/config/LocalSettings.php index c5294bf..64ab397 100644 --- a/config/LocalSettings.php +++ b/config/LocalSettings.php @@ -211,11 +211,12 @@ foreach ( $karateOptionalExtensions as $extName ) { } } -// WikiEditor Standard-Optionen +// WikiEditor Standard-Optionen & Responsive Skin $wgDefaultUserOptions['usebetatoolbar'] = 1; $wgDefaultUserOptions['usebetatoolbar-cgd'] = 1; $wgDefaultUserOptions['wikieditor-preview'] = 1; $wgDefaultUserOptions['wikieditor-publish'] = 1; +$wgDefaultUserOptions['skin-responsive'] = 1; // CookieWarning & EditUser Berechtigungen $wgCookieWarningEnabled = true; diff --git a/docker-compose.dev-env.yml b/docker-compose.dev-env.yml index 03168cd..eed7d48 100644 --- a/docker-compose.dev-env.yml +++ b/docker-compose.dev-env.yml @@ -43,8 +43,11 @@ services: - ./config/php-uploads.ini:/usr/local/etc/php/conf.d/zz-karate-uploads.ini:ro - ./assets/logo.svg:/var/www/html/resources/assets/logo.svg:ro - ./assets/logo-light.svg:/var/www/html/resources/assets/logo-light.svg:ro + - ./assets/icon.svg:/var/www/html/resources/assets/icon.svg:ro - ./assets/favicon-32x32.png:/var/www/html/resources/assets/favicon-32x32.png:ro - ./assets/logo_goju-kai_Bleistift.png:/var/www/html/resources/assets/logo_goju-kai_Bleistift.png:ro + - ./assets/manifest.webmanifest:/var/www/html/manifest.webmanifest:ro + - ./assets/sw.js:/var/www/html/sw.js:ro - ./extensions-custom/KarateMedia:/var/www/html/extensions/KarateMedia:ro - dev-karatewiki-images:/var/www/html/images ports: diff --git a/docker-compose.yml b/docker-compose.yml index 20a57e1..b0fd754 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -45,8 +45,11 @@ services: - ./config/php-uploads.ini:/usr/local/etc/php/conf.d/zz-karate-uploads.ini:ro - ./assets/logo.svg:/var/www/html/resources/assets/logo.svg:ro - ./assets/logo-light.svg:/var/www/html/resources/assets/logo-light.svg:ro + - ./assets/icon.svg:/var/www/html/resources/assets/icon.svg:ro - ./assets/favicon-32x32.png:/var/www/html/resources/assets/favicon-32x32.png:ro - ./assets/logo_goju-kai_Bleistift.png:/var/www/html/resources/assets/logo_goju-kai_Bleistift.png:ro + - ./assets/manifest.webmanifest:/var/www/html/manifest.webmanifest:ro + - ./assets/sw.js:/var/www/html/sw.js:ro - ./extensions-custom/KarateMedia:/var/www/html/extensions/KarateMedia:ro - karatewiki-shared-images:/var/www/html/images ports: diff --git a/docs/BACKLOG.md b/docs/BACKLOG.md new file mode 100644 index 0000000..eb9cc35 --- /dev/null +++ b/docs/BACKLOG.md @@ -0,0 +1,52 @@ +# Karatewiki (Goju-Kai Dojo) – Feature-Backlog & Roadmap + +Dieses Dokument sammelt alle geplanten und diskutierten Funktionserweiterungen, Optimierungen und Ideen für das Karate-Wiki des Goju-Kai Dojo Heilbronn e.V. + +--- + +## 🎯 Priorität 1: Mobile-Optimierung & PWA (Aktuell in Arbeit) + +- [ ] **Echtes Mobile Viewport (Kein 1120px Desktop-Zoom mehr):** + - **Problem:** Vector (Legacy) setzt standardmäßig ``, weshalb Smartphones die Seite auf 1120px Breite herauszoomen (Schrift & Buttons briefmarkengroß). + - **Lösung:** Entfernen/Überschreiben des 1120px-Viewports, sodass echte mobile Skalierung (`width=device-width, initial-scale=1.0, maximum-scale=5.0`) greift. + - **Schriftgrößen & Touch-Ziele:** Mindestschriftgröße 16px auf Mobilgeräten (verhindert auch iOS-Autozoom bei Formularfeldern), Buttons und Links mit mind. 44x44px Touch-Fläche. + - **Flüssige Tabellen & Kacheln:** Gürtelkarten und Thementabellen passen sich flexibel der Handybreite an (1- bis 2-spaltig statt gequetschter Desktop-Raster). +- [ ] **PWA (Progressive Web App):** + - `manifest.webmanifest` / `manifest.json` mit App-Namen ("Karate Dojo", "Karate-Wiki"), Start-URL, App-Icons (192x192, 512x512, maskable) und `theme_color` (`#1a1a1a`), `background_color` (`#1a1a1a`). + - `display: standalone` (beim Öffnen vom Smartphone-Homescreen entfällt die Browser-URL-Leiste, wirkt wie eine native App). + - Apple-Touch-Icons & Safari PWA-Meta-Tags (`apple-mobile-web-app-capable`, `apple-mobile-web-app-status-bar-style: black-translucent`). + - Schneller Service-Worker zum Cachen von App-Shell (CSS, JS, Logos, Favicon) für blitzschnellen Start auch bei schwachem Hallen-WLAN. + +--- + +## 🥋 Priorität 2: Video- & Technik-Features (Dojo-Videothek) + +- [ ] **Spiegelmodus (`🪞 Spiegeln`):** + - Button an jedem Video-Player, der das Video horizontal spiegelt (`transform: scaleX(-1)`). + - Ermöglicht es Karateka, das Tablet/Handy vor sich aufzustellen und Katas synchron "wie im Spiegel" mitzulaufen, ohne links und rechts im Kopf umdenken zu müssen. +- [ ] **Einzelbild-Schaltung (Frame-by-Frame):** + - Buttons `< Frame` und `Frame >` (+ Shortcut Tasten `,` und `.`), um Techniken im Bruchteil einer Sekunde anzuhalten und Schritt für Schritt zu analysieren (Treffmoment, Faustdrehung, Hüftstellung). +- [ ] **Video-Kapitel & Sprungmarken:** + - Klickbare Zeitstempel im Text (z.B. `[0:45] Osae-Uke`, `[1:20] Wendung`), die das Video direkt an die entsprechende Sekunde springen lassen. +- [ ] **Side-by-Side Videovergleich:** + - Zwei Videos nebeneinander abspielen (z.B. Kata von vorne vs. von der Seite, oder Schüler vs. Sensei) mit synchronisiertem Play/Pause. + +--- + +## 📋 Priorität 3: Prüfungsvorbereitung & Interaktives Lernen + +- [ ] **Persönliche Prüfungs-Checkliste ("Ich kann das!"):** + - Interaktive Checkboxen auf den Kyu-Seiten (9. bis 1. Kyu). + - Speichert den individuellen Fortschritt lokal im Browser (`localStorage`), ohne die Datenbank zu belasten. + - Zeigt einen prozentualen Fortschrittsbalken ("75 % für 8. Kyu Gelbgurt bereit"). +- [ ] **Zufallstrainer / Prüfungs-Simulator (Flashcards):** + - Button z.B. auf den Kyu-Seiten: "Zufällige Technik abfragen" (zeigt eine Technik wie "Mae-Geri aus Zenkutsu-Dachi"), Karateka führt sie aus, klickt auf "Video-Lösung anzeigen" und vergleicht sich. + +--- + +## 📖 Priorität 4: Inhalte & Dojo-Praxis + +- [ ] **Audio-Aussprache im Karate-Wörterbuch:** + - Lautsprecher-Icon 🔊 neben japanischen Fachbegriffen (*Hikite*, *Mawashi-Geri*, *Tensho*, *Dojokun*) für korrekte Audio-Aussprache. +- [ ] **Kata-Spickzettel (Druckansicht für die Sporttasche):** + - Spezielles Print-CSS (`@media print`), das Kata-Abläufe und Prüfungsinhalte kompakt auf 1-2 DIN-A4-Seiten ohne Menüleisten und Footer formatiert. diff --git a/extensions-custom/KarateMedia/resources/karatemedia.css b/extensions-custom/KarateMedia/resources/karatemedia.css index c01b0b9..3f62b28 100644 --- a/extensions-custom/KarateMedia/resources/karatemedia.css +++ b/extensions-custom/KarateMedia/resources/karatemedia.css @@ -709,47 +709,156 @@ body.mediawiki:not(.mw-special-Userlogin) .mw-body-content h3 { gap: 6px; } + body.mediawiki.km-sidebar-open:not(.mw-special-Userlogin)::before { + content: ''; + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.65); + backdrop-filter: blur(2px); + z-index: 999; + } + body.mediawiki:not(.mw-special-Userlogin) #mw-panel { position: fixed !important; - left: -13em !important; + left: -14em !important; top: 0 !important; bottom: 0 !important; - width: 12.2em !important; + width: 13em !important; overflow-y: auto !important; - transition: left 0.22s ease !important; + transition: left 0.24s cubic-bezier(0.4, 0, 0.2, 1) !important; z-index: 1000 !important; + box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3) !important; } body.mediawiki.km-sidebar-open:not(.mw-special-Userlogin) #mw-panel { left: 0 !important; } - body.mediawiki:not(.mw-special-Userlogin) #content.mw-body, + body.mediawiki:not(.mw-special-Userlogin) #mw-head-base { + margin-left: 0 !important; + height: auto !important; + } + + body.mediawiki:not(.mw-special-Userlogin) #mw-head { + position: relative !important; + width: 100% !important; + box-sizing: border-box !important; + padding: 6px 12px !important; + background: #ffffff !important; + border-bottom: 1px solid #e5e7eb !important; + } + body.mediawiki:not(.mw-special-Userlogin) #left-navigation, + body.mediawiki:not(.mw-special-Userlogin) #right-navigation { + float: none !important; + margin-left: 0 !important; + margin-right: 0 !important; + display: flex !important; + flex-wrap: wrap !important; + align-items: center !important; + width: 100% !important; + } + + body.mediawiki:not(.mw-special-Userlogin) #p-personal { + position: relative !important; + top: auto !important; + right: auto !important; + float: none !important; + margin: 4px 0 8px 0 !important; + } + + body.mediawiki:not(.mw-special-Userlogin) #p-personal ul { + display: flex !important; + flex-wrap: wrap !important; + gap: 6px 12px !important; + padding: 0 !important; + margin: 0 !important; + } + + body.mediawiki:not(.mw-special-Userlogin) #p-search { + float: none !important; + margin: 6px 0 !important; + width: 100% !important; + } + + body.mediawiki:not(.mw-special-Userlogin) #p-search form { + display: flex !important; + width: 100% !important; + } + + body.mediawiki:not(.mw-special-Userlogin) #searchInput { + width: 100% !important; + box-sizing: border-box !important; + height: 38px !important; + font-size: 16px !important; + } + + body.mediawiki:not(.mw-special-Userlogin) #content.mw-body, body.mediawiki:not(.mw-special-Userlogin) #footer { - margin-left: 0.6em !important; - margin-right: 0.6em !important; + margin-left: 0.5rem !important; + margin-right: 0.5rem !important; } body.mediawiki:not(.mw-special-Userlogin) #content.mw-body { - padding: 1.1em 1.1em 1.8em 1.1em !important; + padding: 1rem 1rem 1.6rem 1rem !important; + border-radius: 10px !important; + } + + body.mediawiki:not(.mw-special-Userlogin) .mw-body-content { + font-size: 1.02rem !important; + line-height: 1.7 !important; + } + + body.mediawiki:not(.mw-special-Userlogin) h1.firstHeading { + font-size: 1.55rem !important; } .kd-hero { - padding: 20px 18px; + padding: 18px 16px; } .kd-hero-title { - font-size: 1.35rem !important; + font-size: 1.3rem !important; } .kd-hero-search { flex-direction: column; } + .kd-hero-search-btn { + width: 100%; + text-align: center; + } + + .kd-belt-grid { + grid-template-columns: repeat(2, 1fr) !important; + gap: 8px !important; + } + + .kd-cards-grid { + grid-template-columns: 1fr !important; + gap: 14px !important; + } + #mw-content-text table { display: block !important; + width: 100% !important; + max-width: 100% !important; overflow-x: auto !important; + -webkit-overflow-scrolling: touch !important; + } + + .karate-media-wrapper { + width: 100% !important; + max-width: 100% !important; + } + + .karate-video-player { + width: 100% !important; + height: auto !important; } } diff --git a/extensions-custom/KarateMedia/resources/karatemedia.js b/extensions-custom/KarateMedia/resources/karatemedia.js index c5a0225..deef11f 100644 --- a/extensions-custom/KarateMedia/resources/karatemedia.js +++ b/extensions-custom/KarateMedia/resources/karatemedia.js @@ -66,4 +66,11 @@ } } } ); + + // 3. PWA Service Worker Registrierung + if ( 'serviceWorker' in navigator && ( window.location.protocol === 'https:' || window.location.hostname === 'localhost' || window.location.hostname === '192.168.2.49' ) ) { + window.addEventListener( 'load', function () { + navigator.serviceWorker.register( '/sw.js' ).catch( function () {} ); + } ); + } }() ); diff --git a/extensions-custom/KarateMedia/src/KarateMediaHooks.php b/extensions-custom/KarateMedia/src/KarateMediaHooks.php index 64bcb70..424c9db 100644 --- a/extensions-custom/KarateMedia/src/KarateMediaHooks.php +++ b/extensions-custom/KarateMedia/src/KarateMediaHooks.php @@ -133,8 +133,83 @@ class KarateMediaHooks { public static function onBeforePageDisplay( $out, $skin ): void { $out->addModules( [ 'ext.karateMedia' ] ); - // Wichtig fuer moderne Smartphone- & Tablet-Darstellung - $out->addMeta( 'viewport', 'width=device-width, initial-scale=1.0' ); + // 1. Skin als responsive kennzeichnen, damit MediaWiki den Standard-Viewport (width=device-width) + // akzeptiert und das veraltete Desktop-width=1120 unterlaesst: + try { + $skinRefl = new \ReflectionClass( $skin ); + if ( $skinRefl->hasProperty( 'options' ) ) { + $optProp = $skinRefl->getProperty( 'options' ); + $optProp->setAccessible( true ); + $opts = $optProp->getValue( $skin ) ?: []; + $opts['responsive'] = true; + $optProp->setValue( $skin, $opts ); + } + } catch ( \Throwable $e ) { + $bindSkin = \Closure::bind( function () { + $this->options['responsive'] = true; + }, $skin, $skin ); + if ( $bindSkin ) { + $bindSkin(); + } + } + + // 2. Etwaige alte oder doppelte Viewport-Tags (insbesondere width=1120) aus mMetatags entfernen + try { + $outRefl = new \ReflectionClass( $out ); + if ( $outRefl->hasProperty( 'mMetatags' ) ) { + $metaProp = $outRefl->getProperty( 'mMetatags' ); + $metaProp->setAccessible( true ); + $tags = $metaProp->getValue( $out ) ?: []; + $cleaned = []; + foreach ( $tags as $t ) { + if ( isset( $t[0] ) && strtolower( $t[0] ) === 'viewport' ) { + continue; + } + $cleaned[] = $t; + } + $metaProp->setValue( $out, $cleaned ); + } + } catch ( \Throwable $e ) { + $bindOut = \Closure::bind( function () { + $this->mMetatags = array_values( array_filter( + $this->mMetatags, + static fn( $t ) => !( isset( $t[0] ) && strtolower( $t[0] ) === 'viewport' ) + ) ); + }, $out, $out ); + if ( $bindOut ) { + $bindOut(); + } + } + + // 3. Garantierter, fluessiger mobiler Viewport fuer alle Smartphones & Tablets + $out->addMeta( 'viewport', 'width=device-width, initial-scale=1.0, maximum-scale=5.0' ); + + // 4. PWA Web App Manifest, App-Icons & Mobile-Fullscreen-Metatags + $pwaHead = implode( "\n", [ + '', + '', + '', + '', + '', + '', + '', + '' + ] ); + $out->addHeadItem( 'karate-pwa-meta', $pwaHead ); + + // 5. Client-seitige Absicherung: Falls die Skin nachtraeglich noch width=1120 einfuegt, + // wird dies sofort beim Head-Parsing entfernt, bevor der Browser skaliert: + $inlineGuard = ''; + $out->addHeadItem( 'karate-viewport-guard', $inlineGuard ); $title = $out->getTitle(); $user = $out->getUser();