variousrainclouds / TC FIX

// ==UserScript==
// @name         TC FIX
// @version      0.50
// @description  Attempting to do stuff to the new tc interface, disable if you have issues. ONLY WORKS ON CHROME.
// @author       variousrainclouds
// @updateURL    https://openuserjs.org/meta/variousrainclouds/TC_FIX.meta.js
// @match        https://tinychat.com/room/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
content.shadowRoot.getElementById("room").getElementsByTagName("tinychat-title")[0].remove(); //removes title bar
    content.shadowRoot.getElementById("users").shadowRoot.getElementById("sidemenu-content").childNodes[1].remove(); //removes "Live directory" button.
    
    function togglefullscreen(){

function findmethod(){
if (document.fullscreenEnabled){return "w3";}
if (document.webkitFullscreenEnabled){return "webkit";}
if (document.mozFullScreenEnabled){return "moz";}
}

var method = findmethod();
var target = document.querySelector("html");

function alreadyfullscreen(){
if (method == "moz" && document.mozFullScreenElement != null){ return true;}
if (method == "w3" && document.fullscreenElement != null){ return true;}
if (method == "webkit" && document.webkitFullscreenElement != null){ return true;}
}

function enterfullscreen(){
if (method == "moz"){ target.mozRequestFullScreen();}
if (method == "w3"){ target.requestFullscreen();}
if (method == "webkit"){ target.webkitRequestFullscreen();}
}

function exitfullscreen(){
if (method == "moz"){ document.mozCancelFullScreen();}
if (method == "w3"){ document.exitFullscreen();}
if (method == "webkit"){ document.webkitExitFullscreen();}
}

if (alreadyfullscreen()){
console.log("already fullscreen! " + alreadyfullscreen());
exitfullscreen();
  
}else{console.log("I don't think fullscreen...");
enterfullscreen();
       }

}
    
    function eventFire(el, etype){
  if (el.fireEvent) {
    el.fireEvent('on' + etype);
  } else {
    var evObj = document.createEvent('Events');
    evObj.initEvent(etype, true, false);
    el.dispatchEvent(evObj);
  }
}

    
    content.shadowRoot.getElementById("room-content").childNodes[0].shadowRoot.getElementById("videos-header-fullscreen").childNodes[0].addEventListener("click", function(){
    togglefullscreen();
        eventFire(content.shadowRoot.getElementById("modal").childNodes[0].shadowRoot.getElementById("close-button"), 'click');

});
    
    content.shadowRoot.getElementById("room-content").childNodes[0].shadowRoot.getElementById("videos-header-fullscreen").childNodes[1].addEventListener("click", function(){
    togglefullscreen();
        eventFire(content.shadowRoot.getElementById("modal").childNodes[0].shadowRoot.getElementById("close-button"), 'click');

});
    
    // content.shadowRoot.getElementById("users").shadowRoot.getElementById("sidemenu-content").lastChild.shadowRoot.querySelectorAll('span[data-gift]').length; can find data-gift values,
    setInterval(function(){var div = content.shadowRoot.getElementById("room-content").lastChild.shadowRoot.getElementById("chat");
div.scrollTop = div.scrollHeight;
                          },500);
    // Your code here...
})();