Gonso_x3 / YouTube - Homebutton-Fix

// ==UserScript==
// @name       YouTube - Homebutton-Fix
// @namespace  www.youtube.com
// @version    0.4
// @description  Redirects to your subscription feed
// @include    *www.youtube.com*
// @require	   http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// @copyright  Gonso_x3
// ==/UserScript==

// |------------------------------------------------------------------|
// |__________________________________________________________________|
// |                                                                  |
// |      IF YOU HAVE ANY PROBLEMS JUST SEND ME A PM OR A TWEET       |
// |            twitter.com/Gonso_x3 || youtube.com/gonssoo           |
// |___________________________________________________________~peaCe_|
// |               TESTED IN FIREFOX WITH GREASEMONKEY                |
// |------------------------------------------------------------------|



var yt_default = 'www.youtube.com/';
var yt_homepage = 'https://www.youtube.com/feed/subscriptions/';

// automatically redirects youtube.com to youtube.com/feed/subsciptions

if (window.location.hostname + window.location.pathname == yt_default) {
  window.location.replace(yt_homepage);
}


// Changes all links which would redirect you to youtube.com to your subscription feed
// except for the "What To Watch"-Button
// currently only working for German / English YouTube. Sorry Guis
// You can add your own "What To Watch"-Thingy if you want. 
// Just replace 'Empfohlene Videos' With the the title of your Link

var yt_full = window.location.protocol + '//' + yt_default;
var yt_links = document.querySelectorAll('a[href=\'/\'], a[href=\'' + yt_full + '\']');

for (var yt_i = 0; yt_i < yt_links.length; yt_i++) {
  
  yt_links[yt_i].setAttribute('href', '/feed/subscriptions/');
  
  if (yt_links[yt_i].attr(title) == 'What To Watch' || yt_links[yt_i].attr(title) == 'Empfohlene Videos') {
    yt_links[yt_i].setAttribute('href', '/');
  }
  
}


// Open all Video-Links in new Tab
// currently not working because of the 'new' design
/*
if (window.location.href == yt_homepage){
	var list = document.getElementById('browse-items-primary').getElementsByTagName('a');

	for(var i = 0; i < list.length; i++) {
		list[i].setAttribute('target','_blank');
	}
}
*/