Embedded YouTube Player for Websites

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

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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();
     }
   }
   
})();