diff 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
line wrap: on
line diff
--- a/lashinbang-always-consent.user.js	Fri May 17 15:03:30 2024 +0900
+++ b/lashinbang-always-consent.user.js	Tue Jan 07 16:07:50 2025 +0900
@@ -1,7 +1,7 @@
 // ==UserScript==
 // @name        lashinbang always consent
 // @namespace   https://nanaya.net
-// @version     1.0.0
+// @version     1.0.1
 // @description always apply adult consent session
 // @author      nanaya
 // @match       https://shop.lashinbang.com/*
@@ -16,7 +16,21 @@
   window.location.reload();
 }
 
-const consentOffLink = document.querySelector('a[href="https://shop.lashinbang.com/age_check_off"]');
-if (consentOffLink == null) {
-  consent();
+function main () {
+  const loginUrl = 'https://shop.lashinbang.com/mypage/login';
+  if (window.location.href === loginUrl) {
+    return;
+  }
+
+  const loginLink = document.querySelector(`a[href="${loginUrl}"]`);
+  if (loginLink != null) {
+    window.location = loginUrl;
+  }
+
+  const consentOffLink = document.querySelector('a[href="https://shop.lashinbang.com/age_check_off"]');
+  if (consentOffLink == null) {
+    consent();
+  }
 }
+
+main();