PageSourceSearch

https://japansociety.org/wp-content/themes/japan-society/front-src/components/Header/script.js?ver=1.1.3

js japansociety.org collected 2026-10-01 10:15:55 UTC 5,563 bytes, 83 lines download raw bytes

1window.addEventListener('DOMContentLoaded', () => {
2
3    const header = document.querySelector('header.header');
4
5    const maincontent = document.querySelector('#primary');
6
7    // const adjustHeader = () => {
8    //     const headerHeight   = parseFloat( getComputedStyle(header).height );
9    //     if(document.body.classList.contains('admin-bar')) {
10    //         const adminBar = document.getElementById('wpadminbar');
11    //         const adminbarHeight = parseFloat (getComputedStyle(adminBar).height);
12    //         maincontent.style.paddingTop = headerHeight - adminbarHeight + 'px';
13    //     }else {
14    //         maincontent.style.paddingTop = headerHeight + 'px';
15    //     }
16    //
17    // }
18    // adjustHeader();
19    // window.addEventListener('resize', adjustHeader);
20
21
22    //Main Menu Setup
23    const openMainMenuIcon  = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M0 96C0 78.33 14.33 64 32 64H416C433.7 64 448 78.33 448 96C448 113.7 433.7 128 416 128H32C14.33 128 0 113.7 0 96zM0 256C0 238.3 14.33 224 32 224H416C433.7 224 448 238.3 448 256C448 273.7 433.7 288 416 288H32C14.33 288 0 273.7 0 256zM416 448H32C14.33 448 0 433.7 0 416C0 398.3 14.33 384 32 384H416C433.7 384 448 398.3 448 416C448 433.7 433.7 448 416 448z"/></svg>`;
24    const closeMainMenuIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/></svg>`;
25    const mainMenuToggler = () => {
26        let isOpen = false;
27        return ( e ) => {
28            if( window.innerWidth > 1024 ) return;
29            e.preventDefault();
30            const menuButtonStarter = e.currentTarget;
31            if( isOpen ) {
32                menuButtonStarter.innerHTML = openMainMenuIcon;
33                document.querySelector('html').classList.remove('mobile-menu-opened');
34                isOpen = false
35            } else {
36                menuButtonStarter.innerHTML = closeMainMenuIcon;
37                document.querySelector('html').classList.add('mobile-menu-opened');
38                isOpen = true
39            }
40        }
41    }
42    document.querySelector('.mobile-area__button').addEventListener('click', mainMenuToggler())
43
44    // Sub Menu Setup
45    const openSubMenuOnMobileIcon  =  `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"/></svg>`;
46    const closeSubMenuOnMobileIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"/></svg>`;
47    const subMenuToggler = () => {
48        let isOpen = false;
49        return ( e ) => {
50            e.preventDefault()
51            const subMenuButtonStarter = e.currentTarget;
52            if( isOpen ) {
53                subMenuButtonStarter.innerHTML = openSubMenuOnMobileIcon;
54                subMenuButtonStarter.parentElement.parentElement.classList.remove('submenu-mobile-open')
55                isOpen = false
56            } else {
57                subMenuButtonStarter.innerHTML = closeSubMenuOnMobileIcon;
58                subMenuButtonStarter.parentElement.parentElement.classList.add('submenu-mobile-open')
59                isOpen = true
60            }
61        }
62    }
63
64    document.querySelectorAll(`.mobile-area__menu .sub-menu`).forEach(( submenuItem) => {
65        const subMenuToggleButton = document.createElement('a');
66        subMenuToggleButton.setAttribute('href','#');
67        subMenuToggleButton.classList.add('submenu-mobile-toggler')
68        subMenuToggleButton.innerHTML = openSubMenuOnMobileIcon;
69        subMenuToggleButton.addEventListener( 'click', subMenuToggler() )
70        submenuItem.parentElement.querySelector('a').append( subMenuToggleButton )
71    });
72
73    // Padding Control
74    // const setTopPadding = () => {
75    //     const headerHeight =  document.querySelector('header.header').getBoundingClientRect().height;
76    //     const adminBarHeight = document.getElementById('wpadminbar') ? document.getElementById('wpadminbar').getBoundingClientRect().height : 0;
77    //     document.querySelector('#primary').style.paddingTop = `${headerHeight - adminBarHeight}px`;
78    // }
79    // setTopPadding();
80    // window.addEventListener('resize', setTopPadding )
81    // window.addEventListener('load', setTopPadding);
82})
83

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.