blob: cf94a6390c7d1dec5e5549c7af6d6b42beef0110 [file] [log] [blame]
{
"version": 3,
"sources": ["site.ts"],
"sourcesContent": ["/*!\n * @license\n * Copyright 2019-2020 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\n/**\n * site.ts contains a set of functions that should be invoked for\n * all page views before other scripts are added to the page.\n */\n\n/**\n * A bit of navigation related code for handling dismissible elements.\n */\n(function registerHeaderListeners() {\n 'use strict';\n\n const header = document.querySelector('.js-header');\n const menuButtons = document.querySelectorAll('.js-headerMenuButton');\n menuButtons.forEach(button => {\n button.addEventListener('click', e => {\n e.preventDefault();\n header?.classList.toggle('is-active');\n button.setAttribute('aria-expanded', `${header?.classList.contains('is-active') ?? false}`);\n });\n });\n\n const scrim = document.querySelector('.js-scrim');\n // eslint-disable-next-line no-prototype-builtins\n if (scrim && scrim.hasOwnProperty('addEventListener')) {\n scrim.addEventListener('click', e => {\n e.preventDefault();\n header?.classList.remove('is-active');\n menuButtons.forEach(button => {\n button.setAttribute('aria-expanded', `${header?.classList.contains('is-active') ?? false}`);\n });\n });\n }\n})();\n\ninterface TagManagerEvent {\n event: string;\n 'gtm.start': number;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ninterface Window {\n dataLayer?: (TagManagerEvent | VoidFunction)[];\n}\n\n/**\n * setupGoogleTagManager intializes Google Tag Manager.\n */\n(function setupGoogleTagManager() {\n window.dataLayer = window.dataLayer || [];\n window.dataLayer.push({\n 'gtm.start': new Date().getTime(),\n event: 'gtm.js',\n });\n})();\n\n/**\n * removeUTMSource removes the utm_source GET parameter if present.\n * This is done using JavaScript, so that the utm_source is still\n * captured by Google Analytics.\n */\nfunction removeUTMSource() {\n const urlParams = new URLSearchParams(window.location.search);\n const utmSource = urlParams.get('utm_source');\n if (utmSource !== 'gopls' && utmSource !== 'godoc') {\n return;\n }\n\n /** Strip the utm_source query parameter and replace the URL. **/\n const newURL = new URL(window.location.href);\n urlParams.delete('utm_source');\n newURL.search = urlParams.toString();\n window.history.replaceState(null, '', newURL.toString());\n}\n\nif (document.querySelector<HTMLElement>('.js-gtmID')?.dataset.gtmid && window.dataLayer) {\n window.dataLayer.push(function () {\n removeUTMSource();\n });\n} else {\n removeUTMSource();\n}\n"],
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAeA,AAAC,WAAmC,CAClC,aAEA,KAAM,GAAS,SAAS,cAAc,cAChC,EAAc,SAAS,iBAAiB,wBAC9C,EAAY,QAAQ,GAAU,CAC5B,EAAO,iBAAiB,QAAS,GAAK,CACpC,EAAE,iBACF,GAAQ,UAAU,OAAO,aACzB,EAAO,aAAa,gBAAiB,GAAG,GAAQ,UAAU,SAAS,cAAgB,UAIvF,KAAM,GAAQ,SAAS,cAAc,aAErC,AAAI,GAAS,EAAM,eAAe,qBAChC,EAAM,iBAAiB,QAAS,GAAK,CACnC,EAAE,iBACF,GAAQ,UAAU,OAAO,aACzB,EAAY,QAAQ,GAAU,CAC5B,EAAO,aAAa,gBAAiB,GAAG,GAAQ,UAAU,SAAS,cAAgB,cAmB1F,UAAiC,CAChC,OAAO,UAAY,OAAO,WAAa,GACvC,OAAO,UAAU,KAAK,CACpB,YAAa,GAAI,QAAO,UACxB,MAAO,cASX,0BAA2B,CACzB,KAAM,GAAY,GAAI,iBAAgB,OAAO,SAAS,QAChD,EAAY,EAAU,IAAI,cAChC,GAAI,IAAc,SAAW,IAAc,QACzC,OAIF,KAAM,GAAS,GAAI,KAAI,OAAO,SAAS,MACvC,EAAU,OAAO,cACjB,EAAO,OAAS,EAAU,WAC1B,OAAO,QAAQ,aAAa,KAAM,GAAI,EAAO,YAG/C,AAAI,SAAS,cAA2B,cAAc,QAAQ,OAAS,OAAO,UAC5E,OAAO,UAAU,KAAK,UAAY,CAChC,oBAGF",
"names": []
}