2023-09-06 19:17:21 -04:00
|
|
|
const nsfwOk = 'nsfw-ok';
|
|
|
|
|
|
|
|
function alreadyYes() {
|
2024-07-07 15:45:10 -04:00
|
|
|
return localStorage.getItem(nsfwOk) == '1';
|
2023-09-06 19:17:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function dismiss() {
|
2024-07-07 14:44:05 -04:00
|
|
|
const dialog = document.getElementById('nsfw-dialog')!;
|
2023-09-06 19:17:21 -04:00
|
|
|
dialog.parentElement?.removeChild(dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
function yes() {
|
|
|
|
localStorage.setItem(nsfwOk, '1');
|
|
|
|
dismiss();
|
|
|
|
}
|
|
|
|
|
|
|
|
function setup() {
|
|
|
|
if (alreadyYes()) {
|
|
|
|
dismiss();
|
|
|
|
} else {
|
|
|
|
document.getElementById('nsfw-yes')!.onclick = yes;
|
|
|
|
// nsfw-no is a normal link
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', setup);
|
|
|
|
|
|
|
|
export {};
|