From 0b06883ff91788393da1868e368c8da60f164c6e Mon Sep 17 00:00:00 2001 From: marko Date: Mon, 29 Sep 2025 05:21:53 +0200 Subject: [PATCH] collapsible nav targets on mobile --- .../cwsvJudo/src/pages/responsive/index.php | 104 ++++++++++-------- 1 file changed, 58 insertions(+), 46 deletions(-) diff --git a/homepage/cwsvJudo/src/pages/responsive/index.php b/homepage/cwsvJudo/src/pages/responsive/index.php index 04c229a..914605c 100644 --- a/homepage/cwsvJudo/src/pages/responsive/index.php +++ b/homepage/cwsvJudo/src/pages/responsive/index.php @@ -10,7 +10,7 @@ if (!is_dir(filename: "{$home}/pages/{$page}")) { $meta = json_decode( json: file_get_contents(filename: $home . "/pages/" . $page . "/meta.json"), - associative: true + associative: true, ); class Section @@ -60,7 +60,7 @@ class Section return new Section( htmls: array_map(function ($file) use ($root_directory) { return Section::parse_file(path: $root_directory . "/" . $file); - }, $file_names) + }, $file_names), ); } } @@ -112,14 +112,14 @@ class Main sections: array_map( callback: fn($file) => Section::create( file_names: $file, - root_directory: $root_path + root_directory: $root_path, ), - array: $data["sections"] + array: $data["sections"], ), wallpapers: array_map( fn($name) => Wallpaper::create($name, $wallpaper_root_path), - array: $data["wallpapers"]["images"] - ) + array: $data["wallpapers"]["images"], + ), ); } } @@ -141,8 +141,8 @@ class Wallpaper ", ", array_map( fn($width) => "{$this->src_dir}/{$width}.{$format} {$width}w", - $widths - ) + $widths, + ), ); // return "src}\" data-src=\"{$this->data_src}\" alt=\"Wallpaper\">"; return "src_dir}/mosaic.svg\" data-src=\"{$this->src_dir}/{$widths[0]}.{$format}\" data-srcset=\"{$src_sets}\" class=\"lazyload\" alt=\"Wallpaper\">"; @@ -165,7 +165,7 @@ class Newsboard hostname: Newsboard::$config["host"], dbName: Newsboard::$config["name"], user: Newsboard::$config["user"], - password: $password + password: $password, ); } @@ -179,7 +179,7 @@ class Newsboard "limit" => $limit, "dbCharset" => Newsboard::$config["dbCharset"], "outCharset" => Newsboard::$config["outCharset"], - ] + ], ); if ($entries !== null) { foreach ($entries as $entryData) { @@ -198,12 +198,12 @@ class Newsboard Newsboard::init( config: $config["cwsvJudo"]["db"], - password: $secrets["cwsvJudo"]["db"][$config["cwsvJudo"]["db"]["user"]] + password: $secrets["cwsvJudo"]["db"][$config["cwsvJudo"]["db"]["user"]], ); Kalender::init( config: $config["cwsvJudo"]["db"], - password: $secrets["cwsvJudo"]["db"][$config["cwsvJudo"]["db"]["user"]] + password: $secrets["cwsvJudo"]["db"][$config["cwsvJudo"]["db"]["user"]], ); $page_data_root_directory = "$home/pages/$page"; @@ -233,32 +233,46 @@ function mainNavTargets($mainNav) echo ""; } -function getHtmlNavBar($mainNav): string{ - return ( - '' - .'' - .'' - ); +function getHtmlNavBar($mainNav): string +{ + return '" . + "" . + '"; } - ?> @@ -290,14 +304,7 @@ function getHtmlNavBar($mainNav): string{
- +
@@ -311,7 +318,7 @@ function getHtmlNavBar($mainNav): string{ Valid html 5 @@ -356,6 +363,11 @@ function getHtmlNavBar($mainNav): string{ // specify options here } ), + sidenav : M.Sidenav.init( + document.querySelectorAll('.sidenav'), { + // specify options here + } + ), } // end instances });