PageSourceSearch

https://cityofbrides.com/invar/page-maker/account/index.js

js cityofbrides.com collected 2026-09-26 09:34:25 UTC 4,636 bytes, 111 lines download raw bytes

1// Account Js
2document.addEventListener("DOMContentLoaded", async () => {
3  const signup = document.querySelector("#signup");
4  const memberLogin = document.querySelector("#member-login");
5  const signupMobile = document.querySelector("#signup-mobile");
6  const loginMobile = document.querySelector("#login-mobile");
7  const logoutMobile = document.querySelector("#logout-mobile");
8
9  try {
10    const response = await fetch('/members/home');
11    const html = await response.text();
12    const parser = new DOMParser();
13    const doc = parser.parseFromString(html, "text/html");
14
15    // Check if user is logged in based on the presence of .badge
16    const badgeElement = doc.querySelector(".badge");
17    const isLoggedIn = badgeElement && badgeElement.textContent.trim() !== "";
18
19    if (isLoggedIn) {
20      // LOGGED IN UI ONLY
21      const myAccount = (el) => {
22        el.innerHTML = `My Inbox <span class="d-flex align-items-center position-relative ps-2">
23                          <svg class="bi bi-envelope profile-pulse" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
24         <path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1zm13 2.383-4.708 2.825L15 11.105zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741M1 11.105l4.708-2.897L1 5.383z"></path>
25       </svg>
26              <span id="badge-text" class="position-absolute top-0 start-100 translate-middle badge
27                    text-white bg-danger rounded-pill d-flex align-items-center justify-content-center"
28                    style="padding: 5px;font-size: 12px;top: -5px !important;font-family: 'Hind Siliguri', sans-serif;
29                    border-radius: 50% !important;color: transparent !important;width: 10px;height: 10px;">
30                       
31                          </span>
32                        </span>`;
33        el.classList.add("position-relative", "d-flex", "justify-content-center", "align-items-center", "gap-1");
34        el.setAttribute("href", "/members/mailbox?folder=received");
35      };
36      myAccount(memberLogin);
37
38      signup.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#000" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
39  <path d="M15 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9"></path>
40  <path d="M20 12h-9"></path>
41  <path d="M17 9l3 3-3 3"></path>
42</svg>Logout`;
43      signup.setAttribute("href", "/members/logout?cmd=logout");
44      signup.style.cssText = `
45  background-color: transparent !important;
46  border: 1px solid #bbb !important;
47  color: #000 !important;
48padding: 5px 15px !important;
49`;
50signup.removeAttribute("data-bs-toggle");
51signup.removeAttribute("data-bs-target");
52
53      // MOBILE
54if (signupMobile) {
55  signupMobile.innerHTML = `
56    <span class="position-relative">
57      <svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 16 16" fill="white">
58        <path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555z"></path>
59        <path d="M0 4.697v7.104l5.803-3.552L0 4.697zM6.761 8.83l-6.761 4.145A2 2 0 0 0 2 14h12a2 2 0 0 0 1.999-1.025L9.239 8.83 8 9.586l-1.239-.756zM16 4.697l-5.803 3.552L16 11.801V4.697z"></path>
60      </svg>
61      <span id="badge-text"
62        class="position-absolute top-0 start-100 translate-middle badge text-white bg-danger rounded-pill fs-6 d-flex align-items-center justify-content-center p-2">
63      </span>
64    </span>
65    <span>My</span>
66    <span>Inbox</span>
67  `;
68
69  signupMobile.setAttribute("href", "/members/mailbox?folder=received");
70}
71
72      loginMobile.style.display = "block"; 
73      logoutMobile.style.display = "block";
74
75// BANNER REGISTER BUTTON → MY ACCOUNT (LOGGED IN ONLY)
76const btn = document.querySelector(".new-reg-btn");
77
78if (btn) {
79  const link = document.createElement("a");
80
81  // Copy attributes except Bootstrap data-bs-*
82  [...btn.attributes].forEach(attr => {
83    if (!attr.name.startsWith("data-bs")) {
84      link.setAttribute(attr.name, attr.value);
85    }
86  });
87
88  link.textContent = "My Account";
89  link.href = "/members/home";
90
91  // Media query
92  const mq = window.matchMedia("(max-width: 1024px)");
93
94  const handleResize = () => {
95    link.style.display = mq.matches ? "none" : "";
96  };
97
98  handleResize(); // initial check
99  mq.addEventListener("change", handleResize);
100
101  btn.replaceWith(link);
102}
103
104    }
105
106    // If NOT logged in, do nothing (UI stays as is)
107
108  } catch (error) {
109    console.error("Error fetching login state:", error);
110  }
111});

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.