PageSourceSearch

https://naturalchoicefoods.com/wp-content/themes/ncf-child/js/header-buttons.js

js naturalchoicefoods.com collected 2026-10-05 19:22:20 UTC 1,137 bytes, 34 lines download raw bytes

1/**
2 * Mobile menu fix
3 */
4(function () {
5  // Only run on touch devices (real phones/tablets)
6  const isTouch = window.matchMedia("(hover: none)").matches;
7  if (!isTouch) return;
8
9  // Clean any existing listeners that might be blocking taps
10  document.querySelectorAll(".menu-item-has-children > a").forEach((a) => {
11    const clean = a.cloneNode(true);
12    a.replaceWith(clean);
13  });
14
15  function go(e) {
16    const a = e.currentTarget;
17    const href = a.getAttribute("href");
18    if (!href || href === "#") return; // nothing to do
19    // Beat any other handlers and force navigation
20    e.preventDefault();
21    e.stopPropagation();
22    e.stopImmediatePropagation?.();
23    window.location.assign(href);
24  }
25
26  const opts = { capture: true }; // run before any bubbling handlers
27  document.querySelectorAll(".menu-item-has-children > a").forEach((a) => {
28    // Use touch/pointer to survive iOS blocking the synthesized click
29    a.addEventListener("pointerup", go, opts);
30    a.addEventListener("touchend", go, opts);
31    // Keep click as a fallback for Android/other browsers
32    a.addEventListener("click", go, opts);
33  });
34})();

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.