mirror of
https://github.com/chylex/Userscripts.git
synced 2025-05-23 03:34:03 +02:00
Update 'Block YouTube Playlists' to work during all navigation
This commit is contained in:
parent
1bf299d4fe
commit
98097ef8c1
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Block YouTube Playlists
|
// @name Block YouTube Playlists
|
||||||
// @description Removes playlists from YouTube video URLs.
|
// @description Removes playlists from YouTube video URLs.
|
||||||
// @version 1
|
// @version 2
|
||||||
// @license MPL-2.0
|
// @license MPL-2.0
|
||||||
// @namespace https://chylex.com
|
// @namespace https://chylex.com
|
||||||
// @homepageURL https://github.com/chylex/Userscripts
|
// @homepageURL https://github.com/chylex/Userscripts
|
||||||
@ -13,18 +13,11 @@
|
|||||||
// @noframes
|
// @noframes
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
if (location.pathname == "/watch" && location.search.includes("&list=")){
|
function redirectPlaylist() {
|
||||||
history.replaceState({}, document.title, location.search.replace(/&list=(.*)/, ""));
|
if (location.pathname === "/watch" && location.search.includes("&list=")) {
|
||||||
location.reload();
|
location.replace(location.href.replace(/&list=(.*)/, ""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("spfclick", function(e){
|
redirectPlaylist();
|
||||||
var url = e.detail.url;
|
document.addEventListener("yt-navigate-start", redirectPlaylist);
|
||||||
|
|
||||||
if (url.includes("youtube.com/watch?") && url.includes("&list=")){
|
|
||||||
// forces a normal page load
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user