comparison 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
comparison
equal deleted inserted replaced
137:7a7aafa65bae 138:76e8b47bbb03
1 // ==UserScript== 1 // ==UserScript==
2 // @name lashinbang always consent 2 // @name lashinbang always consent
3 // @namespace https://nanaya.net 3 // @namespace https://nanaya.net
4 // @version 1.0.0 4 // @version 1.0.1
5 // @description always apply adult consent session 5 // @description always apply adult consent session
6 // @author nanaya 6 // @author nanaya
7 // @match https://shop.lashinbang.com/* 7 // @match https://shop.lashinbang.com/*
8 // @grant none 8 // @grant none
9 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/lashinbang-always-consent.user.js 9 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/lashinbang-always-consent.user.js
14 async function consent () { 14 async function consent () {
15 await fetch('https://shop.lashinbang.com/age_check'); 15 await fetch('https://shop.lashinbang.com/age_check');
16 window.location.reload(); 16 window.location.reload();
17 } 17 }
18 18
19 const consentOffLink = document.querySelector('a[href="https://shop.lashinbang.com/age_check_off"]'); 19 function main () {
20 if (consentOffLink == null) { 20 const loginUrl = 'https://shop.lashinbang.com/mypage/login';
21 consent(); 21 if (window.location.href === loginUrl) {
22 return;
23 }
24
25 const loginLink = document.querySelector(`a[href="${loginUrl}"]`);
26 if (loginLink != null) {
27 window.location = loginUrl;
28 }
29
30 const consentOffLink = document.querySelector('a[href="https://shop.lashinbang.com/age_check_off"]');
31 if (consentOffLink == null) {
32 consent();
33 }
22 } 34 }
35
36 main();