rayanbfvr / Youtube Channel Links Straight To Videos Tab

// ==UserScript==
// @name         Youtube Channel Links Straight To Videos Tab
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Replaces channel links so that it sends you straight to the videos tab instead of the home tab.
// @author       Rayanbfvr
// @match        https://www.youtube.com*
// @match        https://www.youtube.com/*
// @require     https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
// @require     https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant        none
// @downloadURL https://openuserjs.org/install/rayanbfvr/Youtube_Channel_Links_Straight_To_Videos_Tab.user.js
// @updateURL https://openuserjs.org/meta/rayanbfvr/Youtube_Channel_Links_Straight_To_Videos_Tab.meta.js
// ==/UserScript==

(function() {
    'use strict';

    var userChannelsSelector = 'a[href*="/user"], a[href*="/channel"]';
    var userChannelsLinks = document.querySelectorAll(userChannelsSelector);

    function userChannelsToVideos(userChannelsLinks) {
        for(var i = 0; i < userChannelsLinks.length; i++) {
            if(/\/(user|channel)\/([^/]+)$/.test(userChannelsLinks[i])) {
                userChannelsLinks[i].href = userChannelsLinks[i].href+"/videos";
            }
        }
    }

    waitForKeyElements (userChannelsSelector, userChannelsToVideos);
})();