PageSourceSearch

https://buckinghamcrossfit.ca/wp-content/themes/Impreza/framework/js/us.widgets.js?ver=3.3.2

js buckinghamcrossfit.ca collected 2026-10-08 03:29:11 UTC 52,969 bytes, 1,693 lines download raw bytes

1/**
2 * UpSolution Shortcode: us_message
3 */
4(function($){
5	"use strict";
6
7	$.fn.usMessage = function(){
8		return this.each(function(){
9			var $this = $(this),
10				$closer = $this.find('.w-message-close');
11			$closer.click(function(){
12				$this.wrap('<div></div>');
13				var $wrapper = $this.parent();
14				$wrapper.css({overflow: 'hidden', height: $this.outerHeight(true)});
15				$wrapper.performCSSTransition({
16					height: 0
17				}, 400, function(){
18					$wrapper.remove();
19					$us.$canvas.trigger('contentChange');
20				}, 'cubic-bezier(.4,0,.2,1)');
21			});
22		});
23	};
24
25	$(function(){
26		$('.w-message').usMessage();
27	});
28})(jQuery);
29
30
31/**
32 * Focus for different kind of forms
33 */
34jQuery(function($){
35	$(document).on('focus', '.w-form-row-field input, .w-form-row-field textarea', function(){
36		$(this).closest('.w-form-row').addClass('focused');
37	});
38	$(document).on('blur', '.w-form-row-field input, .w-form-row-field textarea', function(){
39		$(this).closest('.w-form-row').removeClass('focused');
40	});
41});
42
43
44/**
45 * UpSolution Widget: w-dropdown
46 */
47(function($){
48	"use strict";
49	$.fn.wDropdown = function(){
50		return this.each(function(){
51			var $this = $(this),
52				$list = $this.find('.w-dropdown-list'),
53				$current = $this.find('.w-dropdown-current');
54			var closeList = function(){
55				$list.slideUpCSS(250, function(){
56					$this.removeClass('active');
57				});
58				$us.$window.off('mouseup touchstart mousewheel DOMMouseScroll touchstart', closeListEvent);
59			};
60			var closeListEvent = function(e){
61				if ($this.has(e.target).length !== 0) return;
62				e.stopPropagation();
63				e.preventDefault();
64				closeList();
65			};
66			$list.hide();
67			$current.click(function(){
68				if ($this.hasClass('active')){
69					closeList();
70					return;
71				}
72				$this.addClass('active');
73				$list.slideDownCSS();
74				$us.$window.on('mouseup touchstart mousewheel DOMMouseScroll touchstart', closeListEvent);
75			});
76		});
77	};
78	$(function(){
79		$('.w-dropdown').wDropdown();
80	});
81})(jQuery);
82
83
84/**
85 * UpSolution Widget: w-blog
86 */
87(function($){
88	"use strict";
89
90	$us.WBlog = function(container, options){
91		this.init(container, options);
92	};
93
94	$us.WBlog.prototype = {
95
96		init: function(container, options){
97			// Commonly used dom elements
98			this.$container = $(container);
99			this.$filters = this.$container.find('.g-filters-item');
100			this.$list = this.$container.find('.w-blog-list');
101			this.$items = this.$container.find('.w-blog-post');
102			this.$pagination = this.$container.find('.g-pagination');
103			this.$loadmore = this.$container.find('.g-loadmore');
104			this.$preloader = this.$container.find('.w-blog-preloader');
105			this.curCategory = '';
106			this.paginationType = this.$pagination.length ? 'regular' : (this.$loadmore.length ? 'ajax' : 'none');
107			this.items = [];
108			this.loading = false;
109
110			if (this.paginationType != 'none') {
111				var $jsonContainer = this.$container.find('.w-blog-json');
112				if ($jsonContainer.length == 0) return;
113				this.ajaxData = $jsonContainer[0].onclick() || {};
114				this.ajaxUrl = this.ajaxData.ajax_url || '';
115				this.permalinkUrl = this.ajaxData.permalink_url || '';
116				this.templateVars = this.ajaxData.template_vars || {};
117				this.category = this.templateVars.query_args.category_name || '';
118				this.curCategory = this.category;
119				this.curPage = this.ajaxData.current_page || 1;
120				this.perpage = this.ajaxData.perpage || this.$items.length;
121				this.infiniteScroll = this.ajaxData.infinite_scroll || 0;
122				$jsonContainer.remove();
123
124			}
125
126			if (this.paginationType == 'ajax') {
127				if (this.templateVars.query_args.orderby == 'rand') {
128					this.$items.each(function(index, item){
129						this.items.push(parseInt(item.getAttribute('data-id')));
130					}.bind(this));
131				}
132				this.$loadmore.on('click', function(){
133					if (this.curPage < this.ajaxData.max_num_pages) {
134						this.setState(this.curPage + 1);
135					}
136				}.bind(this));
137
138				if (this.infiniteScroll) {
139					$us.scroll.addWaypoint(this.$loadmore, '-70%', function(){
140						this.$loadmore.click();
141					}.bind(this));
142				}
143			}
144			else if (this.paginationType == 'regular' && this.$filters.length) {
145				this.paginationPcre = new RegExp('/page/([0-9]+)/$');
146				this.location = location.href.replace(this.paginationPcre, '/');
147				this.$navLinks = this.$container.find('.nav-links');
148				var self = this;
149				this.$navLinks.on('click', 'a', function(e){
150					e.preventDefault();
151					var arr,
152						pageNum = (arr = self.paginationPcre.exec(this.href)) ? parseInt(arr[1]) : 1;
153					self.setState(pageNum);
154				});
155			}
156
157			if (this.$container.hasClass('with_isotope') && $.fn.isotope) {
158				this.$list.imagesLoaded(function(){
159					this.$list.isotope({
160						itemSelector: '.w-blog-post',
161						layoutMode: (this.$container.hasClass('isotope_fit_rows')) ? 'fitRows' : 'masonry',
162						isOriginLeft: !$('.l-body').hasClass('rtl')
163					});
164					this.$list.isotope();
165				}.bind(this));
166
167				$us.$canvas.on('contentChange', function(){
168					this.$list.imagesLoaded(function(){
169						this.$list.isotope('layout');
170					}.bind(this));
171				}.bind(this));
172			}
173
174			this.$filters.each(function(index, filter){
175				var $filter = $(filter),
176					category = $filter.data('category');
177				$filter.on('click', function(){
178					if (category != this.curCategory) {
179						this.setState(1, category);
180						this.$filters.removeClass('active');
181						$filter.addClass('active');
182					}
183				}.bind(this))
184			}.bind(this));
185		},
186
187		setState: function(page, category){
188			if (this.paginationType == 'none') {
189				// Simple state changer
190				this.$list.isotope({filter: (category == '*') ? '*' : ('.' + category)});
191				this.curCategory = category;
192				return;
193			}
194
195			if (this.loading) return;
196
197			this.loading = true;
198
199			category = category || this.curCategory;
200			if (category == '*') {
201				category = this.category;
202			}
203
204			this.templateVars.query_args.paged = page;
205			this.templateVars.query_args.category_name = category;
206
207			if (this.paginationType == 'ajax') {
208				if (page == 1) {
209					this.items = [];
210					this.templateVars.query_args.post__not_in = this.items;
211					this.$loadmore.addClass('done');
212				} else {
213					if (this.templateVars.query_args.orderby == 'rand') {
214						this.templateVars.query_args.paged = 1;
215						this.templateVars.query_args.post__not_in = this.items;
216					}
217					this.$loadmore.addClass('loading');
218				}
219			}
220
221			if (this.paginationType != 'ajax' || page == 1) {
222				this.$preloader.addClass('active');
223				if (this.$list.data('isotope')) {
224					this.$list.isotope('remove', this.$container.find('.w-blog-post'));
225					this.$list.isotope('layout');
226				} else {
227					this.$container.find('.w-blog-post').remove();
228				}
229			}
230
231			this.ajaxData.template_vars = JSON.stringify(this.templateVars);
232
233			// In case we set paged to 1 for rand order - setting it back
234			this.templateVars.query_args.paged = page;
235
236			$.ajax({
237				type: 'post',
238				url: this.ajaxData.ajax_url,
239				data: this.ajaxData,
240				success: function(html){
241					var $result = $(html),
242						$container = $result.find('.w-blog-list'),
243						$items = $container.children(),
244						isotope = this.$list.data('isotope');
245					$container.imagesLoaded(function(){
246						this.beforeAppendItems($items);
247						$items.appendTo(this.$list);
248						$container.remove();
249						var $sliders = $items.find('.w-slider');
250						this.afterAppendItems($items);
251						if (isotope) {
252							isotope.appended($items);
253						}
254						$sliders.each(function(index, slider){
255							$(slider).wSlider().find('.royalSlider').data('royalSlider').ev.on('rsAfterInit', function(){
256								if (isotope) {
257									this.$list.isotope('layout');
258								}
259							});
260						}.bind(this));
261						if (isotope) {
262							this.$list.isotope('layout');
263						}
264						if (this.paginationType == 'regular') {
265							this.$pagination.remove();
266
267							var $pagination = $result.find('.g-pagination');
268
269							this.$container.append($pagination);
270							this.$pagination = this.$container.find('.g-pagination');
271
272							var self = this;
273							this.$pagination.find('.nav-links a').each(function(){
274								var $link = $(this),
275									linkURL = $link.attr('href');
276								linkURL = linkURL.replace(self.ajaxUrl, self.permalinkUrl);
277								$link.attr('href', linkURL);
278							});
279
280							this.paginationPcre = new RegExp('/page/([0-9]+)/$');
281							this.location = location.href.replace(this.paginationPcre, '/');
282							this.$navLinks = this.$container.find('.nav-links');
283
284							this.$navLinks.on('click', 'a', function(e){
285								e.preventDefault();
286								var arr,
287									pageNum = (arr = self.paginationPcre.exec(this.href)) ? parseInt(arr[1]) : 1;
288								self.setState(pageNum);
289							});
290
291						}
292						if (this.paginationType == 'ajax') {
293							if (page == 1) {
294								var $jsonContainer = $result.find('.w-blog-json');
295								if ($jsonContainer.length) {
296									var ajaxData = $jsonContainer[0].onclick() || {};
297									this.ajaxData.max_num_pages = ajaxData.max_num_pages || this.ajaxData.max_num_pages;
298								} else {
299									this.ajaxData.max_num_pages = 1;
300								}
301							}
302
303							if (this.templateVars.query_args.orderby == 'rand') {
304								$items.each(function(index, item){
305									this.items.push(parseInt(item.getAttribute('data-id')));
306								}.bind(this));
307							}
308
309							if (this.templateVars.query_args.paged >= this.ajaxData.max_num_pages) {
310								this.$loadmore.addClass('done');
311							} else {
312								this.$loadmore.removeClass('done');
313								this.$loadmore.removeClass('loading');
314							}
315
316							if (this.infiniteScroll) {
317								$us.scroll.addWaypoint(this.$loadmore, '-70%', function(){
318									this.$loadmore.click();
319								}.bind(this));
320							}
321						}
322						this.$preloader.removeClass('active');
323					}.bind(this));
324
325					this.loading = false;
326
327				}.bind(this),
328				error: function(){
329					this.$loadmore.removeClass('loading');
330				}.bind(this)
331			});
332
333
334			this.curPage = page;
335			this.curCategory = category;
336
337		},
338		/**
339		 * Overloadable function for themes
340		 * @param $items
341		 */
342		beforeAppendItems: function($items){
343		},
344
345		afterAppendItems: function($items){
346		}
347
348	};
349
350	$.fn.wBlog = function(options){
351		return this.each(function(){
352			$(this).data('wBlog', new $us.WBlog(this, options));
353		});
354	};
355
356})(jQuery);
357
358
359/**
360 * UpSolution Widget: w-tabs
361 *
362 * @requires $us.canvas
363 */
364!function($){
365	"use strict";
366
367	$us.WTabs = function(container, options){
368		this.init(container, options);
369	};
370
371	$us.WTabs.prototype = {
372
373		init: function(container, options){
374			// Setting options
375			var defaults = {
376				duration: 300,
377				easing: 'cubic-bezier(.78,.13,.15,.86)'
378			};
379			this.options = $.extend({}, defaults, options);
380			this.isRtl = $('.l-body').hasClass('rtl');
381
382			// Commonly used dom elements
383			this.$container = $(container);
384			this.$tabsList = this.$container.find('.w-tabs-list:first');
385			this.$tabs = this.$tabsList.find('.w-tabs-item');
386			this.$tabsH = this.$tabsList.find('.w-tabs-item-h');
387			this.$sectionsWrapper = this.$container.find('.w-tabs-sections:first');
388			this.$sectionsHelper = this.$sectionsWrapper.children();
389			this.$sections = this.$sectionsHelper.find('.w-tabs-section');
390			this.$headers = this.$sections.children('.w-tabs-section-header');
391			this.$contents = this.$sections.children('.w-tabs-section-content');
392
393			// Class variables
394			this.width = 0;
395			this.tabWidths = [];
396			this.isTogglable = (this.$container.usMod('type') == 'togglable');
397			// Basic layout
398			this.basicLayout = this.$container.hasClass('accordion') ? 'accordion' : (this.$container.usMod('layout') || 'default');
399			// Current active layout (may be switched to 'accordion')
400			this.curLayout = this.basicLayout;
401			this.responsive = $us.canvas.options.responsive;
402			// Array of active tabs indexes
403			this.active = [];
404			this.count = this.$tabs.length;
405			// Container width at which we should switch to accordion layout
406			this.minWidth = 0;
407
408			if (this.count == 0) return;
409
410			// Preparing arrays of jQuery objects for easier manipulating in future
411			this.tabs = $.map(this.$tabs.toArray(), $);
412			this.sections = $.map(this.$sections.toArray(), $);
413			this.headers = $.map(this.$headers.toArray(), $);
414			this.contents = $.map(this.$contents.toArray(), $);
415
416			$.each(this.tabs, function(index){
417				if (this.tabs[index].hasClass('active')) {
418					this.active.push(index);
419				}
420				this.tabs[index].add(this.headers[index]).on('click', function(e){
421					e.preventDefault();
422					// Toggling accordion sections
423					if (this.curLayout == 'accordion' && this.isTogglable) {
424						// Cannot toggle the only active item
425						this.toggleSection(index);
426					}
427					// Setting tabs active item
428					else if (index != this.active[0]) {
429						this.openSection(index);
430					}
431				}.bind(this));
432			}.bind(this));
433
434			this.$tabsH.on('click', function(e){
435				e.preventDefault();
436			});
437
438			// Boundable events
439			this._events = {
440				resize: this.resize.bind(this),
441				contentChanged: function(){
442					$us.$canvas.trigger('contentChange');
443				}
444			};
445
446			// Starting everything
447			this.switchLayout(this.curLayout);
448			if (this.curLayout != 'accordion' || !this.isTogglable) {
449				this.openSection(this.active[0]);
450			}
451
452			setTimeout(this._events.resize, 50);
453			$us.$window.on('resize load', this._events.resize);
454
455			if (window.location.hash) {
456				var hash = window.location.hash.substr(1),
457					$linkedSection = this.$container.find('.w-tabs-section[id="'+hash+'"]');
458				if ($linkedSection.length && ( ! $linkedSection.hasClass('active'))) {
459					var $header = $linkedSection.find('.w-tabs-section-header');
460					$header.click();
461				}
462			}
463		},
464
465		switchLayout: function(to){
466			this.cleanUpLayout(this.curLayout);
467			this.prepareLayout(to);
468			this.curLayout = to;
469		},
470
471		/**
472		 * Clean up layout's special inline styles and/or dom elements
473		 * @param from
474		 */
475		cleanUpLayout: function(from){
476			if (from == 'default' || from == 'timeline' || from == 'modern' || from == 'trendy') {
477				this.$sectionsWrapper.clearPreviousTransitions().resetInlineCSS('width', 'height');
478				this.$sectionsHelper.clearPreviousTransitions().resetInlineCSS('position', 'width', 'left');
479				this.$sections.resetInlineCSS('width');
480				this.$container.removeClass('autoresize');
481			}
482			else if (from == 'accordion') {
483				this.$container.removeClass('accordion');
484				this.$contents.resetInlineCSS('height', 'padding-top', 'padding-bottom', 'display', 'opacity');
485			}
486			else if (from == 'ver') {
487				this.$contents.resetInlineCSS('height', 'padding-top', 'padding-bottom', 'display', 'opacity');
488			}
489		},
490
491		/**
492		 * Apply layout's special inline styles and/or dom elements
493		 * @param to
494		 */
495		prepareLayout: function(to){
496			if (to == 'default' || to == 'timeline' || to == 'modern' || to == 'trendy') {
497				this.$container.addClass('autoresize');
498				this.$sectionsHelper.css('position', 'absolute');
499			}
500			else if (to == 'accordion') {
501				this.$container.addClass('accordion');
502				this.$contents.hide();
503				for (var i = 0; i < this.active.length; i++) {
504					if (this.contents[this.active[i]] !== undefined) {
505						this.contents[this.active[i]].show();
506					}
507				}
508			}
509			else if (to == 'ver') {
510				this.$contents.hide();
511				this.contents[this.active[0]].show();
512			}
513		},
514
515		/**
516		 * Measure needed sizes and store them to this.tabWidths variable
517		 *
518		 * TODO Count minWidth here as well
519		 */
520		measure: function(){
521			if (this.basicLayout == 'ver') {
522				// Measuring minimum tabs width
523				this.$tabsList.css('width', 0);
524				var minTabWidth = this.$tabsList.outerWidth(true);
525				this.$tabsList.css('width', '');
526				// Measuring the mininum content width
527				this.$container.addClass('measure');
528				var minContentWidth = this.$sectionsWrapper.outerWidth(true);
529				this.$container.removeClass('measure');
530				// Measuring minimum tabs width for percent-based sizes
531				var navWidth = this.$container.usMod('navwidth');
532				if (navWidth != 'auto') {
533					// Percent-based measure
534					minTabWidth = Math.max(minTabWidth, minContentWidth * parseInt(navWidth) / (100 - parseInt(navWidth)));
535				}
536				this.minWidth = Math.max(480, minContentWidth + minTabWidth + 1);
537			} else {
538				this.tabWidths = [];
539				// We hide active line temporarily to count tab sizes properly
540				this.$container.addClass('measure');
541				for (var index = 0; index < this.tabs.length; index++) {
542					this.tabWidths.push(this.tabs[index].outerWidth(true));
543				}
544				this.$container.removeClass('measure');
545				if (this.basicLayout == 'default' || this.basicLayout == 'timeline' || this.basicLayout == 'modern' || this.basicLayout == 'trendy') {
546					// Array sum
547					this.minWidth = this.tabWidths.reduce(function(pv, cv){
548						return pv + cv;
549					}, 0);
550				}
551			}
552		},
553
554		/**
555		 * Open tab section
556		 *
557		 * @param index int
558		 */
559		openSection: function(index){
560			if (this.sections[index] === undefined) return;
561			if (this.curLayout == 'default' || this.curLayout == 'timeline' || this.curLayout == 'modern' || this.curLayout == 'trendy') {
562				this.$container.removeClass('autoresize');
563				var height = this.sections[index].height();
564				this.$sectionsHelper.performCSSTransition({
565					left: -this.width * (this.isRtl ? (this.count - index - 1 ) : index)
566				}, this.options.duration, this._events.contentChanged, this.options.easing);
567				this.$sectionsWrapper.performCSSTransition({
568					height: height
569				}, this.options.duration, function(){
570					this.$container.addClass('autoresize');
571				}.bind(this), this.options.easing);
572			}
573			else if (this.curLayout == 'accordion' || this.curLayout == 'ver') {
574				if (this.contents[this.active[0]] !== undefined) {
575					this.contents[this.active[0]].css('display', 'block').slide
575Up(this.options.duration);
576				}
577				this.contents[index].css('display', 'none').slideDown(this.options.duration, this._events.contentChanged);
578				// Scrolling to the opened section at small window dimensions
579				if (this.curLayout == 'accordion' && $us.canvas.winWidth < 768) {
580					var newTop = this.headers[0].offset().top;
581					for (var i = 0; i < index; i++) {
582						newTop += this.headers[i].outerHeight();
583					}
584					$us.scroll.scrollTo(newTop, true);
585				}
586			}
587			this._events.contentChanged();
588			this.$tabs.removeClass('active');
589			this.tabs[index].addClass('active');
590			this.$sections.removeClass('active');
591			this.sections[index].addClass('active');
592			this.active[0] = index;
593		},
594
595		/**
596		 * Toggle some togglable accordion section
597		 *
598		 * @param index
599		 */
600		toggleSection: function(index){
601			// (!) Can only be used within accordion state
602			var indexPos = $.inArray(index, this.active);
603			if (indexPos != -1) {
604				this.contents[index].css('display', 'block').slideUp(this.options.duration, this._events.contentChanged);
605				this.tabs[index].removeClass('active');
606				this.sections[index].removeClass('active');
607				this.active.splice(indexPos, 1);
608			}
609			else {
610				this.contents[index].css('display', 'none').slideDown(this.options.duration, this._events.contentChanged);
611				this.tabs[index].addClass('active');
612				this.sections[index].addClass('active');
613				this.active.push(index);
614			}
615		},
616
617		/**
618		 * Resize-driven logics
619		 */
620		resize: function(){
621			this.width = this.$container.width();
622			this.$tabsList.removeClass('hidden');
623
624			// Basic layout may be overriden
625			if (this.responsive) {
626				if (this.basicLayout == 'ver' && this.curLayout != 'ver') this.switchLayout('ver');
627				if (this.curLayout != 'accordion') this.measure();
628				var nextLayout = (this.width < this.minWidth) ? 'accordion' : this.basicLayout;
629				if (nextLayout !== this.curLayout) this.switchLayout(nextLayout);
630			}
631
632			// Fixing tabs display
633			if (this.curLayout == 'default' || this.curLayout == 'timeline' || this.curLayout == 'modern' || this.curLayout == 'trendy') {
634				this.$container.addClass('autoresize');
635				this.$sectionsWrapper.css('width', this.width);
636				this.$sectionsHelper.css('width', this.count * this.width);
637				this.$sections.css('width', this.width);
638				if (this.contents[this.active[0]] !== undefined) {
639					this.$sectionsHelper.css('left', -this.width * (this.isRtl ? (this.count - this.active[0] - 1) : this.active[0]));
640					var height = this.sections[this.active[0]].height();
641					this.$sectionsWrapper.css('height', height);
642				}
643			} else if (this.curLayout == 'ver') {
644				var sectionsWrapperWidth = this.$sectionsWrapper.width();
645			}
646			this._events.contentChanged()
647		}
648
649	};
650
651	$.fn.wTabs = function(options){
652		return this.each(function(){
653			$(this).data('wTabs', new $us.WTabs(this, options));
654		});
655	};
656
657}(jQuery);
658
659
660/**
661 * UpSolution Shortcode: us_logos
662 */
663jQuery(function($){
664	$(".w-logos.type_carousel .w-logos-list").each(function(){
665		var $list = $(this),
666			items = parseInt($list.data('items'));
667		$list.owlCarousel({
668			items: items,
669			center: (items == 1),
670			loop: true,
671			rtl: $('.l-body').hasClass('rtl'),
672			nav: $list.data('nav'),
673			autoplay: $list.data('autoplay'),
674			autoplayTimeout: $list.data('timeout'),
675			autoplayHoverPause: true,
676			responsive: {
677				0: {items: 1, center: true},
678				480: {items: Math.min(items, 2)},
679				768: {items: Math.min(items, 3)},
680				900: {items: Math.min(items, 4)},
681				1200: {items: items}
682			}
683		});
684	});
685});
686
687
688/**
689 * UpSolution Shortcode: us_feedback
690 */
691jQuery(function($){
692
693	$('.w-form.for_cform').each(function(){
694		var $container = $(this),
695			$form = $container.find('form:first'),
696			$submitBtn = $form.find('.w-btn'),
697			$resultField = $form.find('.w-form-message'),
698			options = $container.find('.w-form-json')[0].onclick();
699
700		$form.submit(function(event){
701			event.preventDefault();
702
703			// Prevent double-sending
704			if ($submitBtn.hasClass('loading')) return;
705
706			$resultField.usMod('type', false).html('');
707			// Validation
708			var errors = 0;
709			$form.find('[data-required="true"]').each(function(){
710				var $input = $(this),
711					isEmpty = ($input.val() == ''),
712					$row = $input.closest('.w-form-row'),
713					errorText = options.errors[$input.attr('name')] || '';
714				$row.toggleClass('check_wrong', isEmpty);
715				$row.find('.w-form-row-state').html(isEmpty ? errorText : '');
716				if (isEmpty) {
717					errors++;
718				}
719			});
720
721			if (errors != 0) return;
722
723			$submitBtn.addClass('loading');
724			$.ajax({
725				type: 'POST',
726				url: options.ajaxurl,
727				dataType: 'json',
728				data: $form.serialize(),
729				success: function(result){
730					if (result.success) {
731						$resultField.usMod('type', 'success').html(result.data);
732						$form.find('.w-form-row.check_wrong').removeClass('check_wrong');
733						$form.find('.w-form-row.not-empty').removeClass('not-empty');
734						$form.find('.w-form-state').html('');
735						$form.find('input[type="text"], input[type="email"], textarea').val('');
736					} else {
737						$form.find('.w-form-row.check_wrong').removeClass('check_wrong');
738						$form.find('.w-form-state').html('');
739						if (result.data && typeof result.data == 'object') {
740							for (var fieldName in result.data) {
741								if (fieldName == 'empty_message') {
742									var errorText = result.data[fieldName];
743									$resultField.usMod('type', 'error').html(errorText);
744									continue;
745								}
746								if (!result.data.hasOwnProperty(fieldName)) continue;
747								var $input = $form.find('[name="' + fieldName + '"]'),
748									errorText = result.data[fieldName];
749								$input.closest('.w-form-row').addClass('check_wrong')
750									.find('.w-form-row-state').html(errorText);
751							}
752						} else {
753							$resultField.usMod('type', 'error').html(result.data);
754						}
755					}
756				},
757				complete: function(){
758					$submitBtn.removeClass('loading');
759				}
760			});
761		});
762
763	});
764});
765
766
767/**
768 * UpSolution Shortcode: us_counter
769 */
770jQuery(function($){
771	$('.w-counter').each(function(index, elm){
772		var $container = $(this),
773			$number = $container.find('.w-counter-number'),
774			initial = ($container.data('initial') || '0') + '',
775			target = ($container.data('target') || '10') + '',
776			prefix = $container.data('prefix') || '',
777			suffix = $container.data('suffix') || '',
778		// 0 for integers, 1+ for floats (number of digits after the decimal)
779			precision = 0;
780		if (target.indexOf('.') != -1) {
781			precision = target.length - 1 - target.indexOf('.');
782		}
783		initial = window[precision ? 'parseFloat' : 'parseInt'](initial, 10);
784		target = window[precision ? 'parseFloat' : 'parseInt'](target, 10);
785
786		$number.html(prefix + initial.toFixed(precision) + suffix);
787
788		$us.scroll.addWaypoint(this, '15%', function(){
789			var current = initial,
790				step = 25,
791				stepValue = (target - initial) / 25,
792				interval = setInterval(function(){
793					current += stepValue;
794					step--;
795					$number.html(prefix + current.toFixed(precision) + suffix);
796					if (step <= 0) {
797						$number.html(prefix + target.toFixed(precision) + suffix);
798						window.clearInterval(interval);
799					}
800				}, 40);
801		});
802	});
803});
804
805
806/**
807 * UpSolution Shortcode: us_progbar
808 */
809jQuery(function($){
810	$('.w-progbar').each(function(index, elm){
811		var $container = $(this),
812			$bar = $container.find('.w-progbar-bar-h'),
813			count = $container.data('count') + '',
814			$titleCount = $container.find('.w-progbar-title-count'),
815			$barCount = $container.find('.w-progbar-bar-count');
816
817		if (count === null) {
818			count = 50;
819		}
820
821		$titleCount.html('0%');
822		$barCount.html('0%');
823
824		$us.scroll.addWaypoint(this, '15%', function(){
825			var current = 0,
826				step = 40,
827				stepValue = count / 40,
828				interval = setInterval(function(){
829					current += stepValue;
830					step--;
831					$titleCount.html(current.toFixed(0) + '%');
832					$barCount.html(current.toFixed(0) + '%');
833					if (step <= 0) {
834						$titleCount.html(count + '%');
835						$barCount.html(count + '%');
836						window.clearInterval(interval);
837					}
838				}, 20);
839
840			$container.removeClass('initial');
841		});
842	});
843});
844
845
846/**
847 * UpSolution Shortcode: us_gallery
848 */
849jQuery(function($){
850	if ($.fn.magnificPopup) {
851		$('.w-gallery.link_media .w-gallery-list').each(function(){
852			$(this).magnificPopup({
853				type: 'image',
854				delegate: 'a.w-gallery-item',
855				gallery: {
856					enabled: true,
857					navigateByImgClick: true,
858					preload: [0, 1],
859					tPrev: $us.langOptions.magnificPopup.tPrev, // Alt text on left arrow
860					tNext: $us.langOptions.magnificPopup.tNext, // Alt text on right arrow
861					tCounter: $us.langOptions.magnificPopup.tCounter // Markup for "1 of 7" counter
862				},
863				removalDelay: 300,
864				mainClass: 'mfp-fade',
865				fixedContentPos: false
866			});
867		});
868	}
869	if ($.fn.isotope) {
870		// Applying isotope to gallery
871		$('.w-gallery.layout_masonry .w-gallery-list').each(function(index, container){
872			var $container = $(container);
873			$container.imagesLoaded(function(){
874				$container.isotope({
875					layoutMode: 'masonry',
876					isOriginLeft: !$('body').hasClass('rtl')
877				});
878				$container.isotope();
879			});
880		});
881	}
882});
883
884
885/**
886 * UpSolution Shortcode: us_slider
887 */
888(function($){
889	$.fn.wSlider = function(){
890		return this.each(function(){
891			var $this = $(this),
892				$slider = $this.find('.royalSlider'),
893				$options = $this.find('.w-slider-json'),
894				options = $options[0].onclick() || {};
895			$options.remove();
896			if (!$.fn.royalSlider) {
897				return;
898			}
899			// Always apply certain fit options for blog listing slider
900			if ($this.parent().hasClass('w-blog-post-preview')) {
901				options['imageScaleMode'] = 'fill';
902			}
903			$slider.royalSlider(options);
904			var slider = $slider.data('royalSlider');
905			if (options.fullscreen && options.fullscreen.enabled) {
906				// Moving royal slider to the very end of body element to allow a proper fullscreen
907				var rsEnterFullscreen = function(){
908					$slider.appendTo($('body'));
909					slider.ev.off('rsEnterFullscreen', rsEnterFullscreen);
910					slider.exitFullscreen();
911					slider.enterFullscreen();
912					slider.ev.on('rsEnterFullscreen', rsEnterFullscreen);
913					slider.ev.on('rsExitFullscreen', rsExitFullscreen);
914				};
915				slider.ev.on('rsEnterFullscreen', rsEnterFullscreen);
916				var rsExitFullscreen = function(){
917					$slider.prependTo($this);
918					slider.ev.off('rsExitFullscreen', rsExitFullscreen);
919					slider.exitFullscreen();
920				};
921			}
922			$us.$canvas.on('contentChange', function(){
923				$slider.parent().imagesLoaded(function(){
924					slider.updateSliderSize();
925				});
926			});
927		});
928	};
929	$(function(){
930		jQuery('.w-slider').wSlider();
931	});
932})(jQuery);
933
934
935/**
936 * UpSolution Widget: w-portfolio
937 */
938!function($){
939	"use strict";
940
941	$us.WPortfolio = function(container, options){
942		this.init(container, options);
943	};
944
945	$us.WPortfolio.prototype = {
946
947		init: function(container, options){
948			// Commonly used dom elements
949			this.$container = $(container);
950
951			if (this.$container.usMod('position') != 'isotope' || !$.fn.isotope) {
952				// No scripts needed
953				return;
954			}
955
956			this.$filters = this.$container.find('.g-filters-item');
957			this.$list = this.$container.find('.w-portfolio-list');
958			this.$items = this.$container.find('.w-portfolio-item');
959			this.$pagination = this.$container.find('.g-pagination');
960			this.$loadmore = this.$container.find('.g-loadmore');
961			this.paginationType = this.$pagination.length ? 'regular' : (this.$loadmore.length ? 'ajax' : 'none');
962			this.items = {};
963			this.curCategory = '*';
964			this.loading = false;
965
966			this.$items.each(function(index, item){
967				this.items[parseInt(item.getAttribute('data-id'))] = $(item);
968			}.bind(this));
969
970			this.isotopeOptions = {
971				itemSelector: '.w-portfolio-item',
972				layoutMode: 'masonry',
973				masonry: {},
974				isOriginLeft: !$('.l-body').hasClass('rtl')
975			};
976
977			if (this.$container.find('.w-portfolio-item.size_1x1').length) {
978				this.itemWidth = 1;
979				this.isotopeOptions.masonry.columnWidth = '.size_1x1';
980			} else if (this.$container.find('.w-portfolio-item.size_1x2').length) {
981				this.itemWidth = 1;
982				this.isotopeOptions.masonry.columnWidth = '.size_1x2';
983			} else {
984				this.itemWidth = 2;
985				this.isotopeOptions.masonry.columnWidth = '.w-portfolio-item';
986			}
987
988			if (this.paginationType != 'none') {
989				var $jsonContainer = this.$container.find('.w-portfolio-json');
990				if ($jsonContainer.length == 0) return;
991				this.jsonData = $jsonContainer[0].onclick() || {};
992				this.ajaxUrl = this.jsonData.ajax_url || '';
993				this.templateVars = JSON.stringify(this.jsonData.template_vars || {});
994				this.perpage = this.jsonData.perpage || this.$items.length;
995				this.order = this.jsonData.order || {};
996				this.sizes = this.jsonData.sizes || {};
997				this.curPage = this.jsonData.page || 1;
998				$jsonContainer.remove();
999				this.isotopeOptions.sortBy = 'number';
1000				this.isotopeOptions.getSortData = {
1001					number: function(elm){
1002						return this.order['*'].indexOf(parseInt(elm.getAttribute('data-id')));
1003					}.bind(this)
1004				};
1005			}
1006
1007			if (this.paginationType == 'ajax') {
1008				this.$loadmore.on('click', function(){
1009					var maxPage = Math.ceil(this.order[this.curCategory].length / this.perpage);
1010					if (this.curPage < maxPage) {
1011						this.setState(this.curPage + 1);
1012					}
1013				}.bind(this));
1014			}
1015			else if (this.paginationType == 'regular') {
1016				this.paginationPcre = new RegExp('/page/([0-9]+)/$');
1017				this.location = location.href.replace(this.paginationPcre, '/');
1018				this.$navLinks = this.$container.find('.nav-links');
1019				var self = this;
1020				this.$navLinks.on('click', 'a', function(e){
1021					e.preventDefault();
1022					var arr,
1023						pageNum = (arr = self.paginationPcre.exec(this.href)) ? parseInt(arr[1]) : 1;
1024					self.setState(pageNum);
1025				});
1026				this.renderPagination(this.curPage);
1027			}
1028
1029			this.$filters.each(function(index, filter){
1030				var $filter = $(filter),
1031					category = $filter.data('category');
1032				$filter.on('click', function(){
1033					if (category != this.curCategory) {
1034						this.setState((this.paginationType == 'regular') ? 1 : this.curPage, category);
1035						this.$filters.removeClass('active');
1036						$filter.addClass('active');
1037					}
1038				}.bind(this))
1039			}.bind(this));
1040
1041			// Applying isotope
1042			this.loading = true;
1043			this.$list.imagesLoaded(function(){
1044				this.$list.isotope(this.isotopeOptions);
1045				this.$list.isotope();
1046				this.loading = false;
1047				$us.$canvas.on('contentChange', function(){
1048					this.$list.isotope('layout');
1049				}.bind(this));
1050				$(window).on('resize', function(){
1051					this.$list.isotope('layout');
1052				}.bind(this));
1053			}.bind(this));
1054		},
1055
1056		setState: function(page, category){
1057			if (this.paginationType == 'none') {
1058				// Simple state changer
1059				this.$list.isotope({filter: (category == '*') ? '*' : ('.' + category)});
1060				this.curCategory = category;
1061				return;
1062			}
1063
1064			if (this.loading) return;
1065			category = category || this.curCategory;
1066			var start = (this.paginationType == 'ajax') ? 0 : ((page - 1) * this.perpage),
1067				length = page * this.perpage,
1068				showIds = (this.order[category] || []).slice(start, length),
1069				loadIds = [],
1070				$newItems = [];
1071			$.each(showIds, function(i, id){
1072				// Determining which items we need to load via ajax and creating temporary stubs for them
1073				if (this.items[id] !== undefined) return;
1074				var itemSize = (this.sizes[id] || '1x1'),
1075					itemHtml = '<div class="w-portfolio-item size_' + itemSize + ' loading" data-id="' + id + '">' +
1076						'<div class="w-portfolio-item-anchor"><div class="g-preloader type_1"></div></div></div>';
1077				this.items[id] = $(itemHtml).appendTo(this.$list);
1078				$newItems.push(this.items[id][0]);
1079				loadIds.push(showIds[i]);
1080			}.bind(this));
1081			if (loadIds.length > 0) {
1082				// Loading new items
1083				var $insertedItems = $();
1084				$.ajax({
1085					type: 'post',
1086					url: this.ajaxUrl,
1087					data: {
1088						action: 'us_ajax_portfolio',
1089						ids: loadIds.join(','),
1090						template_vars: this.templateVars
1091					},
1092					success: function(html){
1093						var $container = $('<div>', {html: html}),
1094							$items = $container.children(),
1095							isotope = this.$list.data('isotope');
1096						$items.each(function(index, item){
1097							var $item = $(item),
1098								itemID = parseInt($item.data('id'));
1099							$item.imagesLoaded(function(){
1100								this.items[itemID].attr('class', $item.attr('class')).attr('style', $item.attr('style'));
1101								this.itemLoaded(itemID, $item);
1102								this.items[itemID].html($item.html());
1103								$insertedItems = $insertedItems.add(this.items[itemID]);
1104								if ($insertedItems.length >= loadIds.length) {
1105									$container.remove();
1106									this.itemsLoaded($insertedItems);
1107								}
1108								if (isotope) {
1109									if (this.itemWidth != 1) {
1110										if (this.$container.find('.w-portfolio-item.size_1x1').length) {
1111											this.itemWidth = 1;
1112											this.isotopeOptions.masonry.columnWidth = '.size_1x1';
1113										} else if (this.$container.find('.w-portfolio-item.size_1x2').length) {
1114											this.itemWidth = 1;
1115											this.isotopeOptions.masonry.columnWidth = '.size_1x2';
1116										} else {
1117											this.itemWidth = 2;
1118											this.isotopeOptions.masonry.columnWidth = '.w-portfolio-item';
1119										}
1120										if (this.itemWidth == 1) {
1121											this.$list.isotope(this.isotopeOptions);
1122										}
1123									}
1124
1125									this.$list.isotope('layout');
1126								}
1127							}.bind(this));
1128						}.bind(this));
1129					}.bind(this)
1130				});
1131			}
1132			this.$list.isotope({
1133				filter: function(){
1134					return (showIds.indexOf(parseInt(this.getAttribute('data-id'))) != -1);
1135				}
1136			});
1137			if (loadIds.length > 0) {
1138				this.$list.isotope('insert', $newItems);
1139			}
1140			this.curPage = page;
1141			this.curCategory = category;
1142			this.renderPagination();
1143		},
1144
1145		renderPagination: function(){
1146			if (this.paginationType == 'ajax') {
1147				var maxPage = Math.ceil(this.order[this.curCategory].length / this.perpage);
1148				this.$loadmore[(this.curPage < maxPage) ? 'removeClass' : 'addClass']('done');
1149			}
1150			else if (this.paginationType == 'regular') {
1151				var maxPage = Math.ceil(this.order[this.curCategory].length / this.perpage),
1152					html = '';
1153				if (maxPage > 1) {
1154					if (this.curPage > 1) {
1155						html += '<a href="' + this.pageUrl(this.curPage - 1) + '" class="prev page-numbers"><span>&lt;</span></a>';
1156					} else {
1157						html += '<span class="prev page-numbers">&lt;</span>';
1158					}
1159					for (var i = 1; i <= maxPage; i++) {
1160						if (i != this.curPage) {
1161							html += '<a href="' + this.pageUrl(i) + '" class="page-numbers"><span>' + i + '</span></a>';
1162						} else {
1163							html += '<span class="page-numbers current"><span>' + i + '</span></span>';
1164						}
1165					}
1166					if (this.curPage < maxPage) {
1167						html += '<a href="' + this.pageUrl(this.curPage + 1) + '" class="next page-numbers"><span>&gt;</span></a>';
1168					} else {
1169						html += '<span class="next page-numbers">&gt;</span>';
1170					}
1171				}
1172				this.$navLinks.html(html);
1173			}
1174		},
1175
1176		pageUrl: function(page){
1177			return (page == 1) ? this.location : (this.location + 'page/' + page + '/');
1178		},
1179
1180		/**
1181		 * Overloadable function for themes
1182		 * @param $item
1183		 */
1184		itemLoaded: function($item){
1185		},
1186
1187		/**
1188		 * Overloadable function for themes
1189		 * @param $item
1190		 */
1191		itemsLoaded: function($items){
1192		}
1193
1194	};
1195
1196	$.fn.wPortfolio = function(options){
1197		return this.each(function(){
1198			$(this).data('wPortfolio', new $us.WPortfolio(this, options));
1199		});
1200	};
1201
1202	if ($.fn.magnificPopup) {
1203		$('.w-portfolio-list').each(function(){
1204			$(this).magnificPopup({
1205				type: 'image',
1206				delegate: 'a[ref=magnificPopupPortfolio]:visible',
1207				gallery: {
1208					enabled: true,
1209					navigateByImgClick: true,
1210					preload: [0, 1],
1211					tPrev: $us.langOptions.magnificPopup.tPrev, // Alt text on left arrow
1212					tNext: $us.langOptions.magnificPopup.tNext, // Alt text on right arrow
1213					tCounter: $us.langOptions.magnificPopup.tCounter // Markup for "1 of 7" counter
1214				},
1215				removalDelay: 300,
1216				mainClass: 'mfp-fade',
1217				fixedContentPos: false
1218			});
1219		});
1220	}
1221
1222}(jQuery);
1223
1224/**
1225 * UpSolution Widget: w-cart
1226 *
1227 * @requires $us.canvas
1228 * @requires $us.nav
1229 */
1230jQuery(function($){
1231	var $cart = $('.w-cart');
1232	if ($cart.length == 0) return;
1233	var $quantity = $cart.find('.w-cart-quantity');
1234
1235	var updateCart = function(){
1236		var $mini_cart_amount = $cart.find('.us_mini_cart_amount'),
1237			mini_cart_amount = $mini_cart_amount.text();
1238
1239		if (mini_cart_amount !== undefined) {
1240			mini_cart_amount = mini_cart_amount + '';
1241			mini_cart_amount = mini_cart_amount.match(/\d+/g);
1242
1243			if (mini_cart_amount > 0) {
1244				$quantity.html(mini_cart_amount);
1245				$cart.removeClass('empty');
1246			} else {
1247				$quantity.html('0');
1248				$cart.addClass('empty');
1249			}
1250
1251		} else {
1252			// fallback in case our action wasn't fired somehow
1253			var $quantities = $cart.find('.quantity'),
1254				total = 0;
1255			$quantities.each(function(){
1256				var quantity,
1257					text = $(this).text() + '',
1258					matches = text.match(/\d+/g);
1259
1260				if (matches) {
1261					quantity = parseInt(matches[0], 10);
1262					total += quantity;
1263				}
1264
1265			});
1266
1267			if (total > 0) {
1268				$quantity.html(total);
1269				$cart.removeClass('empty');
1270			} else {
1271				$quantity.html('0');
1272				$cart.addClass('empty');
1273			}
1274
1275		}
1276
1277	};
1278
1279	updateCart();
1280
1281	$(document.body).bind('wc_fragments_loaded', function(){
1282		updateCart();
1283	});
1284
1285	$(document.body).bind('wc_fragments_refreshed', function(){
1286		updateCart();
1287	});
1288
1289	var $notification = $cart.find('.w-cart-notification'),
1290		$productName = $notification.find('.product-name'),
1291		$cartLink = $cart.find('.w-cart-link'),
1292		$dropdown = $cart.find('.w-cart-dropdown'),
1293		$quantity = $cart.find('.w-cart-quantity'),
1294		productName = $productName.text(),
1295		animationType = (window.$us !== undefined && window.$us.nav !== undefined) ? $us.nav.animationType : 'opacity',
1296		showFn = 'fadeInCSS',
1297		hideFn = 'fadeOutCSS',
1298		opened = false;
1299
1300	if (animationType == 'height') {
1301		showFn = 'slideDownCSS';
1302		hideFn = 'slideUpCSS';
1303	}
1304	else if (animationType == 'mdesign') {
1305		showFn = 'showMD';
1306		hideFn = 'hideMD';
1307	}
1308
1309	$notification.on('click', function(){
1310		$notification[hideFn]();
1311	});
1312
1313	jQuery('body').bind('added_to_cart', function(event, fragments, cart_hash, $button){
1314		if (event === undefined) return;
1315
1316		$quantity.html(parseInt($quantity.html(), 10) + 1);
1317
1318		$cart.removeClass('empty');
1319
1320		productName = $button.closest('.product').find('.product-meta h3:first').text();
1321		$productName.html(productName);
1322
1323		$notification[showFn](undefined, function(){
1324			var newTimerId = setTimeout(function(){
1325				$notification[hideFn]();
1326			}, 3000);
1327			$notification.data('animation-timers', $notification.data('animation-timers') + ',' + newTimerId);
1328		});
1329	});
1330
1331	if ($.isMobile) {
1332		var outsideClickEvent = function(e){
1333			if (jQuery.contains($cart[0], e.target)) return;
1334			$dropdown[hideFn]();
1335			$us.$body.off('touchstart', outsideClickEvent);
1336			opened = false;
1337		};
1338		$cartLink.on('click', function(e){
1339			if (!opened) {
1340				e.preventDefault();
1341				$dropdown[showFn]();
1342				$us.$body.on('touchstart', outsideClickEvent);
1343			} else {
1344				$dropdown[hideFn]();
1345				$us.$body.off('touchstart', outsideClickEvent);
1346			}
1347			opened = !opened;
1348		});
1349	} else {
1350		var hideTimer = null;
1351		$cartLink.on('hover', function(){
1352			if (opened) return;
1353			$dropdown[showFn]();
1354			opened = true;
1355		});
1356		$cart.hover(function(){
1357			clearTimeout(hideTimer);
1358		}, function(){
1359			clearTimeout(hideTimer);
1360			hideTimer = setTimeout(function(){
1361				if (!opened) return;
1362				$dropdown[hideFn]();
1363				opened = false;
1364			}, 250);
1365		});
1366	}
1367});
1368
1369
1370/**
1371 * UpSolution Login Widget: widget_us_login
1372 *
1373 */
1374!function($){
1375	"use strict";
1376
1377	$us.wUsLogin = function(container, options){
1378		this.$container = $(container);
1379		this.$form = this.$container.find('.w-form');
1380		this.$profile = this.$container.find('.w-profile');
1381
1382		var $jsonContainer = this.$container.find('.w-profile-json');
1383
1384		this.jsonData = $jsonContainer[0].onclick() || {};
1385		$jsonContainer.remove();
1386
1387		this.ajaxUrl = this.jsonData.ajax_url || '';
1388		this.logoutRedirect = this.jsonData.logout_redirect || '';
1389
1390		$.ajax({
1391			type: 'post',
1392			url: this.ajaxUrl,
1393			data: {
1394				action: 'us_ajax_user_info',
1395				logout_redirect: this.logoutRedirect
1396			},
1397			success: function(result){
1398				if (result.success) {
1399					var $avatar = this.$profile.find('.w-profile-avatar'),
1400						$name = this.$profile.find('.w-profile-name'),
1401						$logoutLink = this.$profile.find('.w-profile-link.for_logout')
1402
1403					$avatar.html(result.data.avatar);
1404					$name.html(result.data.name);
1405					$logoutLink.attr('href', result.data.logout_url);
1406
1407					this.$profile.removeClass('hidden');
1408				} else {
1409					this.$form.removeClass('hidden');
1410				}
1411			}.bind(this)
1412		});
1413	};
1414
1415	$.fn.wUsLogin = function(options){
1416		return this.each(function(){
1417			$(this).data('wUsLogin', new $us.wUsLogin(this, options));
1418		});
1419	};
1420
1421	$(function(){
1422		$('.widget_us_login').wUsLogin();
1423	});
1424}(jQuery);
1425
1426
1427/**
1428 * UpSolution Widget: w-maps
1429 *
1430 * Used for [us_gmaps] shortcode
1431 */
1432!function($){
1433	"use strict";
1434
1435	$us.WMapsGeocodesCounter = 0; // counter of total geocode requests number
1436	$us.WMapsGeocodesRunning = false;
1437	$us.WMapsCurrentGeocode = 0; // current processing geocode
1438	$us.WMapsGeocodesMax = 5; // max number of simultaneous geocode requests allowed
1439	$us.WMapsGeocodesStack = {};
1440
1441	$us.WMapsRunGeoCode = function(){
1442		if ($us.WMapsCurrentGeocode <= $us.WMapsGeocodesCounter) {
1443			$us.WMapsGeocodesRunning = true;
1444			if ($us.WMapsGeocodesStack[$us.WMapsCurrentGeocode] != null)
1445				$us.WMapsGeocodesStack[$us.WMapsCurrentGeocode]();
1446		} else {
1447			$us.WMapsGeocodesRunning = false;
1448		}
1449	};
1450
1451	$us.WMaps = function(container, options){
1452
1453		this.$container = $(container);
1454
1455		var $jsonContainer = this.$container.find('.w-map-json'),
1456			jsonOptions = $jsonContainer[0].onclick() || {},
1457			$jsonStyleContainer = this.$container.find('.w-map-style-json'),
1458			jsonStyleOptions,
1459			markerOptions,
1460			shouldRunGeoCode = false;
1461		$jsonContainer.remove();
1462		if ($jsonStyleContainer.length) {
1463			jsonStyleOptions = $jsonStyleContainer[0].onclick() || {};
1464			$jsonStyleContainer.remove();
1465		}
1466
1467
1468		// Setting options
1469		var defaults = {};
1470		this.options = $.extend({}, defaults, jsonOptions, options);
1471
1472		this._events = {
1473			redraw: this.redraw.bind(this)
1474		};
1475
1476		var gmapsOptions = {
1477			el: '#' + this.$container.attr('id'),
1478			lat: 0,
1479			lng: 0,
1480			zoom: this.options.zoom,
1481			type: this.options.type,
1482			height: this.options.height + 'px',
1483			width: '100%',
1484			mapTypeId: google.maps.MapTypeId[this.options.maptype]
1485		};
1486
1487		if (this.options.hideControls) {
1488			gmapsOptions.disableDefaultUI = true;
1489		}
1490		if (this.options.disableZoom) {
1491			gmapsOptions.scrollwheel = false;
1492		}
1493		if (this.options.disableDragging && ( !$us.$html.hasClass('no-touch'))) {
1494			gmapsOptions.draggable = false;
1495		}
1496		if (this.options.mapBgColor) {
1497			gmapsOptions.backgroundColor = this.options.mapBgColor;
1498		}
1499
1500		this.GMapsObj = new GMaps(gmapsOptions);
1501		if (jsonStyleOptions != null && jsonStyleOptions != {}) {
1502			this.GMapsObj.map.setOptions({styles: jsonStyleOptions});
1503		}
1504
1505		var that = this;
1506
1507		if (this.options.latitude != null && this.options.longitude != null) {
1508			this.GMapsObj.setCenter(this.options.latitude, this.options.longitude);
1509		} else {
1510			var mapGeoCode = function(geocodeNum){
1511				GMaps.geocode({
1512					address: that.options.address,
1513					callback: function(results, status){
1514						if (status == 'OK') {
1515							var latlng = results[0].geometry.location;
1516							that.options.latitude = latlng.lat();
1517							that.options.longitude = latlng.lng();
1518							that.GMapsObj.setCenter(that.options.latitude, that.options.longitude);
1519							$us.WMapsCurrentGeocode++;
1520							$us.WMapsRunGeoCode();
1521						} else if (status == "OVER_QUERY_LIMIT") {
1522							setTimeout(function(){
1523								$us.WMapsRunGeoCode()
1524							}, 2000);
1525						}
1526					}
1527				});
1528			};
1529			shouldRunGeoCode = true;
1530			$us.WMapsGeocodesStack[$us.WMapsGeocodesCounter] = mapGeoCode;
1531			$us.WMapsGeocodesCounter++;
1532		}
1533
1534		$.each(this.options.markers, function(i, val){
1535			markerOptions = {};
1536			if (that.options.icon != null) {
1537				markerOptions.icon = {
1538					url: that.options.icon.url,
1539					size: new google.maps.Size(that.options.icon.size[0], that.options.icon.size[1]),
1540					origin: new google.maps.Point(0, 0),
1541					anchor: new google.maps.Point(that.options.icon.anchor[0], that.options.icon.anchor[1])
1542				};
1543			}
1544
1545			if (that.options.markers[i] != null) {
1546
1547				if (that.options.markers[i].latitude != null && that.options.markers[i].longitude != null) {
1548					markerOptions.lat = that.options.markers[i].latitude;
1549					markerOptions.lng = that.options.markers[i].longitude;
1550					markerOptions.infoWindow = {content: that.options.markers[i].html};
1551					var marker = that.GMapsObj.addMarker(markerOptions);
1552					if (that.options.markers[i].infowindow) {
1553						marker.infoWindow.open(that.GMapsObj.map, marker);
1554					}
1555				} else {
1556					var markerGeoCode = function(geocodeNum){
1557						GMaps.geocode({
1558							address: that.options.markers[i].address,
1559							callback: function(results, status){
1560								if (status == 'OK') {
1561									var latlng = results[0].geometry.location;
1562									markerOptions.lat = latlng.lat();
1563									markerOptions.lng = latlng.lng();
1564									markerOptions.infoWindow = {content: that.options.markers[i].html};
1565									var marker = that.GMapsObj.addMarker(markerOptions);
1566									if (that.options.markers[i].infowindow) {
1567										marker.infoWindow.open(that.GMapsObj.map, marker);
1568									}
1569									$us.WMapsCurrentGeocode++;
1570									$us.WMapsRunGeoCode();
1571								} else if (status == "OVER_QUERY_LIMIT") {
1572									setTimeout(function(){
1573										$us.WMapsRunGeoCode()
1574									}, 2000);
1575								}
1576							}
1577						});
1578					};
1579					shouldRunGeoCode = true;
1580					$us.WMapsGeocodesStack[$us.WMapsGeocodesCounter] = markerGeoCode;
1581					$us.WMapsGeocodesCounter++;
1582				}
1583			}
1584		});
1585
1586		if (shouldRunGeoCode && ( !$us.WMapsGeocodesRunning)) {
1587			$us.WMapsRunGeoCode();
1588		}
1589
1590		$us.$canvas.on('contentChange', this._events.redraw);
1591
1592		// In case some toggler was opened before the actual page load
1593		$us.$window.load(this._events.redraw);
1594	};
1595
1596	$us.WMaps.prototype = {
1597		/**
1598		 * Fixing hidden and other breaking-cases maps
1599		 */
1600		redraw: function(){
1601			if (this.$container.is(':hidden')) return;
1602			this.GMapsObj.refresh();
1603			if (this.options.latitude != null && this.options.longitude != null) {
1604				this.GMapsObj.setCenter(this.options.latitude, this.options.longitude);
1605			}
1606
1607		}
1608	};
1609
1610	$.fn.wMaps = function(options){
1611		return this.each(function(){
1612			$(this).data('wMaps', new $us.WMaps(this, options));
1613		});
1614	};
1615
1616	$(function(){
1617		$('.w-map').wMaps();
1618	});
1619}(jQuery);
1620
1621
1622/**
1623 * UpSolution Widget: w-sharing
1624 */
1625!function($){
1626	"use strict";
1627
1628	$('.w-sharing.type_fixed.align_left, .w-sharing.type_fixed.align_right').each(function(){
1629		var $this = $(this);
1630		$this.css('margin-top', -.5 * $this.height());
1631	});
1632
1633	$('.w-sharing.type_fixed.align_center').each(function(){
1634		var $this = $(this);
1635		$this.css('margin-left', -.5 * $this.width());
1636	});
1637
1638	$('.w-sharing-item').on('click', function(){
1639		var $this = $(this);
1640		var opt = {
1641			url: window.location,
1642			text: document.title,
1643			lang: document.documentElement.lang,
1644			image: $('meta[name="og:image"]').attr('content') || ''
1645		};
1646		if ($this.attr('data-sharing-url') !== undefined && $this.attr('data-sharing-url') != '') {
1647			opt.url = $this.attr('data-sharing-url');
1648		}
1649		if ($this.attr('data-sharing-image') !== undefined && $this.attr('data-sharing-image') != '') {
1650			opt.image = $this.attr('data-sharing-image');
1651		}
1652		if ( opt.image == '' || opt.image === undefined ) {
1653			var first_image_src = $('img').first().attr('src');
1654			if (first_image_src != undefined && first_image_src != '') {
1655				opt.image = first_image_src;
1656			}
1657		}
1658		if ($this.hasClass('facebook')) {
1659			window.open("http://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(opt.url) + "&t=" + encodeURIComponent(opt.text) + "", "", "toolbar=0, status=0, width=900, height=500");
1660		} else if ($this.hasClass('twitter')) {
1661			window.open("https://twitter.com/intent/tweet?text=" + encodeURIComponent(opt.text) + "&url=" + encodeURIComponent(opt.url), "", "toolbar=0, status=0, width=650, height=360");
1662		} else if ($this.hasClass('linkedin')) {
1663			window.open('https://www.linkedin.com/cws/share?url=' + encodeURIComponent(opt.url) + '&token=&isFramed=true', 'linkedin', 'toolbar=no,width=550,height=550');
1664		} else if ($this.hasClass('gplus')) {
1665			window.open("https://plus.google.com/share?hl=" + encodeURIComponent(opt.lang) + "&url=" + encodeURIComponent(opt.url), "", "toolbar=0, status=0, width=900, height=500");
1666		} else if ($this.hasClass('pinterest')) {
1667			window.open('http://pinterest.com/pin/create/button/?url=' + encodeURIComponent(opt.url) + '&media=' + encodeURIComponent(opt.image) + '&description=' + encodeURIComponent(opt.text), 'pinterest', 'toolbar=no,width=700,height=300');
1668		} else if ($this.hasClass('vk')) {
1669			window.open('http://vk.com/share.php?url=' + encodeURIComponent(opt.url) + '&title=' + encodeURIComponent(opt.text), '&description=&image=' + encodeURIComponent(opt.image), 'toolbar=no,width=700,height=300');
1670		} else if ($this.hasClass('email')) {
1671			window.location = 'mailto:?subject=' + opt.text + '&body=' + opt.url;
1672		}
1673	});
1674}(jQuery);
1675
1676
1677/**
1678 * UpSolution Widget: l-preloader
1679 */
1680!function($){
1681	"use strict";
1682
1683	if ($('.l-preloader').length) {
1684		$('document').ready(function(){
1685			setTimeout(function(){
1686				$('.l-preloader').addClass('done');
1687			}, 500);
1688			setTimeout(function(){
1689				$('.l-preloader').addClass('hidden');
1690			}, 1000); // 500 ms after 'done' class is added
1691		});
1692	}
1693}(jQuery);

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.