Direct Playlist Links for Youtube

Simple script to change youtube playlist links (on the play list page under channels) to go directly to the playlist instead of the first video.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Direct Playlist Links for Youtube
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Simple script to change youtube playlist links (on the play list page under channels) to go directly to the playlist instead of the first video.
// @author       Son_Of_Diablo
// @include         *://*.youtube.com/channel/*/playlists
// @include         *://youtube.com/channel/*/playlists
// @include         *://*.youtube.com/user/*/playlists
// @include         *://youtube.com/user/*/playlists
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var playlists = document.getElementsByClassName("yt-simple-endpoint style-scope ytd-grid-playlist-renderer");
    var playlists2 = document.getElementsByClassName("yt-simple-endpoint style-scope ytd-playlist-thumbnail");
    for (var i = 0; i < playlists.length; i++) {
        changeUrls(playlists[i]);
    }

    for (var i2 = 0; i2 < playlists2.length; i2++) {
        changeUrls(playlists2[i2]);
    }

    function changeUrls(playlist){
    	var tmpUrl = playlist.href;
    	var index = tmpUrl.indexOf("&");
    	playlist.href = "/playlist?" + tmpUrl.substring(index + 1);
    }
})();