diff surugaya-always-consent.user.js @ 116:0e108a9dc6d7

Split suruga-ya scripts
author nanaya <me@nanaya.net>
date Sun, 15 Jan 2023 23:46:56 +0900
parents
children 8de2d53a4cb1
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/surugaya-always-consent.user.js	Sun Jan 15 23:46:56 2023 +0900
@@ -0,0 +1,20 @@
+// ==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();
+}