PageSourceSearch

https://www.autorskecteni.cz/front/_starter/js/project.js?v=c13cd2110d6fa47dedccc0089f5272dc

js autorskecteni.cz collected 2026-09-24 10:01:02 UTC 7,844 bytes, 322 lines download raw bytes

1/*****************************************************************************/
2/* JS pro úprava šablony STARTER												 */
3/*****************************************************************************/
4
5
6$(document).ready(function () {
7  // Inicializace
8  $.nette.init();
9  LazyLoadSources();
10  initMagnific();
11
12  // Smooth scrolling using jQuery easing
13  $('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function() {
14	  if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
15		  var target = $(this.hash);
16		  target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
17		  if (target.length) {
18			  $('html, body').animate({
19				scrollTop: (target.offset().top - 54)
20			  }, 1000, "easeInOutExpo");
21			  return false;
22		  }
23	  }
24  });
25
26  // Closes responsive menu when a scroll trigger link is clicked
27  $('.js-scroll-trigger').click(function() {
28	  $('.navbar-collapse').collapse('hide');
29  });
30
31  // Activate scrollspy to add active class to navbar items on scroll
32  $('body').scrollspy({
33	  target: '.mainNav',
34	  offset: 56
35  });
36
37  // Collapse Navbar
38  var navbarCollapse = function() {
39	  if ($(".mainNav").offset().top > 100) {
40		   $(".mainNav").addClass("navbar-shrink");
41	  } else {
42		   $(".mainNav").removeClass("navbar-shrink");
43	  }
44  };
45
46  // Navbar informace že bylo rozkliknuto (například pro podbarvení)
47  $("body").on("click", ".navbar-toggler", function () {
48	if ($(this).hasClass('collapsed')) {
49	  $('.navbar').addClass('navbar-open-menu');
50	} else {
51	  $('.navbar').removeClass('navbar-open-menu');
52	}
53  });
54
55  // Collapse now if page is not at top
56  navbarCollapse();
57  // Collapse the navbar when page is scrolled
58  $(window).scroll(navbarCollapse);
59
60  if (typeof LiveForm !== 'undefined') {
61	  LiveForm.setOptions({
62		  messageErrorPrefix: '<i class="fal fa-exclamation"></i>&nbsp;',
63		  wait: 500
64	  });
65  }
66
67  /* FlashMessages skrytí po kliku vedle */
68  $("body").on("click", "#flash", function () {
69    if (event.target.id == "flash") {
70      $("#flash").fadeOut();
71    }
72  });
73
74  $('.carousel-indicators-item').on("click", function() {
75    var sliderId = $(this).parent().parent().data('slider-id');
76    $('#'+sliderId).carousel($(this).data('item-id'));
77  });
78
79  /* Infoblock - zobrazení dokud není nastavena cookie, skrytí po kliknutí na křížek (24 h) */
80  if (!getCookie('infoblock')) {
81    $('.infoblock-inner').addClass('active');
82  }
83  $('body').on('click', '.infoblock div.cross', function () {
84    setCookie('infoblock', true, 24);
85    $('.infoblock-inner').removeClass('active').hide();
86  });
87});
88
89
90var LazyLoadSources = function() {
91	/**
92	 * Lazy load
93	 * @see https://github.com/verlok/lazyload
94	 */
95	var lazyLoadInstance = new LazyLoad({
96		elements_selector: ".lazy-load",	// selector
97		threshold: 150,	// počet pixelů do zobrazení obrázku pro načtení
98		load_delay: 0	// zpožděné načtení
99	});
100};
101
102
103/************/
104/*** AJAX ***/
105/************/
106
107/**
108 * Základní nastavení ajaxu, volá funkci initAjaxFunction()
109 */
110$(document).ajaxStart(function (e) {
111	$('#front-ajax-loader').show();
112});
113
114
115$(document).ajaxStop(function (e) {
116	initAjaxFunction();
117	$('#front-ajax-loader').hide();
118});
119
120
121/**
122 * Inicializace funkcí
123 */
124var initAjaxFunction = function () {
125	LazyLoadSources();
126  initMagnific();
127};
128
129/**
130 * Může se lišit a nemusí být třeba
131 */
132var initAjaxFunctionAfterSelectVariant = function() {
133  //initMagnific();
134};
135
136
137/**
138 * Změna URL po AJAXU
139 *
140 * @param link
141 */
142var pushState = function (link) {
143	window.history.pushState(
144			  '',
145			  '',
146			  link
147			  );
148};
149
150
151/**
152 * Vrátí data z LS
153 *
154 * @use favorite-item a last-visited-items
155 *
156 * @param type
157 */
158var getLocalStorage = function (type) {
159	var items = JSON.parse(localStorage.getItem(type));
160	if (items == null) {
161		items = [];
162		localStorage.setItem(type, JSON.stringify(items));
163		items = JSON.parse(localStorage.getItem(type));
164	}
165
166	return items;
167};
168
169
170/*=FLASH_MESSAGES ************************************************************/
171/**
172 * Skrytí flash messages
173 */
174var hideFlash = function () {
175  if ($("#flash .item").length) {
176    var refreshIntervalId = setInterval(function () {
177      $("#flash .item").each(function () {
178        var item = $(this);
179        if (
180          item.hasClass("info") ||
181          item.hasClass("warning") ||
182          item.hasClass("note")
183        ) {
184          $("#flash").fadeOut();
185          clearInterval(refreshIntervalId);
186        }
187      });
188    }, 4000);
189  }
190};
191var hideFlashManulay = function () {
192  if ($("#flash .item").length) {
193    $("#close-flash").on("click", function () {
194      $("#flash").fadeOut();
195    });
196  }
197};
198
199
200/*=MAGNIFIC_POPUP ************************************************************/
201/**
202 * MagnificPopup init
203 * http://dimsemenov.com/plugins/magnific-popup/
204 */
205var initMagnific = function () {
206	// LIGHTBOX - MAGNIFIC_POPUP
207
208	// Ukázka jak nastavit magnific popup
209
210	$('.popup-image').magnificPopup({
211		delegate: '', // child items selector, by clicking on it popup will open
212		type:'image',
213		closeOnContentClick: true,
214		image: {
215			verticalFit: false
216		}
217	});
218
219	$('.popup-gallery').magnificPopup({
220		delegate: 'div.item div a', // child items selector, by clicking on it popup will open
221		type: 'image',
222		gallery:{
223			enabled:true
224		}
225	});
226
227	$('.popup-youtube').magnificPopup({
228		type: 'iframe',
229		mainClass: 'mfp-fade',
230		removalDelay: 160
231	});
232};
233
234/*
235 * Funkce pro změnu parametrů v url adrese
236 *
237 * @name Url Param Chenger
238 * @version 1.0.0
239 *
240 * @author Jiří Bartošík <[email protected]>
241 * @copyright Copyright Via Aurea s. r. o., 2018
242 *
243 */
244
245/**
246 * GET PARAM FROM URL
247 * - získá hodnotu parametru z URL adresy
248 *
249 * @param	param	String	jméno parametru (např. paginator-page)
250 * @return  value	String	hodnota parametru (např. 1)
251 */
252var getUrlParam = function (param) {
253  var results = new RegExp("[?&]" + param + "=([^&#]*)").exec(
254    window.location.href
255  );
256
257  if (results === null) {
258    return null;
259  } else {
260    return decodeURI(results[1]) || 0;
261  }
262};
263
264/**
265 * SET PARAM TO URL
266 * - přidání parametru do URL adresy
267 *
268 * @param	param	String	jméno parametru (např. paginator-page)
269 * @param	value	String	hodnota parametru (např. 1)
270 * @return	url		String	výsledná url adresa
271 */
272var setUrlParam = function (param, value) {
273  var result = new RegExp(param + "=([^&]*)", "i").exec(window.location.search);
274  result = (result && result[1]) || "";
275
276  var loc = window.location;
277  var url = loc.protocol + "//" + loc.host + loc.pathname + loc.search;
278
279  // Hodnota je prázdná = smažu parametr
280  if (value === "") {
281    var search = window.location.search;
282    var urlSearch = search.replace(param + "=" + getUrlParam(param), "");
283
284    url = window.location.origin + window.location.pathname + urlSearch;
285
286    // parametr v adrese ještě není
287  } else if (result === "") {
288    // ještě zde nejsou žádné parametry
289    if (loc.search === "") {
290      url += "?" + param + "=" + value;
291    } else {
292      url += "&" + param + "=" + value;
293    }
294
295    // parametr již v adrese je
296  } else {
297    // Změna parametru
298    var search = window.location.search;
299    var urlSearch = search.replace(
300      param + "=" + getUrlParam(param),
301      param + "=" + value
302    );
303    url = window.location.origin + window.location.pathname + urlSearch;
304  }
305
306  // Nastavení URL adresy
307  window.history.pushState("", "", url);
308
309  return url;
310};
311
312function setCookie(key, value, hours) {
313  var expires = new Date();
314  expires.setTime(expires.getTime() + hours * 60 * 60 * 1000);
315  document.cookie =
316    key + "=" + value + ";path=/;expires=" + expires.toUTCString();
317}
318
319function getCookie(key) {
320  var keyValue = document.cookie.match("(^|;) ?" + key + "=([^;]*)(;|$)");
321  return keyValue ? keyValue[2] : null;
322}

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.