jiskim / Hide Frame TogetherTube

// ==UserScript==
// @name         Hide Frame TogetherTube
// @namespace    https://openuserjs.org/scripts/jiskim/Hide_Frame_TogetherTube/
// @version      0.3
// @description  Hiding the video so you  can listen at work
// @author       jiskim/Captzulu
// @match        https://togethertube.com/rooms/*
// @grant        none
// ==/UserScript==

var player=$('.player-overlay-wrapper');
var ButtonAdded;
(function() {
    ButtonAdded = $('<button id="ButtonHide" type="button" class="btn btn-default navbar-btn">' + '</button>');
    if(checkIfVisible(player)){
        ButtonAdded.text("Hide Player");
    }else{
        ButtonAdded.text("Show Player");
    }
    $("#bs-example-navbar-collapse-1").append(ButtonAdded);

    //--- Activate the newly added button.
    ButtonAdded.click(ButtonClickAction);
})();


function ButtonClickAction () {
    if(checkIfVisible(player)){
        player.css("visibility","hidden");
        ButtonAdded.text("Show Player");
    }else{
        player.css("visibility","visible");
        ButtonAdded.text("Hide Player");
    }
}


function checkIfVisible (el) {
    if($(el).filter("[style='visibility: hidden;']").length===0){
        return true;
    }else{
        return false;
    }
}