view surugaya-always-consent.user.js @ 127:a701294f38ff

More reliable state handling
author nanaya <me@nanaya.net>
date Sat, 21 Jan 2023 03:15:26 +0900
parents 8de2d53a4cb1
children bb4795a52a46
line wrap: on
line source

// ==UserScript==
// @name        suruga-ya always consent
// @namespace   https://nanaya.net
// @version     2.0.2
// @description always inject adult consent cookie
// @author      nanaya
// @match       https://www.suruga-ya.jp/*
// @grant       none
// @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/surugaya-always-consent.user.js
// ==/UserScript==

'use strict';

const hasAdultCookie = document.cookie.split('; ').includes('adult=1');
if (!hasAdultCookie) {
  const d = new Date();
  d.setTime(d.getTime() + (100 * 24 * 60 * 60 * 1000));
  document.cookie = `adult=1; expires=${d.toGMTString()}; path=/`;
  window.location.reload();
}