mirror of
https://github.com/FoggedLens/deflock.git
synced 2026-07-15 00:07:20 +02:00
discord warning
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
Reference in New Issue
Block a user