Bonk.IO Fullscreen Button

Fullscreen button for bonk.io

  1. // ==UserScript==
  2. // @name Bonk.IO Fullscreen Button
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.0.1
  5. // @description Fullscreen button for bonk.io
  6. // @author Zertalious (Zert)
  7. // @match *://bonk.io/
  8. // @icon https://www.google.com/s2/favicons?domain=bonk.io
  9. // @grant GM_addStyle
  10. // @run-at document-end
  11. // ==/UserScript==
  12.  
  13. GM_addStyle( `
  14.  
  15. #myBtn {
  16. position: fixed;
  17. left: 20px;
  18. top: 20px;
  19. width: 50px;
  20. height: 50px;
  21. z-index: 999;
  22. background: url(https://cdn-icons-png.flaticon.com/512/161/161728.png) 0 0 / 100% 100%;
  23. filter: invert(1);
  24. cursor: pointer;
  25. }
  26.  
  27. #myBtn:hover {
  28. transform: scale(1.1);
  29. }
  30.  
  31. ` );
  32.  
  33. const myBtn = document.createElement( 'div' );
  34.  
  35. myBtn.id = 'myBtn';
  36.  
  37. document.body.appendChild( myBtn );
  38.  
  39. myBtn.onclick = function () {
  40.  
  41. document.getElementById( 'maingameframe' ).contentWindow.document.getElementById( 'bonkiocontainer' ).requestFullscreen()
  42.  
  43. }