NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Youtube Fixer // @namespace http://www.youtube.com/ // @version 0.3 // @description Fixes many issues with Youtube (logo, watch later list, show all comments) // @match http://www.youtube.com/* // @match https://www.youtube.com/* // @copyright 2013+, Matic Leva // ==/UserScript== function removeElement(node) { node.parentNode.removeChild(node); } var turnObjToArray = function(obj) { return [].map.call(obj, function(element) { return element; }) }; function init() { if(!('contains' in String.prototype)) String.prototype.contains = function(str, startIndex) { return -1 !== String.prototype.indexOf.call(this, str, startIndex); }; logo(); allComments(); watchLater(); creatorStudio(); keepVidLink(); } function keepVidLink(){ var links = document.querySelectorAll(".yt-lockup-title a.yt-uix-tile-link, .pl-video-title a.pl-video-title-link"); for(var l = 0; l < links.length; l++){ var vlc = document.createElement('a'); vlc.setAttribute('href', "http://www.keepvid.com/?url=" + encodeURIComponent("https://www.youtube.com" + links[l].getAttribute("href"))); vlc.style.width = "20px"; vlc.style.height = "20px"; vlc.style.background = "url('https://lh3.ggpht.com/YSNcRsoWRD64jCbQMe590lMejt9SzM14FZrukHdc9R_6OD3EdHRzUdXcWcz2PwQtp04=w300') center center / 100% 100% no-repeat"; vlc.style.display = "inline-block"; vlc.target = "_blank"; links[l].parentNode.insertBefore(vlc, links[l]); links[l].style.display = "inline"; links[l].style.paddingLeft = "5px"; } } function logo(){ document.getElementById('logo-container').setAttribute('href', 'http://www.youtube.com/feed/subscriptions'); } function allComments(){ var videos = document.getElementsByClassName('vm-video-item-content'); for(var v = 0; v < videos.length; v++) { var video_link = videos[v].getElementsByClassName('vm-video-title-content')[0].getAttribute("href"); var comments = videos[v].getElementsByClassName('vm-video-metric video-comments'); if(comments[0].parentNode.tagName.toLowerCase() != "a") { var link = document.createElement('a'); link.setAttribute('href', "/all_comments" + video_link.substr(video_link.indexOf("?v="))); link.appendChild(comments[0]); videos[v].getElementsByClassName('vm-video-metrics')[0].appendChild(link); } } } function watchLater() { var current_url = document.URL.toString(); if(current_url.contains("feed/subscriptions")) { var watch = document.getElementById('channel-navigation-menu').children[1].cloneNode(true); watch.getElementsByTagName("a")[0].href = "/feed/watch_later"; watch.getElementsByTagName("a")[0].getElementsByTagName("span")[0].innerHTML = "Watch later"; removeElement(document.getElementById('channel-navigation-menu').children[1]); document.getElementById('channel-navigation-menu').appendChild(watch); } } function creatorStudio(){ var button = document.getElementsByClassName('yt-masthead-picker-button-primary')[0]; button.href = "/my_videos"; button.getElementsByTagName("span")[0].innerHTML = "Video Manager"; } init();