PageSourceSearch

https://www.digital.go.jp/themes/custom/gov_theme_base_2023/build/assets/js/common.js?tm7szw

js digital.go.jp collected 2026-10-01 08:31:05 UTC 4,701 bytes, 1 lines download raw bytes

1(()=>{let e={root:`.alert`,close:`.alert__close`,item:`.alert__item`},t=new MutationObserver(()=>{let r=document.querySelector(e.root);r&&(Array.from(r.querySelectorAll(e.close)).forEach(t=>{t.addEventListener(`click`,({target:t})=>n(r,t.closest(e.item),e.item))}),t.disconnect())});t.observe(document.body,{attributes:!1,childList:!0,characterData:!1,subtree:!0});function n(e,t,n){t&&(t.remove(),e.querySelectorAll(n).length===0&&e.remove())}})();function e(e){return e.offsetWidth>0&&e.offsetHeight>0}function t(t){return[...t.querySelectorAll(`a, button, input, select`)].filter(e)}var n={".js-dropdown":class{#e=!1;#t=!1;constructor(e){this.options={id:e.getAttribute(`data-dropdown-id`)??``,closeOnOutside:e.hasAttribute(`data-dropdown-close-on-outside`),closeOnEscape:e.hasAttribute(`data-dropdown-close-on-escape`),disableScroll:e.hasAttribute(`data-dropdown-disable-scroll`),trapFocus:e.hasAttribute(`data-dropdown-trap-focus`),resetFocus:e.getAttribute(`data-dropdown-reset-focus`)},this.elements={container:e,fallback:e.querySelector(`[data-dropdown-fallback="${this.options.id}"]`),toggle:e.querySelector(`[data-dropdown-toggle="${this.options.id}"]`),target:document.getElementById(this.options.id),overlay:e.querySelector(`[data-dropdown-overlay="${this.options.id}"]`),close:e.querySelector(`[data-dropdown-close="${this.options.id}"]`),resetFocus:document.getElementById(this.options.resetFocus??``)},this.elements.toggle?.setAttribute(`aria-controls`,this.options.id),this.elements.toggle?.setAttribute(`aria-expanded`,`false`),this.elements.close?.setAttribute(`aria-controls`,this.options.id),this.elements.fallback?.setAttribute(`hidden`,``),this.elements.toggle?.removeAttribute(`hidden`),this.elements.target?.setAttribute(`aria-hidden`,`true`),this.elements.resetFocus&&![`A`,`BUTTON`].includes(this.elements.resetFocus.tagName)&&this.elements.resetFocus.setAttribute(`tabindex`,`-1`),this.handleCloseOnOutside=this.handleCloseOnOutside.bind(this),this.handleCloseOnEscape=this.handleCloseOnEscape.bind(this),this.elements.toggle?.addEventListener(`click`,this.toggle.bind(this)),this.elements.close?.addEventListener(`click`,this.close.bind(this)),this.options.trapFocus&&(this.elements.target?.addEventListener(`keydown`,this.handleTabKey.bind(this)),this.elements.target?.addEventListener(`focusout`,this.handleTargetFocusOut.bind(this)),this.elements.toggle?.addEventListener(`focusout`,this.handleToggleFocusOut.bind(this))),e.querySelectorAll(`.header-dropdown-list__item`).forEach(e=>{e.textContent.trim()===`ホーム`&&e.classList.add(`header-dropdown-list__item--desktop-only`)})}handleTabKey(e){e.key===`Tab`?this.#t=!0:this.#t=!1}toggle(e){let t=e.detail===0;this.#e?this.close({isKeyboard:t}):this.open({isKeyboard:t}),this.#t=!1}open({isKeyboard:e=!1}={}){this.elements.target?.removeAttribute(`hidden`),this.elements.target?.setAttribute(`aria-hidden`,`false`),this.elements.toggle?.setAttribute(`aria-expanded`,`true`),this.options.closeOnOutside&&document.body.addEventListener(`click`,this.handleCloseOnOutside),this.options.closeOnEscape&&document.body.addEventListener(`keyup`,this.handleCloseOnEscape),this.options.disableScroll&&document.documentElement.style.setProperty(`overflow`,`hidden`),this.options.trapFocus&&e&&this.elements.target&&t(this.elements.target).at(0)?.focus(),this.#e=!0}close({isKeyboard:e=!1}={}){this.elements.target?.setAttribute(`hidden`,``),this.elements.target?.setAttribute(`aria-hidden`,`true`),this.elements.toggle?.setAttribute(`aria-expanded`,`false`),this.options.closeOnOutside&&document.body.removeEventListener(`click`,this.handleCloseOnOutside),this.options.closeOnEscape&&document.body.removeEventListener(`keyup`,this.handleCloseOnEscape),this.options.disableScroll&&document.documentElement.style.removeProperty(`overflow`),this.options.resetFocus&&e&&this.elements.resetFocus?.focus(),this.#e=!1}handleCloseOnOutside(e){let t=e.target;(!this.elements.container.contains(t)||t===this.elements.overlay)&&this.close()}handleCloseOnEscape(e){e.key===`Escape`&&this.close({isKeyboard:!0})}isHandleFocusOut(e){let t=e.relatedTarget!==document.querySelector(`header#header`),n=window.matchMedia&&window.matchMedia(`(max-width: 68rem)`).matches&&!this.#t;return!(!this.#e||!this.elements.toggle||!this.elements.target||!t||n)}handleTargetFocusOut(e){if(!this.isHandleFocusOut(e))return;let n=t(this.elements.target);e.target===n.at(-1)&&e.relatedTarget!==n.at(-2)&&this.elements.toggle.focus()}handleToggleFocusOut(e){if(!this.isHandleFocusOut(e))return;let n=t(this.elements.target);
1e.relatedTarget!==n.at(0)&&n.at(-1)?.focus()}}};Object.keys(n).forEach(e=>{Array.from(document.querySelectorAll(e)).map(t=>new n[e](t))});

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.