discord warning

This commit is contained in:
frillweeman
2025-09-24 11:48:03 -06:00
parent 836eb5e94d
commit f75374cb2c
3 changed files with 112 additions and 0 deletions
@@ -0,0 +1,26 @@
import { ref } from 'vue';
export function useDiscordIntercept() {
const showDialog = ref(false);
const discordUrl = ref('');
function interceptDiscordLinks() {
document.addEventListener('click', (e) => {
const target = e.target as HTMLElement;
if (!target) return;
let link: HTMLAnchorElement | null = null;
if (target.tagName === 'A') {
link = target as HTMLAnchorElement;
} else {
link = target.closest('a');
}
if (link && link.href && (link.href.includes('discord.gg') || link.href.includes('discord.com'))) {
e.preventDefault();
discordUrl.value = link.href;
showDialog.value = true;
}
}, true);
}
return { showDialog, discordUrl, interceptDiscordLinks };
}