35 lines
592 B
JavaScript
35 lines
592 B
JavaScript
(function () {
|
|
'use strict';
|
|
|
|
let nsfwOk = 'nsfw-ok';
|
|
|
|
function alreadyYes() {
|
|
return localStorage.getItem(nsfwOk);
|
|
}
|
|
|
|
function dismiss() {
|
|
let dialog = document.getElementById('nsfw-dialog');
|
|
dialog.parentElement.removeChild(dialog);
|
|
}
|
|
|
|
function yes() {
|
|
localStorage.setItem(nsfwOk, 1);
|
|
dismiss();
|
|
}
|
|
|
|
function no() {
|
|
history.go(-1);
|
|
}
|
|
|
|
function setup() {
|
|
if (alreadyYes()) {
|
|
dismiss();
|
|
} else {
|
|
document.getElementById('nsfw-yes').onclick = yes;
|
|
document.getElementById('nsfw-no').onclick = no;
|
|
}
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', setup);
|
|
|
|
})();
|