PageSourceSearch

https://jobs.prnewsonline.com/c/@search_results/assets/js/search-shared.js

js prnewsonline.com collected 2026-10-02 02:41:47 UTC 6,867 bytes, 130 lines download raw bytes

1(function () {
2  'use strict';
3
4  /* ── gaJobView ────────────────────────────────────────────
5     Merged from script.cfm (old layout) + responsive_v3.cfm (v3).
6     Old layout used a CFML gate for gajt(); replaced here with a
7     runtime typeof guard since this is a static .js file.
8     jQuery-dependent branches (Multi Location List / Job Summary
9     Question) are guarded so they silently skip in v3 (no jQuery). */
10  function gaJobView(e, n, t, h) {
11    if (typeof gajt === 'function') gajt('CCSC.send', 'event', e, n, t, { dimension3: h, nonInteraction: 1, transport: 'beacon' });
12    if (!window.dataLayer) return;
13    if      (n === 'Call')            { dataLayer.push({ event: 'job_call',                job_id: h }); dataLayer.push({ event: 'job_details', clicked_element: 'kebab: call us' }); }
14    else if (n === 'Print')           { dataLayer.push({ event: 'job_print',               job_id: h }); dataLayer.push({ event: 'job_details', clicked_element: 'kebab: print' }); }
15    else if (n === 'Career Fair')     { dataLayer.push({ event: 'job_careerfair_register', job_id: h }); }
16    else if (n === 'Company Profile') { dataLayer.push({ event: 'job_company_name_click',  job_id: h }); }
17    else if (n === 'LinkedIn')        { dataLayer.push({ event: 'job_view_connection',     job_id: h }); }
18    else if (n === 'Apply')           { dataLayer.push({ event: 'job_apply_click',         job_id: h }); }
19    else if (n === 'Multi Location List') {
20      // push only when opening (aria-expanded is still 'false' before v3LocDropdown toggles it)
21      if (t.getAttribute('aria-expanded') !== 'true')
22        dataLayer.push({ event: 'job_details', clicked_element: 'job location list' });
23    }
24    else if (n === 'Job Summary Question') {
25      if (typeof $ === 'undefined' || !$(t).siblings('.dropdown-menu').hasClass('show'))
26        dataLayer.push({ event: 'job_details', clicked_element: (typeof $ !== 'undefined' ? $(t).attr('data-ga-label') : '') + ': view list' });
27    }
28    else if (n === 'Community Intel Pane')     { dataLayer.push({ event: 'community_intel', clicked_element: t + ' intel pane' }); }
29    else if (n === 'Community Intel Location') { dataLayer.push({ event: 'community_intel', clicked_element: 'job location: ' + t }); }
30    else if (n === 'Community Intel Ad')       { dataLayer.push({ event: 'community_intel', clicked_element: 'right side board ad' }); }
31  }
32  window.gaJobView = gaJobView;
33
34  /* ── v3ShowToast ────────────────────────────────────────────
35     Moved from responsive_v3.cfm. Called from submitJobAlert and any future callers. */
36  function v3ShowToast(message, type) {
37    var container = document.getElementById('toast-container');
38    if (!container) {
39      container = document.createElement('div');
40      container.id = 'toast-container';
41      container.className = 'v3-toast-container';
42      container.setAttribute('aria-live', 'polite');
43      container.setAttribute('aria-atomic', 'false');
44      document.body.appendChild(container);
45    }
46    var toast = document.createElement('div');
47    toast.className = 'v3-toast' + (type ? ' v3-toast-' + type : '');
48    toast.setAttribute('role', 'status');
49    var icon = document.createElement('i');
50    icon.setAttribute('aria-hidden', 'true');
51    icon.className = type === 'success' ? 'fa-solid fa-circle-check'
52                   : type === 'error'   ? 'fa-solid fa-circle-exclamation'
53                   : 'fa-solid fa-circle-info';
54    toast.appendChild(icon);
55    var text = document.createElement('span');
56    text.textContent = message;
57    toast.appendChild(text);
58    var closeBtn = document.createElement('button');
59    closeBtn.type = 'button';
60    closeBtn.className = 'v3-toast-close';
61    closeBtn.setAttribute('aria-label', 'Dismiss');
62    closeBtn.innerHTML = '<i class="fa-solid fa-xmark" aria-hidden="true"></i>';
63    closeBtn.onclick = function () { removeToast(toast); };
64    toast.appendChild(closeBtn);
65    container.appendChild(toast);
66    requestAnimationFrame(function () {
67      requestAnimationFrame(function () { toast.classList.add('is-visible'); });
68    });
69    function removeToast(el) {
70      el.classList.remove('is-visible');
71      var removed = false;
72      function doRemove() {
73        if (!removed && el.parentNode) { removed = true; el.parentNode.removeChild(el); }
74      }
75      el.addEventListener('transitionend', doRemove, { once: true });
76      setTimeout(doRemove, 400); /* fallback if transitionend never fires */
77    }
78    setTimeout(function () { removeToast(toast); }, 5000);
79  }
80  window.v3ShowToast = v3ShowToast;
81
82  /* ── v3LocDropdown ──────────────────────────────────────────
83     Toggle the floating location popup on job cards.
84     position:fixed + getBoundingClientRect escapes .job-card{overflow:hidden}.
85     Close-on-outside-click is handled by the document listener below. */
86  function v3LocDropdown(btn) {
87    var meta = btn.closest && btn.closest('.card-meta');
88    if (!meta) return;
89    var menu = meta.querySelector('.loc-dropdown-menu');
90    if (!menu) return;
91    /* Close any other open location popups first */
92    document.querySelectorAll('.loc-dropdown-menu.is-open').forEach(function (m) {
93      if (m !== menu) {
94        m.classList.remove('is-open');
95        var b = m.closest && m.closest('.card-meta');
96        b = b && b.querySelector('.loc-extra');
97        if (b) b.setAttribute('aria-expanded', 'false');
98      }
99    });
100    var wasOpen = menu.classList.contains('is-open');
101    if (wasOpen) {
102      menu.classList.remove('is-open');
103      btn.setAttribute('aria-expanded', 'false');
104    } else {
105      var rect = btn.getBoundingClientRect();
106      menu.style.top  = (rect.bottom + 4) + 'px';
107      menu.style.left = rect.left + 'px';
108      menu.classList.add('is-open');
109      btn.setAttribute('aria-expanded', 'true');
110    }
111  }
112  window.v3LocDropdown = v3LocDropdown;
113
114  function _closeAllLocPopups() {
115    document.querySelectorAll('.loc-dropdown-menu.is-open').forEach(function (m) {
116      m.classList.remove('is-open');
117      var b = m.closest && m.closest('.card-meta');
118      b = b && b.querySelector('.loc-extra');
119      if (b) b.setAttribute('aria-expanded', 'false');
120    });
121  }
122
123  /* Close popup on outside click or scroll */
124  document.addEventListener('click', function (e) {
125    if (e.target.closest && e.target.closest('.card-meta')) return;
126    _closeAllLocPopups();
127  });
128  document.addEventListener('scroll', _closeAllLocPopups, true);
129
130}());

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.