PageSourceSearch

https://apsspb.com/wp-content/themes/optima/fw/shortcodes/shortcodes.js

js apsspb.com collected 2026-10-07 18:10:08 UTC 38,470 bytes, 1,065 lines download raw bytes

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

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.