view surugaya-always-consent.user.js @ 137:7a7aafa65bae default tip

Update url
author nanaya <me@nanaya.net>
date Fri, 17 May 2024 15:03:30 +0900
parents bb4795a52a46
children
line wrap: on
line source

// ==UserScript==
// @name        suruga-ya always consent
// @namespace   https://nanaya.net
// @version     2.0.3
// @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('safe_search_expired=3');
if (!hasAdultCookie) {
  const d = new Date();
  d.setTime(d.getTime() + (100 * 24 * 60 * 60 * 1000));
  const options = `expires=${d.toGMTString()};path=/`;
  document.cookie = `safe_search_expired=3;${options};`;
  document.cookie = `safe_search_option=3;${options};`;
  window.location.reload();
}