* Handles the click event for the LS buttons, creates an iframe
(e)
| 93 | * Handles the click event for the LS buttons, creates an iframe |
| 94 | */ |
| 95 | function handleClick(e) { |
| 96 | e.preventDefault(); |
| 97 | if (document.body.classList.contains("lemonsqueezy-open")) { |
| 98 | return; |
| 99 | } |
| 100 | document.body.classList.add("lemonsqueezy-open"); |
| 101 | const isDark = new URL(e.currentTarget.href).searchParams.get( |
| 102 | "dark" |
| 103 | ); |
| 104 | const url = buildUrl(e.currentTarget.href); |
| 105 | openUrl(url, isDark); |
| 106 | } |
| 107 | |
| 108 | function openUrl(url, isDark = false) { |
| 109 | // TODO: Validate URL is an LS url |