import { Template } from '../mixins/template'; // This overlay is not secure. // It is only meant as a social deterrent. const T = Template('d-interstitial', `
`); export class Interstitial extends T(HTMLElement) { connectedCallback() { const passwordInput = this.root.querySelector('#interstitial-password-input'); passwordInput.oninput = (event) => this.passwordChanged(event); if (typeof(Storage) !== 'undefined') { if (localStorage.getItem('distill-interstitial-password-correct') === 'true') { console.log('Loaded that correct password was entered before; skipping interstitial.'); this.parentElement.removeChild(this); } } } passwordChanged(event) { const entered = event.target.value; if (entered === this.password) { console.log('Correct password entered.'); this.parentElement.removeChild(this); if (typeof(Storage) !== 'undefined') { console.log('Saved that correct password was entered.'); localStorage.setItem('distill-interstitial-password-correct', 'true'); } } } }