summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yt_noplaylist.user.js31
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;
+})();