Autodarts - Auto Fullscreen

Enables auto fullscreen-mode after game start

  1. // ==UserScript==
  2. // @name Autodarts - Auto Fullscreen
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.14
  5. // @description Enables auto fullscreen-mode after game start
  6. // @author benebelter
  7. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
  8. // @match https://play.autodarts.io/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=autodarts.io
  10. // @license MIT
  11. // @run-at document-end
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. // $(document).on('click', '.rematch_button', function(){
  18. // document.querySelector("html").requestFullscreen();
  19. // })
  20.  
  21. $(document).on('click', 'button:contains("Start game"), #enter_fullscreen, .rematch_button', function(){ //
  22. // $(document).on('click', '.chakra-button', function(){
  23. // collapse side bar
  24.  
  25. $('#enter_fullscreen').hide();
  26.  
  27. if( $('.css-17xejub').width() > 100 ){
  28. $('[aria-label="Collapse side bar"]').click();
  29. }
  30.  
  31. if( window.innerHeight != screen.height) {
  32. document.querySelector("html").requestFullscreen();
  33. $('#exit_fullscreen').show();
  34.  
  35. }
  36.  
  37. $(document).on('click', '#exit_fullscreen', function(){
  38. $('#enter_fullscreen').show();
  39. $('#exit_fullscreen').hide();
  40. })
  41.  
  42. if ($('#exit_fullscreen').length < 1) {
  43. $('.css-1jc8v6r').last().after('<a id="exit_fullscreen" class="chakra-menu__menuitem css-1jc8v6r" onclick="document.exitFullscreen(); ">Exit Fullscreen</a>');
  44. }
  45.  
  46. })
  47.  
  48.  
  49. let timeout = setTimeout (
  50. function () {
  51. if ($('#enter_fullscreen').length < 1){
  52. $('.css-1jc8v6r').last().after('<a id="enter_fullscreen" class="chakra-menu__menuitem css-1jc8v6r" onclick="">Enter Fullscreen</a>');
  53. }
  54. else {
  55. clearTimeout(anzeigeTastaturshortcuts);}
  56. }, 2000);
  57.  
  58.  
  59. })();