mirror of
https://github.com/chylex/Userscripts.git
synced 2024-10-17 01:42:45 +02:00
31 lines
975 B
JavaScript
31 lines
975 B
JavaScript
// ==UserScript==
|
|
// @name Block YouTube Playlists
|
|
// @description Removes playlists from YouTube video URLs.
|
|
// @version 1
|
|
// @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==
|
|
|
|
if (location.pathname == "/watch" && location.search.includes("&list=")){
|
|
history.replaceState({}, document.title, location.search.replace(/&list=(.*)/, ""));
|
|
location.reload();
|
|
}
|
|
|
|
document.addEventListener("spfclick", function(e){
|
|
var url = e.detail.url;
|
|
|
|
if (url.includes("youtube.com/watch?") && url.includes("&list=")){
|
|
// forces a normal page load
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
e.stopImmediatePropagation();
|
|
}
|
|
}, true);
|