Mercurial > ec-userscripts
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 |
rev | line source |
---|---|
129 | 1 // ==UserScript== |
2 // @name lashinbang always consent | |
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 | 5 // @description always apply adult consent session |
6 // @author nanaya | |
7 // @match https://shop.lashinbang.com/* | |
8 // @grant none | |
9 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/lashinbang-always-consent.user.js | |
10 // ==/UserScript== | |
11 | |
12 'use strict'; | |
13 | |
14 async function consent () { | |
15 await fetch('https://shop.lashinbang.com/age_check'); | |
16 window.location.reload(); | |
17 } | |
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 | 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(); |