diff --git a/conferences/index.php b/conferences/index.php index 3718ba5baf..6975e3e109 100644 --- a/conferences/index.php +++ b/conferences/index.php @@ -18,22 +18,30 @@ foreach ((new NewsHandler())->getConferences() as $entry) { $link = preg_replace('~^(http://php.net/|https://www.php.net/)~', '', $entry["id"]); $id = parse_url($entry["id"], PHP_URL_FRAGMENT); - $date = date_format(date_create($entry["updated"]), 'Y-m-d'); - $content .= '
'; - $content .= '

' . $entry["title"] . '

'; - $content .= '
'; - if (isset($entry["newsImage"])) { - $content .= sprintf('', $entry["newsImage"]["link"], $entry["newsImage"]["content"]); + $nixtimestamp = date_create($entry["updated"]); + if(isset($entry["finalTeaserDate"])) { + $nixtimestamp = date_create($entry["finalTeaserDate"]); } + $date = date_format($nixtimestamp, 'd M Y'); + $date_w3c = date_format($nixtimestamp, DATE_W3C); + + $content .= '
'; + $content .= '
'; + $content .= '
'; + $content .= '' . $entry["title"] . ''; $content .= '
'; - $content .= '
'; - $content .= $entry["content"]; - $content .= '
'; + $content .= '
'; $content .= '
'; - $panels .= sprintf('

%s

', $entry["newsImage"]["link"], $entry["title"]); + $content .= '
'; + $content .= '
' . $entry["content"] . '
'; + $content .= '
'; + $content .= sprintf('%s', $entry["newsImage"]["link"], $entry["newsImage"]["content"], $entry["title"]); + $content .= '
'; + $content .= '
'; + $content .= '
'; } $content .= "
"; diff --git a/include/footer.inc b/include/footer.inc index faa7305d68..9d4ea4f994 100644 --- a/include/footer.inc +++ b/include/footer.inc @@ -59,43 +59,122 @@
- - - -
"; - } - ?> + + +
+
-
-
diff --git a/include/layout.inc b/include/layout.inc index 02b6f733ca..da154a1e5a 100644 --- a/include/layout.inc +++ b/include/layout.inc @@ -411,7 +411,13 @@ function print_news($news, $dog, $max = 5, $return = false) { $published = substr($item["published"], 0, 10); $nixtimestamp = strtotime($published); + + if(isset($item["finalTeaserDate"])) { + $nixtimestamp = strtotime($item["finalTeaserDate"]); + } + $newsdate = date("d M Y", $nixtimestamp); + $newsdate_w3c = date(DATE_W3C, $nixtimestamp); if ($return) { $retval[] = [ @@ -423,25 +429,35 @@ function print_news($news, $dog, $max = 5, $return = false) { continue; } + $imageBlock = ''; + if ($image) { + $imageBlock = << + {$image} + + EOT; + } + echo << -
- -

{$item["title"]}

-
-
-
{$image}
- {$item["content"]} -
+
+
+ +
+
+
+
{$item["content"]}
+ {$imageBlock} +
- EOT; } return $retval; } -function site_header(?string $title = NULL, array $config = []): void +function site_header(?string $title = null, array $config = []): void { global $MYSITE, $LANG; @@ -453,6 +469,7 @@ function site_header(?string $title = NULL, array $config = []): void "lang" => $LANG, "current" => "", "meta-navigation" => [], + "theme_switcher" => true, 'classes' => '', 'layout_span' => 9, "cache" => false, diff --git a/index.php b/index.php index 9e24fc8c5f..367e35f308 100644 --- a/index.php +++ b/index.php @@ -65,16 +65,16 @@ $date_human = date_format($date, 'd M Y'); $date_w3c = date_format($date, DATE_W3C); $content .= << -
- -

- {$entry["title"]} -

-
-
- {$entry["content"]} -
+ NEWSENTRY; } diff --git a/js/common.js b/js/common.js index b1aa4c7c4c..f66c772224 100644 --- a/js/common.js +++ b/js/common.js @@ -423,6 +423,7 @@ $(document).ready(function () { for (photo in data) { photo = data[photo]; link = $(''); + link.attr('aria-label', "See elephpant photo"); link.attr('href', photo.url); link.attr('title', photo.title); image = $(''); @@ -460,87 +461,6 @@ $(document).ready(function () { } }); - /*{{{ 2024 Navbar */ - const offcanvasElement = document.getElementById("navbar__offcanvas"); - const offcanvasSelectables = - offcanvasElement.querySelectorAll("input, button, a"); - const backdropElement = document.getElementById("navbar__backdrop"); - - const documentWidth = document.documentElement.clientWidth; - const scrollbarWidth = Math.abs(window.innerWidth - documentWidth); - - const offcanvasFocusTrapHandler = (event) => { - if (event.key != "Tab") { - return; - } - - const firstElement = offcanvasSelectables[0]; - const lastElement = - offcanvasSelectables[offcanvasSelectables.length - 1]; - - if (event.shiftKey) { - if (document.activeElement === firstElement) { - event.preventDefault(); - lastElement.focus(); - } - } else if (document.activeElement === lastElement) { - event.preventDefault(); - firstElement.focus(); - } - }; - - const openOffcanvasNav = () => { - offcanvasElement.classList.add("show"); - offcanvasElement.setAttribute("aria-modal", "true"); - offcanvasElement.setAttribute("role", "dialog"); - offcanvasElement.style.visibility = "visible"; - backdropElement.classList.add("show"); - document.body.style.overflow = "hidden"; - // Disable scroll on the html element as well to prevent the offcanvas - // nav from being pushed off screen when the page has horizontal scroll, - // like downloads.php has. - document.documentElement.style.overflow = "hidden"; - document.body.style.paddingRight = `${scrollbarWidth}px`; - offcanvasElement.querySelector(".navbar__link").focus(); - document.addEventListener("keydown", offcanvasFocusTrapHandler); - }; - - const closeOffcanvasNav = () => { - offcanvasElement.classList.remove("show"); - offcanvasElement.removeAttribute("aria-modal"); - offcanvasElement.removeAttribute("role"); - backdropElement.classList.remove("show"); - document.removeEventListener("keydown", offcanvasFocusTrapHandler); - offcanvasElement.addEventListener( - "transitionend", - () => { - document.body.style.overflow = "auto"; - document.documentElement.style.overflow = "auto"; - document.body.style.paddingRight = "0px"; - offcanvasElement.style.removeProperty("visibility"); - }, - { once: true }, - ); - }; - - const closeOffCanvasByClickOutside = (event) => { - if (event.target === backdropElement) { - closeOffcanvasNav(); - } - }; - - document.getElementById("navbar__menu-link").setAttribute("hidden", "true"); - - const menuButton = document.getElementById("navbar__menu-button"); - menuButton.removeAttribute("hidden"); - menuButton.addEventListener("click", openOffcanvasNav); - - document - .getElementById("navbar__close-button") - .addEventListener("click", closeOffcanvasNav); - - backdropElement.addEventListener("click", closeOffCanvasByClickOutside); - /*}}}*/ /*{{{ Scroll to top */ @@ -868,3 +788,25 @@ function applyTheme(theme) { } applyTheme(savedTheme) + +const mobileMenuButton = document.getElementById('mobile-menu-button'); +const navMenu = document.getElementById('js-nav-menu'); +const [menuIcon, closeIcon] = ['menu-icon', 'close-icon'].map(id => document.getElementById(id)); + +const toggleMenu = () => { + const isExpanded = mobileMenuButton.getAttribute('aria-expanded') === 'true'; + navMenu.style.display = isExpanded ? 'none' : 'block'; + menuIcon.classList.toggle('hidden'); + closeIcon.classList.toggle('hidden'); + mobileMenuButton.setAttribute('aria-expanded', !isExpanded); +}; + +mobileMenuButton?.addEventListener('click', toggleMenu); +window.addEventListener('resize', () => { + if (window.innerWidth >= 768) { + navMenu.style.display = ''; + menuIcon.classList.remove('hidden'); + closeIcon.classList.add('hidden'); + mobileMenuButton.setAttribute('aria-expanded', 'false'); + } +}); diff --git a/js/search.js b/js/search.js index 6ef5008afe..ae914d0775 100644 --- a/js/search.js +++ b/js/search.js @@ -217,7 +217,7 @@ const initSearchModal = () => { backdropElement.removeAttribute("aria-modal"); backdropElement.removeAttribute("role"); onModalTransitionEnd(() => { - document.body.style.overflow = "auto"; + document.body.style.overflow = "initial"; document.documentElement.style.overflow = "auto"; document.body.style.paddingRight = "0px"; backdropElement.classList.remove("hiding"); @@ -225,28 +225,9 @@ const initSearchModal = () => { }); }; - const searchLink = document.getElementById("navbar__search-link"); - const searchButtonMobile = document.getElementById( - "navbar__search-button-mobile", - ); const searchButton = document.getElementById("navbar__search-button"); let buttons = [searchButton]; - // Enhance mobile search - if (searchLink !== null) { - searchLink.setAttribute("hidden", "true"); - searchButtonMobile.removeAttribute("hidden"); - buttons.push(searchButtonMobile); - } - - // Enhance desktop search - const searchForm = document - .querySelector(".navbar__search-form"); - if (searchForm !== null) { - searchForm.setAttribute("hidden", "true"); - } - searchButton.removeAttribute("hidden"); - // Open when the search button is clicked buttons.forEach((button) => button.addEventListener("click", show), diff --git a/releases/8.5/common.php b/releases/8.5/common.php index 4a94540e14..c5d7153c33 100644 --- a/releases/8.5/common.php +++ b/releases/8.5/common.php @@ -32,7 +32,6 @@ function common_header(string $description): void { 'current' => 'php85', 'css' => ['php85.css'], 'language_switcher' => $languages, - 'theme_switcher' => true, 'meta_tags' => << diff --git a/releases/8.5/release.inc b/releases/8.5/release.inc index 650ad6d05e..051bca754f 100644 --- a/releases/8.5/release.inc +++ b/releases/8.5/release.inc @@ -206,7 +206,7 @@ common_header(message('common_header', $lang));
-