const html = require('choo/html'); export default function options(state, emit) { function clickCancel(event) { event.preventDefault(); emit('pushState', '/'); } async function submitForm(event) { event.preventDefault(); if (this.addPassword.checked) { if (this.password.value !== this.confirmPassword.value) { state.passwordDoesNotMatchError = true; emit('render'); return; } else { state.passwordDoesNotMatchError = false; } } state.timeLimit = parseInt(event.target.maxTime); emit('upload', { type: 'click', dlimit: parseInt(event.target.numDownloads.value), password: event.target.password.value }); emit('pushState', '/upload'); } function addPasswordChange(event) { const pw = document.getElementById('password-section'); if (event.target.checked) { pw.style.display = 'block'; } else { pw.style.display = 'none'; } } const passwordDoesNotMatchDisplayStyle = state.passwordDoesNotMatchError ? 'display: block' : 'display: none'; const passwordChecked = state.passwordDoesNotMatchError ? true : false; return html`