annotate lashinbang-always-consent.user.js @ 138:76e8b47bbb03 default tip

[lashinbang-always-consent] check for login state It's now required to turn off age check limit.
author nanaya <me@nanaya.net>
date Tue, 07 Jan 2025 16:07:50 +0900
parents dc960ef1248b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
129
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
1 // ==UserScript==
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
2 // @name lashinbang always consent
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
3 // @namespace https://nanaya.net
138
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
4 // @version 1.0.1
129
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
5 // @description always apply adult consent session
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
6 // @author nanaya
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
7 // @match https://shop.lashinbang.com/*
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
8 // @grant none
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
9 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/lashinbang-always-consent.user.js
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
10 // ==/UserScript==
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
11
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
12 'use strict';
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
13
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
14 async function consent () {
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
15 await fetch('https://shop.lashinbang.com/age_check');
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
16 window.location.reload();
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
17 }
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
18
138
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
19 function main () {
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
20 const loginUrl = 'https://shop.lashinbang.com/mypage/login';
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
21 if (window.location.href === loginUrl) {
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
22 return;
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
23 }
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
24
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
25 const loginLink = document.querySelector(`a[href="${loginUrl}"]`);
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
26 if (loginLink != null) {
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
27 window.location = loginUrl;
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
28 }
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
29
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
30 const consentOffLink = document.querySelector('a[href="https://shop.lashinbang.com/age_check_off"]');
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
31 if (consentOffLink == null) {
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
32 consent();
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
33 }
129
dc960ef1248b Add lashinbang always consent script
nanaya <me@nanaya.net>
parents:
diff changeset
34 }
138
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
35
76e8b47bbb03 [lashinbang-always-consent] check for login state
nanaya <me@nanaya.net>
parents: 129
diff changeset
36 main();