PageSourceSearch

https://www.survivornet.com/wp-content/themes/survivornet/assets/mhq/mhq-homepage-redirect.js?ver=1790238421

js survivornet.com collected 2026-09-24 09:05:59 UTC 2,169 bytes, 76 lines download raw bytes

1/**
2 * Lightweight replacement for mhq5.js on the homepage.
3 *
4 * The homepage MHQ widget (textarea, voice button, swiper prompt cards)
5 * now redirects to the standalone React app at /my-health-questions/
6 * instead of opening the old overlay panel.
7 */
8(function () {
9  var MHQ_URL = "/my-health-questions/";
10
11  function redirect(query) {
12    if (query) {
13      window.location.href = MHQ_URL + "?q=" + encodeURIComponent(query);
14    } else {
15      window.location.href = MHQ_URL;
16    }
17  }
18
19  function init() {
20    var hp = document.querySelector(".homepage-mhqs");
21    if (!hp) return;
22
23    var input = hp.querySelector(".input-field");
24    var sendBtn = hp.querySelector(".send-btn");
25    var voiceBtn = hp.querySelector(".voice-popup-btn");
26    var slides = hp.querySelectorAll(".swiper-slide");
27
28    if (input) {
29      input.addEventListener("keypress", function (e) {
30        if (e.key === "Enter" || e.which === 13) {
31          e.preventDefault();
32          var text = input.value.trim();
33          if (text) redirect(text);
34        }
35      });
36
37      input.addEventListener("input", function () {
38        var hasValue = input.value.trim() !== "";
39        if (sendBtn) sendBtn.style.display = hasValue ? "flex" : "none";
40        if (voiceBtn) voiceBtn.style.display = hasValue ? "none" : "flex";
41      });
42    }
43
44    if (sendBtn) {
45      sendBtn.addEventListener("click", function (e) {
46        e.preventDefault();
47        var text = input ? input.value.trim() : "";
48        if (text) redirect(text);
49      });
50    }
51
52    if (voiceBtn) {
53      voiceBtn.addEventListener("click", function (e) {
54        e.preventDefault();
55        e.stopImmediatePropagation();
56        window.location.href = MHQ_URL + "?voice=1";
57      });
58    }
59
60    slides.forEach(function (slide) {
61      slide.addEventListener("click", function (e) {
62        e.preventDefault();
63        e.stopPropagation();
64        var p = slide.querySelector("p");
65        var text = p ? p.textContent.trim() : "";
66        if (text) redirect(text);
67      });
68    });
69  }
70
71  if (document.readyState === "loading") {
72    document.addEventListener("DOMContentLoaded", init);
73  } else {
74    init();
75  }
76})();

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.