Embedded YouTube Player for Websites

Spawns a youtube player that can be resized and moved on every page.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Embedded YouTube Player for Websites
// @namespace    http://www.example.com
// @version      0.1
// @description  Spawns a youtube player that can be resized and moved on every page.
// @author       Miles
// @match        *://*/*
// @grant        none
// ==/UserScript==
 (function() {

  let player = spawnB();


  function spawnB(){
    spawnA();
    var tag = document.createElement('script');
    var iDiv = document.createElement('div');
    iDiv.className = 'YouTube Player';
    document.getElementsByTagName('body')[0].appendChild(iDiv);
       tag.src = "https://www.youtube.com/iframe_api";
       var firstScriptTag = document.getElementsByTagName('script')[0];
       firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
       var player;
       function onYouTubeIframeAPIReady() {
         player = new YT.Player('player', {
           height: '0',
           width: '0',
           videoId: prompt("URL:"),
           events: {
             'onReady': onPlayerReady
           }
         });
       }
       function onPlayerReady(event) {
         event.target.setVolume(100);
         event.target.playVideo();
       }  
  }
  
  function spawnA(){
  var tag = document.createElement('script');
  var iDiv = document.createElement('div');
  iDiv.className = 'ograndeegostosoplayeroculto';
  document.getElementsByTagName('body')[0].appendChild(iDiv);
     tag.src = "https://www.youtube.com/iframe_api";
     var firstScriptTag = document.getElementsByTagName('script')[0];
     firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
     var player;
     function onYouTubeIframeAPIReady() {
       player = new YT.Player('player', {
         height: '0',
         width: '0',
         videoId: 'Gn8GH8gOiXY',
         events: {
           'onReady': onPlayerReady
         }
       });
     }
     function onPlayerReady(event) {
       event.target.setVolume(0); /* kk ngm vai ouvir */
       event.target.playVideo();
     }
   }
   
})();