1// fixed 8/17/2026 2 3 4document.addEventListener("DOMContentLoaded", function () { 5 6 // Add domains you want to exclude from being marked as external 7 const excludeDomains = [ 8 "olb-ebanking.com", 9 "olb.thefourcountybank.com", 10 "w-w-i-s.com" 11 ]; 12 13 // Links that should receive .wealth instead of .external 14 const wealthLinks = [ 15 "/investmentss", 16 "apps.apple.com/us/app/id577934858", 17 "www.externalwealthlink.com" 18 ]; 19 20 // Links that should receive .custom instead of .external 21 const customLinks = [ 22 "b063105515.account-open.online-banking-services.com/openaccount/?externalProductIds=113336", 23 "www.customlink.com", 24 "/anotherlink/page" 25 ]; 26 27 const currentHost = window.location.hostname 28 .replace(/^www\./, "") 29 .toLowerCase(); 30 31 function normalizeValue(value) { 32 if (!value) { 33 return ""; 34 } 35 36 return value 37 .trim() 38 .toLowerCase() 39 .replace(/^https?:\/\//, "") 40 .replace(/^www\./, "") 41 .replace(/\/$/, ""); 42 } 43 44 function getComparableValues(link) { 45 const rawHref = link.getAttribute("href"); 46 const resolvedUrl = new URL(link.href); 47 48 return { 49 rawHref: normalizeValue(rawHref), 50 resolvedHref: normalizeValue(resolvedUrl.href), 51 pathname: normalizeValue(resolvedUrl.pathname) 52 }; 53 } 54 55 function linkMatchesList(link, linkList) { 56 const values = getComparableValues(link); 57 58 return linkList.some(function (item) { 59 const normalizedItem = normalizeValue(item); 60 61 return ( 62 values.rawHref.includes(normalizedItem) || 63 values.resolvedHref.includes(normalizedItem) || 64 values.pathname.includes(normalizedItem) 65 ); 66 }); 67 } 68 69 document.querySelectorAll("a[href]").forEach(function (link) { 70 71 const href = link.getAttribute("href"); 72 73 if (!href) { 74 return; 75 } 76 77 // Remove only classes managed by this script 78 link.classList.remove( 79 "email", 80 "wealth", 81 "custom", 82 "external" 83 ); 84 85 // Mailto links 86 if (href.startsWith("mailto:")) { 87 link.classList.add("email"); 88 return; 89 } 90 91 // Ignore anchors, tel, javascript, etc. 92 if ( 93 href.startsWith("#") || 94 href.startsWith("tel:") || 95 href.startsWith("javascript:") 96 ) { 97 return; 98 } 99 100 try { 101 102 const linkUrl = new URL(link.href); 103 const linkHost = linkUrl.hostname 104 .replace(/^www\./, "") 105 .toLowerCase(); 106 107 const isWealthLink = linkMatchesList( 108 link, 109 wealthLinks 110 ); 111 112 const isCustomLink = linkMatchesList( 113 link, 114 customLinks 115 ); 116 117 const isExternal = 118 linkHost !== currentHost; 119 120 const isExcluded = excludeDomains.some(function (domain) { 121 122 const normalizedDomain = domain 123 .replace(/^www\./, "") 124 .toLowerCase(); 125 126 return ( 127 linkHost === normalizedDomain || 128 linkHost.endsWith("." + normalizedDomain) 129 ); 130 131 }); 132 133 // console.log({ 134 // href: link.href, 135 // isWealthLink, 136 // isCustomLink, 137 // isExternal, 138 // isExcluded 139 // }); 140 141 // Only one class should ever be applied 142 if (isWealthLink) { 143 144 link.classList.add("wealth"); 145 // console.log("Applied wealth:", link.href); 146 147 } else if (isCustomLink) { 148 149 link.classList.add("custom"); 150 // console.log("Applied custom:", link.href); 151 152 } else if (isExternal && !isExcluded) { 153 154 link.classList.add("external"); 155 // console.log("Applied external:", link.href); 156 157 } 158 159 } catch (error) { 160 161 console.error( 162 "Failed to process link:", 163 href, 164 error 165 ); 166 167 } 168 169 }); 170 171}); 172 173 174// speedbumps 175 176var exUrl = ""; 177 178document.addEventListener("click", function (e) { 179 180 var link = e.target.closest("a[href]"); 181 182 if (!link) { 183 return; 184 } 185 186 // console.log("Clicked link:", link); 187 // console.log("Classes:", link.className); 188 189 var modalId = ""; 190 191 if (link.classList.contains("wealth")) { 192 modalId = "wealth"; 193 } else if (link.classList.contains("custom")) { 194 modalId = "custom"; 195 } else if (link.classList.contains("external")) { 196 modalId = "thirdParty"; 197 } 198 199 // console.log("Modal selected:", modalId); 200 201 if (modalId) { 202 203 e.preventDefault(); 204 205 exUrl = link.getAttribute("href"); 206 207 // console.log("Speedbump link detected:", exUrl); 208 // console.log("Modal ID:", modalId); 209 210 var modalElement = 211 document.getElementById(modalId); 212 213 if (!modalElement) { 214 console.error("Modal not found:", modalId); 215 return; 216 } 217 218 if ( 219 typeof bootstrap === "undefined" || 220 typeof bootstrap.Modal === "undefined" 221 ) { 222 console.error( 223 "Bootstrap 5 Modal API is not available." 224 ); 225 return; 226 } 227 228 var modal = 229 bootstrap.Modal.getOrCreateInstance( 230 modalElement 231 ); 232 233 modal.show(); 234 235 return; 236 } 237 238 if (link.classList.contains("email")) { 239 240 e.preventDefault(); 241 242 exUrl = link.getAttribute("href"); 243 244 // console.log("Email link detected:", exUrl); 245 246 var emailModalElement = 247 document.getElementById("email"); 248 249 if (!emailModalElement) { 250 console.error("Email modal not found."); 251 return; 252 } 253 254 if ( 255 typeof bootstrap === "undefined" || 256 typeof bootstrap.Modal === "undefined" 257 ) { 258 console.error( 259 "Bootstrap 5 Modal API is not available." 260 ); 261 return; 262 } 263 264 var emailModal = 265 bootstrap.Modal.getOrCreateInstance( 266 emailModalElement 267 ); 268 269 emailModal.show(); 270 } 271 272});
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.