PageSourceSearch

https://azlawhelp.org/templates/shaper_helixultimate/js/custom.js

js azlawhelp.org collected 2026-10-02 06:02:06 UTC 4,764 bytes, 135 lines download raw bytes

1window.addEventListener("load", () => {
2  console.log("hello world");
3  try{
4    
5  }catch(err){
6    console.err(err);
7  }
8  
9  try {
10    // Fix custom search buttons/text.
11     const customSearches = document.querySelectorAll(".custom-search");
12     for (const customSearch of customSearches) {
13       const button = customSearch.querySelector(".input-group button");
14      const input = customSearch.querySelector(
15        ".input-group input[type='text']"
16      );
17      if (button && !customSearch.classList.contains("homepage-search"))
18        button.innerHTML = button.innerHTML.replace("Search", "");
19     if (input && !customSearch.classList.contains("alt-search"))
20       input.placeholder = `Search`;
21       else input.placeholder = `Search`;
22     }
23
24    // OpenStreetMap integration.
25    if (window.location.pathname.includes("/directory/")) {
26      document.querySelector("div.directory-title").style.display = "none";
27
28      loadDetailsViewMap();
29      //       if (document.querySelector("div.map-container a")) {
30      //         const href = document.querySelector("div.map-container a").href;
31      //         const params = {};
32      //         const queryString = new URL(href).searchParams;
33
34      //         for (const [key, value] of queryString.entries()) {
35      //           params[key] = value;
36      //         }
37
38      //         const [lat, lon] = params.to
39      //           .split(",")
40      //           .map((s) => parseFloat(s.trim()));
41      //         // Calculate a small bbox around the point (needed for OSM embed zoom)
42      //         const offset = 0.001; // smaller offset at higher zoom
43      //         const left = lon - offset;
44      //         const right = lon + offset;
45      //         const bottom = lat - offset;
46      //         const top = lat + offset;
47
48      //         document.querySelector("div.map-container").innerHTML = `
49      //                 <embed
50      // loading="eager"
51      //    width="610" height="385" src="https://www.openstreetmap.org/export/embed.html?bbox=${left},${bottom},${right},${top}&layer=mapnik&marker=${params.to.replace(
52      //           ",",
53      //           "%2C"
54      //         )}"
55      //                 style="width: 100%; height: 24rem;"></embed>
56      //             `;
57      //       }
58
59      // Open first detail tab because otherwise all tab contents are shown.
60      document.querySelector("span#dir-tab-1").click();
61
62      // Add icons to detail headers.
63      const detailHeaders = document.querySelectorAll(
64        "div.listing-attributes div.attribute-name"
65      );
66
67      const icons = {
68        "services-limited-to": "fa-user-check",
69        "income-based-eligibility": "fa-sack-dollar",
70        "counties-served": "fa-map-pin",
71      };
72
73      for (const header of detailHeaders) {
74        const iconClass =
75          icons[
76            header.innerText
77              .toLowerCase()
78              .trim()
79              .split(" ")
80              .join("-")
81              .replace(":", "")
82          ];
83        const icon = document.createElement("i");
84        icon.style = "color:#000000";
85        icon.className = `fas ${iconClass}`;
86
87        header.prepend(icon);
88      }
89
90      const overviewTitle = document.querySelector("div.listing-detail-header");
91      if (overviewTitle.innerText === "OVERVIEW")
92        overviewTitle.innerHTML = "Overview";
93
94      const otherLocationsContainers = document.querySelectorAll(
95        "div.company-location"
96      );
97
98      for (const location of otherLocationsContainers) {
99        const phoneRegex = /\(?\d{3}\)?[\s-]?\d{3}-\d{4}/;
100        const phoneMatch = location.innerText.match(phoneRegex);
101        const phone = phoneMatch ? phoneMatch[0] : null;
102
103        // Remove phone number (and any trailing/leading spaces)
104        const cleanedText = location.innerText.replace(phoneRegex, "").trim();
105
106        const [names, address] = [...cleanedText.split(/(?:&nbsp;| - )/)];
107
108        location.innerHTML = `
109          ${
110            names
111              ? `<div><strong style="text-transform: capitalize; margin-bottom: 0.5rem;">${names
112                  .trim()
113                  .toLowerCase()}</strong></div>`
114              : ""
115          }
116          ${
117            address
118              ? `<div style="margin-bottom: 0.5rem;"><i class="la la-map-marker"></i>${address}</div>`
119              : ""
120          }
121          ${
122            phone
123              ? `<div style="margin-bottom: 0.5rem;"><i class="la la-phone"></i>${phone}</div>`
124              : ""
125          }
126        `;
127      }
128    }
129  } catch (err) {
130    console.error("Failed to run custom code.", err);
131  }
132  //force first choice for languages
133  //const select = document.querySelector('select');
134  //select.options[0].selected = true;
135});

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.