24 lines
468 B
TypeScript
24 lines
468 B
TypeScript
const nsfwOk = 'nsfw-ok';
|
|
|
|
function dismiss() {
|
|
const dialog = document.getElementById('nsfw-dialog')!;
|
|
dialog.parentElement!.removeChild(dialog);
|
|
}
|
|
|
|
function yes() {
|
|
localStorage.setItem(nsfwOk, '1');
|
|
dismiss();
|
|
}
|
|
|
|
function setup() {
|
|
if (localStorage.getItem(nsfwOk)) {
|
|
dismiss();
|
|
} else {
|
|
document.getElementById('nsfw-yes')!.onclick = yes;
|
|
// nsfw-no is a normal link
|
|
}
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', setup);
|
|
|
|
export {};
|