{"version":3,"sources":["webpack://BirnPartners/./Src/Scripts/components/switch-universe.js"],"names":["constructor","elm","args","switchButtonMainNavDesktopEsc","document","getElementById","switchButtonMainNavMobileEsc","switchButtonFooterEsc","switchButtonMainNavDesktopEbe","switchButtonMainNavMobileEbe","switchButtonFooterEbe","fadeOut","body","classList","add","requestAnimationFrame","switchToExecutiveBoardEducation","setTimeout","location","href","ebeUrl","switchToExecutiveSearchConsulting","escUrl","removeURLParameter","url","parameter","urlparts","split","length","prefix","encodeURIComponent","pars","i","lastIndexOf","splice","join","contains","remove","window","history","pushState","title","onclick"],"mappings":"gMAAe,MACXA,YAAYC,EAAKC,GAEb,MAAMC,EAAgCC,SAASC,eAAe,kCACxDC,EAA+BF,SAASC,eAAe,iCACvDE,EAAwBH,SAASC,eAAe,0BAGhDG,EAAgCJ,SAASC,eAAe,kCACxDI,EAA+BL,SAASC,eAAe,iCACvDK,EAAwBN,SAASC,eAAe,0BAKtD,SAASM,IACLP,SAASQ,KAAKC,UAAUC,IAAI,0BAC5BC,uBAAsB,KAClBX,SAASQ,KAAKC,UAAUC,IAAI,qBAOpC,SAASE,IACLC,YAAW,WAAcC,SAASC,KAAOjB,EAAKkB,SAAW,MAgB7D,SAASC,IACLJ,YAAW,WAAcC,SAASC,KAAOjB,EAAKoB,SAAU,MAG5D,SAASC,EAAmBC,EAAKC,GAE7B,MAAMC,EAAWF,EAAIG,MAAM,KAC3B,GAAID,EAASE,QAAU,EAAG,CAEtB,MAAMC,EAASC,mBAAmBL,GAAa,IACzCM,EAAOL,EAAS,GAAGC,MAAM,SAG/B,IAAK,IAAIK,EAAID,EAAKH,OAAQI,KAAM,IAEY,IAApCD,EAAKC,GAAGC,YAAYJ,EAAQ,IAC5BE,EAAKG,OAAOF,EAAG,GAIvB,OAAON,EAAS,IAAMK,EAAKH,OAAS,EAAI,IAAMG,EAAKI,KAAK,KAAO,IAEnE,OAAOX,EAnCPpB,SAASQ,KAAKC,UAAUuB,SAAS,6BACjChC,SAASQ,KAAKC,UAAUC,IAAI,oBAC5BV,SAASQ,KAAKC,UAAUwB,OAAO,2BAC/BC,OAAOC,QAAQC,UAAU,GAAIpC,SAASqC,MAAOlB,EAAmBA,EAAmBnB,SAASc,SAASC,KAAM,aAAc,UAmCvF,OAAlChB,IACAA,EAA8BuC,QAAU,WACpC/B,IACAK,MAI6B,OAAjCV,IACAA,EAA6BoC,QAAU,WACnC/B,IACAK,MAIsB,OAA1BT,IACAA,EAAsBmC,QAAU,WAC5B/B,IACAK,MAI8B,OAAlCR,IACAA,EAA8BkC,QAAU,WACpC/B,IACAU,MAI6B,OAAjCZ,IACAA,EAA6BiC,QAAU,WACnC/B,IACAU,MAIsB,OAA1BX,IACAA,EAAsBgC,QAAU,WAC5B/B,IACAU","file":"507.4482b8bda12eedee8001.js","sourcesContent":["export default class SwitchUniverse {\n constructor(elm, args) {\n // ESC Universe\n const switchButtonMainNavDesktopEsc = document.getElementById('switchButtonMainNavDesktop-esc');\n const switchButtonMainNavMobileEsc = document.getElementById('switchButtonMainNavMobile-esc');\n const switchButtonFooterEsc = document.getElementById('switchButtonFooter-esc');\n\n // EBE Universe\n const switchButtonMainNavDesktopEbe = document.getElementById('switchButtonMainNavDesktop-ebe');\n const switchButtonMainNavMobileEbe = document.getElementById('switchButtonMainNavMobile-ebe');\n const switchButtonFooterEbe = document.getElementById('switchButtonFooter-ebe');\n\n // Common frontpage hero stuff\n // Fade out hero elements (except decoration layers).\n // First step when switching universe via one of the switch buttons (see ESC & EBE Universe IDs above)\n function fadeOut() {\n document.body.classList.add('body--prepare-fade-out');\n requestAnimationFrame(() => {\n document.body.classList.add('body--fade-out');\n });\n }\n\n // Switch from website birn-partners.com to board-education.com\n // Need to change the href according to environment (local, development, live)\n // The proper live environment is not yet set up\n function switchToExecutiveBoardEducation() {\n setTimeout(function () { location.href = args.ebeUrl; }, 1250);\n }\n\n if (document.body.classList.contains('body--pending-animation')) {\n document.body.classList.add('body--animate-in');\n document.body.classList.remove('body--pending-animation');\n window.history.pushState({}, document.title, removeURLParameter(removeURLParameter(document.location.href, 'animateIn'), 'menu'));\n\n // setTimeout(() => {\n // window.location.href = `${x.dataset.url}?animate=1${menu}`;\n // }, 1900)\n }\n\n // Switch from website board-education.com to birn-partners.com\n // Need to change the href according to environment (local, development, live)\n // The proper live environment is not yet set up\n function switchToExecutiveSearchConsulting() {\n setTimeout(function () { location.href = args.escUrl }, 1250);\n }\n\n function removeURLParameter(url, parameter) {\n // prefer to use l.search if you have a location/link object\n const urlparts = url.split('?');\n if (urlparts.length >= 2) {\n\n const prefix = encodeURIComponent(parameter) + '=';\n const pars = urlparts[1].split(/[&;]/g);\n\n // reverse iteration as may be destructive\n for (let i = pars.length; i-- > 0;) {\n // idiom for string.startsWith\n if (pars[i].lastIndexOf(prefix, 0) !== -1) {\n pars.splice(i, 1);\n }\n }\n\n return urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : '');\n }\n return url;\n }\n\n if (switchButtonMainNavDesktopEsc !== null) {\n switchButtonMainNavDesktopEsc.onclick = function () {\n fadeOut();\n switchToExecutiveBoardEducation();\n };\n }\n\n if (switchButtonMainNavMobileEsc !== null) {\n switchButtonMainNavMobileEsc.onclick = function () {\n fadeOut();\n switchToExecutiveBoardEducation();\n };\n }\n\n if (switchButtonFooterEsc !== null) {\n switchButtonFooterEsc.onclick = function () {\n fadeOut();\n switchToExecutiveBoardEducation();\n };\n }\n\n if (switchButtonMainNavDesktopEbe !== null) {\n switchButtonMainNavDesktopEbe.onclick = function () {\n fadeOut();\n switchToExecutiveSearchConsulting();\n };\n }\n\n if (switchButtonMainNavMobileEbe !== null) {\n switchButtonMainNavMobileEbe.onclick = function () {\n fadeOut();\n switchToExecutiveSearchConsulting();\n };\n }\n\n if (switchButtonFooterEbe !== null) {\n switchButtonFooterEbe.onclick = function () {\n fadeOut();\n switchToExecutiveSearchConsulting();\n };\n }\n }\n}\n"],"sourceRoot":""}