PageSourceSearch

https://www.oceanstatecu.org/wp-content/themes/ncr-child-theme/js/_new_script.js?ver=1

js oceanstatecu.org collected 2026-10-05 20:13:20 UTC 11,032 bytes, 362 lines download raw bytes

1var findEmptys;
2
3//Globals:
4var uri = document.location.href;
5var diDir = typeof DIDIR !== "undefined" ? DIDIR : "";
6var fiDocs = typeof FIDOCS !== "undefined" ? FIDOCS : "";
7var fiImages = typeof FIIMAGES !== "undefined" ? FIIMAGES : "";
8var themeImages = typeof THEMEIMAGES !== "undefined" ? THEMEIMAGES : "";
9var contextPath = typeof CONTEXTPATH !== "undefined" ? CONTEXTPATH : "";
10var region = typeof REGION !== "undefined" ? REGION : "";
11var fiName = typeof FINAME !== "undefined" ? FINAME : "";
12var cfg_enable_logging =
13  typeof CFG_ENABLE_LOGGING !== "undefined" ? CFG_ENABLE_LOGGING : "";
14var ncr_blog_landing =
15  typeof NCR_BLOG_LANDING !== "undefined" ? NCR_BLOG_LANDING : "";
16var layout = typeof LAYOUT !== "undefined" ? LAYOUT : "";
17var cfg_site_live = typeof CFG_SITE_LIVE !== "undefined" ? CFG_SITE_LIVE : "";
18var ua = typeof USERAGENT !== "undefined" ? USERAGENT : "";
19var userAgent = typeof USERAGENT !== "undefined" ? USERAGENT : "";
20
21function fixTargetBlank() {
22  window.opener = null;
23  const links = document.querySelectorAll("a");
24  links.forEach((link) => {
25    const target = link.target;
26    if (target == "_blank") {
27      const rel = !link.rel ? "" : link.rel;
28      if (!rel.includes("noopener")) {
29        link.rel += " noopener";
30      }
31      if (!rel.includes("noreferrer")) {
32        link.rel += " noreferrer";
33      }
34    }
35  });
36}
37fixTargetBlank();
38
39function replaceBolds() {
40  const bolds = document.querySelectorAll("b");
41  bolds.forEach((bold) => {
42    const strong = document.createElement("strong");
43    bold.childNodes.forEach((node) => strong.appendChild(node));
44    bold.replaceWith(strong);
45  });
46}
47replaceBolds();
48
49//NOT REMOVING ELEMENTS WITH ~. WE NEED TO FIND AND REMOVE THEM IN BUILD
50
51//NOT ADDING FILENAMES AS ALT TAGS.
52
53//WRAP ALL OF IT IN SECTIONS
54document
55  .querySelectorAll("body > *:not(section,main,header,footer)")
56  .forEach((element) => {
57    const section = document.createElement("section");
58    section.appendChild(element);
59  });
60
61function labelSections() {
62  const sections = document.querySelectorAll("section");
63  const labels = [];
64  function generateLabel(section, labels) {
65    let txt = "";
66    if (section.textContent) {
67      txt = section.textContent.trim().split(/\s/);
68    }
69    let words = txt.length > 3 ? txt.length : 3;
70    const max = 10;
71    let label = "";
72    for (let i = 0; i < words; i++) {
73      if (txt[i] != undefined && txt[i].trim().length > 0) {
74        label += txt[i].trim() + " ";
75      } else if (words < max) {
76        words++;
77      }
78    }
79    label += "...";
80    txt = label;
81    if (labels.includes(txt)) {
82      txt += " (duplicate)";
83    }
84    labels.push(txt);
85    return txt;
86  }
87  sections.forEach((section) => {
88    section.setAttribute("aria-label", generateLabel(section, labels));
89  });
90}
91labelSections();
92
93if (document.querySelectorAll("h1").length < 1) {
94  const heading = document.createElement("h1");
95  heading.innerText = fiName;
96  heading.classList.add("bankNameH1");
97  document.querySelector("#logoLink").appendChild(heading);
98}
99
100function labelAnchors() {
101  const anchors = document.querySelectorAll(".add-labels a:not(.editorLink)");
102  anchors.forEach((anchor) => {
103    const label = anchor.attributes["aria-label"];
104    const prefix = "autogenerated link to ";
105    if (!label) {
106      const text = anchor.textContent.trim();
107      anchor.attributes["aria-label"] = prefix + text;
108    }
109  });
110}
111labelAnchors();
112
113function fixIframes() {
114  const iframes = document.querySelectorAll("iframes");
115  let title_count = 0;
116  iframes.forEach((frame) => {
117    frame.attributes["border"] = null;
118    frame.attributes["frameborder"] = null;
119    const title = frame.attributes.title;
120    if (!title) {
121      frame.attributes.title = "untitled iframe: " + title_count;
122      title_count++;
123    }
124  });
125}
126fixIframes();
127//Why is this code so
128//Strangely written, did Jordan
129//want to make me cry
130function makeDropdownsWork() {
131  let count = 0;
132  const dropdowns = document.querySelectorAll(".dropdown");
133  function slideToggle(element, duration) {
134    const start = performance.now();
135    const end = start + duration;
136    const height = element.innerHeight;
137    element.style.maxHeight = "0px";
138    element.style.display = "block";
139    function step() {
140      const currentHeight =
141        ((performance.now() - start) / duration) * height < height
142          ? ((performance.now() - start) / duration) * height
143          : height;
144      element.style.maxHeight = currentHeight + "px";
145      if (performance.now() >= end) {
146        requestAnimationFrame(step);
147      }
148    }
149    requestAnimationFrame(step);
150  }
151  function expandDisc(target) {
152    const dropdownId = target.attribute["data-ncr-dropdown"];
153    const dropdown = document.querySelector(
154      ".content[data-ncr-dropdown=" + dropdown_id + "]"
155    );
156    slideToggle(dropdown, 200);
157    target.classList.add("open");
158  }
159  dropdowns.forEach((dropdown) => {
160    dropdown.querySelector(".heading").classList.add("discToggle");
161    dropdown.querySelector(".heading").attributes["data-ncr-dropdown"] = count;
162    dropdown.querySelector(".content").classList.add("disclaimer");
163    dropdown.querySelector(".content").attributes["data-ncr-dropdown"] = count;
164    dropdown.classList.add("disclaimerBox");
165    dropdown.classList.add("unhidden");
166    dropdown.attributes["data-ncr-dropdown"] = count;
167    count++;
168  });
169  document.querySelectorAll(".dropdown heading").forEach((dropdown) => {
170    dropdown.addEventListener("click", (e) => {
171      expandDisc(e.currentTarget);
172    });
173    dropdown.addEventListener("keydown", (e) => {
174      if (e.keyCode == 13 || e.keyCode == 32) {
175        expandDisc(e.currentTarget);
176        return false;
177      }
178    });
179  });
180}
181makeDropdownsWork();
182
183function initializeTPWModal() {
184  document.querySelector(".btn-go").addEventListener("click", () => {
185    document
186      .querySelector("#ncr-tpw-popup-panel")
187      .dispatchEvent(new Event("ncr-close-panel"));
188  });
189  // document.querySelector(".hide-tpw").classList.toggle("hide-tpw");
190}
191initializeTPWModal();
192
193function initializeTPWRules() {
194  console.log("Initializing global tpw rules");
195  const rules = NCR_TPW_RULES;
196  const all_external = NCR_TPW_ALL_EXTERNAL_SITES;
197  const links = document.querySelectorAll("a[href]:not(.ncr-tpw)");
198  links.forEach((link) => {
199    const href = link.attributes.href.value.toLowerCase();
200
201    if (all_external.enabled == "true") {
202      const local_domain = all_external.local_domain;
203      const tpw = all_external.tpw;
204      if (
205        href.includes(local_domain) ||
206        href.startsWith("/") ||
207        href.startsWith("#") ||
208        href.startsWith("javascript:")
209      ) {
210      } else {
211        console.log("adding tpw to: " + href);
212        link.classList.add("ncr-tpw");
213        link.attributes["data-ncr-tpw"] = tpw;
214      }
215    } else {
216      for (let rule of rules) {
217        const { domain } = rule;
218        if (rule.regex === "true") {
219          const res = href.match(new RegExp(domain, "gi"));
220          if (res) {
221            link.classList.add("ncr-tpw");
222            link.attributes["data-ncr-tpw"] = rule.tpw;
223          }
224        } else {
225          if (href.includes(domain.toLowerCase())) {
226            link.classList.add("ncr-tpw");
227            link.attributes["data-ncr-tpw"] = rule.tpw;
228          }
229        }
230      }
231    }
232  });
233}
234initializeTPWRules();
235
236function displayThirdPartyAlert(msg, lk) {
237  var description = lk.innerHTML;
238  if (description.indexOf('alt="') != -1) {
239    var x = description.indexOf('alt="') + 5;
240    var temp = description.substring(x);
241    description = temp.substring(0, temp.indexOf('"'));
242  }
243  showWarning(lk.href, description, lk.target, msg);
244  return false;
245}
246
247function showWarning(lk, desc, target, msg) {
248  desc = desc ? desc : "Third Party Site";
249  target = "_blank";
250  if (
251    lk.indexOf("http:") != 0 &&
252    lk.indexOf("https:") != 0 &&
253    lk.indexOf("mailto:") != 0
254  ) {
255    target = "_self";
256  }
257  msg = msg ? msg : 0;
258
259  var titles = NCR_TPW_LABELS;
260  var messages = NCR_TPW_CONTENT;
261  if (msg !== 0) {
262    const panel = document.querySelector("#ncr-tpw-popup-panel");
263    panel.querySelector(".ncr-tpw-title").innerHTML = titles[msg];
264    panel.querySelector(".ncr-tpw-body").innerHTML = messages[msg];
265    panel.querySelector(".btn-go").attributes.href.value = lk;
266    panel.dispatchEvent(new Event("ncr-open-panel"));
267  }
268}
269document.querySelectorAll("a.ncr-tpw").forEach((link) => {
270  link.addEventListener("click", (e) => {
271    e.preventDefault();
272    const tpw = parseInt(e.currentTarget.attributes["data-ncr-tpw"]) + 1;
273    if (!isNaN(tpw)) {
274      return displayThirdPartyAlert(tpw, e.currentTarget);
275    }
276  });
277});
278
279function doHashtag() {
280  const full_hash = window.location.href;
281  const hash_name =
282    full_hash.indexOf("?") > -1
283      ? full_hash.split("?")[1]
284      : full_hash.substring(1); //hash_name = test
285  console.log("handling hashtag: " + hash_name);
286  console.log(full_hash);
287  if (hash_name == undefined || hash_name === "") {
288    console.log("empty hashtag, bailing");
289    return;
290  }
291
292  if (hash_name === "login" || hash_name === "skip-to-login") {
293    showLogin();
294    document
295      .querySelector("[ncr-panel='Log in']")
296      .scrollIntoView({ scrollBehavior: "smooth" });
297  }
298  /*
299  if (document.querySelector("*[name=" + hash_name + "]")) {
300    console.log("scrolling to: [name=" + hash_name + "]");
301    document
302      .querySelector("*[name=" + hash_name + "]")
303      .scrollIntoView({ scrollBehavior: "smooth" });
304  } else if (document.querySelector("#" + hash_name)) {
305    console.log("scrolling to: id=" + hash_name);
306    document
307      .querySelector("#" + hash_name)
308      .scrollIntoView({ scrollBehavior: "smooth" });
309  }
310  */
311}
312if (window.location.hash != undefined && window.location.hash != "") {
313  doHashtag();
314}
315window.addEventListener("load", function () {
316  setTimeout(function () {
317    doHashtag();
318    console.log("loaded!");
319  }, 300);
320});
321//doHashtag();
322/*
323function showLogin() {
324  console.log("showing login.");
325  //If panel based, you need these:
326  /*
327  $("[ncr-panel='Log in']").on("ncr-panel-opened", function () {
328    console.log("hello login");
329    setTimeout(function () {
330      $("input[name=userid]").focus();
331    }, 300);
332  });
333
334  $("[ncr-panel='Login']").trigger("ncr-open-panel");
335  //$("#loginToggle").trigger("click");
336
337  //You'll always want this:
338  $("input[name=userid]").focus();
339  */
340//document.getElementById("username1").focus();
341
342//Some older methods include:
343//$(".ibDropdown").addClass("active");
344//$("#login").show();
345
346//document.querySelector("input[name=userid]").focus();
347/*
348  document
349    .querySelector("[ncr-panel='Log in']")
350    .dispatchEvent(new Event("ncr-open-panel"));
351  setTimeout(function () {
352    document.querySelector("input[name=userid]").focus();
353  }, 300);
354  //You'll always want this:
355  //$("input[name=userid]").focus();
356  //document.getElementById("username1").focus();
357
358  //Some older methods include:
359  //$(".ibDropdown").addClass("active");
360  //$("#login").show();
361}
362*/

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.