PageSourceSearch

https://www.milkitapp.com/sites/themes/industrial/js/custom/shortcodes.js

js milkitapp.com collected 2026-10-02 16:03:17 UTC 40,631 bytes, 1,105 lines download raw bytes

1// Animation
2function ancora_animation_shortcodes() {
3	jQuery('[data-animation^="animated"]:not(.animated)').each(function() {
4		"use strict";
5		if (jQuery(this).offset().top < jQuery(window).scrollTop() + jQuery(window).height())
6			jQuery(this).addClass(jQuery(this).data('animation'));
7	});
8}
9
10
11// Shortcodes init
12function ancora_init_shortcodes(container) {
13
14	// Accordion
15	if (container.find('.sc_accordion:not(.inited)').length > 0) {
16		container.find(".sc_accordion:not(.inited)").each(function () {
17			"use strict";
18			var init = jQuery(this).data('active');
19			if (isNaN(init)) init = 0;
20			else init = Math.max(0, init);
21			jQuery(this)
22				.addClass('inited')
23				.accordion({
24					active: init,
25					heightStyle: "content",
26					header: "> .sc_accordion_item > .sc_accordion_title",
27					create: function (event, ui) {
28						ancora_init_shortcodes(ui.panel);
29						if (window.ancora_init_hidden_elements) ancora_init_hidden_elements(ui.panel);
30						ui.header.each(function () {
31							jQuery(this).parent().addClass('sc_active');
32						});
33					},
34					activate: function (event, ui) {
35						ancora_init_shortcodes(ui.newPanel);
36						if (window.ancora_init_hidden_elements) ancora_init_hidden_elements(ui.newPanel);
37						ui.newHeader.each(function () {
38							jQuery(this).parent().addClass('sc_active');
39						});
40						ui.oldHeader.each(function () {
41							jQuery(this).parent().removeClass('sc_active');
42						});
43					}
44				});
45		});
46	}
47
48	// Contact form
49	if (container.find('.sc_contact_form:not(.inited) form').length > 0) {
50		container.find(".sc_contact_form:not(.inited) form")
51			.addClass('inited')
52			.submit(function(e) {
53				"use strict";
54				ancora_contact_form_validate(jQuery(this));
55				e.preventDefault();
56				return false;
57			});
58	}
59
60	//Countdown
61	if (container.find('.sc_countdown:not(.inited)').length > 0) {
62		container.find('.sc_countdown:not(.inited)')
63			.each(function () {
64				"use strict";
65				jQuery(this).addClass('inited');
66				var id = jQuery(this).attr('id');
67				var curDate = new Date(); 
68				var curDateTimeStr = curDate.getFullYear()+'-'+(curDate.getMonth()<9 ? '0' : '')+(curDate.getMonth()+1)+'-'+(curDate.getDate()<10 ? '0' : '')+curDate.getDate()
69					+' '+(curDate.getHours()<10 ? '0' : '')+curDate.getHours()+':'+(curDate.getMinutes()<10 ? '0' : '')+curDate.getMinutes()+':'+(curDate.getSeconds() ? '0' : '')+curDate.getSeconds(); 
70				var interval = 1;	//jQuery(this).data('interval');
71				var endDateStr = jQuery(this).data('date');
72				var endDateParts = endDateStr.split('-');
73				var endTimeStr = jQuery(this).data('time');
74				var endTimeParts = endTimeStr.split(':');
75				var endDateTimeStr = endDateStr+' '+endTimeStr;
76				if (curDateTimeStr < endDateTimeStr) {
77					jQuery(this).find('.sc_countdown_placeholder').countdown({
78						until: new Date(endDateParts[0], endDateParts[1]-1, endDateParts[2], endTimeParts[0], endTimeParts[1], endTimeParts[2]), 
79						tickInterval: interval,
80						onTick: ancora_countdown
81					}); 
82				} else {
83					jQuery(this).find('.sc_countdown_placeholder').countdown({
84						since: new Date(endDateParts[0], endDateParts[1]-1, endDateParts[2], endTimeParts[0], endTimeParts[1], endTimeParts[2]), 
85						tickInterval: interval,
86						onTick: ancora_countdown
87					}); 
88				}
89			});
90	}
91
92	// Emailer form
93	if (container.find('.sc_emailer:not(.inited)').length > 0) {
94		container.find(".sc_emailer:not(.inited)")
95			.addClass('inited')
96			.find('.sc_emailer_button')
97			.click(function(e) {
98				"use strict";
99				var form = jQuery(this).parents('form');
100				var parent = jQuery(this).parents('.sc_emailer');
101				if (parent.hasClass('sc_emailer_opened')) {
102					if (form.length>0 && form.find('input').val()!='') {
103						var group = jQuery(this).data('group');
104						var email = form.find('input').val();
105						var regexp = new RegExp(ANCORA_GLOBALS['email_mask']);
106						if (!regexp.test(email)) {
107							form.find('input').get(0).focus();
108							ancora_message_warning(ANCORA_GLOBALS['strings']['email_not_valid']);
109						} else {
110							jQuery.post(ANCORA_GLOBALS['ajax_url'], {
111								action: 'emailer_submit',
112								nonce: ANCORA_GLOBALS['ajax_nonce'],
113								group: group,
114								email: email
115							}).done(function(response) {
116								var rez = JSON.parse(response);
117								if (rez.error === '') {
118									ancora_message_info(ANCORA_GLOBALS['strings']['email_confirm'].replace('%s', email));
119									form.find('input').val('');
120								} else {
121									ancora_message_warning(rez.error);
122								}
123							});
124						}
125					} else
126						form.get(0).submit();
127				} else {
128					parent.addClass('sc_emailer_opened');
129				}
130				e.preventDefault();
131				return false;
132			});
133	}
134	
135	// Googlemap init
136	if (container.find('.sc_googlemap:not(.inited)').length > 0) {
137		container.find('.sc_googlemap:not(.inited)')
138			.each(function () {
139				"use strict";
140				if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return;
141				var map = jQuery(this).addClass('inited');
142				var map_address	= map.data('address');
143				var map_latlng	= map.data('latlng');
144				var map_id		= map.attr('id');
145				var map_zoom	= map.data('zoom');
146				var map_style	= map.data('style');
147				var map_descr	= map.data('description');
148				var map_title	= map.data('title');
149				var map_point	= map.data('point');
150				ancora_googlemap_init( jQuery('#'+map_id).get(0), {address: map_address , latlng: map_latlng, style: map_style, zoom: map_zoom, description: map_descr, title: map_title, point: map_point});
151			});
152	}
153
154	// Infoboxes
155	if (container.find('.sc_infobox.sc_infobox_closeable:not(.inited)').length > 0) {
156		container.find('.sc_infobox.sc_infobox_closeable:not(.inited)')
157			.addClass('inited')
158			.click(function () {
159				jQuery(this).slideUp();
160			});
161	}
162
163	// Popup links
164	if (container.find('.popup_link:not(.inited)').length > 0) {
165		container.find('.popup_link:not(.inited)')
166			.addClass('inited')
167			.magnificPopup({
168				type: 'inline',
169				removalDelay: 500,
170				midClick: true,
171				callbacks: {
172					beforeOpen: function () {
173						this.st.mainClass = 'mfp-zoom-in';
174					},
175					open: function() {},
176					close: function() {}
177				}
178			});
179	}
180
181    //rocks skills init
182    if (jQuery('.sc_rocks_skills:not(.inited)').length > 0) {
183        rocks_skills_init(container);
184        jQuery(window).scroll(function () { rocks_skills_init(container); });
185    }
186
187    //islands
188    if (jQuery('.sc_islands:not(.inited)').length > 0) {
189        IslandsInit(container);
190        jQuery(window).scroll(function () { IslandsInit(container); });
191    }
192
193    //icons widget
194    if (jQuery('.sc_icons_widget:not(.inited)').length > 0) {
195        iconsWidgetInit(container);
196        jQuery(window).scroll(function () { iconsWidgetInit(container); });
197    }
198
199    //chart type='arc' init
200    if (jQuery('.sc_chart_diagram:not(.inited)').length > 0) {
201        chart_diagram_init(container);
202        jQuery(window).scroll(function () { chart_diagram_init(container); });
203    }
204
205	// Search form
206	if (container.find('.search_wrap:not(.inited)').length > 0) {
207		container.find('.search_wrap:not(.inited)').each(function() {
208			jQuery(this).addClass('inited');
209			jQuery(this).find('.search_icon').click(function(e) {
210				"use strict";
211				var search_wrap = jQuery(this).parent();
212				if (!search_wrap.hasClass('search_fixed')) {
213					if (search_wrap.hasClass('search_opened')) {
214						search_wrap.find('.search_form_wrap').animate({'width': 'hide'}, 200, function() {
215							if (search_wrap.parents('.menu_main_wrap').length > 0)
216								search_wrap.parents('.menu_main_wrap').removeClass('search_opened');
217						});
218						search_wrap.find('.search_results').fadeOut();
219						search_wrap.removeClass('search_opened');
220					} else {
221						search_wrap.find('.search_form_wrap').animate({'width': 'show'}, 200, function() {
222							jQuery(this).parents('.search_wrap').addClass('search_opened');
223							jQuery(this).find('input').get(0).focus();
224						});
225						if (search_wrap.parents('.menu_main_wrap').length > 0)
226							search_wrap.parents('.menu_main_wrap').addClass('search_opened');
227					}
228				} else {
229					search_wrap.find('.search_field').val('');
230					search_wrap.find('.search_results').fadeOut();
231				}
232				e.preventDefault();
233				return false;
234			});
235			jQuery(this).find('.search_results_close').click(function(e) {
236				"use strict";
237				jQuery(this).parent().fadeOut();
238				e.preventDefault();
239				return false;
240			});
241			jQuery(this).on('click', '.search_submit,.search_more', function(e) {
242				"use strict";
243				if (jQuery(this).parents('.search_wrap').find('.search_field').val() != '')
244					jQuery(this).parents('.search_wrap').find('.search_form_wrap form').get(0).submit();
245				e.preventDefault();
246				return false;
247			});
248			if (jQuery(this).hasClass('search_ajax')) {
249				var ajax_timer = null;
250				jQuery(this).find('.search_field').keyup(function(e) {
251					"use strict";
252					var search_field = jQuery(this);
253					var s = search_field.val();
254					if (ajax_timer) {
255						clearTimeout(ajax_timer);
256						ajax_timer = null;
257					}
258					if (s.length >= ANCORA_GLOBALS['ajax_search_min_length']) {
259						ajax_timer = setTimeout(function() {
260							jQuery.post(ANCORA_GLOBALS['ajax_url'], {
261								action: 'ajax_search',
262								nonce: ANCORA_GLOBALS['ajax_nonce'],
263								text: s
264							}).done(function(response) {
265								clearTimeout(ajax_timer);
266								ajax_timer = null;
267								var rez = JSON.parse(response);
268								if (rez.error === '') {
269									search_field.parents('.search_ajax').find('.search_results_content').empty().append(rez.data);
270									search_field.parents('.search_ajax').find('.search_results').fadeIn();
271								} else {
272									ancora_message_warning(ANCORA_GLOBALS['strings']['search_error']);
273								}
274							});
275						}, ANCORA_GLOBALS['ajax_search_delay']);
276					}
277				});
278			}
279		});
280	}
281
282	
283	// Section Pan init
284	if (container.find('.sc_pan:not(.inited_pan)').length > 0) {
285		container.find('.sc_pan:not(.inited_pan)')
286			.each(function () {
287				"use strict";
288				if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return;
289				var pan = jQuery(this).addClass('inited_pan');
290				var cont = pan.parent();
291				cont.mousemove(function(e) {
292					"use strict";
293					var anim = {};
294					var tm = 0;
295					var pw = pan.width(), ph = pan.height();
296					var cw = cont.width(), ch = cont.height();
297					var coff = cont.offset();
298					if (pan.hasClass('sc_pan_vertical'))
299						pan.css('top', -Math.floor((e.pageY - coff.top) / ch * (ph-ch)));
300					if (pan.hasClass('sc_pan_horizontal'))
301						pan.css('left', -Math.floor((e.pageX - coff.left) / cw * (pw-cw)));
302				});
303				cont.mouseout(function(e) {
304					pan.css({'left': 0, 'top': 0});
305				});
306			});
307	}
308
309	//Scroll
310	if (container.find('.sc_scroll:not(.inited)').length > 0) {
311		container.find('.sc_scroll:not(.inited)')
312			.each(function () {
313				"use strict";
314				if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return;
315				ANCORA_GLOBALS['scroll_init_counter'] = 0;
316				ancora_init_scroll_area(jQuery(this));
317			});
318	}
319
320
321	// Swiper Slider
322	if (container.find('.sc_slider_swiper:not(.inited)').length > 0) {
323		container.find('.sc_slider_swiper:not(.inited)')
324			.each(function () {
325				"use strict";
326				if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return;
327				//if (jQuery(this).parents('.isotope_wrap:not(.inited)').length > 0) return;
328				jQuery(this).addClass('inited');
329				ancora_slider_autoheight(jQuery(this));
330				if (jQuery(this).parents('.sc_slider_pagination_area').length > 0) {
331					jQuery(this).parents('.sc_slider_pagination_area').find('.sc_slider_pagination .post_item').eq(0).addClass('active');
332				}
333				var id = jQuery(this).attr('id');
334				if (id == undefined) {
335					id = 'swiper_'+Math.random();
336					id = id.replace('.', '');
337					jQuery(this).attr('id', id);
338				}
339				jQuery(this).addClass(id);
340				jQuery(this).find('.slides .swiper-slide').css('position', 'relative');
341				if (ANCORA_GLOBALS['swipers'] === undefined) ANCORA_GLOBALS['swipers'] = {};
342				ANCORA_GLOBALS['swipers'][id] = new Swiper('.'+id, {
343					calculateHeight: !jQuery(this).hasClass('sc_slider_height_fixed'),
344					resizeReInit: true,
345					autoResize: true,
346					loop: true,
347					grabCursor: true,
348					pagination: jQuery(this).hasClass('sc_slider_pagination') ? '#'+id+' .sc_slider_pagination_wrap' : false,
349				    paginationClickable: true,
350					autoplay: jQuery(this).hasClass('sc_slider_noautoplay') ? false : (isNaN(jQuery(this).data('interval')) ? 7000 : jQuery(this).data('interval')),
351					autoplayDisableOnInteraction: false,
352					initialSlide: 0,
353					speed: 600,
354					// Autoheight on start
355					onFirstInit: function (slider){
356						var cont = jQuery(slider.container);
357						if (!cont.hasClass('sc_slider_height_auto')) return;
358						var li = cont.find('.swiper-slide').eq(1);
359						var h = li.data('height_auto');
360						if (h > 0) {
361							var pt = parseInt(li.css('paddingTop')), pb = parseInt(li.css('paddingBottom'));
362							li.height(h);
363							cont.height(h + (isNaN(pt) ? 0 : pt) + (isNaN(pb) ? 0 : pb));
364							cont.find('.swiper-wrapper').height(h + (isNaN(pt) ? 0 : pt) + (isNaN(pb) ? 0 : pb));
365						}
366					},
367					// Autoheight on slide change
368					onSlideChangeStart: function (slider){
369						var cont = jQuery(slider.container);
370						if (!cont.hasClass('sc_slider_height_auto')) return;
371						var idx = slider.activeIndex;
372						var li = cont.find('.swiper-slide').eq(idx);
373						var h = li.data('height_auto');
374						if (h > 0) {
375							var pt = parseInt(li.css('paddingTop')), pb = parseInt(li.css('paddingBottom'));
376							li.height(h);
377							cont.height(h + (isNaN(pt) ? 0 : pt) + (isNaN(pb) ? 0 : pb));
378							cont.find('.swiper-wrapper').height(h + (isNaN(pt) ? 0 : pt) + (isNaN(pb) ? 0 : pb));
379						}
380					},
381					// Change current item in 'full' or 'over' pagination wrap
382					onSlideChangeEnd: function (slider, dir) {
383						var cont = jQuery(slider.container);
384						if (cont.parents('.sc_slider_pagination_area').length > 0) {
385							var li = cont.parents('.sc_slider_pagination_area').find('.sc_slider_pagination .post_item');
386							var idx = slider.activeIndex > li.length ? 0 : slider.activeIndex-1;
387							ancora_change_active_pagination_in_slider(cont, idx);
388						}
389					}
390				});
391				
392				jQuery(this).data('settings', {mode: 'horizontal'});		// VC hook
393				
394				var curSlide = jQuery(this).find('.slides').data('current-slide');
395				if (curSlide > 0)
396					ANCORA_GLOBALS['swipers'][id].swipeTo(curSlide-1);
397				ancora_prepare_slider_navi(jQuery(this));
398			});
399	}
400
401    // Flex Slider
402    if (container.find('.flexslider:not(.inited)').length > 0) {
403        container.find('.flexslider:not(.inited)')
404            .addClass('inited')
405            .each(function () {
406                "use strict";
407                if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return;
408                if (jQuery(this).parents('.isotopeNOanim:not(.inited),.isotope:not(.inited)').length > 0) return;
409                jQuery(this).flexslider({
410                    animation: "fade",
411                    useCSS: true,
412                    controlNav: true,
413                    directionNav: true,
414                    prevText: "",
415                    nextText: "",
416                    smoothHeight: false,
417                    slideshowSpeed:4000,
418                    animationSpeed:750,
419                    start: function( slider ) {
420                        //slider.find('.slide_description').children().css({'visibility': 'hidden'});
421                        slider.find('.flex-active-slide .slide_description').each(function(index){
422                            var self = jQuery(this);
423                            var animationClass = !self.data('animation') ? 'fadeIn' : self.data('animation');
424                            setTimeout(function(){
425                                self.addClass("animated "+animationClass);
426                            }, index*200);
427                        });
428                    },
429                    after :function( slider ){
430                        slider.find('.flex-active-slide .slide_description').each(function(index){
431                            var self = jQuery(this);
432                            var animationClass = !self.data('animation') ? 'fadeIn' : self.data('animation');
433                            setTimeout(function(){
434                                self.addClass("animated "+animationClass);
435                            }, index*200);
436                        });
437                    },
438                    end :function( slider ){
439                        slider.find('.slide_description').each(function() {
440                            jQuery(this).attr('class', '');
441                        });
442                    }
443                });
444                //calcSliderDimensions(jQuery(this));
445            });
446    }
447
448	//Skills init
449	if (container.find('.sc_skills_item:not(.inited)').length > 0) {
450		ancora_init_skills(container);
451		jQuery(window).scroll(function () { ancora_init_skills(container); });
452	}
453	//Skills type='arc' init
454	if (container.find('.sc_skills_arc:not(.inited)').length > 0) {
455		ancora_init_skills_arc(container);
456		jQuery(window).scroll(function () { ancora_init_skills_arc(container); });
457	}
458
459	// Tabs
460	if (container.find('.sc_tabs:not(.inited),.tabs_area:not(.inited)').length > 0) {
461		container.find('.sc_tabs:not(.inited),.tabs_area:not(.inited)').each(function () {
462			var init = jQuery(this).data('active');
463			if (isNaN(init)) init = 0;
464			else init = Math.max(0, init);
465			jQuery(this)
466				.addClass('inited')
467				.tabs({
468					active: init,
469					show: {
470						effect: 'fadeIn',
471						duration: 300
472					},
473					hide: {
474						effect: 'fadeOut',
475						duration: 300
476					},
477					create: function (event, ui) {
478						ancora_init_shortcodes(ui.panel);
479						if (window.ancora_init_hidden_elements) ancora_init_hidden_elements(ui.panel);
480					},
481					activate: function (event, ui) {
482						ancora_init_shortcodes(ui.newPanel);
483						if (window.ancora_init_hidden_elements) ancora_init_hidden_elements(ui.newPanel);
484					}
485				});
486		});
487	}
488
489	// Toggles
490	if (container.find('.sc_toggles .sc_toggles_title:not(.inited)').length > 0) {
491		container.find('.sc_toggles .sc_toggles_title:not(.inited)')
492			.addClass('inited')
493			.click(function () {
494				jQuery(this).toggleClass('ui-state-active').parent().toggleClass('sc_active');
495				jQuery(this).parent().find('.sc_toggles_content').slideToggle(300, function () { 
496					ancora_init_shortcodes(jQuery(this).parent().find('.sc_toggles_content'));
497					if (window.ancora_init_hidden_elements) ancora_init_hidden_elements(jQuery(this).parent().find('.sc_toggles_content'));
498				});
499			});
500	}
501
502	//Zoom
503	if (container.find('.sc_zoom:not(.inited)').length > 0) {
504		container.find('.sc_zoom:not(.inited)')
505			.each(function () {
506				"use strict";
507				if (jQuery(this).parents('div:hidden,article:hidden').length > 0) return;
508				jQuery(this).addClass('inited');
509				jQuery(this).find('img').elevateZoom({
510					zoomType: "lens",
511					lensShape: "round",
512					lensSize: 200,
513					lensBorderSize: 4,
514					lensBorderColour: '#ccc'
515				});
516			});
517	}
518
519}
520
521
522
523// Scrolled areas
524function ancora_init_scroll_area(obj) {
525
526	// Wait for images loading
527	if (!ancora_check_images_complete(obj) && ANCORA_GLOBALS['scroll_init_counter']++ < 30) {
528		setTimeout(function() { ancora_init_scroll_area(obj); }, 200);
529		return;
530	}
531
532	// Start init scroll area
533	obj.addClass('inited');
534	var id = obj.attr('id');
535	if (id == undefined) {
536		id = 'scroll_'+Math.random();
537		id = id.replace('.', '');
538		obj.attr('id', id);
539	}
540	obj.addClass(id);
541	var bar = obj.find('#'+id+'_bar');
542	if (bar.length > 0 && !bar.hasClass(id+'_bar')) {
543		bar.addClass(id+'_bar');
544	}
545
546	// Init Swiper with scroll plugin
547	if (ANCORA_GLOBALS['swipers'] === undefined) ANCORA_GLOBALS['swipers'] = {};
548	ANCORA_GLOBALS['swipers'][id] = new Swiper('.'+id, {
549		calculateHeight: false,
550		resizeReInit: true,
551		autoResize: true,
552		
553		freeMode: true,
554		freeModeFluid: true,
555		grabCursor: true,
556		noSwiping: obj.hasClass('scroll-no-swiping'),
557		mode: obj.hasClass('sc_scroll_vertical') ? 'vertical' : 'horizontal',
558		slidesPerView: obj.hasClass('sc_scroll') ? 'auto' : 1,
559		mousewheelControl: true,
560		mousewheelAccelerator: 4,	// Accelerate mouse wheel in Firefox 4+
561		scrollContainer: obj.hasClass('sc_scroll_vertical'),
562		scrollbar: {
563			container: '.'+id+'_bar',
564			hide: true,
565			draggable: true  
566		}
567	})
568	
569	obj.data('settings', {mode: 'horizontal'});		// VC hook
570	
571	ancora_prepare_slider_navi(obj);
572}
573
574
575// Slider navigation
576function ancora_prepare_slider_navi(slider) {
577	// Prev / Next
578	var navi = slider.find('> .sc_slider_controls_wrap, > .sc_scroll_controls_wrap');
579	if (navi.length == 0) navi = slider.siblings('.sc_slider_controls_wrap,.sc_scroll_controls_wrap');
580	if (navi.length > 0) {
581		navi.find('.sc_slider_prev,.sc_scroll_prev').click(function(e){
582			var swiper = jQuery(this).parents('.swiper-slider-container');
583			if (swiper.length == 0) swiper = jQuery(this).parents('.sc_slider_controls_wrap,.sc_scroll_controls_wrap').siblings('.swiper-slider-container');
584			var id = swiper.attr('id');
585			ANCORA_GLOBALS['swipers'][id].swipePrev();
586			e.preventDefault();
587			return false;
588		});
589		navi.find('.sc_slider_next,.sc_scroll_next').click(function(e){
590			var swiper = jQuery(this).parents('.swiper-slider-container');
591			if (swiper.length == 0) swiper = jQuery(this).parents('.sc_slider_controls_wrap,.sc_scroll_controls_wrap').siblings('.swiper-slider-container');
592			var id = swiper.attr('id');
593			ANCORA_GLOBALS['swipers'][id].swipeNext();
594			e.preventDefault();
595			return false;
596		});
597	}
598
599	// Pagination
600	navi = slider.siblings('.sc_slider_pagination');
601	if (navi.length > 0) {
602		navi.find('.post_item').click(function(e){
603			var swiper = jQuery(this).parents('.sc_slider_pagination_area').find('.swiper-slider-container');
604			var id = swiper.attr('id');
605			ANCORA_GLOBALS['swipers'][id].swipeTo(jQuery(this).index());
606			e.preventDefault();
607			return false;
608		});
609	}
610}
611
612function ancora_change_active_pagination_in_slider(slider, idx) {
613	var pg = slider.parents('.sc_slider_pagination_area').find('.sc_slider_pagination');
614	if (pg.length==0) return;
615	pg.find('.post_item').removeClass('active').eq(idx).addClass('active');
616	var h = pg.height();
617	var off = pg.find('.active').offset().top - pg.offset().top;
618	var off2 = pg.find('.sc_scroll_wrapper').offset().top - pg.offset().top;
619	var h2  = pg.find('.active').height();
620	if (off < 0) {
621		pg.find('.sc_scroll_wrapper').css({'transform': 'translate3d(0px, 0px, 0px)', 'transition-duration': '0.3s'});
622	} else if (h <= off+h2) {
623		pg.find('.sc_scroll_wrapper').css({'transform': 'translate3d(0px, -'+(Math.abs(off2)+off-h/4)+'px, 0px)', 'transition-duration': '0.3s'});
624	}
625}
626
627// Sliders: Autoheight
628function ancora_slider_autoheight(slider) {
629	if (slider.hasClass('.sc_slider_height_auto')) {
630		slider.find('.swiper-slide').each(function() {
631			if (jQuery(this).data('height_auto') == undefined) {
632				jQuery(this).attr('data-height_auto', jQuery(this).height());
633			}
634		});
635	}
636}
637
638
639// Skills init
640function ancora_init_skills(container) {
641	if (arguments.length==0) var container = jQuery('body');
642	var scrollPosition = jQuery(window).scrollTop() + jQuery(window).height();
643
644	container.find('.sc_skills_item:not(.inited)').each(function () {
645		var skillsItem = jQuery(this);
646		var scrollSkills = skillsItem.offset().top;
647		if (scrollPosition > scrollSkills) {
648			skillsItem.addClass('inited');
649			var skills = skillsItem.parents('.sc_skills').eq(0);
650			var type = skills.data('type');
651			var total = (type=='pie' && skills.hasClass('sc_skills_compact_on')) ? skillsItem.find('.sc_skills_data .pie') : skillsItem.find('.sc_skills_total').eq(0);
652			var start = parseInt(total.data('start'));
653			var stop = parseInt(total.data('stop'));
654			var maximum = parseInt(total.data('max'));
655			var startPercent = Math.round(start/maximum*100);
656			var stopPercent = Math.round(stop/maximum*100);
657			var ed = total.data('ed');
658			var duration = parseInt(total.data('duration'));
659			var speed = parseInt(total.data('speed'));
660			var step = parseInt(total.data('step'));
661			if (type == 'bar') {
662				var dir = skills.data('dir');
663				var count = skillsItem.find('.sc_skills_count').eq(0);
664				if (dir=='horizontal')
665					count.css('width', startPercent + '%').animate({ width: stopPercent + '%' }, duration);
666				else if (dir=='vertical')
667					count.css('height', startPercent + '%').animate({ height: stopPercent + '%' }, duration);
668				ancora_animate_skills_counter(start, stop, speed-(dir!='unknown' ? 5 : 0), step, ed, total);
669			} else if (type == 'counter') {
670				ancora_animate_skills_counter(start, stop, speed - 5, step, ed, total);
671			} else if (type == 'pie') {
672				var steps = parseInt(total.data('steps'));
673				var bg_color = total.data('bg_color');
674				var border_color = total.data('border_color');
675				var cutout = parseInt(total.data('cutout'));
676				var easing = total.data('easing');
677				var options = {
678					segmentShowStroke: true,
679					segmentStrokeColor: border_color,
680					segmentStrokeWidth: 1,
681					percentageInnerCutout : cutout,
682					animationSteps: steps,
683					animationEasing: easing,
684					animateRotate: true,
685					animateScale: false
686				};
687				var pieData = [];
688				total.each(function() {
689					var color = jQuery(this).data('color');
690					var stop = parseInt(jQuery(this).data('stop'));
691					var stopPercent = Math.round(stop/maximum*100);
692					pieData.push({
693						value: stopPercent,
694						color: color
695					});
696				});
697				if (total.length == 1) {
698					ancora_animate_skills_counter(start, stop, Math.round(1500/steps), step, ed, total);
699					pieData.push({
700						value: 100-stopPercent,
701						color: bg_color
702					});
703				}
704				var canvas = skillsItem.find('canvas');
705				canvas.attr({width: skillsItem.width(), height: skillsItem.width()}).css({width: skillsItem.width(), height: skillsItem.height()});
706				new Chart(canvas.get(0).getContext("2d")).Doughnut(pieData, options);
707			}
708		}
709	});
710}
711
712// Skills counter animation
713function ancora_animate_skills_counter(start, stop, speed, step, ed, total) {
714	start = Math.min(stop, start + step);
715	total.text(start+ed);
716	if (start < stop) {
717		setTimeout(function () {
718			ancora_animate_skills_counter(start, stop, speed, step, ed, total);
719		}, speed);
720	}
721}
722
723// Skills arc init
724function ancora_init_skills_arc(container) {
725	if (arguments.length==0) var container = jQuery('body');
726	container.find('.sc_skills_arc:not(.inited)').each(function () {
727		var arc = jQuery(this);
728		arc.addClass('inited');
729		var items = arc.find('.sc_skills_data .arc');
730		var canvas = arc.find('.sc_skills_arc_canvas').eq(0);
731		var legend = arc.find('.sc_skills_legend').eq(0);
732		var w = Math.round(arc.width() - legend.width());
733		var c = Math.floor(w/2);
734		var o = {
735			random: function(l, u){
736				return Math.floor((Math.random()*(u-l+1))+l);
737			},
738			diagram: function(){
739				var r = Raphael(canvas.attr('id'), w, w),
740					rad = hover = Math.round(w/2/items.length),
741					step = Math.round(((w-20)/2-rad)/items.length),
742					stroke = Math.round(w/9/items.length),
743					speed = 400;
744				
745				
746				r.circle(c, c, Math.round(w/2)).attr({ stroke: 'none', fill: ANCORA_GLOBALS['theme_skin_bg'] ? ANCORA_GLOBALS['theme_skin_bg'] : '#ffffff' });
747				
748				var title = r.text(c, c, arc.data('subtitle')).attr({
749					font: 'lighter '+Math.round(rad*0.7)+'px "'+ANCORA_GLOBALS['theme_font']+'"',
750					fill: '#888888'
751				}).toFront();
752				
753				rad -= Math.round(step/2);
754
755				r.customAttributes.arc = function(value, color, rad){
756					var v = 3.6 * value,
757						alpha = v == 360 ? 359.99 : v,
758						rand = o.random(91, 240),
759						a = (rand-alpha) * Math.PI/180,
760						b = rand * Math.PI/180,
761						sx = c + rad * Math.cos(b),
762						sy = c - rad * Math.sin(b),
763						x = c + rad * Math.cos(a),
764						y = c - rad * Math.sin(a),
765						path = [['M', sx, sy], ['A', rad, rad, 0, +(alpha > 180), 1, x, y]];
766					return { path: path, stroke: color }
767				}
768				
769				items.each(function(i){
770					var t = jQuery(this), 
771						color = t.find('.color').val(),
772						value = t.find('.percent').val(),
773						text = t.find('.text').text();
774					
775					rad += step;
776					var z = r.path().attr({ arc: [value, color, rad], 'stroke-width': stroke });
777					
778					z.mouseover(function(){
779						this.animate({ 'stroke-width': hover, opacity: .75 }, 1000, 'elastic');
780						if (Raphael.type != 'VML') //solves IE problem
781							this.toFront();
782						title.stop().animate({ opacity: 0 }, speed, '>', function(){
783							this.attr({ text: (text ? text + '\n' : '') + value + '%' }).animate({ opacity: 1 }, speed, '<');
784						});
785					}).mouseout(function(){
786						this.stop().animate({ 'stroke-width': stroke, opacity: 1 }, speed*4, 'elastic');
787						title.stop().animate({ opacity: 0 }, speed, '>', function(){
788							title.attr({ text: arc.data('subtitle') }).animate({ opacity: 1 }, speed, '<');
789						});	
790					});
791				});
792				
793			}
794		}
795		o.diagram();
796	});
797}
798
799
800// Countdown update
801function ancora_countdown(dt) {
802	var counter = jQuery(this).parent();
803	for (var i=3; i<dt.length; i++) {
804		var v = (dt[i]<10 ? '0' : '') + dt[i];
805		counter.find('.sc_countdown_item').eq(i-3).find('.sc_countdown_digits span').addClass('hide');
806		for (var ch=v.length-1; ch>=0; ch--) {
807			counter.find('.sc_countdown_item').eq(i-3).find('.sc_countdown_digits span').eq(ch+(i==3 && v.length<3 ? 1 : 0)).removeClass('hide').text(v.substr(ch, 1));
808		}
809	}
810}
811
812//rocks skills init
813function rocks_skills_init(container) {
814    if (arguments.length==0) var container = jQuery('body');
815    var scrollPosition = jQuery(window).scrollTop() + jQuery(window).height();
816
817
818    container.find('.sc_rocks_skills:not(.inited)').each(function () {
819        var chart = jQuery(this);
820        var scrollSkills = chart.offset().top + 500;
821
822        if (scrollPosition > scrollSkills) {
823            chart.addClass('inited');
824            var item = jQuery(this);
825            var width = jQuery(this).width();
826            var count =  jQuery(item).find('.sc_rocks_row').length;
827            var shadow = width/count;
828            var maxHeight = jQuery(item).find('.sc_rocks_row .sc_rocks_progress').css('height');
829
830            jQuery(item).find('.sc_rocks_row').each(function () {
831                var percent = jQuery(this).find('.sc_rocks_progress').attr('data-process');
832                percent = percent.replace('%', '');
833                maxHeight = maxHeight.replace('px', '');
834                var x = maxHeight * percent / 100;
835
836                jQuery(this).find('.sc_rocks_progress').css({
837                    'height': x
838                });
839                jQuery(this).find('.sc_rocks_progressbar .sc_rocks_shadow').animate({
840                    'border-bottom-width': '30px',
841                    'border-right-width': shadow
842                }, 1000, "linear");
843                jQuery(this).find('.sc_rocks_progress .sc_rocks_before, .sc_rocks_progress .sc_rocks_after ').animate({
844                    'border-bottom-width': x
845                }, 1600, "linear", function () {
846                    jQuery('.sc_rocks_row').find('.sc_rocks_value, .sc_rocks_caption').css('opacity', 1);
847                });
848            });
849        }
850
851    });
852}
853
854//islands
855function IslandsInit(container){
856    if (arguments.length==0) var container = jQuery('body');
857    var scrollPosition = jQuery(window).scrollTop() + jQuery(window).height();
858
859    container.find('.sc_islands:not(.inited)').each(function () {
860        var item = jQuery(this);
861        var scrollSkills = item.offset().top + 200;
862
863        if (scrollPosition > scrollSkills) {
864            item.addClass('inited');
865            setTimeout(function(){ jQuery(item).find('.sc_island_item.style_1').css('margin-top','0'); }, 900);
866            setTimeout(function(){ jQuery(item).find('.sc_island_item.style_2').css('margin-top','0'); }, 400);
867            setTimeout(function(){ jQuery(item).find('.sc_island_item.style_3').css('margin-top','0'); }, 1200);
868            setTimeout(function(){ jQuery(item).find('.sc_island_item.style_4').css('margin-top','0'); }, 900);
869            setTimeout(function(){ jQuery(item).find('.sc_island_item.style_5').css('margin-top','0'); }, 400);
870            setTimeout(function(){ jQuery(item).find('.sc_island_item .sc_island_title ').css('opacity', 1); }, 2200);
871        }
872    });
873}
874
875//icons widget
876function iconsWidgetInit(container){
877    if (arguments.length==0) var container = jQuery('body');
878    var scrollPosition = jQuery(window).scrollTop() + jQuery(window).height();
879
880    container.find('.sc_icons_widget:not(.inited)').each(function () {
881        var item = jQuery(this);
882        var scrollSkills = item.offset().top + 200;
883
884        if (scrollPosition > scrollSkills) {
885            item.addClass('inited');
886            var x = jQuery(this).find('.sc_icons_item.active').length;
887            var color = jQuery(this).find('.sc_icons_item.active').data('color');
888            var i = 1;
889            step(jQuery(this), i , x, color);
890        }
891    });
892}
893function step(item, i , x, color){
894    jQuery(item).find('.sc_icons_item.active:nth-child('+ i +')').css({'color': color});
895    i++;
896    if(i <= x)
897    {
898        setTimeout(function(){ step(item, i , x, color); }, 200);
899    }
900}
901
902//chart diagram init
903function chart_diagram_init(container) {
904    if (arguments.length==0) var container = jQuery('body');
905    var scrollPosition = jQuery(window).scrollTop() + jQuery(window).height();
906
907    container.find('.sc_chart_diagram:not(.inited)').each(function () {
908        var chart = jQuery(this);
909        var scrollSkills = chart.offset().top + 300;
910        if (scrollPosition > scrollSkills) {
911            chart.addClass('inited');
912            var chart_flag = false;
913            var chart_invise = false;
914            var init_attempts = 0;
915            var inner_cutout = 90;
916
917            function chart_anim(id, doughnutData) {
918
919                var id = id;
920                var doughnutData = doughnutData;
921                var oft = jQuery('#' + id).offset().top;
922                var scrt = jQuery(window).scrollTop();
923                var hgt = jQuery(window).height();
924                if (chart_flag === false) {
925
926                    var options = {
927                        segmentShowStroke: 0,
928                        percentageInnerCutout: inner_cutout,
929                        segmentShowStroke: false
930                    };
931                    var myDoughnut = new Chart(document.getElementById('canvas_' + id).getContext("2d")).Doughnut(doughnutData, options);
932                    chart_flag = true;
933
934                }
935                chart_flag = false;
936            }
937
938
939            var marg = jQuery(chart).find('canvas:first-child').width() * 0.1171875 / (-2);
940            var i = marg;
941            var S = 0;
942
943
944            var sl_width = jQuery(chart).find('canvas').css('width');
945
946            if (jQuery(chart).attr('data-cutout') != '' && jQuery(chart).attr('data-cutout')) {
947                inner_cutout = jQuery(chart).attr('data-cutout');
948            }
949
950            var Count = -1;
951            jQuery(chart).find('.sc_chart_item').each(function () {
952                var dt_percent = jQuery(this).find('canvas').attr('data-percent');
953                var dt_color = jQuery(this).find('canvas').attr('data-color');
954
955                var R = hexToR(dt_color);
956                var G = hexToG(dt_color);
957                var B = hexToB(dt_color);
958
959                dt_color_1  = 'rgb(' + R + ',' + G + ',' + B + ')';
960                dt_color = 'rgba(' + R + ',' + G + ',' + B + ', 0.5)';
961
962                var WH = 100 - dt_percent;
963                var SA = 100 - WH;
964                var FR = 0;
965                var SC = 0;
966
967                if (dt_percent <= 12) {
968                    FR = SA;
969                    SA = 0;
970                }
971                if (dt_percent > 12) {
972                    FR = 12;
973                    SA = SA - 12;
974                }
975                if (dt_percent > 62) {
976                    SC = SA - 50;
977                    SA = 50;
978                }
979
980                var doughnutData = [{
981                    value: FR, //12
982                    color: dt_color_1
983                }, {
984                    value: SA,//63
985                    color: dt_color
986                }, {
987                    value: SC,
988                    color: dt_color_1
989                }, {
990                    value: WH,
991                    color: "transparent"
992                }];
993                Count++;
994                i = i - marg;
995                inner_cutout = inner_cutout - Count;
996
997                var id = jQuery(this).attr('id');
998                chart_anim(id, doughnutData);
999                jQuery(this).css({
1000                    'margin-top': i,
1001                    'margin-left': i
1002                });
1003
1004            });
1005
1006            setTimeout(function () {
1007                jQuery(chart).find('.sc_chart_title').css('opacity', 1);
1008                jQuery(chart).find('.sc_chart_content').css('opacity', 1);
1009                jQuery(chart).find('.sc_chart_line').css('opacity', 1);
1010                jQuery(chart).find('.name').css('opacity', 1);
1011            }, 2000);
1012
1013
1014            jQuery(chart).find('.sc_chart_item .sc_chart_content').each(function () {
1015                var percent = jQuery(this).parent().find('canvas').attr('data-percent');
1016                var height = jQuery(this).parent().find('canvas').height() / 2;
1017
1018                if (percent < 25) var plots = (100 + percent) * 10 - 250;
1019                else var plots = percent * 10 - 250;
1020
1021                var increase = Math.PI * 2 / 1000,
1022                    angle = 0,
1023                    x = 0,
1024                    y = 0;
1025                for (var i = 1; i < plots; i++) {
1026                    angle += increase;
1027                }
1028
1029                x = (height + height * 0.35) * Math.cos(angle) + height;
1030                y = (height + height * 0.35) * Math.sin(angle) + height;
1031
1032                if (percent == 50){ x = x - jQuery(this).width() / 2 - 3; y = y + 10;}
1033                if (percent > 50 && percent < 80) x = x - jQuery(this).width();
1034                if (percent > 50 || percent < 26) y = y - jQuery(this).height() / 2;
1035                if (percent > 75) { y = y - jQuery(this).height() / 2 - 10; x = x - jQuery(this).width() / 2; }
1036                jQuery(this).css({
1037                    'left': x,
1038                    'top': y
1039                });
1040
1041                var T= 0; var L=0;
1042                if(jQuery(this).find('.icon').length > 0)
1043                {
1044                    var position = jQuery(this).find('.icon').position();
1045                    T = position.top + jQuery(this).find('.icon').height() + 40;
1046                    L = position.left - 160 + jQuery(this).width() / 2;
1047                }
1048                jQuery(this).find('.content').css({
1049                    'top': T,
1050                    'left': L
1051                });
1052            });
1053
1054            var k = 0;
1055            jQuery(chart).find('.sc_chart_item .sc_chart_line').each(function () {
1056                var percent = jQuery(this).parent().find('canvas').attr('data-percent');
1057                var ItemHeight = jQuery(this).parent().find('canvas').height();
1058                var LineHeight = ItemHeight + ItemHeight * 0.35;
1059                plots = percent * 10 - 250;
1060                increase = Math.PI * 2 / 1000,
1061                    angle = 0,
1062                    x = 0,
1063                    y = 0;
1064                var U = percent * 360 / 100;
1065                k = k + marg;
1066                if (percent > 50) x = x - jQuery(this).width();
1067                jQuery(this).css({
1068                    'height': LineHeight,
1069                    'transform': 'rotate(' + U + 'deg)',
1070                    'left': (ItemHeight / 2),
1071                    'top': ((ItemHeight - LineHeight) / 2)
1072                });
1073                var t = jQuery(this).parent().find('canvas').height() * 0.18  + marg * (-0.9);
1074                jQuery(this).find('.sc_chart_tail').css('height', t);
1075
1076            });
1077
1078            jQuery(chart).find('.sc_chart_content img').mouseover(function () {
1079                jQuery(this).parent().find('.content').show();
1080            });
1081
1082            jQuery(chart).find('.sc_chart_content img').mouseout(function () {
1083                jQuery(this).parent().find('.content').hide();
1084            });
1085        }
1086
1087    });
1088}
1089
1090
1091function hexToR(h) {
1092    return parseInt((cutHex(h)).substring(0, 2), 16)
1093}
1094
1095function hexToG(h) {
1096    return parseInt((cutHex(h)).substring(2, 4), 16)
1097}
1098
1099function hexToB(h) {
1100    return parseInt((cutHex(h)).substring(4, 6), 16)
1101}
1102
1103function cutHex(h) {
1104    return (h.charAt(0) == "#") ? h.substring(1, 7) : h
1105}

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.