Autodarts - Auto Fullscreen

Enables auto fullscreen-mode after game start

目前為 2025-03-07 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Autodarts - Auto Fullscreen
// @namespace    http://tampermonkey.net/
// @version      0.12
// @description  Enables auto fullscreen-mode after game start
// @author       benebelter
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @match        https://play.autodarts.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=autodarts.io
// @license      MIT
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    $(document).on('click', 'button:contains("Start game"), #enter_fullscreen', function(){  //  $(document).on('click', '.chakra-button', function(){
        // collapse side bar
        if( $('.css-17xejub').width() > 100 ){
            $('[aria-label="Collapse side bar"]').click();
        }

        if( window.innerHeight != screen.height) {
            document.querySelector("html").requestFullscreen();
        }

        if ($('#exit_fullscreen').length < 1) {
            $('.css-1jc8v6r').last().after('<a id="exit_fullscreen" class="chakra-menu__menuitem css-1jc8v6r" onclick="document.exitFullscreen();">Exit Fullscreen</a>');
        }

        if ($('#enter_fullscreen').length < 1) {
            $('.css-1jc8v6r').last().after('<a id="enter_fullscreen" class="chakra-menu__menuitem css-1jc8v6r">Enter Fullscreen</a>');
        }

    });
})();