blob: 2a16f6ebd4cde6436841b26e2c9b9217d63ddebf [file] [log] [blame]
{
"version": 3,
"sources": ["toggle-tip.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\nconst toggles = document.querySelectorAll('[data-toggletip-content]');\n\n/**\n * Adds event listeners to toggletip elements to display their\n * content when the toggle button is pressed. Used in the right\n * sidebar details section.\n */\ntoggles.forEach(toggle => {\n const message = toggle.getAttribute('data-toggletip-content');\n const tip = toggle.nextElementSibling;\n toggle.addEventListener('click', () => {\n if (!tip) {\n return;\n }\n tip.innerHTML = '';\n setTimeout(() => {\n tip.innerHTML = '<span class=\"UnitMetaDetails-toggletipBubble\">' + message + '</span>';\n }, 100);\n });\n\n // Close on outside click\n document.addEventListener('click', e => {\n if (toggle !== e.target) {\n if (!tip) {\n return;\n }\n tip.innerHTML = '';\n }\n });\n\n // Remove toggletip on ESC\n toggle.addEventListener('keydown', e => {\n if (!tip) {\n return;\n }\n if ((e as KeyboardEvent).key === 'Escape') {\n tip.innerHTML = '';\n }\n });\n});\n"],
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAOA,KAAM,SAAU,SAAS,iBAAiB,4BAO1C,QAAQ,QAAQ,GAAU,CACxB,KAAM,GAAU,EAAO,aAAa,0BAC9B,EAAM,EAAO,mBACnB,EAAO,iBAAiB,QAAS,IAAM,CACrC,AAAI,CAAC,GAGL,GAAI,UAAY,GAChB,WAAW,IAAM,CACf,EAAI,UAAY,iDAAmD,EAAU,WAC5E,QAIL,SAAS,iBAAiB,QAAS,GAAK,CACtC,GAAI,IAAW,EAAE,OAAQ,CACvB,GAAI,CAAC,EACH,OAEF,EAAI,UAAY,MAKpB,EAAO,iBAAiB,UAAW,GAAK,CACtC,AAAI,CAAC,GAGA,EAAoB,MAAQ,UAC/B,GAAI,UAAY",
"names": []
}