PageSourceSearch

https://orimattila.fi/wp-content/themes/Orimattila/src/js/youtube-embed.js

js orimattila.fi collected 2026-10-02 12:12:09 UTC 1,403 bytes, 41 lines download raw bytes

1/* Light YouTube Embeds by @labnol */
2/* Web: https://www.labnol.org/ */
3
4function labnolIframe(div) {
5    var iframe = document.createElement("iframe");
6    iframe.setAttribute(
7      "src",
8      "https://www.youtube.com/embed/" + div.dataset.id + "?autoplay=1&rel=0"
9    );
10    iframe.setAttribute("frameborder", "0");
11    iframe.setAttribute("allowfullscreen", "1");
12    iframe.setAttribute(
13      "allow",
14      "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
15    );
16    div.parentNode.replaceChild(iframe, div);
17  }
18  
19  function initYouTubeVideos() {
20    var playerElements = document.querySelectorAll(".youtube-player, .youtube-player-fw");
21    for (var n = 0; n < playerElements.length; n++) {
22      var videoId = playerElements[n].dataset.id;
23      var div = document.createElement("div");
24      div.setAttribute("data-id", videoId);
25      var thumbNode = document.createElement("img");
26      thumbNode.src = "https://i.ytimg.com/vi/ID/maxresdefault.jpg".replace(
27        "ID",
28        videoId
29      );
30      div.appendChild(thumbNode);
31      var playButton = document.createElement("div");
32      playButton.setAttribute("class", "play");
33      div.appendChild(playButton);
34      div.onclick = function () {
35        labnolIframe(this);
36      };
37      playerElements[n].appendChild(div);
38    }
39  }
40  
41  document.addEventListener("DOMContentLoaded", initYouTubeVideos);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.