Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

airgap-links.ts 613 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  1. export default function airgapLinks() {
  2. // @ts-ignore
  3. if (window.IS_NEXTJS_PAGE) return
  4. // When in an airgapped environment,
  5. // show a tooltip on external links
  6. const exposeEl = document?.getElementById('expose') as HTMLScriptElement
  7. const { airgap } = JSON.parse(exposeEl.text)
  8. if (!airgap) return
  9. const externaLinks = Array.from(document.querySelectorAll('a[href^="http"], a[href^="//"]'))
  10. externaLinks.forEach((link) => {
  11. link.classList.add('tooltipped')
  12. link.setAttribute('aria-label', 'This link may not work in this environment.')
  13. link.setAttribute('rel', 'noopener')
  14. })
  15. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...