Skip to content

@xtagon /youtube_kid_mode.js secret
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
"YouTube Kid Mode" for Tampermonkey
// ==UserScript==
// @name YouTube Kid Mode
// @description Don't show recommendations at the end of YouTube videos
// @version 0.1
// @namespace http://www.xtagon.com/
// @copyright 2012 Justin Workman
// @match http://www.youtube.com/watch*
// @match http://www.youtu.be/*
// @match http://youtu.be/*
// ==/UserScript==
// See http://www.reddit.com/r/SomebodyMakeThis/comments/16gtte/
function replace_video()
{
var video_id_regex = /(?:http:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?(.+)/g;
var embed_code_pattern = '<iframe width="640" height="390" src="http://www.youtube.com/embed/$1?rel=0" frameborder="0" allowfullscreen></iframe>';
var embed_code = window.location.href.replace(video_id_regex, embed_code_pattern);
var player_root_element = document.getElementsByClassName("player-root")[0];
player_root_element.innerHTML = embed_code;
}
// Set a short delay before replacing YouTube's player embed code
// It doesn't work without the delay, but it can probably be tweaked
setTimeout(replace_video, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.