you WOULD type a script
This commit is contained in:
parent
8cb6752168
commit
7a08c05cea
11 changed files with 385 additions and 359 deletions
28
script/nsfw-warning.ts
Normal file
28
script/nsfw-warning.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
const nsfwOk = 'nsfw-ok';
|
||||
|
||||
function alreadyYes() {
|
||||
return localStorage.getItem(nsfwOk) !== undefined;
|
||||
}
|
||||
|
||||
function dismiss() {
|
||||
let dialog = document.getElementById('nsfw-dialog')!;
|
||||
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 {};
|
Loading…
Add table
Add a link
Reference in a new issue