PageSourceSearch

https://img.ceskatelevize.cz/poradyaz/program_ini_2025.js?1790188032

js ceskatelevize.cz collected 2026-10-09 21:36:49 UTC 13,820 bytes, 443 lines download raw bytes

1/*
2new PerformanceObserver((entryList) => {
3	const entries = entryList.getEntries();
4	for (const entry of entries) {
5		console.log('Layout shift:', entry);
6	}
7	const lastEntry = entries[entries.length - 1]; // Use the latest LCP candidate
8	console.log("LCP:", lastEntry.startTime);
9}).observe({type: 'layout-shift', buffered: true});
10*/
11
12var
13	localStorageAvailable = isLocalStorageAvailable(),
14	channel = get_channel(),
15	init = true,
16	doc = {},
17	mainBox = {},
18	formPanel = {},
19	channels = {},
20	channelsTop = 0,
21	channelsFlow = "",
22	channelsList = {},
23	channelsDiff = 0,
24	programmeBlocks = {},
25	virtual = {},
26	virtualPar = {},
27	virtualPaddingBottom = 0,
28	virtualHeight = 0,
29	lastScrollTop = 0,
30	lastScrollDir = 0,
31	mainPanel = 0,
32	hideHeight = 0,
33	headerHeight = 0,
34	contentHeight = 0,
35	autoScrolled = false,
36	customScrolled = false,
37	scrollingTimeout = -1,
38	hideAuto = false,
39	videoOnlyBox = {},
40	videoOnlyAnimating = false,
41	lastCtgOpened = false,
42	hideMainPanel = 0,
43	mobileDisplay = false,
44	mobileMargin = 0,
45	blockTop = {},
46	analytika_wait = true,
47	animTime = 300,
48	WeekSlider_touch_detect = false,
49	calendar_touch_detect = false,
50	prevTime = new Date().getTime(),
51	calendarAnimating = false,
52	sticky = false,
53	lazyImages = false,
54	calendarInit = false,
55	timeLinksOverHeight = 0,
56	xx1 = xx2 = window.performance.now(),
57	ctg,
58	pozicovani,
59	selectedTime = 0,
60	noFiltered = document.documentElement.classList.contains("noFiltered"),
61	iPad = navigator.userAgent.match(/iPad/i),
62	webp_feature = 0,
63	has_webp_feature = false,
64	activeElement = false,
65	collapseLimit = 0,
66	noVideoHeight = 62; //výška announce
67
68var window_width, window_height, document_width, document_height;
69
70depo_idec = false;
71
72function check_webp_feature(feature) {
73	var kTestImages = {
74		lossy: "UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",
75		lossless: "UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",
76		alpha: "UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",
77		animation: "UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"
78	};
79	var img = new Image();
80	img.onload = function () {
81		if ((img.width > 0) && (img.height > 0)) {
82			webp_feature++;
83			if (webp_feature == 3) {
84				has_webp_feature = true;
85				document.documentElement.classList.add("webp");
86			}
87		}
88	};
89	img.src = "data:image/webp;base64," + kTestImages[feature];
90}
91check_webp_feature("lossy");
92check_webp_feature("lossless");
93check_webp_feature("alpha");
94
95function isLocalStorageAvailable() {
96	var test = 'test';
97	try {
98		localStorage.setItem(test, test);
99		localStorage.removeItem(test);
100		return true;
101	} catch(e) {
102		return false;
103	}
104}
105function setCookieAZ(cname, cvalue, exdays) {
106	if (localStorageAvailable) {
107		localStorage[cname] = cvalue;
108	} else {
109		var d = new Date();
110		d.setTime(d.getTime() + (exdays*24*60*60*1000));
111		var expires = "expires="+ d.toUTCString();
112		document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
113	}
114}
115function getCookieAZ(cname) {
116	if (localStorageAvailable) {
117		return localStorage[cname];
118	} else {
119		var name = cname + "=";
120		try {
121			decodeURIComponent(document.cookie);
122		} catch(err) {
123			document.cookie = "user-ct=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
124			document.cookie = "basket-ct=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
125			document.cookie = "contact-ct=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
126			console.log("Byla smazana stara cookie z eshopu!");
127		}
128		var decodedCookie = decodeURIComponent(document.cookie);
129		var ca = decodedCookie.split(';');
130		for(var i = 0; i <ca.length; i++) {
131			var c = ca[i];
132			while (c.charAt(0) == ' ') {
133				c = c.substring(1);
134			}
135			if (c.indexOf(name) == 0) {
136				return c.substring(name.length, c.length);
137			}
138		}
139	}
140	return "";
141}
142function get_channel() {
143	var co = document.documentElement.getAttribute("class").match(/.*(selectedChannel
143([0-9a-zA-Z]+)).*/);
144	var ch = co ? co[2] : getCookieAZ("CTPoradyTVchannel");
145	if (ch == 5) {
146		if (document.documentElement.classList.contains("currentChannelArt")) ch = "Art";
147		if (document.documentElement.classList.contains("currentChannelD")) ch = "D";
148	}
149	if (ch == 5) ch = "D";
150	if (ch == 6) ch = "Art";
151	//console.log(ch)
152	return ch && availableChannels.indexOf(ch)>-1 ? ch : 1;
153}
154
155var CookieLink = new function() {
156	this.init = function() {};
157};
158
159//otevírání odkazů do nového okna
160function openWindowInit() {
161	var links = document.getElementsByClassName('openWindow');
162	for (var i=0; i < links.length; i++) {
163		links[i].addEventListener('click', function(e) {
164			e.preventDefault();
165			window.open(this.getAttribute("href"));
166		});
167	}
168}
169
170//osobní poznámky
171function osobniPoznamkyInit() {
172	return false;
173}
174
175var WeekSlider = {
176
177	status: false,
178	
179	Define: {
180		IDs: {},
181		isSliding: false,
182		startDate: null,
183		endDate: null,
184		currentDate: null,
185		dayLink: null,
186		filterQuery: null,
187		months: null
188	},
189	obj: {
190	},
191	init: function(Define) {
192		WeekSlider.Define = Define;
193		WeekSlider.Define.isSliding = false;
194		WeekSlider.months = new Array('leden','únor','březen','duben','květen','červen','červenec','srpen','září','říjen','listopad','prosinec');
195		WeekSlider.status = true;
196	},
197	size: {
198		width:0,
199		container:0,
200		ul:0,
201		li:0,
202		margin: 0,
203	}
204
205};
206
207// podpanel
208var SiteControls = {
209	filterPanelVisible: false,
210	filterQuery: '',
211	panelDisplay: false,
212	status: false,
213	init: function(config) {
214		SiteControls.filterPanelVisible = config.filterPanelVisible;
215		SiteControls.filterQuery = config.filterQuery;
216		if (config.panelDisplay !== undefined) {
217			SiteControls.panelDisplay = config.panelDisplay;
218		}
219		SiteControls.status = true;
220		//document.getElementById("scheduleFilterFieldset").disabled = true;
221		//if (document.getElementById("subPanelLinkDelete")) document.getElementById("subPanelLinkDelete").tabIndex = -1;
222		//if (document.getElementById("subPanelLinkClose")) document.getElementById("subPanelLinkClose").tabIndex = -1;
223	}	
224};
225
226function collapseBlock(ktery) {
227	//return
228	if (getComputedStyle(document.getElementById("scheduleNavigationSubFormPanel")).position=="static") return;
229	var c;
230	if (ktery != undefined) {
231		if (!ktery.classList.contains("collapsableBlocks")) return false;
232		c = [ktery];
233	} else {
234		c = document.getElementsByClassName("collapsableBlocks");
235	}
236	var cp, pb, d, pr, min, prmax, nonCollapsableHeight, ph, pc;
237	for (var i=0; i<c.length; i++) {
238		//if (c[i].classList.contains("hideProgrammeList")) continue;
239		nonCollapsableHeight = 0;
240		prmax = 0;
241		pb = c[i].getElementsByClassName("programmeBlock");
242		d = false;
243		for (var j=0; j<pb.length; j++) {
244			if (pb[j].classList.contains("collapsableBlock")) {
245				d = pb[j];
246			} else if (!mobileDisplay) {
247				ph = pb[j].offsetHeight;
248				if (ph > nonCollapsableHeight) nonCollapsableHeight = ph;
249				pc = pb[j].getElementsByTagName("li").length;
250				if (pc > prmax) prmax = pc;
251			}
252		}
253		if (d) {
254			if (mobileDisplay) {
255				d.style.height = "";
256				d.classList.remove("collapsedBlock");
257			} else {
258				cp = d.getElementsByClassName("collapsedProgramme");//button
259				if (cp.length) {
260					d.style.height = "";
261					pr = d.getElementsByTagName("li");
262					if (prmax && pr.length - prmax <= 2 || pr.length <= 5) {
263						d.classList.remove("collapsedBlock");
264					} else {
265						//nonCollapsableHeight += collapseLimit;
266						min = pr[c[i].classList.contains("programmeListPast") ? pr.length-1 : 0].offsetHeight + cp[0].offsetHeight;
267						if (nonCollapsableHeight < min) nonCollapsableHeight = min;
268						if (d.offsetHeight >= nonCollapsableHeight + collapseLimit) {
269							d.style.height = nonCollapsableHeight+"px";
270							d.classList.add("collapsedBlock");
271						} else {
272							d.classList.remove("collapsedBlock");
273						}
274					}
275				}
276			}
277		}
278	}
279}
280
281if (!hideProgramme && (!performance || !performance.navigation || !performance.navigation.type) && noFiltered) {
282	if (selectedTime = getCookieAZ("CTPoradyTVtime")) {
283		document.documentElement.classList.add("selectedTime" + selectedTime);
284	}
285}
286
287function getCurrent() {
288	//return
289	
290	if (selectedTime) {
291		var b;
292		switch (selectedTime) {
293			case "24":
294				b = document.getElementsByClassName("progTimeBlock20");
295				if (b.length) b[0].classList.add("programmeListPast");
296			case "20":
297				b = document.getElementsByClassName("progTimeBlock16");
298				if (b.length) b[0].classList.add("programmeListPast");
299			case "16":
300				b = document.getElementsByClassName("progTimeBlock12");
301				if (b.length) b[0].classList.add("programmeListPast");
302			case "12":
303				b = document.getElementsByClassName("progTimeBlock06");
304				if (b.length) b[0].classList.add("programmeListPast");
305		}
306	} else if (!hideProgramme || mobileDisplay && !document.documentElement.classList.contains("currentChannel"+channel) && todayProgramme) return;
307	
308	var p = document.getElementsByClassName("programmeListPast");
309	if (p.length) {
310		hideAuto = false;
311		
312		var c = document.getElementById("programmeBlockChannels");
313		var mt = parseInt(getComputedStyle(document.getElementById("programmeBlocks")).marginTop, 10);
314		var ds = -channelsTop;
315		var vir, cur, fut, foo, but;
316
317		foo = document.getElementsByClassName("ctg-footer");
318		if (foo.length && !foo[0].offsetHeight) foo = document.getElementsByClassName("ctg-footer-mobile");
319		if (foo.length) foo[0].style.display = "none";
320		
321		but = document.getElementsByClassName("vysledek-button");
322		if (but.length) but[0].style.display = "none";
323
324		if (!mobileDisplay) {
325			vir = document.getElementById("programmeBlocksVirtual");
326			if (vir) vir.style.display = "none";
327		}
328		
329		fut = document.getElementsByClassName("programmeListFuture");
330		if (fut.length) for (var f=fut.length-1;f>=0;f--) { fut[f].style.display = "none"; }
331		
332		cur = document.getElementsByClassName("programmeCurrent");
333		if (cur.length) cur[0].style.display = "none";
334		
335		if (!c.style.position && getComputedStyle(c).position == "relative") {
336			c.style.top = "0";
337			c.style.position = "fixed";
338		}
339		if (c.style.position=="fixed" && document.getElementById("programmeBlockChannels").offsetHeight != parseInt(document.getElementById("scheduleBox").style.paddingTop,10)) {
340			document.getElementById("scheduleBox").style.paddingTop = c.offsetHeight + "px";
341		}
342		
343		document.documentElement.classList.remove("hideProgramme","selectedTime06","selectedTime12","selectedTime16","selectedTime20","selectedTime24");
344		
345		for (var i=0; i<p.length; i++) {
346			ds += p[i].offsetHeight;
347			window.scrollTo({top:ds + mt, behavior: "instant"});
348		}
349		
350		if (cur && cur.length) cur[0].style.display = "";
351		if (fut) for (var f=0;f<fut.length;f++) { fut[f].style.display = ""; }
352		if (vir) {
353			var virpar = document.getElementById("programmeBlockChannelVirtual");
354			vir.style.display = "";
355			virpar.style.width = vir.offsetWidth + "px";
356			virpar.style.top = c.offsetHeight + "px";
357			virpar.style.position = "fixed";
358		}
359		if (but && but.length) but[0].style.display = "";
360		if (foo && foo.length) foo[0].style.display = "";
361		
362		window.scrollTo({top:ds + mt, behavior: "instant"});
363		hideAuto = true;
364		lastScrollTop = ds + mt;
365		lastScrollDir = 0;
366	}
367}
368
369function beforeHideProgramme() {
370	if (hideProgramme || selectedTime>"06" && channel!="Art" || selectedTime>"20" && channel=="Art") {
371		if ((!mobileDisplay || document.getElementsByClassName("programmeBlockChannel"+channel).length) && !document.getElementById("programmeBlockChannels").classList.contains("programmeBlockChannelsShadowDefault")) {
372			document.getElementById("programmeBlockChannels").classList.add("programmeBlockChannelsShadowDefault");
373		}
374		if (selectedTime) {
375			document.getElementById("timeLinks").classList.add("scrolledTime" + selectedTime);
376		} else if (hideProgramme) {
377			if (todayProgramme) {
378				document.getElementById("timeLinks").classList.add("scrolledTimeTED");
379			} else if (channel=="D" && mobileDisplay) {
380				document.getElementById("timeLinks").classList.add("scrolledTime06");
381			} else {
382				document.getElementById("timeLinks").classList.add("scrolledTime20");
383			}
384		} else {
385			document.getElementById("timeLinks").classList.add("scrolledTime06");
386		}
387	} else if (channel=='Art') {
388		document.getElementById("timeLinks").classList.add("scrolledTime20");
389	} else {
390		document.getElementById("timeLinks").classList.add("scrolledTime06");
391	}
392	if (typeof tomorrowAfterMidnight != "undefined" && tomorrowAfterMidnight) {
393		var p = document.getElementsByClassName("programmeListPast");
394		if (p.length) p[p.length-1].classList.remove("programmeListPast");
395		var cp = document.getElementsByClassName("collapsedProgramme");
396		if (cp.length) {
397			var ca = cp[cp.length-1].getElementsByTagName("A");
398			if (ca.length) ca[0].innerHTML = "Následující pořady";
399		}
400	}
401}
402
403function prepareHiddenPrograme() {
404	if (!mobileDisplay) collapseBlock();
405	getCurrent();
406}
407
408if (window.ctgHeader && window.ctgHeader.emitter) {
409	window.ctgHeader.emitter.on("user_logged", function(data) {
410		gtm_view(data);
411	});
412} else {
413	window.onload = function() {
414		gtm_view();
415	};
416}
417
418if (window.matchMedia) {
419	prefersColorSchemeDark = window.matchMedia("(prefers-color-scheme: dark)");
420	if (localStorage) {
421		if (!localStorage["iVysilaniThemeMode"]) {
422			switch (localStorage["TVprogram-color-scheme-dark"]) {
423				case "ano":
424					localStorage["iVysilaniThemeMode"] = "dark";	
425					break;
426				case "ne":
427					localStorage["iVysilaniThemeMode"] = "light";
428					break;
429				default:
430					localStorage["iVysilaniThemeMode"] = "system";	
431			}
432		}
433		if (localStorage["iVysilaniThemeMode"] == "dark" || localStorage["iVysilaniThemeMode"] == "system" && prefersColorSchemeDark.matches) {
434			document.documentElement.classList.add("color-scheme-dark");
435		}
436	}
437}
438
439function debug(x) {
440	xx2 = window.performance.now();
441	console.log(""+x, xx2-xx1);
442	xx1 = xx2;
443}

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.