insin / control-panel-for-youtube

Browser extension which gives you more control over YouTube by adding missing options and UI improvements - for desktop & mobile browsers

Home Page:https://jbscript.dev/control-panel-for-youtube

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extend support for mobileGridView to landscape orientation

insin opened this issue · comments

The default styling for Search and Subscriptions is the landscape list view - YouTube uses a @media (orientation: portrait) query to override this with the version you see in portrait mode, which is what mobileGridView builds on to turn it into a grid view.

In order to allow use of the grid view in landscape orientation, we need to override the default styling to undo the list view, but this is extremely specific and likely to be brittle.

Some WIP:

/*
 * Undo default styling to make Subcription items display as list items in landscape
 * Very flaky, needs to be media queried
 */
 ytm-media-item {
  margin: 0 !important;
  padding: 0 12px !important;
  display: block !important;
}
.media-item-thumbnail-container {
  padding: 0 12px !important;
}
.video-thumbnail-container-large {
  margin: 0 -12px !important;
  width: auto !important;
  height: auto !important;
  padding-bottom: 56.25% !important;
  border-radius: 0 !important;
}
lazy-list ytm-media-item .details {
  margin: 4px 0 0 0 !important;
  flex-direction: row !important;
}
lazy-list ytm-media-item .media-channel {
  display: block !important;
  order: unset !important;
  margin-top: 8px !important;
  flex-grow: 0 !important;
  width: auto !important;
}
.media-item-info {
  flex-grow: 1 !important;
  margin-left: 12px !important;
}
lazy-list ytm-media-item .media-item-metadata {
  margin-top: 8px !important;
}

Instead of trying to undo this manually, we could try to find the appropriate @media (orientation: portrait) rules in YouTube's stylesheets at runtime and add copies of them without the query or with a landscape query instead.