Youtube Embed NoCookie

Change any embedded youtube videos with the no-cookie version

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        Youtube Embed NoCookie
// @namespace   s
// @description Change any embedded youtube videos with the no-cookie version
// @include     *
// @exclude     https://www.youtube.com/*
// @version     1
// @grant       none
// ==/UserScript==
function func(item) {
  src = item.getAttribute('src');
  fixed = src.replace(/youtube.com\/embed/, 'youtube-nocookie.com/embed');
  if (src != fixed) {
    item.setAttribute('src', fixed);
  }
}
function updateiframes(m) {
  iframes = document.getElementsByTagName('iframe');
  for (var i = 0; i < iframes.length; i = i + 1) func(iframes[i]);
}

// Observe mutations
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
if (MutationObserver) {
  var body = document.getElementsByTagName('body') [0];
  var mutationObserver = new MutationObserver(updateiframes);
  mutationObserver.observe(body, {
    childList: true,
    subtree: true
  });
}

updateiframes(0);