{ "version": 3, "sources": ["../../../Vettvangur.Heilsuvera/src/scripts/components/Sykurmagn/sugarRedirects.ts"], "sourcesContent": ["/* eslint-disable prettier/prettier */\n\nimport { gsap } from \"gsap/all\";\n\nconst sugarRedirects = {\n\telBannerLink: document.querySelector(\".sugarBanner__link\"),\n\telMain: document.querySelector(\".sykurmagn\"),\n\telLinks: document.querySelectorAll(\".sykurmagn a:not([target='_blank'])\"),\n\n\tinit: (): void => {\n\t\tif (sugarRedirects.elBannerLink)\n\t\t\tsugarRedirects.elBannerLink.addEventListener(\n\t\t\t\t\"click\",\n\t\t\t\tsugarRedirects.fadeOutRedirect,\n\t\t\t);\n\n\t\tif (sugarRedirects.elMain) {\n\t\t\tsugarRedirects.handleRedirects();\n\t\t\tsugarRedirects.pageFadeIn();\n\t\t}\n\n\t\t// handling page restore for mobile iOS - without this back/forward buttons will cause page to be faded out\n\t\twindow.addEventListener(\"pageshow\", (event) => {\n\t\t\tif (event.persisted) {\n\t\t\t\twindow.location.reload();\n\t\t\t}\n\t\t});\n\t},\n\n\thandleRedirects: (): void => {\n\t\tArray.from(sugarRedirects.elLinks)\n\t\t\t.filter(\n\t\t\t\t(link) =>\n\t\t\t\t\t!link.getAttribute(\"target\") &&\n\t\t\t\t\t!/mailto:|tel:|javascript:\\$zopim/g.test(link.getAttribute(\"href\")),\n\t\t\t)\n\t\t\t.map((link) => {\n\t\t\t\tlink.addEventListener(\"click\", sugarRedirects.fadeOutRedirect);\n\t\t\t});\n\t},\n\n\tfadeOutRedirect: (event): void => {\n\t\tevent.preventDefault();\n\n\t\tconst url = event.currentTarget.getAttribute(\"href\");\n\n\t\tgsap.to(document.body, {\n\t\t\tduration: 0.456,\n\t\t\tease: \"power3.inOut\",\n\t\t\topacity: 0,\n\t\t\tonComplete: () => {\n\t\t\t\twindow.location.href = url;\n\t\t\t},\n\t\t});\n\t},\n\n\tpageFadeIn: (): void => {\n\t\tgsap.fromTo(\n\t\t\tsugarRedirects.elMain,\n\t\t\t{\n\t\t\t\topacity: 0,\n\t\t\t},\n\t\t\t{\n\t\t\t\tduration: 2.34,\n\t\t\t\tease: \"power3.out\",\n\t\t\t\topacity: 1,\n\t\t\t},\n\t\t);\n\t},\n};\n\nexport default sugarRedirects;\n"], "mappings": "4GAIA,IAAMA,EAAiB,CACtB,aAAc,SAAS,cAAc,oBAAoB,EACzD,OAAQ,SAAS,cAAc,YAAY,EAC3C,QAAS,SAAS,iBAAiB,qCAAqC,EAExE,KAAM,IAAY,CACbA,EAAe,cAClBA,EAAe,aAAa,iBAC3B,QACAA,EAAe,eAChB,EAEGA,EAAe,SAClBA,EAAe,gBAAgB,EAC/BA,EAAe,WAAW,GAI3B,OAAO,iBAAiB,WAAaC,GAAU,CAC1CA,EAAM,WACT,OAAO,SAAS,OAAO,CAEzB,CAAC,CACF,EAEA,gBAAiB,IAAY,CAC5B,MAAM,KAAKD,EAAe,OAAO,EAC/B,OACCE,GACA,CAACA,EAAK,aAAa,QAAQ,GAC3B,CAAC,mCAAmC,KAAKA,EAAK,aAAa,MAAM,CAAC,CACpE,EACC,IAAKA,GAAS,CACdA,EAAK,iBAAiB,QAASF,EAAe,eAAe,CAC9D,CAAC,CACH,EAEA,gBAAkBC,GAAgB,CACjCA,EAAM,eAAe,EAErB,IAAME,EAAMF,EAAM,cAAc,aAAa,MAAM,EAEnDG,EAAK,GAAG,SAAS,KAAM,CACtB,SAAU,KACV,KAAM,eACN,QAAS,EACT,WAAY,IAAM,CACjB,OAAO,SAAS,KAAOD,CACxB,CACD,CAAC,CACF,EAEA,WAAY,IAAY,CACvBC,EAAK,OACJJ,EAAe,OACf,CACC,QAAS,CACV,EACA,CACC,SAAU,KACV,KAAM,aACN,QAAS,CACV,CACD,CACD,CACD,EAEOK,EAAQL", "names": ["sugarRedirects", "event", "link", "url", "gsapWithCSS", "sugarRedirects_default"] }