Ani Gamer Age Check Bypass

The script automically select agree when age check appear

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name              Ani Gamer Age Check Bypass
// @name:zh-Tw        動畫瘋年齡確認自動同意
// @description       The script automically select agree when age check appear
// @description:zh-Tw 年齡認證出現時自動選取同意
// @namespace         ani.gamer
// @version           2.1
// @include           https://*ani.gamer.com.tw/animeVideo*
// @include           https://*ani.gamer.com.tw/party.php*
// @license           Beerware
// @compatible firefox 瀏覽器需給予自動撥放影音內容的權限
// ==/UserScript==

/* jshint esversion: 8 */
(async function() {
  // get video node
  function get_video_node() {
    let ani_video = document.getElementById('ani_video');
    let party_video = document.getElementById('partyPlayer');
    return ani_video || party_video
  }

  // click the agree button
  function agreeAnyway() {
    let agreeButton = document.getElementById('adult');
    if (agreeButton) {
      console.log("I AM A GROWN MAN, I'M A BIG ADULT, I CAN DO THIS.");
      agreeButton.click();
    }
  }

  function delay(milliseconds){
      return new Promise(resolve => {
          setTimeout(resolve, milliseconds);
      });
  }

  // wait for ani_video node appear
  let retryCount = 0;
  let video_node = null;

  // check 4 times/second for 20 seconds
  while (retryCount++ < 80) {
    video_node = get_video_node()
    if (video_node) {
      break;
    }
    await delay(250);
  }

  if (!video_node) {
    console.error("Can not get the video node");
    return;
  }

  // add observer on video node
  const config = { childList: true, subtree: false};
  const observer = new MutationObserver(() => agreeAnyway());
  observer.observe(video_node, config);

  // this step is required to prevent the agreeAnyway not trigger if
  // ani_video is fully loaded before observer started
  agreeAnyway();
})();