PageSourceSearch

https://16handles.com/wp-content/themes/16handles/js/ytbg.js

js 16handles.com collected 2026-09-26 02:33:23 UTC 2,424 bytes, 100 lines download raw bytes

1// jQuery youtube-background plugin
2// by Florian CHAPON
3// http://www.florian-chapon.fr/
4// version: 1.0
5// updated: Febrary 19, 2016
6// since 20166
7// Enjoy.
8//
9// Florian 
10
11
12$(document).ready(function () {
13	//var div = "<div id='front-background' style='position:fixed;width:100%;height:100%;z-index:-1;'></div><div id='yt-background' style='position:fixed; width:100%; height:100%; z-index:-2;'><div id='ytplayer' style='position: absolute;'</div>";
14	//$("body").prepend(div);
15});
16
17
18 var tag = document.createElement('script');
19    tag.src = "https://www.youtube.com/iframe_api";
20    var firstScriptTag = document.getElementsByTagName('script')[0];
21    firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
22    var player;
23	
24	// Default value 
25	var embedId = "vQWlNALvbhE";
26	var starttime = 0; 
27	var endtime = 0;
28	var setvolume = "0";
29	
30	
31	function ytbg(url, start, end, vol){
32		embedId = url;
33		starttime = start;
34		endtime = end;
35		setvolume = vol;
36
37        player = new YT.Player('ytplayer', {
38            videoId: embedId,
39            playerVars:{
40                controls:0,
41                showinfo:0,
42                modestbranding:1,
43                autoplay: 1,
44                start:starttime,
45                end:endtime,
46                rel: 0,
47                wmode:"transparent"
48            },
49
50            events: {
51                onReady:onPlayerReady,
52                onStateChange:onPlayerStateChange
53            }
54        });
55	}
56	
57	
58    function onPlayerReady() {
59        player.playVideo();
60		player.setVolume(setvolume);
61        // Mute!
62        // player.mute();	
63    }
64	function onPlayerStateChange(e) {
65		 if (e.data === YT.PlayerState.ENDED) {
66            player.seekTo(starttime);
67		}
68	}
69
70	
71setInterval(function(){
72		
73	// Get viewport informations 
74	var height = $( window ).height();
75	var width = $( window ).width();
76	
77	// Calculate height and width considering 16/9 ratio 
78	var calcH = height * (16 / 9);
79	var calcW = width * (9 / 16);
80	
81	// Calculate left and top position to center player 
82	var left = (width - calcH) / 2;
83	var top = (height - calcW) / 2;
84	
85	// Responsive player, size and position 	
86	if ( width < calcH) {
87		$("#ytplayer").css("width", calcH);
88		$("#ytplayer").css("height", height);
89		$("#ytplayer").css("left", left);		
90	}
91	
92	else { 
93		$("#ytplayer").css("width", width);
94		$("#ytplayer").css("height", calcW);
95		$("#ytplayer").css("top",top);
96	}
97	
98},100);
99		
100	

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.