Shin KGS Fullscreen Option

Shin KGS Fullscreen Option - Click yellow Fullscreen button while in a game

  1. // ==UserScript==
  2. // @name Shin KGS Fullscreen Option
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Shin KGS Fullscreen Option - Click yellow Fullscreen button while in a game
  6. // @author dracflam
  7. // @match https://shin.gokgs.com/*
  8. // @require https://code.jquery.com/jquery-3.2.1.min.js
  9. // ==/UserScript==
  10.  
  11. $(document).ready(function() {
  12. addGlobalStyle('.GameScreen:-webkit-full-screen {top: 0px;}');
  13. setTimeout(function(){
  14. var t=$('<a>').css('background','yellow').addClass('MainNav-feedback-button').html('Fullscreen').on('click',function() {
  15. if ( document.querySelector('.GameScreen')!==null)
  16. document.querySelector('.GameScreen').webkitRequestFullscreen();
  17. else
  18. alert('Watch or play a game first!');
  19. });
  20. $('.MainNav-feedback').prepend(t);
  21. }, 2000);
  22. });
  23. function addGlobalStyle(css) {
  24. var head, style;
  25. head = document.getElementsByTagName('head')[0];
  26. if (!head) { return; }
  27. style = document.createElement('style');
  28. style.type = 'text/css';
  29. style.innerHTML = css;
  30. head.appendChild(style);
  31. }