import { Template } from '../mixins/template'; // This overlay is not secure. // It is only meant as a social deterrent. const T = Template('d-interstitial', `

This article is in review.

Do not share this URL or the contents of this article. Thank you!

Enter the password we shared with you as part of the review process to view the article.

`); 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'); } } } }