From 0b0412786fde9ea030b7cd7ac6f920b04626fcd9 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 9 Jun 2024 16:30:21 -0400 Subject: [PATCH] Fix mismerge --- assets/js/captcha.ts | 13 +++++++------ assets/vite.config.ts | 2 +- lib/philomena_web/templates/layout/app.html.slime | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/assets/js/captcha.ts b/assets/js/captcha.ts index ec0b4f32..44d0d9b6 100644 --- a/assets/js/captcha.ts +++ b/assets/js/captcha.ts @@ -1,18 +1,19 @@ +import { assertNotNull } from './utils/assert'; import { delegate, leftClick } from './utils/events'; import { clearEl, makeEl } from './utils/dom'; -function insertCaptcha(_event, target) { - const { parentNode, dataset: { sitekey } } = target; +function insertCaptcha(_event: Event, target: HTMLInputElement) { + const parentElement = assertNotNull(target.parentElement); const script = makeEl('script', {src: 'https://hcaptcha.com/1/api.js', async: true, defer: true}); const frame = makeEl('div', {className: 'h-captcha'}); - frame.dataset.sitekey = sitekey; + frame.dataset.sitekey = target.dataset.sitekey; - clearEl(parentNode); + clearEl(parentElement); - parentNode.insertAdjacentElement('beforeend', frame); - parentNode.insertAdjacentElement('beforeend', script); + parentElement.insertAdjacentElement('beforeend', frame); + parentElement.insertAdjacentElement('beforeend', script); } export function bindCaptchaLinks() { diff --git a/assets/vite.config.ts b/assets/vite.config.ts index 5b2a49c0..3e1d3cd9 100644 --- a/assets/vite.config.ts +++ b/assets/vite.config.ts @@ -39,7 +39,7 @@ export default defineConfig(({ command, mode }: ConfigEnv): UserConfig => { cssCodeSplit: true, rollupOptions: { input: { - 'js/app': './js/app.js', + 'js/app': './js/app.ts', ...Object.fromEntries(themes) }, output: { diff --git a/lib/philomena_web/templates/layout/app.html.slime b/lib/philomena_web/templates/layout/app.html.slime index 227432e7..cfa82d19 100644 --- a/lib/philomena_web/templates/layout/app.html.slime +++ b/lib/philomena_web/templates/layout/app.html.slime @@ -23,7 +23,7 @@ html lang="en" = vite_hmr? do script type="module" src="http://localhost:5173/@vite/client" - script type="module" src="http://localhost:5173/js/app.js" + script type="module" src="http://localhost:5173/js/app.ts" - else script type="text/javascript" src=~p"/js/app.js" async="async" = render PhilomenaWeb.LayoutView, "_opengraph.html", assigns