PageSourceSearch

https://obalkyknih.cz/js/script.js?v=3

js obalkyknih.cz collected 2026-10-02 06:57:08 UTC 13,440 bytes, 458 lines download raw bytes

1$(function () {
2
3/* Glider
4------------------------------------------------------------------------------*/
5
6var topLinks = $(".topLinks > ul > li > a", "#blackbox");
7var topLinksEl;
8topLinks.on("click", function(event) {
9	event.preventDefault();
10	topLinks.removeClass("active");
11	$(this).addClass("active");
12	topLinksEl = $($(this).attr("href"));
13	$("#section").scrollTo(topLinksEl, 500);
14});
15
16
17var glider = $(".glider", "#blackbox");
18var gliderLiWidth = 185;
19var gliderUlWidth = 980;
20var gliderCount = 4;
21
22if(glider.length) {
23	glider.each(function() {
24		var gliderHolder = $(this);
25		var gliderUl = $("ul", gliderHolder);
26		var gliderNav = $(".gliderNav", gliderHolder);
27
28		/* Points in glider controls */
29		var gliderPoints = "";
30		//var gliderSections = Math.ceil($("li", gliderHolder).length / gliderCount);
31		var gliderSections = 4;
32		for (var i = 1; i <= gliderSections; i++) {
33			gliderPoints += '<a class="replace point" href="#">' + i + '<span></span></a>';
34		}
35
36		/* Glider controls = points and arrows */
37		gliderNav.append('<p class="squares">' + gliderPoints +'</p> <p class="arrows"><a class="prevSlide replace" href="">&lt;<span></span></a> <a class="nextSlide replace" href="">&gt;<span></span></a></p>');
38		$("ul", gliderHolder).width($("li", gliderHolder).length * gliderLiWidth);
39
40		var gliderNavPrev = $(".prevSlide", gliderNav);
41		var gliderNavNext = $(".nextSlide", gliderNav);
42
43		$('.point:first', gliderNav).addClass('active');
44
45		/* Check glider width */
46		function setGliderElementWidth() {
47			var documentWidth = document.documentElement.scrollWidth;
48			console.log("Document width: " + documentWidth + "px");
49			var gliderUlWidth = 680;
50			if (documentWidth >= 1400) {
51				gliderUlWidth = 1080;
52			} else if (documentWidth >= 1200) {
53				gliderUlWidth = 850;
54			} else if (documentWidth >= 992) {
55				gliderUlWidth = 925;
56			}
57			console.log("Glider width: " + gliderUlWidth + "px");
58			return gliderUlWidth;
59		}
60
61		/* Check previous/next arrows */
62		function checkArrows() {
63			/* If is first item active, stop clickable */
64			if($(".squares a.point:first", gliderNav).hasClass("active")) {
65				gliderNavPrev.addClass("disabled");
66			} else {
67				gliderNavPrev.removeClass("disabled");
68			}
69
70			/* If is last item active, stop clickable */
71			if($(".squares a.point:last", gliderNav).hasClass("active")) {
72				gliderNavNext.addClass("disabled");
73			} else {
74				gliderNavNext.removeClass("disabled");
75			}
76		}
77
78
79		/* Next arrow
80			- show previous 3 items
81		*/
82		gliderNavNext.click(function(event) {
83			event.preventDefault();
84			if(!$(this).hasClass("disabled")) {
85				gliderUlWidth = setGliderElementWidth();
86				gliderNavPrev.removeClass("active");
87				gliderUl.animate({marginLeft: -gliderUlWidth * parseInt($(".squares .active", gliderNav).html())}, {queue: false, duration: 250});
88				$(".squares .active", gliderNav).removeClass("active").next().addClass("active");
89
90				if($(".squares .point:nth-child(" + (gliderSections) + ")", gliderNav).hasClass("active")) {
91					$(this).addClass("disabled");
92				}
93			}
94			checkArrows();
95		});
96
97
98		/* Previous arrow
99			- show next 3 items
100		*/
101		gliderNavPrev.click(function(event) {
102			event.preventDefault();
103			if(!$(this).hasClass("disabled")) {
104				gliderUlWidth = setGliderElementWidth();
105				gliderNavNext.removeClass("active");
106				gliderUl.animate({marginLeft: -gliderUlWidth * (parseInt($(".squares .active", gliderNav).html())-2)}, {queue: false, duration: 250});
107				$(".squares .active", gliderNav).removeClass("active").prev().addClass("active");
108
109				if($(".squares .point:nth-child(1)").hasClass("active")) {
110					$(this).addClass("disabled");
111				}
112			}
113			checkArrows();
114		});
115
116
117		/* Points in glider controls
118			- shows selected 3 items
119		*/
120		$(".point", gliderNav).click(function(event) {
121			gliderUlWidth = setGliderElementWidth();
122			event.preventDefault();
123			gliderUl.animate({marginLeft: -gliderUlWidth * (parseInt($(this).html())-1)}, {queue: false, duration: 250});
124			$(".squares .active", gliderNav).removeClass("active");
125			$(this).addClass("active");
126			checkArrows();
127		});
128
129		checkArrows();
130	});
131}
132
133
134$('a.print').click(function(){
135	window.print();
136});
137
138$('input[name="type"]').click(function(){
139	if ($(this).val() == 'z3950') {
140		$('div#type_check').show();
141	}
142	else {
143		$('div#type_check').hide();
144	}
145
146});
147
148// SHP form labels
149$('#blue form input').focus(function () {
150	$(this).prev('label').fadeOut('fast');
151}).blur(function () {
152	if ($(this).val() == '' & $(this).text() == '') $(this).prev('label').fadeIn('fast');
153});
154$('#blue form input').each(function () {
155	if ($(this).val() != '' || $(this).text() != '') $(this).prev('label').remove();
156});
157
158
159// Footer logos hover effect
160$('footer .author').hover(function(){
161	$(this).find('span').stop(true,true).fadeOut('fast');
162},function(){
163	$(this).find('span').stop(true,true).fadeIn('slow');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ('slow');
164});	
165
166// Common confirm dialog
167$('.confirm-common').on('click', function(){
168	if (!confirm($(this).text() + ' ?')) {
169		return false;
170	}
171});
172
173
174// Quick edit - delete modal dialog
175$('.qe-table a.qe-action-del').on('click', function(){
176	if (!confirm('Skutečně si přejete smazat tuto položku ?')) { 
177		return false;
178	}
179});
180
181
182// Quick edit - edit single column
183$('.qe-table a.qe-action-edit').on('click', function(){
184	$('.qe-form').hide();
185	$('.qe-form input[type="submit"]').css('visibility', 'visible');
186	$('.qe-form input[type="image"]').hide();
187	$(this).parent().parent().find('form.qe-form').show();
188	return false;
189});
190$('.qe-table .qe-cancel, .qe-table .f-form .f-cancel').on('click', function(){
191	$(this).parent().parent().hide();
192	return false;
193});
194$('form.qe-form').on('submit', function(){
195	var self = $(this);
196	self.find('input[type="submit"]').css('visibility', 'hidden');
197	self.find('input[type="image"]').show();
198	ajaxLoader = $.ajax({
199		url: '//'+window.location.hostname+$(this).attr('action'),
200		data: 'val='+self.find('input[type="text"]').val(),
201		type: 'POST',
202		success: function(data, textStatus, XMLHttpRequest) {
203			var error = $(data).find('.error');
204			if (error.length > 0) {
205				// update hlasi chybu, hodnota nebyla ulozena
206				$('.qe-form input[type="submit"]').css('visibility', 'visible');
207				$('.qe-form input[type="image"]').hide();
208				alert(error.text());
209			} else {
210				// update provedeny
211				self.parent().find('span.qe-value').text( self.find('input[type="text"]').val() );
212				self.hide();
213			}
214		},
215		failure: function(data, textStatus, XMLHttpRequest) {
216			alert('Ukládání selhalo. Prosím, pokus opakujte.');
217			self.hide();
218		}
219	});
220	return false;
221});
222
223// Quick edit - edit single column
224$('a.f-icon').on('click', function() {
225	$(this).next().show();
226	return false;
227});
228
229// Periodika
230$('div.parts-list .parts-list-toggle').click(function() {
231	$(this).toggleClass('fa-plus');
232	$(this).toggleClass('fa-minus');
233	var parent = $(this).parent().parent();
234	parent.children('.parts-list-container').toggleClass('d-none');
235	parent.find('img').each(function(){
236		var src = $(this).data('src');
237		if (src!='') {
238			$(this).attr('src', src);
239			$(this).data('src', '');
240		}
241	});
242});
243
244// Toggle
245$('.toggle-controller').click(function() {
246	$(this).next().removeClass('d-none');
247	$(this).addClass('d-none');
248	return false;
249});
250
251// View show more
252$('#show-more-block > a').on('click', function() {
253	var id = $(this).data('id');
254	var page, partsElement, newParts, responseData, newTable, noMore;
255	if ($(this).data('page')) {
256		page = $(this).data('page');
257	} else {
258		page = 2;
259	}
260	
261	$('#show-more-loader').removeClass('d-none');
262	
263	var httpPort = (window.location.port == 443) ? '' : ':' + window.location.port;
264
265	$.ajax({
266		url: '//' + window.location.hostname + httpPort + '/view'+window.location.search,
267		data: {book_id : id, page : page},
268		dataType: "html",
269		type: 'POST',
270		success: function(data, textStatus, resp) {
271			var responseData = $(data);
272			$('#show-more-block > a').data('page',parseInt(page)+1);
273			var newTable = '<div class="showmore-page' + parseInt(page) + '">' + responseData.find('.parts-showmore-container').html() + '</div>';
274			$(newTable).insertBefore('#show-more-loader');
275			noMore = responseData.find('input[name=no_more_pages]').val();
276			if (noMore == 1){
277				$('#show-more-block > a').parent().remove();
278				$('#show-more-spacer').append('<br/>');
279			}
280			$('#show-more-loader').addClass('d-none');
281			
282			$('.showmore-page' + parseInt(page) + ' .parts-list-toggle').click(function(){
283				$(this).toggleClass('fa-plus');
284				$(this).toggleClass('fa-minus');
285				var parent = $(this).parent().parent();
286				parent.children('.parts-list-container').toggleClass('d-none');
287				parent.find('img').each(function(){
288					var src = $(this).data('src');
289					if (src!='') {
290						$(this).attr('src', src);
291						$(this).data('src', '');
292					}
293				});
294			});
295		}	
296	});
297	return false;
298});
299
300// Delete auth cover on admin_auth_cover
301$('.auth-cover-del').on('click', function(){
302	var id = $(this).data('id'),
303		img = $(this).next(); 
304	
305	img.attr('src', '/img/loading_small.gif');
306	
307	$.ajax({
308		url: '//'+window.location.hostname+'/admin_auth_cover',
309		data: 'del='+id,
310		type: 'POST',
311		success: function(data, textStatus, XMLHttpRequest) {
312			img.attr('src', '/img/spacer.gif');
313		},
314		failure: function(data, textStatus, XMLHttpRequest) {
315			img.attr('src', '/img/error_big.gif');
316		}
317	});
318	return false;
319});
320
321
322// Datove tabulky
323/*
324$('.okcz-datatable').DataTable({
325	"language": {
326		"lengthMenu": "Zobrazit _MENU_ záznamů na stránku",
327		"zeroRecords": "Nenalezeno",
328		"info": "Stránka _PAGE_ z _PAGES_",
329		"infoEmpty": "Nenalezeno",
330		"infoFiltered": "(z celkového počtu _MAX_ záznamů)",
331		"search": "Vyhledat",
332		"nextButton": "Další",
333		"previousButton": "Předchozí"
334	}
335});
336
337// Suggestions check all
338$('.suggestions-check-all').click(function(){
339var id = $(this).data('id');
340$('.for-' + id + ' input').prop('checked', true);
341	return false;
342});
343
344// Suggestions uncheck all
345$('.suggestions-uncheck-all').click(function(){
346	var id = $(this).data('id');
347$('.for-' + id + ' input').prop('checked', false);
348	return false;
349});
350*/
351
352/*
353// Fetch all the forms we want to apply custom Bootstrap validation styles to
354const forms = document.querySelectorAll('.needs-validation')
355
356// Loop over them and prevent submission
357Array.from(forms).forEach(form => {
358  form.addEventListener('submit', event => {
359	if (!form.checkValidity()) {
360	  event.preventDefault()
361	  event.stopPropagation()
362	}
363
364	form.classList.add('was-validated')
365  }, false)
366})
367*/
368
369});
370
371
372
373/* View
374------------------------------------------------------------------------------*/
375
376function view_abuse_onsubmit() {
377	var textarea = document.getElementById("abuse_comment");
378	if(textarea.style.display == 'none') {
379		textarea.style.display = 'block';
380		return false;
381	} else {
382		if(textarea.value.length < 10) {
383			alert('Zadejte prosím popis chyby.');
384			return false;
385		}
386		return true;
387	}
388}
389
390function view_abuse_toc_onsubmit() {
391	var textarea = document.getElementById("abuse_toc_comment");
392	if(textarea.style.display == 'none') {
393		textarea.style.display = 'block';
394		return false;
395	} else {
396		if(textarea.value.length < 10) {
397			alert('Zadejte prosím popis chyby.');
398			return false;
399		}
400		return true;
401	}
402}
403
404function view_abuse_bib_onsubmit() {
405	var textarea = document.getElementById("abuse_bib_comment");
406	if(textarea.style.display == 'none') {
407		textarea.style.display = 'block';
408		return false;
409	} else {
410		if(textarea.value.length < 10) {
411			alert('Zadejte prosím popis chyby.');
412			return false;
413		}
414		return true;
415	}
416}
417
418function view_review_onsubmit() {
419	var name   = document.getElementById("review_name");
420	var text   = document.getElementById("review_text");
421	var rating = document.getElementById("review_rating");
422	if(name.value == '') {
423		alert('Do pole "Od" zadejte Vaše jméno.');
424		return false;
425	}
426	var textLength = text.value.length;
427	if(textLength && textLength < 10) {
428		alert('Napište komentář k dané knížce (alespoň 10 znaků).');
429		return false;
430	}
431	alert('Děkujeme za Vaše hodnocení. Po schválení bude zveřejněno na této stránce.');
432	return true;
433}
434
435function vote(obj,id,amnt){
436	$('#review_rating').val(amnt);
437	$('.star-rating a').removeClass('active');
438	$('#review_recaptcha').show();
439	for (i=amnt; i>0; i--) {
440		$('.star-rating a.s' + i).addClass('active');
441	}
442}
443
444function starsOver(amnt){
445	$('.star-rating a').removeClass('hover');
446	for (i=amnt; i>0; i--) {
447		el = '.star-rating a.s' + i;
448		if (!$(el).is('.active')) {
449			$(el).addClass('hover');
450		}
451	}
452}
453
454function showRecaptcha(){
455	if (!$('#review_recaptcha').is(':visible')) {
456		$('#review_recaptcha').toggle("highlight");
457	}
458}

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.