Created
February 25, 2024 22:45
-
-
Save martok/a60bb10ae15df127a3ad09a55ab7f092 to your computer and use it in GitHub Desktop.
Reset Youtube 2024 "Grid" Layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Yt-nogrid | |
// @namespace http://scripts.martoks-place.de/yt-grid | |
// @include *://*.youtube.com/* | |
// @version 1 | |
// @grant none | |
// @run-at document-end | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
if (window.top != window.self) return; | |
console.log('Youtube No Grid Mode'); | |
const WANT_FLAGS = { | |
//ab_det_apb_b: false, | |
//check_user_lact_at_prompt_shown_time_on_web: true, | |
//cold_missing_history: false, | |
//desktop_shorts_v2_anchored_panel: false, | |
//desktop_shorts_v2_persistent_anchored_panel: false, | |
//disable_safari_ui_status_check: true, | |
//fill_view_models_on_web_vod: false, | |
//kevlar_watch_comments_ep_disable_theater: true, | |
//kevlar_watch_comments_panel_button: false, | |
kevlar_watch_feed_big_thumbs: false, | |
kevlar_watch_grid: false, | |
kevlar_watch_grid_auto_open_playlist: false, | |
main_app_controller_extraction_batch_18: false, | |
main_app_controller_extraction_batch_19: false, | |
//optimal_reading_width_comments_ep: false, | |
//web_home_appeal_survey: true, | |
//web_player_enable_featured_product_banner_exclusives_on_desktop: false, | |
web_watch_theater_chat: true, | |
web_watch_theater_fixed_chat: true, | |
kevlar_watch_flexy_metadata_height: 136, | |
//kevlar_watch_max_player_width: 1280, | |
wn_grid_max_item_width: 0, | |
wn_grid_min_item_width: 0, | |
}; | |
// Disables (if available) the creation of the new flexy dom. | |
function applyChanges() { | |
let cfg = (typeof window.ytcfg === "undefined") ? false : window.ytcfg.get("EXPERIMENT_FLAGS"); | |
if (!cfg) | |
return; | |
const changed_cfg = Object.assign({}, cfg, WANT_FLAGS); | |
for (const name of Object.keys(changed_cfg)) { | |
if (cfg[name] !== changed_cfg[name]) | |
console.log('Set ', name, ' to ', changed_cfg[name]); | |
} | |
window.ytcfg.set("EXPERIMENT_FLAGS", changed_cfg); | |
} | |
applyChanges(); | |
document.addEventListener("DOMContentLoaded", applyChanges, true); | |
document.addEventListener("yt-navigate-start", applyChanges, true); | |
})(); |
"Watch Next" does not change because it's generated server-side by the https://www.youtube.com/youtubei/v1/next?prettyPrint=false
endpoint. Same request gets different results, containing either richGridRenderer
(shitty ui) or compactVideoRenderer
(good ui) items depending on the user. Clientside just converts the JS object to DOM.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based off of Youtube No Flexy Mode.
See also Wezelkrozum on Reddit, posted literally within minutes of me diffing the flags for this.