(function () { // ===== Settings ===== var SHOW_AFTER_MS = 10000; // 10 seconds var FREQUENCY = "daily"; var DEFAULT_KEYWORDS = "coach"; var EXCLUDE_PREFIXES = ["/job-alerts", "/login", "/registration", "/logout"]; // show once per visit/tab var START_KEY = "cb_alert_start_v1"; var SHOWN_KEY = "cb_alert_shown_v1"; function now() { return Date.now(); } function isExcluded() { var p = (location.pathname || "").toLowerCase(); for (var i = 0; i < EXCLUDE_PREFIXES.length; i++) { if (p.indexOf(EXCLUDE_PREFIXES[i]) === 0) return true; } return false; } // Coachbridge logged-out header includes /login/ link; when logged in, it typically changes. function isLoggedIn() { // If we can see a "Sign in" link, assume logged OUT if (document.querySelector('a[href^="/login"], a[href*="/login/"], a[href*="login"]')) return false; // If there is a logout link, assume logged IN if (document.querySelector('a[href*="logout"], a[href*="signout"], a[href*="sign-out"]')) return true; // Otherwise: unknown; treat as logged OUT so you still capture leads return false; } function guessKeywords() { var selectors = ["h1", ".job-title", ".job__title", "[data-job-title]"]; for (var i = 0; i < selectors.length; i++) { var el = document.querySelector(selectors[i]); if (el) { var txt = (el.textContent || "").replace(/\s+/g, " ").trim(); if (txt.length >= 6) return txt.slice(0, 80); } } return DEFAULT_KEYWORDS; } function buildQuery(obj) { var parts = []; for (var k in obj) { if (!obj.hasOwnProperty(k)) continue; var v = obj[k]; if (v === undefined || v === null || v === "") continue; parts.push(encodeURIComponent(k) + "=" + encodeURIComponent(String(v))); } return parts.join("&"); } function alreadyShown() { try { return sessionStorage.getItem(SHOWN_KEY) === "1"; } catch (e) { return false; } } function markShown() { try { sessionStorage.setItem(SHOWN_KEY, "1"); } catch (e) {} } function getStart() { try { var v = sessionStorage.getItem(START_KEY); if (v) return parseInt(v, 10); var t = now(); sessionStorage.setItem(START_KEY, String(t)); return t; } catch (e) { return now(); } } function getAlertCreateUrl(email) { var base = location.origin.replace(/\/$/, "") + "/job-alerts/create/"; var q = buildQuery({ email: email, email_frequency: FREQUENCY, keywords: guessKeywords() }); return base + "?" + q; } function buildModal() { if (document.getElementById("cb-alert-overlay")) return; var overlay = document.createElement("div"); overlay.id = "cb-alert-overlay"; overlay.style.display = "none"; overlay.innerHTML = ''; document.body.appendChild(overlay); function close() { overlay.style.display = "none"; document.body.classList.remove("cb-alert-lock"); markShown(); } overlay.addEventListener("click", function (e) { if (e.target === overlay) close(); }); overlay.querySelector(".cb-x").addEventListener("click", close); overlay.querySelector("#cb-alert-later").addEventListener("click", close); overlay.querySelector("#cb-alert-cta").addEventListener("click", function () { var emailEl = overlay.querySelector("#cb-alert-email"); var email = (emailEl.value || "").replace(/\s+/g, "").trim(); if (!email || email.indexOf("@") === -1) { emailEl.focus(); return; } markShown(); window.location.href = getAlertCreateUrl(email); }); } function show() { var overlay = document.getElementById("cb-alert-overlay"); if (!overlay) return; overlay.style.display = "flex"; document.body.classList.add("cb-alert-lock"); var inp = document.getElementById("cb-alert-email"); if (inp) setTimeout(function () { inp.focus(); }, 50); } function init() { if (isExcluded()) return; if (isLoggedIn()) return; if (alreadyShown()) return; buildModal(); var elapsed = now() - getStart(); var remaining = SHOW_AFTER_MS - elapsed; if (remaining < 0) remaining = 0; setTimeout(function () { if (isExcluded()) return; if (isLoggedIn()) return; if (alreadyShown()) return; markShown(); show(); }, remaining); } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", init); } else { init(); } })();
Lowell Junior High School
Bisbee Unified coaching jobs