diff surugaya-always-consent.user.js @ 134:bb4795a52a46

Update consent cookie
author nanaya <me@nanaya.net>
date Wed, 21 Feb 2024 21:19:16 +0900
parents 8de2d53a4cb1
children
line wrap: on
line diff
--- a/surugaya-always-consent.user.js	Sun Jan 07 19:20:55 2024 +0900
+++ b/surugaya-always-consent.user.js	Wed Feb 21 21:19:16 2024 +0900
@@ -1,7 +1,7 @@
 // ==UserScript==
 // @name        suruga-ya always consent
 // @namespace   https://nanaya.net
-// @version     2.0.2
+// @version     2.0.3
 // @description always inject adult consent cookie
 // @author      nanaya
 // @match       https://www.suruga-ya.jp/*
@@ -11,10 +11,12 @@
 
 'use strict';
 
-const hasAdultCookie = document.cookie.split('; ').includes('adult=1');
+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));
-  document.cookie = `adult=1; expires=${d.toGMTString()}; path=/`;
+  const options = `expires=${d.toGMTString()};path=/`;
+  document.cookie = `safe_search_expired=3;${options};`;
+  document.cookie = `safe_search_option=3;${options};`;
   window.location.reload();
 }