// ==UserScript== // @name Togethertube Fullscreen // @namespace https://github.com/SirTony // @version 0.2 // @description Enables fullscreen on togethertube.com // @author Tony J. Ellis // @match https://togethertube.com/rooms/* // @grant none // @require https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.18.4/URI.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.18.4/SecondLevelDomains.min.js // ==/UserScript== let registeredClick = false; $( "div#bs-example-navbar-collapse-1:nth-of-type(1) ul.nav.navbar-nav.navbar-right" ) .append( "
  • " ); $( "a#btn-fullscreen" ).click( function() { var frame = $( "div#player div iframe" )[0]; var func = frame.requestFullscreen || frame.mozRequestFullScreen || frame.msRequestFullscreen || frame.webkitRequestFullScreen; if( typeof func !== "function" ) { alert( "Fullscreen not available" ); return; } func.call( frame ); } ); const search = $( "#videoSearchInput" ); search.on( "input", function() { const url = URI.parse( search.val() ); if( !url.hostname ) return; ( function() { /* Brute-force this event by trying to register it constantly until it works because togethertube is a huge pain in the ass */ const buttonId = setInterval( function() { const voteUpButton = $( "div[data-ng-hide='searchInProgress'].ng-isolate-scope button.btn.btn-success.btn-block" ); if( voteUpButton.length === 0 ) return; voteUpButton.click( function() { angular.element( document.getElementById( "videoSearchInput" ) ).scope().videoSearchInput = ""; } ); clearInterval( buttonId ); }, 1 ); } )(); } );