PageSourceSearch

https://kbz.in.ua/wp-content/themes/sitegist-theme/assets/js/script.js?ver=56.22

js kbz.in.ua collected 2026-10-02 18:29:03 UTC 40,469 bytes, 1,692 lines download raw bytes

1(function ($) {
2	"use strict";
3
4	$('img').on('dragstart', function (event) {
5		event.preventDefault();
6	});
7
8	$(window).on("scroll touchmove", function () {
9		$('body').toggleClass('scroll', $(document).scrollTop() > 0);
10	});
11
12
13	let searchPanel = document.querySelector('.quick-srch');
14	$('.quick-srch-opener').click(function (e) {
15		mainSearch("open");
16	})
17	
18	// only for demonstaration autosgs
19	// call from .main-search wrapper
20	function showHideAutoSgs(context) {
21
22		let mainSearch = context.parents('.main-search'),
23			contextInput = mainSearch.find('.main-search__ctrl');
24
25		if (contextInput.val().length >= 1) {
26			mainSearch.addClass('main-search--with-result')
27		} else {
28			mainSearch.removeClass('main-search--with-result')
29			contextInput.removeClass('notEmpty')
30		}
31
32	}
33
34
35	$('.main-search__ctrl').on('input', function (e) {
36
37		if ($(this).val().length >= 1) {
38			$(this).addClass('notEmpty')
39		} else {
40			$(this).removeClass('notEmpty')
41		}
42		showHideAutoSgs($(this))
43	});
44
45
46	function mainSearch(action) {
47
48		if (action !== "close") {
49			$('body').addClass('quick-srch-opened');
50			DLAnimate.show(searchPanel, {
51				name: 'scale',
52				track: 'animation'
53			});
54			setTimeout(function () {
55				$('.main-search__ctrl').focus()
56			}, 300)
57		} else {
58			$('body').removeClass('quick-srch-opened');
59			DLAnimate.hide(searchPanel, {
60				name: 'scale',
61				track: 'animation'
62			});
63		}
64	}
65
66	$('.quick-srch-closer').click(function (e) {
67		mainSearch('close')
68	})
69
70
71	// visualSlider
72	// var swiperAnimation = new SwiperAnimation();
73	var visualSlider = new Swiper('.visual', {
74		speed: 400,
75		spaceBetween: 0,
76	//	autoplay: {
77	//		delay: 5000,
78	//	},
79		speed: 300,
80		parallax: true,
81		slidesPerView: 1,
82		navigation: {
83			nextEl: '.visual .swiper-button-next',
84			prevEl: '.visual .swiper-button-prev',
85		},
86		pagination: {
87			el: '.visual-ctrls__pagination',
88			type: 'bullets',
89			clickable: 1
90		},
91		on: {
92			// init: function () {
93			// swiperAnimation.init(this).animate();
94			// },
95			slideChange: function () {
96				// DEMO:
97				// if (visualSlider.activeIndex == 0) {
98				// 	console.log("Slide 1");
99				// }
100				// if (visualSlider.activeIndex == 1) {
101				// 	console.log("Slide 2");
102				// }
103				// if (visualSlider.activeIndex == 2) {
104				// 	console.log("Slide 3");
105				// }
106				// if (visualSlider.activeIndex == 3) {
107				// 	console.log("Slide 4");
108				// }
109				// if (visualSlider.activeIndex == 4) {
110				// 	console.log("Slide 5");
111				// }
112				// swiperAnimation.init(this).animate();
113			}
114		}
115	});
116
117
118	// visual-top-sldr
119	var vtSlider = new Swiper('.vt-slider', {
120		speed: 400,
121		spaceBetween: 0,
122		parallax: true,
123		slidesPerView: 1,
124		// progressbarOpposite
125		// autoplay: {
126		// 	delay: 5000,
127		// },
128		// speed: 300,
129		navigation: {
130			nextEl: '.visual-ctrls__btn--r',
131			prevEl: '.visual-ctrls__btn--l',
132		},
133		pagination: {
134			el: '.visual-ctrls__pagination',
135			type: 'bullets',
136			clickable: 1
137		},
138		autoHeight: true,
139		// breakpoints: {
140		// 	576: {
141		// 		direction: "vertical",
142		// 	}
143		// },
144		breakpoints: {
145			769: {
146				autoHeight: false,
147			}
148		},
149
150	});
151
152
153	// Alert block
154	$('.alert__close').click(function (e) {
155		$(this).parent('.alert').css('display', 'none');
156		return false;
157	});
158
159	// Clear quick-search
160	$('.main-search__clear').click(function (e) {
161		$('.main-search__ctrl').val("");
162		showHideAutoSgs($(this))
163		return false;
164	});
165
166
167	// shifted slider optional
168	function setLeftPosition(value) {
169
170		let slider = $('.shifted-slider__roller');
171
172		let container = $('.shifted-section__container'),
173			containerWidh = container.width(),
174			windowWidh = window.innerWidth,
175			offset = Math.floor((windowWidh - containerWidh) / 2),
176			offsetStr = `translate3d(${offset}px, 0px, 0px)`;
177
178
179		let currentPosition = Math.floor(slider.css('transform').split(',')[4]),
180			currentStr = `translate3d(${offset}px, 0px, 0px)`;
181
182		function increment() {
183			currentPosition = currentPosition - 10;
184			currentStr = `translate3d(${currentPosition}px, 0px, 0px)`;
185			slider.css('transform', currentStr);
186			if (currentPosition <= offset) clearInterval(Timer);
187			if (currentPosition <= 0) clearInterval(Timer);
188		}
189
190		var Timer = setInterval(increment, 1);
191		offset = windowWidth() >= 767 ? - window.innerWidth / 4 : offset;
192		return offset
193	}
194
195
196	// img-slider
197	(function () {
198		var imgSlider = new Swiper('.img-slider', {
199			speed: 400,
200			spaceBetween: 0,
201			slidesPerView: 1,
202			autoHeight: true,
203			loop: true,
204			// freeMode: 1,
205			// grabCursor: 1,
206			// centeredSlides: true,
207			slidesPerView: 'auto',
208			pagination: {
209				el: '.img-slider__pagination',
210				// type: 'bullets',
211			},
212			navigation: {
213				nextEl: '.img-slider__btn--next',
214				prevEl: '.img-slider__btn--prev',
215			},
216		})
217	}());
218
219
220	// shifted slider
221	$(function () {
222
223		var shiftedSlider = new Swiper('.shifted-slider', {
224			speed: 400,
225			// mousewheel: true,
226			loop: true,
227			spaceBetween: 16,
228			// freeMode: 1,
229			// grabCursor: 1,
230			centeredSlides: true,
231			slidesPerView: 'auto',
232			// navigation: {
233			// 	nextEl: '.img-slider__btn--next',
234			// 	prevEl: '.img-slider__btn--prev',
235			// },
236			navigation: {
237				nextEl: '.shifted-section .swiper-button-next',
238				prevEl: '.shifted-section .swiper-button-prev',
239			},
240			on: {
241				init: function () {
242					setTimeout(function () {
243						setLeftPosition()
244					}, 500)
245				},
246				resize: function () {
247					setTimeout(function () {
248						setLeftPosition()
249					}, 500)
250				},
251				reachBeginning: function () {
252					setTimeout(function () {
253						setLeftPosition()
254					}, 500)
255				},
256
257			},
258		});
259
260	});
261
262	function windowWidth() {
263		return window.innerWidth;
264	}
265
266	// imgGrid
267	$(function () {
268
269		let gutter = windowWidth() <= 767 ? 6 : 16;
270
271		let $imgGrid = $('.img-grid');
272		$imgGrid.imagesLoaded(function () {
273			$imgGrid.masonry({
274				columnWidth: '.img-grid__sizer',
275				itemSelector: '.img-grid__el',
276				percentPosition: true,
277				gutter,
278				horizontalOrder: true,
279			});
280			$imgGrid.addClass('loaded');
281		});
282	}())
283
284
285
286	// function parallax(selector){
287	//   var scrolled = $(window).scrollTop();
288	//   $(selector).css('background-position',"0 "+  (scrolled * 1) + 'px');
289	// }
290
291	// $(window).scroll(function(e){
292	//   parallax('.visual-slider__slide');
293	// });
294
295	// $('.visual-slider__slide').css('background-position',"0px 300px");
296
297
298	// Show/Hide menu
299	let body = document.querySelector('body'),
300		menu = document.querySelector('.mobile-menu'),
301		btn = document.querySelector('.menu-opener');
302
303	btn.addEventListener('click', function () {
304		body.classList.toggle('menu-opened');
305
306		if (body.classList.contains('menu-opened')) {
307			DLAnimate.show(menu, {
308				name: 'scale',
309				track: 'animation'
310			});
311		} else {
312			DLAnimate.hide(menu, {
313				name: 'scale',
314				track: 'animation'
315			});
316		}
317
318	});
319
320
321	// M.Nav
322	(function () {
323		var acc = document.getElementsByClassName("mobile-nav__ttl");
324		var i;
325
326		for (i = 0; i < acc.length; i++) {
327			acc[i].addEventListener("click", function () {
328				this.classList.toggle("active");
329
330				var parent = this.parentElement;
331				var panel = this.nextElementSibling;
332
333				if (panel.style.maxHeight) {
334					panel.style.maxHeight = null;
335				} else {
336					panel.style.maxHeight = panel.scrollHeight + "px";
337
338					parent.style.maxHeight = parseInt(parent.style.maxHeight) + panel.scrollHeight +
339						panel.scrollHeight +
340						panel.scrollHeight +
341						panel.scrollHeight +
342						"px";
343
344				}
345			});
346		}
347	}())
348
349	// POPOVER
350	// https://getbootstrap.com/docs/4.1/components/popovers/
351
352	function npaPopover() {
353		if (windowWidth() <= 991) return;
354		$('[data-toggle="popover-img"]').popover({
355			html: true,
356			trigger: 'hover',
357			offset: 10,
358			placement: 'top',
359			container: '#main',
360			content: function () {
361				return `
362            <img src = "${$(this).data('img')}" / >
363          `;
364			}
365		});
366	}
367	npaPopover();
368
369
370	/**
371	 *  acc
372	 */
373	(function () {
374		$('.acrd .acrd__content').hide();
375
376		$('.acrd .acrd__option--opened .acrd__content').show();
377
378		$('.acrd .acrd__opener').click(function () {
379			if ($(this).parent().hasClass('acrd__option--opened')) {
380				$(this).parent().removeClass('acrd__option--opened').children('.acrd__content').slideUp(300);
381				$(this).siblings('.acrd__content').slideUp(300);
382			} else {
383				// $(this).parent().addClass('acrd__option--opened').siblings('.acrd__option--opened').removeClass('acrd__option--opened').children('.acrd__content').slideUp(300);
384				$(this).parent().addClass('acrd__option--opened');
385				$(this).siblings('.acrd__content').slideDown(300);
386			};
387			return false;
388		});
389	}());
390
391
392
393	// img-cards Modal
394	(function () {
395
396		$('.img-cards__el').click(function (e) {
397
398			let {
399				modalTtl,
400				modalDesc,
401				btnTxt,
402			} = $(this).data(),
403				modalImg = $(this).attr("href");
404
405			if (!modalTtl || !modalDesc || !modalImg || modalImg.length < 5) return;
406
407			Swal.fire({
408				title: modalTtl,
409				text: modalDesc,
410				imageUrl: modalImg,
411				imageWidth: '100%',
412				imageHeight: 'auto',
413				imageAlt: 'modal image',
414				showCloseButton: true,
415				showConfirmButton: false,
416				width: 1113,
417				padding: 0,
418				customClass: {
419					container: 'npa-modal'
420				},
421				showClass: {
422					popup: 'animated zoomIn'
423				},
424				hideClass: {
425					popup: 'animated zoomOut'
426				}
427			})
428			return false;
429		})
430
431	}());
432
433	// esc
434	$(document).keyup(function (e) {
435		if (e.keyCode === 27) {
436			if ($(body).hasClass('quick-srch-opened')) mainSearch('close')
437		}
438	});
439
440
441	// TODO: task-rogress chart
442	// (function () {
443
444	// 	var $circle = $('.circle'),
445	// 		$percent = $('#percent'),
446	// 		r = $circle.attr('r'),
447	// 		c = Math.PI * (r * 2),
448	// 		data = $('.progress').attr('data-percent'),
449	// 		pct = ((100 - data) / 100) * c;
450
451	// 	// load with current progress specified
452	// 	$circle.css({
453	// 		strokeDashoffset: pct
454	// 	});
455
456	// 	$percent.on('change', function () {
457
458	// 		var val = parseInt($(this).val());
459
460	// 		if (isNaN(val)) {
461
462	// 			val = 100;
463	// 		} else {
464
465	// 			if (val < 0) {
466	// 				val = 0;
467	// 			}
468	// 			if (val > 100) {
469	// 				val = 100;
470	// 			}
471
472	// 			var pct = ((100 - val) / 100) * c;
473
474	// 			$circle.css({
475	// 				strokeDashoffset: pct
476	// 			});
477
478	// 			$('.progress').attr('data-percent', val);
479	// 		}
480	// 	});
481	// }());
482
483	// TODO: chart
484	$(function () {
485		var $ppc = $('.progress-pie-chart'),
486			percent = parseInt($ppc.data('percent')),
487			deg = 360 * percent / 100;
488		if (percent > 50) {
489			$ppc.addClass('gt-50');
490		}
491		$('.ppc-progress-fill').css('transform', 'rotate(' + deg + 'deg)');
492		// $('.ppc-percents span').html(percent+'%');
493	});
494
495
496	// route
497	let route = $('.route').get(0),
498		ofst = 100;
499
500	if (route) {
501		$('.route__row').css('min-height', route.scrollHeight + ofst);
502	}
503
504
505	// scrollspy route
506	function spy() {
507
508		let windowHeight = window.innerHeight;
509
510		$('body').scrollspy({
511			target: '#spyTarget',
512			offset: 260,
513			// offset: windowHeight * 1.05,
514			// offset: windowHeight * 1.04,
515		})
516		// $('body').on('activate.bs.scrollspy', function () {
517		// 	console.log('evt')
518		// })
519	}
520
521	setTimeout(function () {
522		$('#spyTarget').length ? spy() : null;
523	}, 100);
524
525
526
527	// ctrl-filter
528	function clearFilter() {
529		if ($('.ctrl-filter-opts__chkb:checked').length > 0) {
530			$('.ctrl-filter__clr').css('display', "inline-flex")
531		} else {
532			$('.ctrl-filter__clr').css('display', "none")
533		}
534	}
535
536	$('.ctrl-filter-opts__chkb').click(function () {
537		clearFilter()
538	});
539
540	clearFilter();
541
542	// filter check
543	// $('ctrl-filter-opts__chkb:checked').each(function () {
544	// 	alert($(this).val());
545	// });
546
547
548	// ctrl-searchl
549	$('.ctrl-search__btn').click(function (e) {
550		$(this).parent('.ctrl-search').toggleClass('active');
551		// $(this).parent('.ctrl-search').find('.main-search__ctrl').focus();
552		return false;
553	});
554
555
556	// content date range__date
557	// doc -> http://www.daterangepicker.com/#usage
558	$(function () {
559
560		if ($('#reportrange').length < 1) return;
561		// $('input[name="daterange"]').daterangepicker({
562		// 	opens: 'left'
563		// }, function (start, end, label) {
564		// 	console.log("A new date selection was made: " + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD'));
565		// });
566
567		// mock start data
568		var start = moment().subtract(366, 'days');
569		var end = moment();
570
571
572		function cb(start, end, label) {
573
574			if(label !== undefined) {
575			    setTimeout(function () {
576			        window.location.href = '?date=' + start.format('YYYY-MM-DD') + ',' + end.format('YYYY-MM-DD')  + '#main';
577			    }, 1000);
578			}
579
580			$('#reportrange span')
581				// .html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
582				.html(label)
583		}
584
585
586		// daterangepicker
587		$('#reportrange').daterangepicker({
588			startDate: start,
589			endDate: end,
590			"cancelClass": "btn-secondary",
591			// $('input[name="daterange"]').daterangepicker({
592			// "minYear": 2021,
593			// "maxYear": 2041,
594			showCustomRangeLabel: true,
595			ranges: {
596				"Всі": [start, end],
597				"Сьогодні": [moment(), moment()],
598				"Вчора": [
599					moment().subtract(1, "days"),
600					moment().subtract(1, "days")
601				],
602				"Останні 7 днів": [moment().subtract(6, "days"), moment()],
603				"Останні 30 днів": [moment().subtract(29, "days"), moment()],
604				"Цей місяць": [moment().startOf("month"), moment().endOf("month")],
605				"Минулий місяць": [
606					moment().subtract(1, "month").startOf("month"),
607					moment().subtract(1, "month").endOf("month")
608				]
609				// All: [moment(), moment()],
610				// Today: [moment(), moment()],
611				// Yesterday: [
612				// 	moment().subtract(1, "days"),
613				// 	moment().subtract(1, "days")
614				// ],
615				// "Last 7 Days": [moment().subtract(6, "days"), moment()],
616				// "Last 30 Days": [moment().subtract(29, "days"), moment()],
617				// "This Month": [moment().startOf("month"), moment().endOf("month")],
618				// "Last Month": [
619				// 	moment().subtract(1, "month").startOf("month"),
620				// 	moment().subtract(1, "month").endOf("month")
621				// ]
622			},
623			"locale": {
624				"format": "DD/MM/YYYY",
625				"separator": " - ",
626				"applyLabel": "Застосувати",
627				"cancelLabel": "Відміна",
628				"fromLabel": "З",
629				"toLabel": "До",
630				"customRangeLabel": "Обрати свою",
631				// "applyLabel": "Apply",
632				// "cancelLabel": "Cancel",
633				// "fromLabel": "From",
634				// "toLabel": "To",
635				// "customRangeLabel": "Custom",
636				// "weekLabel": "W",
637				"daysOfWeek": [
638					"Нд",
639					"Пн",
640					"Вт",
641					"Ср",
642					"Чт",
643					"Пт",
644					"Сб"
645				],
646				"monthNames": [
647					'Січень',
648					'Лютий',
649					'Березень',
650					'Квітень',
651					'Травень',
652					'Червень',
653					'Липень',
654					'Серпень',
655					'Вересень',
656					'Жовтень',
657					'Листопад',
658					'Грудень'
659				],
660				// "daysOfWeek": [
661				// 	"Su",
662				// 	"Mo",
663				// 	"Tu",
664				// 	"We",
665				// 	"Th",
666				// 	"Fr",
667				// 	"Sa"
668				// ],
669				// "monthNames": [
670				// 	"January",
671				// 	"February",
672				// 	"March",
673				// 	"April",
674				// 	"May",
675				// 	"June",
676				// 	"July",
677				// 	"August",
678				// 	"September",
679				// 	"October",
680				// 	"November",
681				// 	"December"
682				// ],
683				"firstDay": 1
684			},
685			// "startDate": "01/06/2021",
686			// "endDate": "01/12/2021"
687		}, cb);
688
689
690		//initial view 
691		cb(start, end);
692	});
693
694
695
696
697	// cs select
698	(function () {
699		$('.custom-select select').each(function () {
700			let name = $(this).attr('name');
701			var $this = $(this),
702				numberOfOptions = $(this).children('option').length;
703
704			$this.addClass('select-hidden');
705			$this.wrap('<div class="select"></div>');
706			$this.after('<div class="select-styled"></div>');
707
708			var $styledSelect = $this.next('div.select-styled');
709			$styledSelect.text($this.children('option').eq(0).text());
710
711			var $list = $('<ul />', {
712				'class': 'select-options'
713			}).insertAfter($styledSelect);
714
715			for (var i = 0; i < numberOfOptions; i++) {
716				$('<li />', {
717					text: $this.children('option').eq(i).text(),
718					rel: $this.children('option').eq(i).val()
719				}).appendTo($list);
720			}
721
722			var $listItems = $list.children('li');
723
724			$styledSelect.click(function (e) {
725				e.stopPropagation();
726				$('div.select-styled.active').not(this).each(function () {
727					$(this).removeClass('active').next('ul.select-options').hide();
728				});
729				$(this).toggleClass('active').next('ul.select-options').toggle();
730			});
731
732			$listItems.click(function (e) {
733				e.stopPropagation();
734				$styledSelect.text($(this).text()).removeClass('active');
735				$this.val($(this).attr('rel'));
736				$list.hide();
737
738				let url = link != undefined && link.length > 0 ? $('#' + link).attr('href') : window.location.href;
739				if(url.charAt(url.length - 1) == '&'){
740					url = url.substring(0, url.length - 1);
741				}
742				let url_get = '?';
743				if(url.includes('?')){
744					let url_params = url.split('?')[1].split('#')[0];
745					let params = url_params.split('&');
746					for(let i = 0; i < params.length; i++){
747						let parts = params[i].split('=');
748						if(parts[1] != 'all' && parts[0] != name){
749							url_get += parts[0] + '=' + parts[1] + '&';
750						}
751					}
752					url = url.split('?')[0];
753				}
754				url_get += name + '=' + $this.val() + '&';
755				if(link != undefined && link.length > 0){
756					$('#' + link).attr('href', url + url_get);
757				}else{
758					let this_link = $('[name=page_link]');
759					if(this_link.length > 0){
760						window.location.href = this_link.val() + '?' + url_get + '#main';
761					}else{
762						window.location.href = '?' + url_get + '#main';
763					}
764				}
765			});
766
767			$(document).click(function () {
768				$styledSelect.removeClass('active');
769				$list.hide();
770			});
771
772		});
773	}())
774
775
776
777
778	// npa-objects mobile
779	$('.obj-sidebar__opener').click(function (e) {
780		$(this).parents('.npa-objects')
781			.find('.npa-objects__sidebar').toggleClass('active');
782		e.preventDefault()
783	});
784
785
786	// objForm Handler
787	function objFormApply(form) {
788
789		var formData = new FormData(form),
790			formDataStorage = {}
791
792		// entries
793		for (let pair of formData.entries()) {
794			formDataStorage[pair[0]] = pair[1]
795			// formDataStorage[pair[0]] = Boolean(pair[1])
796		}
797
798		// DEMO
799		// console.info(formDataStorage);
800
801		let rangeData = formData.get('obj-range');
802
803		if (rangeData) {
804			let [currentObjRangeStart, currentObjRangeFinish] =
805			rangeData.split(';');
806
807			let ObjRangeChanged = +currentObjRangeStart != rangeStart ||
808				+currentObjRangeFinish != rangeFinish;
809
810			if (formDataStorage.hasOwnProperty('obj-range') && !ObjRangeChanged) {
811				delete formDataStorage['obj-range'];
812			}
813		}
814
815
816
817
818		// console.log({
819		// 	ObjRangeChanged,
820		// })
821
822		// obj-form reset btn status
823		if (!jQuery.isEmptyObject(formDataStorage)) {
824			// if (!jQuery.isEmptyObject(formDataStorage) && Object.keys(formDataStorage).length >= 1  ObjRangeChanged) {
825			// if (Object.keys(formDataStorage).length >= 1) {
826			$('.obj-form__reset').addClass('active');
827			// return
828		} else {
829			$('.obj-form__reset').removeClass('active');
830		}
831
832		// demo submit
833		// form.submit();
834	}
835
836
837	// objForm onChange evt
838	var objForm = document.querySelector('.obj-form');
839	if (objForm) {
840		objForm.addEventListener('change', function () {
841			objFormApply(objForm)
842		});
843	}
844
845
846	// objForm Range Slider
847	// http://ionden.com/a/plugins/ion.rangeSlider/api.html
848	var minOut = $(".obj-range-val__box--l"),
849		maxOut = $(".obj-range-val__box--r"),
850		rangeStart = 1,
851		rangeFinish = 9;
852
853
854
855	(function () {
856
857
858
859		if (!Boolean($(".js-range-slider")[0])) return;
860
861		$(".js-range-slider").ionRangeSlider({
862			type: "double",
863			min: 0,
864			max: 10,
865			from: rangeStart,
866			to: rangeFinish,
867			skin: "round",
868			// grid: true,
869			onStart: function (data) {
870				minOut.val(data.from + " км");
871				maxOut.val(data.to + " км");
872			},
873			onFinish: function (data) {
874				// onChange: function (data) {
875				// console.dir(data);
876				let {
877					from,
878					input,
879					slider,
880					to
881				} = data;
882
883				console.log({
884					from,
885					to,
886					// input,
887					// slider
888				});
889
890				minOut.val(from + " км");
891				maxOut.val(to + " км");
892
893				objFormApply(objForm)
894
895			}
896		});
897
898		// objRange instance
899		// let objRange = $(".js-range-slider").data("ionRangeSlider");
900		// objRange.update({
901		// 	from: 2,
902		// 	to: 10
903		// });
904		// objRange.destroy();
905	}())
906
907
908
909
910
911	//FULL CLDR 
912	$(function () {
913		var calendarEl = document.getElementById('npa-calendar');
914
915		if (!calendarEl) return;
916
917		var calendar = new FullCalendar.Calendar(calendarEl, {
918			initialView: 'dayGridMonth',
919			initialDate: date_start,
920
921			// dayHeaderFormat: { weekday: 'short', month: 'numeric', day: 'numeric', omitCommas: true },
922			eventTimeFormat: {
923				hour: 'numeric',
924				minute: '2-digit',
925				meridiem: false
926			},
927
928
929			// titleFormat: {
930			// month: 'long'     
931			// },
932
933			// selectable: true,
934			// weekends: false,
935			firstDay: 1,
936			locale: 'uk',
937			buttonText: {
938				today: 'сьогодні',
939				// today:    'today',
940				month: 'month',
941				week: 'week',
942				day: 'day',
943				list: 'list'
944			},
945
946			// dayPopoverFormat: { month: 'long', day: 'numeric', year: 'numeric' },
947
948			headerToolbar: {
949				left: 'prev,next',
950				// left: 'prev,next today',
951				center: 'title',
952				right: 'today'
953				// right: 'dayGridMonth,timeGridWeek,timeGridDay',
954
955			},
956
957			dateClick: function (e) {
958				console.info('cell evt!');
959				console.info(e);
960
961			},
962
963			eventClick: function (info) {
964
965				let {
966					el,
967					event,
968					jsEvent,
969					view
970				} = info;
971
972				// console.log({
973				// 	el,
974				// 	event,
975				// 	jsEvent,
976				// 	view
977				// });
978
979
980				// if (info.event.url) {
981				// 	window.open(info.event.url);
982				// }
983
984				info.jsEvent.preventDefault();
985
986
987				let evtBgColor = $(el).css('background-color'),
988					evTags = '';
989
990				// event.extendedProps.evTags.map(function (i, el) {
991				// 	evTags += `
992				// 		<span href="#" class="site-tag">
993				// 			${event.extendedProps.evTags || ''}
994				// 		</span>
995				// 	`
996				// })
997
998
999				// <p class="cldr-modal__desc mb20px">${event.extendedProps.description}</p>
1000				Swal.fire({
1001					width: 373,
1002					html: `
1003						<div class="cldr-modal__wrp">
1004							<a href="${event.url}" class="cldr-modal__ttl mb10px" target="_blank">
1005								<i class="cldr-modal__ico" style="background-color: ${evtBgColor}"></i>
1006								${event.title || ''}
1007							</a>
1008
1009							
1010							<div class="small-info mb15px">
1011								<span>${event.extendedProps.evType || ''}</span>
1012								<span>${event.extendedProps.evDate || ''}</span>
1013							</div>
1014
1015
1016							<div class="cldr-modal__tags">
1017								${evTags || ''}
1018							</div>
1019							
1020						</div>
1021						
1022					`,  
1023					showCloseButton: true,
1024					// showCancelButton: true,
1025					// focusConfirm: false,
1026					// confirmButtonText:
1027					//   '<i class="fa fa-thumbs-up"></i> Great!',
1028					// confirmButtonAriaLabel: 'Thumbs up, great!',
1029					// cancelButtonText:
1030					//   '<i class="fa fa-thumbs-down"></i>',
1031					// cancelButtonAriaLabel: 'Thumbs down',
1032					showConfirmButton: false,
1033					// width: 1113,
1034					// padding: 0,
1035					customClass: {
1036						container: 'cldr-modal'
1037					},
1038					showClass: {
1039						popup: 'animated faster zoomIn'
1040					},
1041					hideClass: {
1042						popup: 'animated faster zoomOut'
1043					}
1044				  })
1045
1046
1047				// alert('Event: ' + info.event.title);
1048				// alert('Coordinates: ' + info.jsEvent.pageX + ',' + info.jsEvent.pageY);
1049				// alert('View: ' + info.view.type);
1050
1051				// change the border color just for fun
1052				// info.el.style.borderColor = 'red';
1053			},
1054
1055
1056			eventRender: function (event, element) {
1057				// console.log(event);
1058
1059				// var html = '<a data-event-id="' + event.id + '" class="' + ((event.strikeout) ? 'strikeout' : '') + ' fc-day-grid-event fc-h-event fc-event fc-start fc-end fc-draggable">';
1060				// html += '<div class="fc-content">';
1061				// html += ' <label><input type="checkbox" ' + ((event.strikeout) ? 'checked' : '') + '> <span class="fc-time">' + event.start.format('ha') + '</span> ';
1062				// html += ' <span class="fc-title">' + event.title + '</span>';
1063				// html += '</label></div></a>';
1064
1065				// var $event = $(html);
1066
1067				// addRightClickMenu($event);
1068
1069				// return $event;
1070
1071			},
1072
1073			// 	  eventRender: function(event, element) {
1074
1075			// 		  console.log({
1076			// 			  event,
1077			// 			  element
1078			// 		  })
1079
1080			// 	  if (event.type == "test1")
1081			// 		 element.find(".fc-event-dot").css('background-color','#000');
1082			// 	  // if (event.type == "Y")
1083			// 	  // element.find(".fc-event-dot").css('background-color','#2a7568');
1084			// 		},
1085
1086			eventDidMount: function (info) {
1087
1088				//  console.log({
1089				// info,
1090				// })
1091
1092				if (info.event.extendedProps.dot == 'type1') {
1093
1094					// Change background color of row
1095					// info.el.style.backgroundColor = 'red';
1096
1097					// Change color of dot marker
1098					var dotEl = info.el.getElementsByClassName('fc-daygrid-event-dot')[0];
1099					// if (dotEl) dotEl.style.backgroundColor = '#000';
1100					if (dotEl) dotEl.style.borderColor = 'red';
1101				}
1102
1103				if (info.event.extendedProps.dot == 'type2') {
1104
1105					// Change background color of row
1106					// info.el.style.backgroundColor = 'red';
1107
1108					// Change color of dot marker
1109					var dotEl = info.el.getElementsByClassName('fc-daygrid-event-dot')[0];
1110					// if (dotEl) dotEl.style.backgroundColor = '#000';
1111					if (dotEl) dotEl.style.borderColor = 'green';
1112				}
1113
1114				if (info.event.extendedProps.dot == 'type3') {
1115
1116					// Change background color of row
1117					// info.el.style.backgroundColor = 'red';
1118
1119					// Change color of dot marker
1120					var dotEl = info.el.getElementsByClassName('fc-daygrid-event-dot')[0];
1121					// if (dotEl) dotEl.style.backgroundColor = '#000';
1122					if (dotEl) dotEl.style.borderColor = 'violet';
1123				}
1124
1125
1126				// create hover tips	  
1127				// var tooltip = new Tooltip(info.el, {
1128				// 	title: info.event.extendedProps.description,
1129				// 	placement: 'top',
1130				// 	trigger: 'hover',
1131				// 	container: 'body'
1132				// });
1133
1134
1135
1136			},
1137			events: window.events || [],
1138			// events: [{
1139			// 		title: 'Подія з лінком 1',
1140			// 		start: '2021-01-01',
1141			// 		url: 'http://google.com/',
1142			// 		// start: '02-01-2021',
1143
1144			// 		color: 'green',
1145			// 	},
1146			// 	{
1147			// 		title: 'Подія з лінком 2',
1148			// 		start: '2021-01-01',
1149			// 		url: 'http://google.com/',
1150			// 		// start: '02-01-2021',
1151
1152			// 		color: 'blue',
1153			// 	},
1154			// 	// {
1155			// 	//   title: 'Long Event',
1156			// 	//   start: '2021-01-07',
1157			// 	//   end: '2021-01-10'
1158			// 	// },
1159			// 	// {
1160			// 	//   groupId: '999',
1161			// 	//   title: 'Repeating Event',
1162			// 	//   start: '2021-01-09T16:00:00'
1163			// 	// },
1164			// 	// {
1165			// 	//   groupId: '999',
1166			// 	//   title: 'Repeating Event',
1167			// 	//   start: '2021-01-16T16:00:00'
1168			// 	// },
1169			// 	// {
1170			// 	//   title: 'Conference',
1171			// 	//   start: '2021-01-11',
1172			// 	//   end: '2021-01-13'
1173			// 	// },
1174			// 	{
1175			// 		title: 'Подія 1',
1176			// 		start: '2021-01-12T10:30:00',
1177			// 		end: '2021-01-12T12:30:00',
1178			// 		// extendedProps: {
1179			// 		dot: 'type1',
1180			// 		// }
1181			// 	},
1182			// 	{
1183			// 		title: 'Подія 2',
1184			// 		start: '2021-01-12T12:00:00',
1185			// 		// extendedProps: {
1186			// 		dot: 'type2',
1187			// 		// }
1188			// 	},
1189			// 	{
1190			// 		title: 'Подія 3 лінк',
1191			// 		start: '2021-01-12T14:30:00',
1192			// 		url: 'http://google.com/',
1193			// 		// extendedProps: {
1194			// 		dot: 'type3',
1195			// 		// }
1196			// 	},
1197			// 	{
1198			// 		title: 'Подія з підказою',
1199			// 		start: '2021-01-13T07:00:00',
1200			// 		description: 'Lorem ipsum dolor sit amet consectetur.',
1201
1202			// 	},
1203			// 	{
1204			// 		title: 'Подія довга',
1205			// 		url: 'http://google.com/',
1206			// 		start: '2021-01-27',
1207			// 		end: '2021-01-30',
1208			// 		color: 'Red',
1209			// 	}
1210			// ]
1211		});
1212
1213		calendar.render();
1214
1215	}())
1216
1217
1218
1219
1220
1221	// objForm Handler demo
1222	function evtFormApply(form) {
1223
1224		var formData = new FormData(form),
1225			dataStorage = {}
1226
1227		// entries
1228		for (let pair of formData.entries()) {
1229			dataStorage[pair[0]] = pair[1]
1230		}
1231
1232		// DEMO
1233		console.info(dataStorage);
1234
1235
1236		// obj-form reset btn status
1237		// if (!jQuery.isEmptyObject(dataStorage)) {
1238		// if (!jQuery.isEmptyObject(formDataStorage) && Object.keys(formDataStorage).length >= 1  ObjRangeChanged) {
1239		// if (Object.keys(formDataStorage).length >= 1) {
1240		// $('.obj-form__reset').addClass('active');
1241		// return
1242		// } else {
1243		// $('.obj-form__reset').removeClass('active');
1244		// }
1245
1246		// demo submit
1247		// form.submit();
1248	}
1249
1250
1251	// objForm onChange evt
1252	var evtTagsFilter = document.querySelector('#event-tags');
1253	if (evtTagsFilter) {
1254		evtTagsFilter.addEventListener('change', function (e) {
1255			// demo
1256			console.log(e.target)
1257			evtFormApply(evtTagsFilter)
1258		});
1259	}
1260
1261
1262	// pb-aside
1263	$('.pb-aside-opener').click(function (e) {
1264		$('.pb-aside').toggleClass('active')
1265	})
1266
1267	$('.pb-aside__x').click(function (e) {
1268		$('.pb-aside').removeClass('active')
1269	})
1270
1271
1272
1273	// EV-FORM
1274
1275	function evForm() {
1276
1277		var eventForm = $('#ev-form');
1278
1279		if (!eventForm.length) return;
1280
1281
1282		// ev-form smb demo
1283		function evFormSmb() {
1284			console.log("ev-form smb...");
1285			// eventForm.submit();
1286		}
1287
1288
1289		$('#ev-date').daterangepicker({
1290			// "startDate": "01/22/2021",
1291			"startDate": moment(),
1292			// "endDate": "01/28/2021"
1293		}, function (start, end, label) {
1294			console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')');
1295		});
1296
1297
1298		// copy inputs demo
1299		$('.ev-form__add').click(function (e) {
1300
1301			let prevHolder = $(this).parent().prev(),
1302				prevHolderClone = prevHolder.clone();
1303
1304			prevHolderClone.find('input').val('');
1305			prevHolder.after(prevHolderClone)
1306
1307		})
1308
1309
1310
1311		//  ev-form files upload
1312		// https: //www.dropzonejs.com/#installation
1313
1314		// server
1315		// https://www.dropzonejs.com/#server-side-implementation
1316
1317		// wiki
1318		//https://gitlab.com/meno/dropzone/-/wikis/faq#i-want-to-display-additional-information-after-a-file-uploaded
1319
1320
1321		// emit default behaivor
1322		Dropzone.options.myAwesomeDropzone = false;
1323		Dropzone.autoDiscover = false;
1324
1325
1326
1327		var evUpload1 = new Dropzone('#evUpload1', {
1328			url: 'http://httpbin.org/post',
1329			// autoProcessQueue: false,
1330			uploadMultiple: true,
1331			thumbnailHeight: 200,
1332			thumbnailWidth: 200,
1333			parallelUploads: 5,
1334			maxFiles: 100,
1335			maxFilesize: 1,
1336			clickable: '#evUpload1 .ev-upload__btn',
1337			acceptedFiles: 'image/*',
1338			// addRemoveLinks: true,
1339			init: function () {
1340
1341				var wrapperThis = this;
1342
1343				// smb manual
1344				// var submitButton = document.querySelector("#ev-form__smb");
1345				// submitButton.addEventListener("click", function () {
1346				// 	wrapperThis.processQueue();
1347				// });
1348
1349				this.on("addedfile", function (file) {
1350
1351					// Create the remove button
1352					var removeButton = Dropzone.createElement("<button class='btn ev-upload__del'>Видалити</button>");
1353
1354					// Listen to the click event
1355					removeButton.addEventListener("click", function (e) {
1356						// Make sure the button click doesn't submit the form:
1357						e.preventDefault();
1358						e.stopPropagation();
1359
1360						// Remove the file preview.
1361						wrapperThis.removeFile(file);
1362						// If you want to the delete the file on the server as well,
1363						// you can do the AJAX request here.
1364					});
1365
1366					// Add the button to the file preview element.
1367					file.previewElement.appendChild(removeButton);
1368				});
1369
1370				this.on('sendingmultiple', function (data, xhr, formData) {
1371					formData.append("Username", $("#Username").val());
1372				});
1373			},
1374			success: function (file, response) {
1375				alert("on success")
1376				console.log({
1377					file,
1378					response
1379				})
1380			}
1381		});
1382
1383
1384		var evUpload2 = new Dropzone('#evUpload2', {
1385			url: 'http://httpbin.org/post',
1386			// autoProcessQueue: false,
1387			uploadMultiple: true,
1388			parallelUploads: 5,
1389			maxFiles: 100,
1390			maxFilesize: 1,
1391			clickable: '#evUpload2 .ev-upload__btn',
1392			acceptedFiles: 'image/*',
1393			// addRemoveLinks: true,
1394			init: function () {
1395
1396				var wrapperThis = this;
1397
1398				// smb manual
1399				// var submitButton = document.querySelector("#ev-form__smb");
1400				// submitButton.addEventListener("click", function () {
1401				// 	wrapperThis.processQueue();
1402				// });
1403
1404				this.on("addedfile", function (file) {
1405
1406					// Create the remove button
1407					var removeButton = Dropzone.createElement("<button class='btn ev-upload__del'>Видалити</button>");
1408					removeButton.addEventListener("click", function (e) {
1409						// Make sure the button click doesn't submit the form:
1410						e.preventDefault();
1411						e.stopPropagation();
1412
1413						// Remove the file preview.
1414						wrapperThis.removeFile(file);
1415						// If you want to the delete the file on the server as well,
1416						// you can do the AJAX request here.
1417					});
1418
1419					// Add the button to the file preview element.
1420					file.previewElement.appendChild(removeButton);
1421				});
1422
1423				// this.on('sendingmultiple', function (data, xhr, formData) {
1424				// 	formData.append("Username", $("#Username").val());
1425				// });
1426			},
1427			success: function (file, response) {
1428				alert("on success")
1429				console.log({
1430					file,
1431					response
1432				})
1433			}
1434		});
1435
1436		// 	// thumbnail: function (file, dataUrl) {
1437		// 	// 	if (file.previewElement) {
1438		// 	// 		file.previewElement.classList.remove("dz-file-preview");
1439		// 	// 		var images = file.previewElement.querySelectorAll("[data-dz-thumbnail]");
1440		// 	// 		for (var i = 0; i < images.length; i++) {
1441		// 	// 			var thumbnailElement = images[i];
1442		// 	// 			thumbnailElement.alt = file.name;
1443		// 	// 			thumbnailElement.src = dataUrl;
1444		// 	// 		}
1445		// 	// 		setTimeout(function () {
1446		// 	// 			file.previewElement.classList.add("dz-image-preview");
1447		// 	// 		}, 1);
1448		// 	// 	}
1449		// 	// }
1450
1451
1452		$("#ev-form__smb").click(function (e) {
1453			e.preventDefault();
1454
1455			// manual send photo - when param - autoProcessQueue: false,
1456
1457			// evUpload1.processQueue();
1458			// evUpload2.processQueue();
1459
1460			evFormSmb()
1461		});
1462	}
1463
1464	evForm()
1465
1466
1467
1468
1469	// mFilter
1470	function mFilterHandler () {
1471			
1472		function panelReset() {
1473			$('.mFilter-subPanel').removeClass('isOpen hid');
1474			$('.mFilter').removeClass('hid');
1475
1476			$('.mFilter-subPanel, .z').animate({
1477				scrollTop: 0
1478			}, 300);
1479		}
1480
1481		// open menu from content
1482		$('.mFilter-opener').click( function () {
1483			$('body').addClass('mFilterIsOpened');
1484				return false;
1485		});
1486
1487		
1488		// close menu from menu
1489		$('.mFilter-head__close').click( function () {
1490			$('body').removeClass('mFilterIsOpened');
1491			panelReset();
1492			return false;
1493		});
1494
1495
1496		// actions
1497		$('.mFilter-action__btn--back').click( function () {
1498			panelReset();
1499			return false;
1500		});
1501
1502
1503		$('.mFilter-action__btn--smb').click( function () {
1504			alert('smb');
1505			// panelReset();
1506			return false;
1507		});
1508
1509
1510		//panelNext
1511		function panelNext(ctx) {
1512
1513			// $('.mFilter').addClass('hid');
1514			$(ctx).parents('.mFilter').addClass('hid');
1515			$(ctx).parents('.mFilter-subPanel').addClass('hid');
1516
1517
1518			let isThisFirstFloor = $(ctx).parent('li').parent('.mFilter-main').length > 0;
1519
1520			let topOffset;
1521			if (isThisFirstFloor) {
1522				topOffset = $(ctx).parents('.mFilter').scrollTop();
1523				$(ctx).next('.mFilter-subPanel').css({top: topOffset + "px"})
1524			} else {
1525				topOffset = $($(ctx).parents('.mFilter-subPanel')[0]).scrollTop();
1526				$(ctx).next('.mFilter-subPanel').css({top: topOffset + "px"})
1527			}
1528
1529			setTimeout(() => {
1530				$(ctx).next('.mFilter-subPanel').addClass('isOpen');
1531			}, 200)
1532
1533		}
1534
1535		
1536		// panelPrev
1537		function panelPrev (ctx) {
1538
1539			let prevStep = $(ctx).parents('.mFilter-subPanel')[1];
1540			if ($(prevStep).length > 0) $(prevStep).removeClass('hid');
1541
1542			let mainParent = $(ctx).parents('ul')[1];
1543			let isThisFirstFloor = $(mainParent).hasClass('mFilter-main');
1544
1545			if (isThisFirstFloor) {
1546				$(ctx).parents('.mFilter').removeClass('hid');
1547			}
1548
1549			$(ctx).parent('.mFilter-subPanel').removeClass('isOpen');
1550		}
1551
1552
1553		$('.closemFilter-subPanel').click( function(e) {
1554			panelPrev(this);
1555		});
1556
1557
1558		$('.openmFilter-subPanel').click( function(e) {
1559			panelNext(this);
1560		});
1561
1562
1563		// tags main
1564		function tagsMainHandler() {
1565
1566			let currentWrapper = $('.mFilter-form'),
1567				activeFiltersData = $(currentWrapper).find( "input:checked" ),
1568				targetWrapper = $(".mFilter-tags" );
1569
1570			let tagsCount = activeFiltersData.length;
1571
1572			if( tagsCount > 0 ) {
1573				$('.mFilter-acrd__ttl').text(`${tagsCount} фільтрів`);
1574				$('.mFilter-status').show();
1575
1576			} else {
1577				$('.mFilter-status').hide();
1578				$('.mFilter-subPanel__clear').remove()
1579			}
1580
1581			//  clr btn evt
1582			switch(tagsCount) {
1583			case 1: 
1584					$(".mFilter-status__clear").bind("click.clear",function(){
1585						clearFilter( $(currentWrapper), () => {
1586							tagsMainHandler()
1587						});
1588						return false;
1589					});
1590			break;
1591			case 0: 
1592					$(".mFilter-status__clear").unbind("click.clear");
1593			break;
1594			}
1595
1596			targetWrapper.empty();
1597			activeFiltersData.each( function(i, val) {
1598				let tag = $("<a></a>"),
1599					labelText = $('label[for='+  this.id  +']').text();
1600
1601				tag.text(labelText)
1602				tag.attr({
1603					href: '#',
1604					class: 'ctrl-tag mFilter-tags__tag',
1605					'data-tag-id': this.id
1606				})
1607				targetWrapper.append(tag)
1608			})
1609
1610			$('[data-tag-id]').click(function(e) {
1611				// alert('click')
1612				let tagId = $(e.target).data('tagId');
1613				clearFilter( $(currentWrapper), () => {
1614					tagsMainHandler();
1615				}, tagId)
1616			})
1617		}
1618
1619
1620		// function clearFilter ($wrapperPart = [], clb) {
1621		function clearFilter ($wrapperPart, clb, specialId) {
1622
1623			if (specialId) {
1624				let activeTarget = $wrapperPart.find('#' + specialId + ':checked');
1625				activeTarget.prop("checked", false),
1626				tagsLocalHandler(activeTarget)
1627			} else {
1628				$wrapperPart.find("input:checked").each(function(i){
1629					$(this).prop("checked", false);
1630				})
1631			}
1632		
1633			clb && clb();
1634		}
1635
1636
1637
1638		function tagsLocalHandler (target) {
1639			if( !target ) return;
1640			let currentWrapper = $(target).parents('li')[0],
1641				localFiltersStatus = $(currentWrapper).find("input:checked").length;
1642
1643
1644			if (localFiltersStatus && $(currentWrapper).find('.mFilter-subPanel__clear').length > 0) {
1645
1646				$(currentWrapper).find('.mFilter-subPanel__clear').text(`Очистити ${localFiltersStatus} фільри`)
1647
1648			} else if (localFiltersStatus > 0) {
1649				let subPanelClearBtn = $("<a />", {
1650					name : "link",
1651					href : "#",
1652					text : `Очистити ${localFiltersStatus} фільри`,
1653					class: 'mFilter-clear mFilter-subPanel__clear'
1654				});
1655
1656
1657				subPanelClearBtn.click(function(e) {
1658					e.preventDefault();
1659					clearFilter( $(currentWrapper), () => {
1660						$(currentWrapper).find('.mFilter-subPanel__clear').remove();
1661						tagsMainHandler();
1662					});
1663
1664				})
1665
1666				$(currentWrapper).prepend(subPanelClearBtn)
1667			} else {
1668				$(currentWrapper).find('.mFilter-subPanel__clear').remove();
1669			}
1670
1671
1672		}
1673
1674
1675		//  form change
1676		var form = document.querySelector('.mFilter-form');
1677			if (form) {
1678				form.addEventListener('change', function (e) {
1679					tagsMainHandler();
1680					tagsLocalHandler(e.target)
1681				});
1682			}
1683
1684		tagsMainHandler();
1685
1686	};
1687	
1688	$('.mFilter').length &&  mFilterHandler();
1689
1690
1691
1692})(jQuery); // End of use strict

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.