🏠 Home 

Youtube video section cleaner

Unclutters the video page on Youtube's video section and resizes it


Install this script?
  1. // ==UserScript==
  2. // @name Youtube video section cleaner
  3. // @description Unclutters the video page on Youtube's video section and resizes it
  4. // @include /^http(|s)://www\.youtube\.com/watch\?v=.*$/
  5. // @grant none
  6. // @author iceman94
  7. // @copyright 2014+, iceman94
  8. // @version 0.01
  9. // @grant none
  10. // @namespace 2883c859593dd67ceaea42331264acf6
  11. // ==/UserScript==
  12. // Wraps all the code in a single function to bypass issues with some browsers
  13. function main()
  14. {
  15. // Gets browser's current height and width
  16. var w = window.screen.availWidth;
  17. var h = window.screen.availHeight;
  18. // Sets video player size to browser's size minus reserved height and width
  19. var rh = 5;
  20. var rw = 5;
  21. var vw = rw * w / 100;
  22. vw = w - vw;
  23. var vh = rh * w / 100;
  24. vh = h - vh;
  25. // Video container manipulation
  26. var vidc = document.getElementsByClassName('html5-video-container')[0];
  27. vidc.style.width = vw + 'px';
  28. vidc.style.height = vh + 'px';
  29. // Adds the video container directly to the body
  30. var bdy = document.getElementById('body');
  31. bdy.appendChild(vidc);
  32. // Main video manipulation
  33. var vidm = document.getElementsByClassName('video-stream html5-main-video')[0];
  34. vidm.style.width = vw + 'px';
  35. vidm.style.height = vh + 'px';
  36. // Removes all clutter but the video container itself
  37. var clutter = document.getElementById('body-container');
  38. clutter.parentNode.removeChild(clutter);
  39. }; //<-- DON'T REMOVE, CLOSES MAIN FUNCTION
  40. // Call the main function with a delay of 1 second
  41. setTimeout(main, 100);