PageSourceSearch

https://photography-workshops.directory/wp-content/themes/listify-child/assets/js/header-layout.js?ver=3.4.5

js photography-workshops.directory collected 2026-09-27 10:08:43 UTC 2,512 bytes, 87 lines download raw bytes

1/**
2 * PWD 2026 v3.3.0
3 * Clean desktop header layout.
4 *
5 * Reuses Listify's existing navigation and utility/account controls.
6 * Desktop DOM becomes:
7 *   Logo | #site-navigation | Listify search/account controls
8 *
9 * Below 992px the original DOM is restored so Listify's native
10 * mobile navigation mechanics remain untouched.
11 */
12(function () {
13    'use strict';
14
15    var breakpoint = window.matchMedia('(min-width: 992px)');
16    var nav;
17    var target;
18    var originalParent;
19    var originalNextSibling;
20
21    function cache() {
22        nav = document.querySelector('#site-navigation');
23        target = document.querySelector('.primary-header-inner');
24
25        if (nav && !originalParent) {
26            originalParent = nav.parentNode;
27            originalNextSibling = nav.nextSibling;
28        }
29    }
30
31    function moveDesktop() {
32        cache();
33        if (!nav || !target) return;
34
35        if (nav.parentNode !== target) {
36            /*
37             * Place the menu after the logo/site-branding and before
38             * Listify's existing primary utility/account navigation.
39             */
40            var utilityNav = target.querySelector(':scope > .primary.nav-menu');
41            if (utilityNav) {
42                target.insertBefore(nav, utilityNav);
43            } else {
44                target.appendChild(nav);
45            }
46        }
47
48        nav.classList.add('pwd-header-main-nav');
49        document.documentElement.classList.add('pwd-desktop-single-header');
50    }
51
52    function restoreMobile() {
53        cache();
54        if (!nav || !originalParent) return;
55
56        if (nav.parentNode !== originalParent) {
57            if (originalNextSibling && originalNextSibling.parentNode === originalParent) {
58                originalParent.insertBefore(nav, originalNextSibling);
59            } else {
60                originalParent.appendChild(nav);
61            }
62        }
63
64        nav.classList.remove('pwd-header-main-nav');
65        document.documentElement.classList.remove('pwd-desktop-single-header');
66    }
67
68    function apply() {
69        if (breakpoint.matches) {
70            moveDesktop();
71        } else {
72            restoreMobile();
73        }
74    }
75
76    if (document.readyState === 'loading') {
77        document.addEventListener('DOMContentLoaded', apply);
78    } else {
79        apply();
80    }
81
82    if (breakpoint.addEventListener) {
83        breakpoint.addEventListener('change', apply);
84    } else if (breakpoint.addListener) {
85        breakpoint.addListener(apply);
86    }
87})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.