{ "version": 3, "sources": ["../../javascript/lib/responsiveEmbeds.ts", "../../javascript/lib/gridOverlay.ts", "../../javascript/features/navigation.ts", "../../javascript/application.ts"], "sourcesContent": ["const selectors = [\n 'iframe[src*=\"bandcamp.com\"]',\n 'iframe[src*=\"player.vimeo.com\"]',\n 'iframe[src*=\"youtube.com\"]',\n 'iframe[src*=\"youtube-nocookie.com\"]',\n 'iframe[src*=\"spotify.com\"]',\n 'iframe[src*=\"kickstarter.com\"][src*=\"video.html\"]'\n];\n\nfunction readyHandler(fn: () => void) {\n if (\n document.readyState === \"complete\" ||\n document.readyState === \"interactive\"\n ) {\n setTimeout(fn, 1);\n } else {\n document.addEventListener(\"DOMContentLoaded\", fn);\n }\n}\n\nfunction wrapEmbed(embed: HTMLElement): HTMLElement {\n const parent = embed.parentNode as HTMLElement;\n\n // Recycle the existing container if the embed is already responsive.\n if (\n parent &&\n parent.tagName === \"DIV\" &&\n parent.childNodes.length === 1 &&\n parent.style.position === \"relative\"\n ) {\n return parent;\n }\n\n const wrapper = document.createElement(\"div\");\n if (parent.tagName === \"P\") {\n parent.parentNode.replaceChild(wrapper, parent);\n } else {\n parent.replaceChild(wrapper, embed);\n }\n wrapper.appendChild(embed);\n return wrapper;\n}\n\nfunction applyEmbed(embed: HTMLElement) {\n const parent = embed.parentNode as HTMLElement;\n\n if (parent && parent.classList.contains(\"responsive-embed\")) {\n return;\n }\n\n const width = embed.offsetWidth;\n const height = embed.offsetHeight;\n const ratio = height / width;\n const wrapper = wrapEmbed(embed);\n\n wrapper.classList.add(\"responsive-embed\");\n wrapper.style.position = \"relative\";\n wrapper.style.width = \"100%\";\n wrapper.style.paddingTop = \"0\";\n wrapper.style.paddingBottom = `${ratio * 100}%`;\n\n embed.style.position = \"absolute\";\n embed.style.width = \"100%\";\n embed.style.height = \"100%\";\n embed.style.top = \"0\";\n embed.style.left = \"0\";\n}\n\nexport default function responsiveEmbeds() {\n readyHandler(() => {\n document.querySelectorAll(selectors.join(\",\")).forEach(applyEmbed);\n });\n}\n", "function ready(callback: () => void) {\n if (document.readyState !== \"loading\") {\n callback();\n } else {\n document.addEventListener(\"DOMContentLoaded\", callback);\n }\n}\n\nfunction applyGrid() {\n let showGrid = false;\n const gridOverlay = document.querySelector(\".grid-overlay\");\n\n const setState = (newState: boolean) => {\n showGrid = newState;\n\n if (newState) {\n window.localStorage.setItem(\"showGrid\", \"true\");\n gridOverlay.classList.add(\"grid-overlay--active\");\n } else {\n window.localStorage.removeItem(\"showGrid\");\n gridOverlay.classList.remove(\"grid-overlay--active\");\n }\n };\n\n if (gridOverlay) {\n setState(window.localStorage.getItem(\"showGrid\") == \"true\");\n\n // Keyboard toggle\n document.addEventListener(\"keyup\", (evt: KeyboardEvent) => {\n if (evt.ctrlKey && evt.which == 71) {\n setState(!showGrid);\n }\n });\n }\n}\n\nexport default function gridOverlay() {\n ready(applyGrid);\n}\n", "function readyHandler(fn: () => void) {\n if (\n document.readyState === \"complete\" ||\n document.readyState === \"interactive\"\n ) {\n setTimeout(fn, 1);\n } else {\n document.addEventListener(\"DOMContentLoaded\", fn);\n }\n}\n\nfunction maybeClickListener(elem: Element, fn: (evt: Event) => void) {\n if (elem) {\n elem.addEventListener(\"click\", fn);\n }\n}\n\nfunction setAriaExpanded(elem: Element, value: boolean) {\n elem.setAttribute(\"aria-expanded\", value ? \"true\" : \"false\");\n}\n\nfunction mainMenu() {\n let showMenu = false;\n const menuButton = document.querySelector(\".mobile-toggle\");\n const header = document.querySelector(\"header\");\n\n const updateHeader = () => {\n if (header) {\n setAriaExpanded(menuButton, showMenu);\n if (showMenu) {\n header.classList.add(\"show-menu\");\n } else {\n header.classList.remove(\"show-menu\");\n }\n }\n };\n\n const toggleMenu = (evt: Event) => {\n evt.preventDefault();\n showMenu = !showMenu;\n updateHeader();\n };\n\n maybeClickListener(menuButton, toggleMenu);\n}\n\nexport default function navigation() {\n readyHandler(() => {\n mainMenu();\n });\n}\n", "// Entry point for the build script in your package.json\n\n// Responsive embeds\nimport responsiveEmbeds from \"./lib/responsiveEmbeds\";\nresponsiveEmbeds();\n\n// Grid overlay\nimport gridOverlay from \"./lib/gridOverlay\";\ngridOverlay();\n\n// Navigation\nimport navigation from \"./features/navigation\";\nnavigation();\n"], "mappings": "MAAA,IAAMA,EAAY,CAChB,8BACA,kCACA,6BACA,sCACA,6BACA,mDACF,EAEA,SAASC,EAAaC,EAAgB,CAElC,SAAS,aAAe,YACxB,SAAS,aAAe,cAExB,WAAWA,EAAI,CAAC,EAEhB,SAAS,iBAAiB,mBAAoBA,CAAE,CAEpD,CAEA,SAASC,EAAUC,EAAiC,CAClD,IAAMC,EAASD,EAAM,WAGrB,GACEC,GACAA,EAAO,UAAY,OACnBA,EAAO,WAAW,SAAW,GAC7BA,EAAO,MAAM,WAAa,WAE1B,OAAOA,EAGT,IAAMC,EAAU,SAAS,cAAc,KAAK,EAC5C,OAAID,EAAO,UAAY,IACrBA,EAAO,WAAW,aAAaC,EAASD,CAAM,EAE9CA,EAAO,aAAaC,EAASF,CAAK,EAEpCE,EAAQ,YAAYF,CAAK,EAClBE,CACT,CAEA,SAASC,EAAWH,EAAoB,CACtC,IAAMC,EAASD,EAAM,WAErB,GAAIC,GAAUA,EAAO,UAAU,SAAS,kBAAkB,EACxD,OAGF,IAAMG,EAAQJ,EAAM,YAEdK,EADSL,EAAM,aACEI,EACjBF,EAAUH,EAAUC,CAAK,EAE/BE,EAAQ,UAAU,IAAI,kBAAkB,EACxCA,EAAQ,MAAM,SAAW,WACzBA,EAAQ,MAAM,MAAQ,OACtBA,EAAQ,MAAM,WAAa,IAC3BA,EAAQ,MAAM,cAAgB,GAAG,OAAAG,EAAQ,IAAG,KAE5CL,EAAM,MAAM,SAAW,WACvBA,EAAM,MAAM,MAAQ,OACpBA,EAAM,MAAM,OAAS,OACrBA,EAAM,MAAM,IAAM,IAClBA,EAAM,MAAM,KAAO,GACrB,CAEe,SAARM,GAAoC,CACzCT,EAAa,IAAM,CACjB,SAAS,iBAAiBD,EAAU,KA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AACA,EACZG,EAAa,CACf,CAEyC,CAC3C,CAEe,SAARE,GAA8B,CACnCZ,EAAa,IAAM,CACjBM,EAAS,CACX,CAAC,CACH,CC9CAO,EAAiB,EAIjBC,EAAY,EAIZC,EAAW", "names": ["selectors", "readyHandler", "fn", "wrapEmbed", "embed", "parent", "wrapper", "applyEmbed", "width", "ratio", "responsiveEmbeds", "ready", "callback", "applyGrid", "showGrid", "gridOverlay", "setState", "newState", "evt", "readyHandler", "fn", "maybeClickListener", "elem", "setAriaExpanded", "value", "mainMenu", "showMenu", "menuButton", "header", "updateHeader", "evt", "navigation", "responsiveEmbeds", "gridOverlay", "navigation"] }