Kittens Game AutoPlay Loader

Add-on for the wonderful incremental browser game: https://kittensgame.com/web/

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        Kittens Game AutoPlay Loader
// @namespace   E4gle
// @description Add-on for the wonderful incremental browser game: https://kittensgame.com/web/
// @icon        https://kitten-science.com/assets/images/organization-logo64.png
// @match       https://kittensgame.com/web/
// @match       https://kittensgame.com/beta/
// @match       https://kittensgame.com/alpha/
// @version      1.0
// @grant       none
// @license MIT
// ==/UserScript==
(function () {
  'use strict';

  const SCRIPT_URL = 'https://dandcvs.github.io/KGAutoPlay/kitg.js';
  const FLAG = '__KG_AUTOPLAY_LOADED__';

  if (window[FLAG]) {
    console.log('[KG AutoPlay] already loaded');
    return;
  }

  let tries = 0;
  const maxTries = 60; // ~30 Sekunden

  const waitForGame = setInterval(() => {
    tries++;

    if (window.gamePage && document.readyState === 'complete') {
      clearInterval(waitForGame);

      const script = document.createElement('script');
      script.src = SCRIPT_URL;
      script.onload = () => {
        window[FLAG] = true;
        console.log('[KG AutoPlay] successfully loaded');
      };

      document.body.appendChild(script);
    }

    if (tries >= maxTries) {
      clearInterval(waitForGame);
      console.warn('[KG AutoPlay] Kittens Game not detected');
    }
  }, 500);
})();