script fixes

This commit is contained in:
rhiannon morris 2024-07-11 15:04:55 +02:00
parent 411f2feb44
commit cd5801dd7d
2 changed files with 3 additions and 7 deletions

View file

@ -1,12 +1,8 @@
const nsfwOk = 'nsfw-ok';
function alreadyYes() {
return localStorage.getItem(nsfwOk) == '1';
}
function dismiss() {
const dialog = document.getElementById('nsfw-dialog')!;
dialog.parentElement?.removeChild(dialog);
dialog.parentElement!.removeChild(dialog);
}
function yes() {
@ -15,7 +11,7 @@ function yes() {
}
function setup() {
if (alreadyYes()) {
if (localStorage.getItem(nsfwOk)) {
dismiss();
} else {
document.getElementById('nsfw-yes')!.onclick = yes;