/*umx-dollar-fix*/window.$ = window.$ || window.jQuery;
// REVEAL SPONSOR BIO
// Open
$(document).on('click', '.sponsor .sponsor-card .sponsor-title .sponsor-open', function (e) {
e.preventDefault();
var $sponsor = $(this).closest('.sponsor');
$sponsor.find('.sponsor-card').addClass('hide');
$sponsor.find('.sponsor-info').removeClass('hide');
});
// Close: return to initial state
$(document).on('click', '.sponsor .sponsor-info .sponsor-close', function (e) {
e.preventDefault();
var $sponsor = $(this).closest('.sponsor');
$sponsor.find('.sponsor-info').addClass('hide');
$sponsor.find('.sponsor-card').removeClass('hide');
});
// REMOVE PROFILE PHOTO LINK
$(document).ready(function() {
$(".um .um-profile-photo a.um-profile-photo-img").removeAttr("href");
});
/*umx-dollar-fix*/window.$ = window.$ || window.jQuery;
(function () {
// -----------------------
// SCOPE / GUARDS
// -----------------------
var body = document.body;
if (!body) return;
var okPage =
body.classList.contains("single-networks") ||
body.classList.contains("post-type-archive-networks");
if (!okPage) return;
var WIDGET_ROOT_SELECTOR = "#network-tabs"; // keep this if you want maximum safety
// -----------------------
// CONFIG
// -----------------------
var TAB_PARAM = "tab"; // change to "ntab" if you ever want
var USE_HASH = false; // you chose querystring mode
// Query params that should NOT "carry across" when switching tabs.
// Add anything else that is tab-specific here.
var TAB_SCOPED_PARAMS = ["nm_page"];
// Optional: if true, when URL has no tab param, we clear stored tab so root URL always defaults.
var CLEAR_STORED_WHEN_NO_TAB = true;
// Retry timing
var OPEN_TRIES = 60; // increased from 40 — more headroom for slow first loads
var OPEN_TRY_DELAY = 250; // slightly longer between attempts
// -----------------------
// HELPERS
// -----------------------
function slugify(str) {
return (str || "")
.toString()
.trim()
.toLowerCase()
.replace(/&/g, "and")
.replace(/[^a-z0-9]+/g, "-")
.replace(/(^-|-$)/g, "");
}
function getRequestedSlug() {
if (USE_HASH) {
var h = (window.location.hash || "").replace("#", "").trim();
return h ? decodeURIComponent(h) : "";
}
var p = new URLSearchParams(window.location.search);
return (p.get(TAB_PARAM) || "").trim();
}
function urlHasExplicitTab() {
if (USE_HASH) return !!(window.location.hash || "").replace("#", "").trim();
var p = new URLSearchParams(window.location.search);
return p.has(TAB_PARAM);
}
function setUrlForTab(slug, opts) {
opts = opts || {};
var preserveParams = opts.preserveParams || [];
var stripParams = opts.stripParams || [];
if (USE_HASH) {
history.replaceState(
null,
"",
window.location.pathname + window.location.search + "#" + encodeURIComponent(slug)
);
return;
}
var url = new URL(window.location.href);
stripParams.forEach(function (k) {
if (preserveParams.indexOf(k) === -1) {
url.searchParams.delete(k);
}
});
url.searchParams.set(TAB_PARAM, slug);
history.replaceState(null, "", url.toString());
}
function storageKeyForWidget(widgetId) {
return "elNestedTabsActive:" + window.location.pathname + ":" + (widgetId || "unknown");
}
function getTabTitleSlug(btn) {
var txtEl = btn.querySelector(".e-n-tab-title-text");
var label = txtEl ? (txtEl.textContent || "") : (btn.textContent || "");
return slugify(label);
}
/**
* Check whether a given tab button is truly the active/visible one.
* We check both the aria attribute AND whether the associated panel is active,
* because Elementor can update one without the other during initialization.
*/
function isTabActuallyActive(scopeEl, btn) {
if (btn.getAttribute("aria-selected") !== "true") return false;
var panelId = btn.getAttribute("aria-controls");
if (!panelId) return false;
var panel = scopeEl.querySelector("#" + CSS.escape(panelId));
if (!panel) return false;
return panel.classList.contains("e-active");
}
function forceActivateTab(scopeEl, btn) {
if (!scopeEl || !btn) return false;
var titles = scopeEl.querySelectorAll("button.e-n-tab-title");
if (!titles || !titles.length) return false;
var panelId = btn.getAttribute("aria-controls");
if (!panelId) return false;
var panelsWrap = scopeEl.querySelector(".e-n-tabs-content");
if (!panelsWrap) return false;
var targetPanel = scopeEl.querySelector("#" + CSS.escape(panelId));
if (!targetPanel) return false;
// Reset all titles
for (var i = 0; i < titles.length; i++) {
titles[i].setAttribute("aria-selected", "false");
titles[i].setAttribute("tabindex", "-1");
}
// Reset all panels
var panels = panelsWrap.querySelectorAll('[role="tabpanel"]');
for (var j = 0; j < panels.length; j++) {
panels[j].classList.remove("e-active");
}
// Activate chosen
btn.setAttribute("aria-selected", "true");
btn.setAttribute("tabindex", "0");
targetPanel.classList.add("e-active");
return true;
}
function openTabBySlug(scopeEl, slug) {
if (!slug) return false;
var titles = scopeEl.querySelectorAll("button.e-n-tab-title");
if (!titles || !titles.length) return false;
for (var i = 0; i < titles.length; i++) {
var btn = titles[i];
if (getTabTitleSlug(btn) === slug) {
btn.click();
// If Elementor doesn't reflect selection, force it
if (!isTabActuallyActive(scopeEl, btn)) {
forceActivateTab(scopeEl, btn);
}
return true;
}
}
return false;
}
function initNestedTabs(scopeEl) {
if (!scopeEl || scopeEl.__tabsDeepLinkInit) return;
scopeEl.__tabsDeepLinkInit = true;
var widgetEl = scopeEl.closest(".elementor-widget") || scopeEl;
var widgetId = widgetEl.getAttribute("data-id") || widgetEl.id || "";
var key = storageKeyForWidget(widgetId);
var titles = scopeEl.querySelectorAll("button.e-n-tab-title");
if (!titles || !titles.length) return;
var explicitTab = urlHasExplicitTab();
var requested = getRequestedSlug();
if (!explicitTab) {
if (CLEAR_STORED_WHEN_NO_TAB) {
try { sessionStorage.removeItem(key); } catch (e) {}
}
// Don't force any open; let Elementor's default (first tab) remain.
} else {
// ---- FIX: robust retry that keeps re-asserting until stable ----
// On cold / incognito loads Elementor may:
// a) not have rendered the buttons yet,
// b) re-initialise its widget AFTER we successfully opened the tab,
// snapping it back to the default.
// We handle both by:
// 1. Continuing retries even after a "successful" open — we verify
// the tab is *still* active on subsequent ticks.
// 2. Only stopping once the correct tab has been stable for several
// consecutive checks (meaning Elementor is done re-initialising).
var tries = 0;
var consecutiveStableChecks = 0;
var STABLE_THRESHOLD = 4; // need this many consecutive "already correct" checks
function tryOpenLater() {
tries++;
var nowRequested = getRequestedSlug();
if (!nowRequested) return; // tab param removed mid-load — stop
// Find the target button
var targetBtn = null;
var allTitles = scopeEl.querySelectorAll("button.e-n-tab-title");
for (var i = 0; i < allTitles.length; i++) {
if (getTabTitleSlug(allTitles[i]) === nowRequested) {
targetBtn = allTitles[i];
break;
}
}
if (!targetBtn) {
// Buttons not rendered yet — keep waiting
consecutiveStableChecks = 0;
if (tries = STABLE_THRESHOLD) {
// It's been stable for long enough — Elementor is done, we can stop.
try { sessionStorage.setItem(key, nowRequested); } catch (e) {}
return;
}
} else {
// Wrong tab is active — Elementor likely re-asserted the default.
// Force-open the correct one and reset stability counter.
consecutiveStableChecks = 0;
openTabBySlug(scopeEl, nowRequested);
try { sessionStorage.setItem(key, nowRequested); } catch (e) {}
}
if (tries < OPEN_TRIES) setTimeout(tryOpenLater, OPEN_TRY_DELAY);
}
// Start immediately rather than waiting 50ms — we want to beat
// Elementor's first paint when possible, and the retry loop handles
// cases where we're too early.
tryOpenLater();
}
// ---- Click behavior ----
for (var i = 0; i < titles.length; i++) {
(function (btn) {
btn.addEventListener("click", function () {
var slug = getTabTitleSlug(btn);
if (!slug) return;
var preserve = [];
if (slug === "members") preserve.push("nm_page");
setUrlForTab(slug, {
preserveParams: preserve,
stripParams: TAB_SCOPED_PARAMS
});
try { sessionStorage.setItem(key, slug); } catch (e) {}
});
})(titles[i]);
}
}
function findAndInit() {
var roots;
if (WIDGET_ROOT_SELECTOR) {
roots = document.querySelectorAll(WIDGET_ROOT_SELECTOR + " .e-n-tabs");
} else {
roots = document.querySelectorAll(".elementor-widget-n-tabs .e-n-tabs");
}
if (roots && roots.length) {
for (var i = 0; i < roots.length; i++) initNestedTabs(roots[i]);
return true;
}
return false;
}
function boot() {
findAndInit();
var obs = new MutationObserver(function () {
findAndInit();
});
obs.observe(document.documentElement, { childList: true, subtree: true });
// Also listen for Elementor's own "init" event — on cold loads this fires
// once the frontend JS has finished bootstrapping all widgets.
// This gives us one more reliable trigger point beyond the MutationObserver.
window.addEventListener("elementor/frontend/init", function () {
// Short delay to let Elementor finish activating its default tabs
setTimeout(findAndInit, 100);
});
setTimeout(function () {
try { obs.disconnect(); } catch (e) {}
}, 25000); // extended from 20s to 25s for slow connections
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", boot);
} else {
boot();
}
})();