1
0
mirror of https://github.com/chylex/Userscripts.git synced 2025-05-29 21:34:04 +02:00
Userscripts/YouTube/BlockPlaylists.user.js

24 lines
743 B
JavaScript

// ==UserScript==
// @name Block YouTube Playlists
// @description Removes playlists from YouTube video URLs.
// @version 2
// @license MPL-2.0
// @namespace https://chylex.com
// @homepageURL https://github.com/chylex/Userscripts
// @supportURL https://github.com/chylex/Userscripts/issues
// @include https://youtube.com/*
// @include https://*.youtube.com/*
// @run-at document-start
// @grant none
// @noframes
// ==/UserScript==
function redirectPlaylist() {
if (location.pathname === "/watch" && location.search.includes("&list=")) {
location.replace(location.href.replace(/&list=(.*)/, ""));
}
}
redirectPlaylist();
document.addEventListener("yt-navigate-start", redirectPlaylist);