mirror of
https://github.com/chylex/Userscripts.git
synced 2025-05-05 04: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==
|
||||
// @name Block YouTube Playlists
|
||||
// @description Removes playlists from YouTube video URLs.
|
||||
// @version 1
|
||||
// @version 2
|
||||
// @license MPL-2.0
|
||||
// @namespace https://chylex.com
|
||||
// @homepageURL https://github.com/chylex/Userscripts
|
||||
@ -13,18 +13,11 @@
|
||||
// @noframes
|
||||
// ==/UserScript==
|
||||
|
||||
if (location.pathname == "/watch" && location.search.includes("&list=")){
|
||||
history.replaceState({}, document.title, location.search.replace(/&list=(.*)/, ""));
|
||||
location.reload();
|
||||
function redirectPlaylist() {
|
||||
if (location.pathname === "/watch" && location.search.includes("&list=")) {
|
||||
location.replace(location.href.replace(/&list=(.*)/, ""));
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
redirectPlaylist();
|
||||
document.addEventListener("yt-navigate-start", redirectPlaylist);
|
||||
|
Loading…
Reference in New Issue
Block a user