view 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 source

// ==UserScript==
// @name        lashinbang always consent
// @namespace   https://nanaya.net
// @version     1.0.1
// @description always apply adult consent session
// @author      nanaya
// @match       https://shop.lashinbang.com/*
// @grant       none
// @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/lashinbang-always-consent.user.js
// ==/UserScript==

'use strict';

async function consent () {
  await fetch('https://shop.lashinbang.com/age_check');
  window.location.reload();
}

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();