Mercurial > ec-userscripts
comparison 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 | 15ec4ec958d7 |
comparison
equal
deleted
inserted
replaced
133:717bc604371b | 134:bb4795a52a46 |
---|---|
1 // ==UserScript== | 1 // ==UserScript== |
2 // @name suruga-ya always consent | 2 // @name suruga-ya always consent |
3 // @namespace https://nanaya.net | 3 // @namespace https://nanaya.net |
4 // @version 2.0.2 | 4 // @version 2.0.3 |
5 // @description always inject adult consent cookie | 5 // @description always inject adult consent cookie |
6 // @author nanaya | 6 // @author nanaya |
7 // @match https://www.suruga-ya.jp/* | 7 // @match https://www.suruga-ya.jp/* |
8 // @grant none | 8 // @grant none |
9 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/surugaya-always-consent.user.js | 9 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/surugaya-always-consent.user.js |
10 // ==/UserScript== | 10 // ==/UserScript== |
11 | 11 |
12 'use strict'; | 12 'use strict'; |
13 | 13 |
14 const hasAdultCookie = document.cookie.split('; ').includes('adult=1'); | 14 const hasAdultCookie = document.cookie.split('; ').includes('safe_search_expired=3'); |
15 if (!hasAdultCookie) { | 15 if (!hasAdultCookie) { |
16 const d = new Date(); | 16 const d = new Date(); |
17 d.setTime(d.getTime() + (100 * 24 * 60 * 60 * 1000)); | 17 d.setTime(d.getTime() + (100 * 24 * 60 * 60 * 1000)); |
18 document.cookie = `adult=1; expires=${d.toGMTString()}; path=/`; | 18 const options = `expires=${d.toGMTString()};path=/`; |
19 document.cookie = `safe_search_expired=3;${options};`; | |
20 document.cookie = `safe_search_option=3;${options};`; | |
19 window.location.reload(); | 21 window.location.reload(); |
20 } | 22 } |