pub / yt2html

Fetches Youtube content via RSS and provides a chronological timeline
git clone https://src.jayvii.de/pub/yt2html.git
Home | Log | Files | Exports | Refs | README | RSS

yt.js (760B)


      1 // Embed Youtube Video
      2 function embed_yt(oid, vid) {
      3   // Scroll to video section
      4   window.location = "#entry_" + oid;
      5   // Fetch thumbnail image to replace
      6   var img = document.querySelector("#thumbnail_" + oid);
      7   // Create player iframe-object and set
      8   var player = document.createElement("iframe");
      9   player.id = "videoplayer_" + oid;
     10   player.allowFullscreen = "true";
     11   player.sandbox = "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox";
     12   player.width = "100%";
     13   player.frameborder = "0";
     14   player.scrolling = "no";
     15   player.loading = "lazy";
     16   player.allow = "autoplay";
     17   player.src = "https://www.youtube-nocookie.com/embed/" + vid + "?autoplay=1";
     18   // Replace thumbnail image with player
     19   img.replaceWith(player);
     20 }
     21