Greasy Fork is available in English.

Revert YouTube Layout - Simple Version

Revert to the old layout where comments appear under the video on the left.

// ==UserScript==
// @name         Revert YouTube Layout - Simple Version
// @namespace    http://tampermonkey.net/
// @version      2024.02
// @description  Revert to the old layout where comments appear under the video on the left.
// @author       hodev.co
// @match        https://www.youtube.com/**
// @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @license MIT
// @grant        none
// ==/UserScript==

(function () {
  "use strict";

  function setOldLayout() {
    // Check if the old layout is already applied
    if (document.body.dataset.oldLayout) {
      return;
    }

    const styleElement = document.createElement("style");
    styleElement.textContent = `
      ytd-watch-grid #columns {
        flex-direction: row-reverse !important;
        max-width: 1650px !important;
      }
      ytd-watch-grid #secondary {
        flex: 1 0 auto !important;
        padding-left: 20px !important;
      }
      ytd-watch-grid #primary {
        min-width: 300px !important;
        flex: 0 !important;
        margin-left: 0 !important;
      }
    `;

    document.head.appendChild(styleElement);

    // Add a data attribute to indicate that the old layout is applied
    document.body.dataset.oldLayout = true;
  }

  setOldLayout();
})();