38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import { selectId, pushStyles } from "./helperFunctions.js";
|
|
|
|
window.onload = function() {
|
|
if (!localStorage.getItem('dontShowPopup')) {
|
|
pushStyles(selectId('joinModal'), { display: 'flex' });
|
|
}
|
|
}
|
|
|
|
function openModal() {
|
|
pushStyles(selectId('joinModal'), { display: 'flex' });
|
|
}
|
|
|
|
function openCopyModal() {
|
|
if (selectId('joinModal').style.display === 'flex') {
|
|
pushStyles(selectId('joinModal'), { display: 'none' });
|
|
}
|
|
pushStyles(selectId('copyModal'), { display: 'flex' });
|
|
if (selectId('dontShowCheckbox').checked) {
|
|
localStorage.setItem('dontShowPopup', true);
|
|
}
|
|
}
|
|
|
|
function closeModal() {
|
|
pushStyles(selectId('copyModal'), { display: 'none' });
|
|
if (document.getElementById('dontShowCheckbox').checked) {
|
|
localStorage.setItem('dontShowPopup', true);
|
|
}
|
|
}
|
|
|
|
function copyLink() {
|
|
const copyText = selectId('discordLink').textContent;
|
|
navigator.clipboard.writeText(copyText).then(function() {
|
|
alert("Discord link copied to clipboard!");
|
|
}, function() {
|
|
alert("Failed to copy the link.");
|
|
});
|
|
}
|