diff options
| author | stderr64 <stderr64@null.net> | 2026-07-03 21:02:15 +0300 |
|---|---|---|
| committer | stderr64 <stderr64@null.net> | 2026-07-03 21:02:15 +0300 |
| commit | 440b19a21a5cdfe69a6c91b9004405a33b28f9fb (patch) | |
| tree | 3a49bb6538fca5c2c6dac3071ee0647479a12193 | |
| download | yt_noplaylist-440b19a21a5cdfe69a6c91b9004405a33b28f9fb.tar.gz yt_noplaylist-440b19a21a5cdfe69a6c91b9004405a33b28f9fb.tar.zst | |
First commit
| -rw-r--r-- | yt_noplaylist.user.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/yt_noplaylist.user.js b/yt_noplaylist.user.js new file mode 100644 index 0000000..4e51eb6 --- /dev/null +++ b/yt_noplaylist.user.js @@ -0,0 +1,31 @@ +// ==UserScript== +// @name YouTube No Playlist +// @namespace https://git.xservers.dy.fi/cgit.cgi/stderr64/yt_noplaylist +// @version 1.0 +// @description Redirect youtube playlist to non-playlist url +// @author stderr64 +// @match https://www.youtube.com/watch?v=*&list=* +// @grant none +// ==/UserScript== + +(function() { + 'use strict'; + + if ( window.location === undefined || window.location.length == 0 ){ + console.log( "[YouTube No Playlist] Error: window.location is undefined or empty" ); + return; + } + var win_location_str = window.location.toString(); + if ( !win_location_str.match(/\/watch\?v=\w+&list=\w+$/) ){ + return; + } + var win_location_split = win_location_str.split( "&list=" ); + if ( win_location_split.length === 0 ){ + return; + } + if ( win_location_split[1].length === 0 || !win_location_split[1].match(/\w+$/) ){ + return; + } + window.location.assign( win_location_split[0] ); + return; +})(); |
