Youtube Age Confirmation Bypass

Prevents you from having to sign in to view age restricted videos on YouTube

As of 01.08.2014. See ბოლო ვერსია.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Youtube Age Confirmation Bypass
// @namespace   kneels
// @description Prevents you from having to sign in to view age restricted videos on YouTube
// @include     https://www.youtube.com/*
// @include     http://*.youtube.com/*
// @include     https://*.youtube.com/*
// @match       http://*.youtube.com/*
// @match       https://*.youtube.com/*
// @exclude     http://apiblog.youtube.com/*
// @exclude     https://apiblog.youtube.com/*
// @version     1.1
// @grant       none
// ==/UserScript==

var message = document.getElementById('player-mole-container').innerHTML;

if(message.search("Content Warning") != -1) {
   var embedString =   "<iframe width=\"100%\" height=\"100%\" src='" + 
                       getEmbedUrl() +  
                       "' frameborder=\"0\" allowfullscreen></iframe>";
   document.getElementById('player-unavailable').innerHTML = embedString;
}

function getEmbedUrl()
{
    var urlStr = window.location.href.replace('watch?v=', 'embed/');
    var junk = urlStr.indexOf("&");
    if(junk != -1) {
       urlStr = urlStr.substr(0, junk);        
    }
    return urlStr;
};