PageSourceSearch

https://stupski.org/wp-content/themes/stupski/assets/js/stupski-video-block.js?ver=7.1.1.1739303180

js stupski.org collected 2026-09-24 09:35:53 UTC 2,226 bytes, 81 lines download raw bytes

1function get_youtube_thumbnail(url) {
2	if(url === null) {
3		return '';
4	}
5	const results = url.match('[\\?&]v=([^&#]*)');
6	const video = (results === null) ? url : results[1];
7	return 'http://img.youtube.com/vi/' + video + '/0.jpg';
8
9}
10
11document.addEventListener('DOMContentLoaded', () => {
12	let thumbnail_list_items = '';
13
14	const blocks = document.querySelectorAll('.stupski-video-block');
15	for(let i = 0; i < blocks.length; i++) {
16		var block_id = blocks[i].getAttribute('id');
17		new Splide(`#${block_id} .main-slider`).mount(window.splide.Extensions);
18		var main = new Splide(`#${block_id} .main-slider`, {
19			arrows: false,
20			pagination: false,
21			padding: '0px',
22			video: {
23				loop: true,
24				mute: false,
25				playerOptions: {
26					controls: 1,
27					fs: 1
28				}
29			}
30		});
31
32		main.on('moved', (newIndex) => {
33			document.querySelectorAll('.splide__video__wrapper iframe').forEach((iframe) => {
34				iframe.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}', '*')
35			});
36			document.querySelector(`#${block_id} .main-slider`).classList.remove('is-playing');
37		});
38
39		const slide_count = document.querySelectorAll(`#${block_id} .thumbnail-slider li`).length;
40		var show_thumbnail_navigation = (document.querySelectorAll(`#${block_id} .thumbnail-slider li`).length > 1);
41		if(show_thumbnail_navigation) {
42			var thumbnails = new Splide(`#${block_id} .thumbnail-slider`, {
43				type: 'loop',
44				//padding: '8px',
45				pagination: false,
46				perPage: (slide_count) > 4 ? 4 : slide_count,
47				perMove: 1,
48				breakpoints: {
49					400: {
50						perPage: 1
51					},
52					640: {
53						perPage: 2
54					},
55					960: {
56						perPage: 3
57					},
58					1024: {
59						perPage: 4
60					}
61				}
62			});
63			main.sync(thumbnails);
64		}
65
66
67		main.mount();
68
69
70		if(show_thumbnail_navigation) {
71			thumbnails.mount();
72			var thumbnail_slides = document.querySelectorAll(`#${block_id} .thumbnail-slider .splide__slide`);
73			for(let i = 0; i < thumbnail_slides.length; i++) {
74				thumbnail_slides[i].addEventListener('click', function(e) {
75					var index = this.getAttribute('data-index');
76					main.go(parseInt(index));
77				});				
78			}
79		}
80	}
81});

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.