import { loadPageTexts } from '../i18n/main.js'; import { hide_login_page, hide_signup_page, } from '../main/main.js'; import { hideFiles } from '../files/main.js'; import { jCloudUIElements } from '../tools/main.js'; const showContactForm = async function () { await loadPageTexts('/contact'); document.querySelector('#contact').classList.remove('hidden') document.querySelector('#startpage').setAttribute('class', 'hidden'); window.history.pushState(null, '', '/contact'); hideFiles(); document.querySelector('#home').setAttribute('class', 'hidden'); document.querySelector('#user-details-on-footer').style.display = 'none'; document.querySelector('#user-details-on-footer').setAttribute('class', 'hidden'); }; const hideContactForm = function () { document.querySelector('#contact').classList.add('hidden'); }; const submitContactForm = async function() { const params = new URLSearchParams(); params.append('email', ' '); params.append('message', document.querySelector('#contact-form-textarea').value); await fetch('https://jcloud-services.ddns.net:1024/contact', { method: 'POST', body: params.toString() }) .then(async response => { if (response.status === 201) { document.querySelector('#contact-request-number-container').classList.remove('hidden'); document.querySelector('#contact-request-number').textContent = await response.text(); }; }) .catch(err => { jCloudUIElements.alert(err) }); }; export { showContactForm, hideContactForm, submitContactForm };