YouTube Mobile View

Emulates YouTube mobile view on desktop

  1. // ==UserScript==
  2. // @name YouTube Mobile View
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Emulates YouTube mobile view on desktop
  6. // @match *://www.youtube.com/*
  7. // @grant none
  8. // @run-at document-end
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // Inject CSS to emulate mobile view
  15. const style = document.createElement('style');
  16. style.textContent = `
  17. /* General styling for mobile view */
  18. body {
  19. overflow-x: hidden !important;
  20. }
  21. #player-container {
  22. max-width: 100% !important;
  23. margin: 0 auto !important;
  24. }
  25. #content {
  26. margin: 0 !important;
  27. padding: 0 !important;
  28. }
  29. .ytd-app {
  30. max-width: 375px !important;
  31. margin: 0 auto !important;
  32. width: 100% !important;
  33. overflow-x: hidden !important;
  34. }
  35. .ytd-two-column-browse-results-renderer {
  36. display: flex;
  37. flex-direction: column;
  38. width: 100% !important;
  39. }
  40. .ytd-feed-filter-chip-bar-renderer {
  41. display: none !important;
  42. }
  43. .ytd-masthead {
  44. display: none !important;
  45. }
  46. `;
  47. document.head.appendChild(style);
  48. })();