PageSourceSearch

https://iacforaction.org/wp-content/themes/uncode/library/js/app.js?ver=2079021399

js iacforaction.org collected 2026-10-03 00:52:54 UTC 117,316 bytes, 3,576 lines download raw bytes

1
2
3/* ----------------------------------------------------------
4 * Uncode App
5 * ---------------------------------------------------------- */
6
7(function($) {
8	"use strict";
9	var UNCODE = window.UNCODE || {};
10	window.UNCODE = UNCODE;
11
12UNCODE.utils = function() {
13	$('.btn-tooltip').tooltip();
14	$('a').hover(function() {
15		$(this).attr('data-title', $(this).attr('title'));
16		$(this).removeAttr('title');
17	}, function() {
18		$(this).attr('title', $(this).attr('data-title'));
19	});
20	$('.counter').counterUp({
21		delay: 10,
22		time: 1500
23	});
24	$('[data-countdown]').each(function() {
25		var $this = $(this),
26			finalDate = $(this).data('countdown');
27		$this.countdown(finalDate, function(event) {
28			$this.html(event.strftime('%D <small>' + SiteParameters.days + '</small> %H <small>' + SiteParameters.hours + '</small> %M <small>' + SiteParameters.minutes + '</small> %S <small>' + SiteParameters.seconds + '</small>'));
29		});
30	});
31	var share_button_top = new Share(".share-button", {
32		ui: {
33			flyout: "top center",
34			button_font: false,
35			button_text: '',
36			icon_font: false
37		},
38	});
39	$(document).on('click', '.uncode-dot-irecommendthis', function() {
40		var link = $(this),
41			linkCounter = link.find('span.likes-counter');
42		if (link.hasClass('active')) return false;
43		var id = $(this).attr('id'),
44			suffix = link.find('.dot-irecommendthis-suffix').text();
45		$.post(dot_irecommendthis.ajaxurl, {
46			action: 'uncode-dot-irecommendthis',
47			recommend_id: id,
48			suffix: suffix
49		}, function(data) {
50			var counter = $(data).text();
51			linkCounter.html(counter);
52			link.addClass('active').attr('title', 'You already recommended this');
53		});
54		return false;
55	});
56
57	this.get_scroll_offset = function() {
58
59		var scroll_offset = 0;
60
61		if ($('.menu-hide').length || $('.menu-hide-vertical').length) {
62			if (UNCODE.bodyTop > UNCODE.wheight / 2) {
63				UNCODE.hideMenu(100);
64			}
65		}
66
67		UNCODE.scrolling = true;
68
69		if (($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length)) {
70			scroll_offset += UNCODE.menuMobileHeight;
71		}
72
73		scroll_offset += UNCODE.bodyBorder;
74
75		return scroll_offset;
76	}
77
78	$('a[href*="#"]').click(function(e) {
79
80		var hash = (e.currentTarget).hash,
81		is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false,
82		anchor = '';
83		if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return;
84		if ($(e.currentTarget).hasClass('woocommerce-review-link')) {
85			e.preventDefault();
86			if (!$('#tab-reviews').is(':visible')) {
87				$('a[href="#tab-reviews"]').trigger('click');
88			}
89			var calc_scroll = $('.wootabs .tab-content').offset().top;
90			calc_scroll -= UNCODE.get_scroll_offset();
91
92			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
93				delta = bodyTop - calc_scroll,
94				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
95			if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
96
97			setTimeout(function(){
98				if (scrollSpeed == 0) {
99					$('html, body').scrollTop(calc_scroll);
100					UNCODE.scrolling = false;
101				} else {
102					$('html, body').animate({
103							scrollTop: calc_scroll
104						}, scrollSpeed, 'easeInOutCubic', function() {
105							UNCODE.scrolling = false;
106						}
107					);
108				}
109			}, 200);
110			return;
111		}
112		if (hash != undefined) {
113			if (location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) {
114	      var anchor = $(hash);
115	      anchor = anchor.length ? anchor : this.hash.slice(1);
116	    }
117		}
118
119		if (is_scrolltop || anchor != '') {
120			if (is_scrolltop) {
121				e.preventDefault();
122				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
123				scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
124				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
125
126				if (scrollSpeed == 0) {
127					$('html, body').scrollTop(0);
128					UNCODE.scrolling = false;
129				} else {
130					$('html, body').animate({
131						scrollTop: 0
132					}, scrollSpeed, 'easeInOutCubic', function() {
133						UNCODE.scrolling = false;
134					});
135				}
136			} else {
137				var scrollSection = (typeof anchor === 'string') ? $('[data-name=' + anchor + ']') : anchor;
138				$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) {
139					var get_href = $(val).attr('href');
140					if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active');
141					else $(val).parent().removeClass('active');
142				});
143				if (scrollSection.length) {
144					e.preventDefault();
145
146					if (UNCODE.menuOpened) {
147						if (UNCODE.wwidth < UNCODE.mediaQuery) window.dispatchEvent(UNCODE.menuMobileTriggerEvent);
148						else $('.mmb-container-overlay .overlay-close').trigger('click');
149					}
150
151					var calc_scroll = scrollSection.offset().top;
152					calc_scroll -= UNCODE.get_scroll_offset();
153
154					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
155						delta = bodyTop - calc_scroll,
156						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
157					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
158
159					if (scrollSpeed == 0) {
160						$('html, body').scrollTop(calc_scroll);
161						UNCODE.scrolling = false;
162					} else {
163						$('html, body').animate({
164							scrollTop: calc_scroll
165						}, scrollSpeed, 'easeInOutCubic', function() {
166							UNCODE.scrolling = false;
167						});
168					}
169				}
170			}
171		}
172	});
173	$('.header-scrolldown').on('click', function(event) {
174		event.preventDefault();
175		var pageHeader = $(event.target).closest('#page-header'),
176			pageHeaderTop = pageHeader.offset().top,
177			pageHeaderHeight = pageHeader.outerHeight(),
178			scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
179		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
180
181		var calc_scroll = pageHeaderTop + pageHeaderHeight;
182		calc_scroll -= UNCODE.get_scroll_offset();
183
184		if (scrollSpeed == 0) {
185			$('html, body').scrollTop(calc_scroll);
186			UNCODE.scrolling = false;
187		} else {
188			$('html, body').animate({
189					scrollTop: calc_scroll
190				}, scrollSpeed, 'easeInOutCubic', function() {
191				UNCODE.scrolling = false;
192			});
193		}
194	});
195	// TAB DATA-API
196	// ============
197	$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) {
198		e.preventDefault()
199		$(this).tab('show');
200		setTimeout(function() {
201			window.dispatchEvent(UNCODE.boxEvent);
202		}, 300);
203	});
204	// COLLAPSE DATA-API
205	// =================
206	$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) {
207		var $this = $(this),
208			href
209		var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
210		var $target = $(target)
211		var data = $target.data('bs.collapse')
212		var option = data ? 'toggle' : $this.data()
213		var parent = $this.attr('data-parent')
214		var $parent = parent && $(parent)
215		var $title = $(this).parent()
216		if ($parent) {
217			$parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
218			if ($title.hasClass('active')) {
219				$title.removeClass('active');
220			} else {
221				$parent.find('.panel-title').removeClass('active')
222				$title[!$target.hasClass('in') ? 'addClass' : 'removeClass']('active')
223			}
224		}
225		$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
226	});
227	// FitText
228	// =================
229	window.uncode_textfill = function(el, loaded) {
230		if (el == undefined) el = $('body');
231		$.each($('.bigtext', el), function(index, val) {
232			$(val).bigtext({
233				minfontsize: 24
234			});
235			if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({
236				opacity: 1
237			});
238			setTimeout(function() {
239				if ($(val).find('.animate_when_almost_visible').length != 0) {
240					$(val).css({opacity: 1});
241				}
242			}, 400);
243		});
244	}
245	window.uncode_textfill();
246
247	// Colomun hover effect
248	// =================
249	$(document).on('mouseenter', '.col-link', function(e) {
250		var uncol = $(e.target).prev('.uncol'),
251		el = uncol.find('.column-background');
252		if (el) {
253			$('.btn-container .btn', uncol).toggleClass('active');
254			var elOverlay = $(el[0]).find('.block-bg-overlay');
255			if (elOverlay.length) {
256				var getOpacity = $(elOverlay).css('opacity');
257				if (getOpacity != 1) {
258					getOpacity = Math.round(getOpacity * 100) / 100;
259					var newOpacity = getOpacity + .1;
260					$(elOverlay).data('data-opacity', getOpacity);
261					$(elOverlay).css('opacity', newOpacity);
262				}
263			}
264		}
265	}).on('mouseleave', '.col-link', function(e) {
266		var uncol = $(e.target).prev('.uncol'),
267		el = uncol.find('.column-background');
268		$('.btn-container .btn', uncol).toggleClass('active');
269		if (el) {
270			var elOverlay = $(el[0]).find('.block-bg-overlay');
271			if (elOverlay.length) {
272				var getOpacity = $(elOverlay).data('data-opacity');
273				$(elOverlay).css('opacity', getOpacity);
274			}
275		}
276	});
277
278	// REVSLIDER API
279	// ============
280	$(window).on("load", function() {
281		$('.rev_slider_wrapper').each(function(){
282			var $this = jQuery(this),
283   		id_array = $this.attr("id").split("_"),
284   		id = id_array[2];
285   		if (id != undefined && id != '') {
286				$.globalEval('revapi'+id+'.bind("revolution.slide.onloaded",function (e, data) { if (jQuery(e.currentTarget).closest(".header-revslider").length) { var style = jQuery(e.currentTarget).find("li").eq(0).attr("data-skin"), scrolltop = jQuery(document).scrollTop(); if (style != undefined) UNCODE.switchColorsMenu(scrolltop, style);}})');
287				$.globalEval('revapi'+id+'.bind("revolution.slide.onchange",function (e,data) { if (jQuery(e.currentTarget).closest(".header-revslider").length) { var style = jQuery(e.currentTarget).find("li").eq(data.slideIndex - 1).attr("data-skin"), scrolltop = jQuery(document).scrollTop(); if (style != undefined) UNCODE.switchColorsMenu(scrolltop, style);}})');
288   		}
289		});
290	});
291	// Admin bar
292	// ============
293	$(window).resize(function() {
294		if ($('html').hasClass('admin-mode')) {
295			var getAdminBar = $('#wpadminbar');
296			if (getAdminBar.length) {
297				if (getAdminBar.css('position') !== 'hidden') {
298					var getAdminBarHeight = getAdminBar.height();
299					if (getAdminBar.css('position') === 'fixed') {
300						$('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'});
301						$('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'});
302					} else {
303						$('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'});
304						$('.body-borders .top-border').css({'margin-top':'0px'});
305					}
306				}
307			}
308		}
309	});
310	// Facebook
311	// ===========
312 	this.fb_timeout = undefined;
313	$(window).resize(function() {
314		$('.facebook-object').each(function(index, el) {
315			var el = $(el),
316			parentWidth = el.closest('.tmb').width();
317			el.width(parentWidth);
318		});
319		if (this.fb_timeout == undefined) {
320			if ($('.facebook-object').length) {
321				window.clearTimeout(this.fb_timeout);
322				this.fb_timeout = window.setTimeout(function(msg) {
323	      	window.dispatchEvent(UNCODE.boxEvent);
324	    	}, 1000);
325			}
326		}
327	});
328}
329
330UNCODE.menuSystem = function() {
331
332	function menuMobile() {
333		var $mobileToggleButton = $('.mobile-menu-button'),
334			$box,
335			$el,
336			elHeight,
337			check,
338			animating = false,
339			stickyMobile = false;
340		UNCODE.menuOpened = false;
341			//browserToolbar = 56;
342		$mobileToggleButton.on('click', function(event) {
343			var btn = this;
344			if ($(btn).hasClass('overlay-close')) return;
345			event.preventDefault();
346			if (UNCODE.wwidth < UNCODE.mediaQuery) {
347				$box = $(this).closest('.box-container').find('.main-menu-container'),
348					$el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner');
349				if (UNCODE.isMobile && $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical').length) {
350					stickyMobile = true;
351					elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1;
352				} else {
353					elHeight = 0;
354					$.each($el, function(index, val) {
355						elHeight += $(val).outerHeight();
356					});
357				}
358				var open = function() {
359					if (!animating) {
360						animating = true;
361						UNCODE.menuOpened = true;
362						if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky').length)) {
363							$('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
364							$('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'});
365						}
366						if ($('body.hmenu-center').length && ($('.menu-hide, .menu-sticky').length)) {
367							$('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + 
367UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'});
368						}
369						btn.classList.add('close');
370						$box.addClass('open-items');
371						$box.animate({
372							height: elHeight
373						}, 600, "easeInOutCirc", function() {
374							animating = false;
375							if (!stickyMobile) $box.css('height', 'auto');
376						});
377					}
378				};
379
380				var close = function() {
381					if (!animating) {
382						animating = true;
383						UNCODE.menuOpened = false;
384						btn.classList.remove('close');
385						btn.classList.add('closing');
386						$box.addClass('close');
387						setTimeout(function() {
388							$box.removeClass('close');
389							$box.removeClass('open-items');
390							btn.classList.remove('closing');
391						}, 500);
392						$box.animate({
393							height: 0
394						}, {
395							duration: 600,
396							easing: "easeInOutCirc",
397							complete: function(elements) {
398								$(elements).css('height', '');
399								animating = false;
400								if ($('body[class*="vmenu-"]').length) $('.main-header > .vmenu-container').css('position','relative');
401							}
402						});
403					}
404				};
405				check = (!UNCODE.menuOpened) ? open() : close();
406			}
407		});
408		window.addEventListener('menuMobileTrigged', function(e) {
409			$mobileToggleButton.trigger('click');
410		});
411		window.addEventListener("resize", function() {
412			if ($(window).width() < UNCODE.mediaQuery) {
413				if (UNCODE.isMobile) {
414					var $box = $('.box-container .main-menu-container'),
415						$el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner');
416					if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto') {
417						if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) {
418							elHeight = 0;
419							$.each($el, function(index, val) {
420								elHeight += $(val).outerHeight();
421							});
422							elHeight = window.innerHeight - $('.menu-wrapper.menu-sticky .menu-container .row-menu-inner, .menu-wrapper.menu-hide-only .menu-container .row-menu-inner').height() - (UNCODE.bodyBorder * 2) + 1;
423							$($box).css('height', elHeight + 'px');
424						}
425					}
426				}
427			} else {
428				$('.menu-hide-vertical').removeAttr('style');
429				$('.menu-container-mobile').removeAttr('style');
430				$('.vmenu-container.menu-container').removeAttr('style');
431			}
432		});
433	};
434
435	function menuOffCanvas() {
436		$('.menu-primary .menu-button-offcanvas').click(function(event) {
437			if ($(window).width() > UNCODE.mediaQuery) {
438				if ($(event.currentTarget).hasClass('close')) {
439					$(event.currentTarget).removeClass('close');
440					$(event.currentTarget).addClass('closing');
441					setTimeout(function() {
442						$(event.currentTarget).removeClass('closing');
443					}, 500);
444				} else $(event.currentTarget).addClass('close');
445			}
446			$('body').toggleClass('off-opened');
447		});
448	};
449	function menuSmart() {
450		if ($('[class*="menu-smart"]').length > 0) {
451			$('[class*="menu-smart"]').smartmenus({
452				subIndicators: false,
453				subIndicatorsPos: 'append',
454				subMenusMinWidth: '13em',
455				subIndicatorsText: '',
456				showTimeout: 50,
457				hideTimeout: 50,
458				showFunction: function($ul, complete) {
459					$ul.fadeIn(0, 'linear', complete);
460				},
461				hideFunction: function($ul, complete) {
462					var fixIE = $('html.ie').length;
463					if (fixIE) {
464						var $rowParent = $($ul).closest('.main-menu-container');
465						$rowParent.height('auto');
466					}
467					$ul.fadeOut(0, 'linear', complete);
468				},
469				collapsibleShowFunction: function($ul, complete) {
470					$ul.slideDown(400, 'easeInOutCirc', function() {
471				12});
472				},
473				collapsibleHideFunction: function($ul, complete) {
474					$ul.slideUp(200, 'easeInOutCirc', complete);
475				},
476				hideOnClick: true
477			});
478		}
479	};
480	function menuOverlay() {
481		if ($('.overlay-sequential, .menu-mobile-animated').length > 0) {
482			$('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li').each(function(index, el) {
483				var transDelay = (index / 20) + 0.1;
484				$(this)[0].setAttribute('style', '-webkit-transition-delay:' + transDelay + 's; -moz-transition-delay:' + transDelay + 's; -ms-transition-delay:' + transDelay + 's; -o-transition-delay:' + transDelay + 's; transition-delay:' + transDelay + 's');
485			});
486		}
487	};
488	//menuMobileButton();
489	menuMobile();
490	menuOffCanvas();
491	menuSmart();
492	menuOverlay();
493};
494
495UNCODE.okvideo = function() {
496	var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
497	$.okvideo = function(options) {
498		// if the option var was just a string, turn it into an object
499		if (typeof options !== 'object') options = {
500			'video': options
501		};
502		var base = this;
503		// kick things off
504		base.init = function() {
505			base.options = $.extend({}, $.okvideo.options, options);
506			// support older versions of okvideo
507			if (base.options.video === null) base.options.video = base.options.source;
508			base.setOptions();
509			var target = base.options.target || $('body');
510			var position = target[0] == $('body')[0] ? 'fixed' : 'absolute';
511			var zIndex = base.options.controls === 3 ? -999 : "auto";
512			if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000));
513				var mask = '<div id="okplayer-mask-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:-998;height:100%;width:100%;"></div>';
514				if (OKEvents.utils.isMobile()) {
515					target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
516				} else {
517					if (base.options.controls === 3) {
518						target.append(mask)
519					}
520					if (base.options.adproof === 1) {
521						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:-10%;top:-10%;overflow:hidden;z-index:' + zIndex + ';height:120%;width:120%;"></div>');
522					} else {
523						target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>');
524					}
525				}
526				$("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")");
527				if (base.options.playlist.list === null) {
528					if (base.options.video.provider === 'youtube') {
529						base.loadYouTubeAPI();
530					} else if (base.options.video.provider === 'vimeo') {
531						base.options.volume /= 100;
532						base.loadVimeoAPI();
533					}
534				} else {
535					base.loadYouTubeAPI();
536				}
537			}
538		};
539		// clean the options
540		base.setOptions = function() {
541			// exchange 'true' for '1' and 'false' for 3
542			for (var key in this.options) {
543				if (this.options[key] === true) this.options[key] = 1;
544				if (this.options[key] === false) this.options[key] = 3;
545			}
546			if (base.options.playlist.list === null) {
547				base.options.video = base.determineProvider();
548			}
549			// pass options to the window
550			$(window).data('okoptions-' + base.options.id, base.options);
551		};
552		// insert js into the head and exectue a callback function
553		base.insertJS = function(src, callback){
554      var tag = document.createElement('script');
555      if (callback){
556        if (tag.readyState){  //IE
557          tag.onreadystatechange = function(){
558            if (tag.readyState === "loaded" ||
559                tag.readyState === "complete"){
560              tag.onreadystatechange = null;
561              callback();
562            }
563          };
564        } else {
565          tag.onload = function() {
566            callback();
567          };
568        }
569      }
570      tag.src = src;
571      var firstScriptTag = document.getElementsByTagName('script')[0];
572      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
573    };
574		// load the youtube api
575		base.loadYouTubeAPI = function(callback) {
576			base.insertJS('https://www.youtube.com/player_api');
577		};
578		base.loadYouTubePlaylist = function() {
579			player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality);
580		};
581		// load the vimeo api by replacing the div with an iframe and loading js
582		base.loadVimeoAPI = function() {
583			var source = '//player.vimeo.com/video/' + base.options.video.id + '?api=1&title=0&byline=0&portrait=0&playbar=0&loop=' + base.options.loop + '&autoplay=' + (base.options.autoplay === 1 ? 1 : 0) + '&player_id=okplayer-' + base.options.id,
584			jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" />');
585			$(window).data('okoptions-' + base.options.id).jobject = jIframe;
586			$('#okplayer-' + base.options.id).replaceWith(jIframe[0]);
587			base.insertJS('//origin-assets.vimeo.com/js/froogaloop2.min.js', function() {
588				vimeoPlayerReady(base.options.id);
589			});
590		};
591		// is it from youtube or vimeo?
592		base.determineProvider = function() {
593			var a = document.createElement('a');
594			a.href = base.options.video;
595			if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) {
596				var videoid = a.href.split('/')[3].toString();
597				var query = videoid.substring(videoid.indexOf('?') + 1);
598				if (query != '') {
599					var vars = query.split('&');
600					for (var i = 0; i < vars.length; i++) {
601						var pair = vars[i].split('=');
602						if (pair[0] == 'v') {
603							videoid = pair[1];
604						}
605					}
606				}
607				return {
608					"provider": "youtube",
609					"id": videoid
610				};
611			} else if (/vimeo.com/.test(base.options.video)) {
612				return {
613					"provider": "vimeo",
614					"id": (a.href.split('/')[3].toString()).split('#')[0],
615				};
616			} else if (/[-A-Za-z0-9_]+/.test(base.options.video)) {
617				var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/));
618				if (id.length == 11) {
619					return {
620						"provider": "youtube",
621						"id": id.toString()
622					};
623				} else {
624					for (var i = 0; i < base.options.video.length; i++) {
625						if (typeof parseInt(base.options.video[i]) !== "number") {
626							throw 'not vimeo but thought it was for a sec';
627						}
628					}
629					return {
630						"provider": "vimeo",
631						"id": base.options.video
632					};
633				}
634			} else {
635				throw "OKVideo: Invalid video source";
636			}
637		};
638		base.init();
639	};
640	$.okvideo.options = {
641		id: null,
642		source: null, // Deprecate dis l8r
643		video: null,
644		playlist: { // eat ur heart out @brokyo
645			list: null,
646			index: 0,
647			startSeconds: 0,
648			suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default
649		},
650		disableKeyControl: 1,
651		captions: 0,
652		loop: 1,
653		hd: 1,
654		volume: 0,
655		adproof: false,
656		unstarted: null,
657		onFinished: null,
658		onReady: null,
659		onPlay: null,
660		onPause: null,
661		buffering: null,
662		controls: false,
663		autoplay: true,
664		annotations: true,
665		cued: null
666	};
667	$.fn.okvideo = function(options) {
668		options.target = this;
669		return this.each(function() {
670			(new $.okvideo(options));
671		});
672	};
673
674	$(".no-touch .uncode-video-container.video").each(function(index, el) {
675		var $this = $(this),
676			url = $this.attr('data-video'),
677			id = $this.attr('data-id'),
678			cloned = $this.closest('.owl-item');
679		if (!cloned.hasClass('cloned') || cloned.length == 0) {
680			$this.okvideo({
681				id: id,
682				source: url.split('#')[0],
683				time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null,
684				autoplay: 1,
685				controls: 0,
686				volume: 0,
687				adproof: 0,
688				caller: $this,
689				hd: 1,
690				onReady: function(player) {
691					var getPlayer = player.c || player,
692					getContainer = $(getPlayer).closest('.background-element');
693					if (getContainer.length) {
694						UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video');
695					}
696				}
697			});
698		}
699	});
700	$(".no-touch .background-video-shortcode").each(function(index, el) {
701		var video_id = $(this).attr('id');
702		if (typeof MediaElement === "function") {
703			new MediaElement(video_id, {
704				startVolume: 0,
705				loop: true,
706				success: function(mediaElement, domObject) {
707					domObject.volume = 0;
708					$(mediaElement).data('started', false);
709					mediaElement.addEventListener('timeupdate', function(e) {
710						if (!$(e.target).data('started')) {
711							$(mediaElement).data('started', true);
712							$(mediaElement).closest('.uncode-video-container').css('opacity', '1');
713						}
714					});
715					if (!UNCODE.isMobile) {
716						setTimeout(function() {
717							UNCODE.initVideoComponent(document.body, '.uncode-video-container.video, .uncode-video-container.self-video');
718						}, 100);
719					}
720					mediaElement.play();
721				},
722				// fires when a problem is detected
723				error: function() {}
724			});
725		}
726	});
727};
728
729UNCODE.disableHoverScroll = function() {
730
731    if (!UNCODE.isMobile) {
732        var body = document.body,
733        timer;
734
735        window.addEventListener('scroll', function() {
736            clearTimeout(timer);
737            if (body.classList)  {
738                if (!body.classList.contains('disable-hover')) {
739                    body.classList.add('disable-hover')
740                }
741
742                timer = setTimeout(function() {
743                    body.classList.remove('disable-hover')
744                }, 300);
745            }
746        }, false);
747    }
748};
749
750
751UNCODE.isotopeLayout = function() {
752	if ($('.isotope-layout').length > 0) {
753		var isotopeContainersArray = [],
754			typeGridArray = [],
755			layoutGridArray = [],
756			screenLgArray = [],
757			screenMdArray = [],
758			screenSmArray = [],
759			transitionDuration = [],
760			$filterItems = [],
761			$filters = $('.isotope-filters'),
762			$itemSelector = '.tmb',
763			$items,
764			itemMargin,
765			correctionFactor = 0,
766			firstLoad = true,
767			isOriginLeft = $('body').hasClass('rtl') ? false : true;
768		$('[class*="isotope-container"]').each(function() {
769			var isoData = $(this).data(),
770			$data_lg,
771			$data_md,
772			$data_sm;
773			if (isoData.lg !== undefined) $data_lg = $(this).attr('data-lg');
774			else $data_lg = '1000';
775			if (isoData.md !== undefined) $data_md = $(this).attr('data-md');
776			else $data_md = '600';
777			if (isoData.sm !== undefined) $data_sm = $(this).attr('data-sm');
778			else $data_sm = '480';
779			screenLgArray.push($data_lg);
780			screenMdArray.push($data_md);
781			screenSmArray.push($data_sm);
782			transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s');
783			if (isoData.type == 'metro') typeGridArray.push(true);
784			else typeGridArray.push(false);
785			if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout);
786			else layoutGridArray.push('masonry');
787			isotopeContainersArray.push($(this));
788		});
789		var colWidth = function(index) {
790				$(isotopeContainersArray[index]).width('');
791				var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'),
792					widthAvailable = $(isotopeContainersArray[index]).width(),
793					columnNum = 12,
794					columnWidth = 0;
795
796				if (isPx) {
797					columnWidth = Math.ceil(widthAvailable / columnNum);
798					$(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth));
799				} else {
800					columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum;
801				}
802				$items = $(isotopeContainersArray[index]).find('.tmb:not(.tmb-carousel)');
803				itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top"));
804				for (var i = 0, len = $items.length; i < len; i++) {
805					var $item = $($items[i]),
806						multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/),
807						multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,2})/);
808
809					if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) {
810						if (multiplier_w != null && multiplier_w[1] !== undefined) {
811							switch (parseInt(multiplier_w[1])) {
812								case (5):
813								case (4):
814								case (3):
815									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
816									multiplier_w[1] = 6;
817									break;
818								case (2):
819								case (1):
820									if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1];
821									multiplier_w[1] = 3;
822									break;
823								default:
824									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
825									multiplier_w[1] = 12;
826									break;
827							}
828						}
829					} else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) {
830						if (multiplier_w != null && multiplier_w[1] !== undefined) {
831							switch (parseInt(multiplier_w[1])) {
832								case (5):
833								case (4):
834								case (3):
835								case (2):
836								case (1):
837									if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1];
838									multiplier_w[1] = 6;
839									break;
840								default:
841									if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
842									multiplier_w[1] = 12;
843									break;
844							}
845						}
846					} else if (widthAvailable < screenSmArray[index]) {
847						if (multiplier_w != null && multiplier_w[1] !== undefined) {
848							//if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1];
849							multiplier_w[1] = 12;
850							if (typeGridArray[index]) multiplier_h[1] = 12;
851						}
852					}
853					var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth,
854						height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth;
855
856					if (width >= widthAvailable) {
857						$item.css({
858							width: widthAvailable
859						});
860						if (typeGridArray[index]) {
861							$item.children().add($item.find('.backimg')).css({
862								height: height
863							});
864						}
865					} else {
866						$item.css({
867							width: width
868						});
869						if (typeGridArray[index]) {
870							$item.children().add($item.find('.backimg')).css({
871								height: height
872							});
873						}
874					}
875				}
876				return columnWidth;
877			},
878			init_isotope = function() {
879				for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
880					var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')),
881						isotopeId = isotopeSystem.attr('id'),
882						$layoutMode = layoutGridArray[i];
883					$(isotopeContainersArray[i]).isotope({
884						//resizable: true,
885						itemSelector: $itemSelector,
886						layoutMode: $layoutMode,
887						transitionDuration: transitionDuration[i],
888						masonry: {
889							columnWidth: colWidth(i)
890						},
891						vertical: {
892							horizontalAlignment: 0.5,
893						},
894						sortBy: 'original-order',
895						isOriginLeft: isOriginLeft
896					}).on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0));
897					if ($(isotopeContainersArray[i]).hasClass('isotope-infinite')) {
898						$(isotopeContainersArray[i]).infinitescroll({
899								navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container
900								nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2)
901								itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li', // selector for all items 
901you'll retrieve
902								animate: false,
903								behavior: 'local',
904								debug: false,
905								loading: {
906									selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner',
907									speed: 0,
908									finished: undefined,
909									msg: $('#' + isotopeId + ' .loadmore-button'),
910								},
911								errorCallback: function() {
912									var isotope_system = $(this).closest('.isotope-system');
913									$('.loading-button', isotope_system).hide();
914									$('.loadmore-button', isotope_system).attr('style', 'display:none !important');
915								}
916							},
917							// append the new items to isotope on the infinitescroll callback function.
918							function(newElements, opts) {
919								var $isotope = $(this),
920									isotopeId = $isotope.closest('.isotope-system').attr('id'),
921									filters = new Array(),
922									$loading_button = $isotope.closest('.isotope-system').find('.loading-button'),
923									$infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'),
924									$numPages = $('a', $infinite_button).data('pages'),
925									delay = 300;
926								$('a', $infinite_button).html($('a', $infinite_button).data('label'));
927								$infinite_button.show();
928								$loading_button.hide();
929								if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide();
930								$('> li', $isotope).remove();
931								$.each($(newElements), function(index, val) {
932									if ($(val).is("li")) {
933										filters.push($(val)[0]);
934									}
935								});
936								newElements = newElements.filter(function(x) {
937									return filters.indexOf(x) < 0
938								});
939								$.each($(filters), function(index, val) {
940									if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val));
941								});
942								$isotope.isotope('reloadItems', onLayout($isotope, newElements.length));
943							});
944						if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) {
945							var $infinite_isotope = $(isotopeContainersArray[i]),
946								$infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a');
947							$infinite_isotope.infinitescroll('pause');
948							$infinite_button.on('click', function(event) {
949								event.preventDefault();
950								var $infinite_system = $(event.target).closest('.isotope-system'),
951								$infinite_isotope = $infinite_system.find('.isotope-container'),
952								isotopeId = $infinite_system.attr('id');
953								$(event.currentTarget).html('Loading…');
954								$infinite_isotope.infinitescroll('resume');
955								$infinite_isotope.infinitescroll('retrieve');
956								$infinite_isotope.infinitescroll('pause');
957							});
958						}
959					}
960				}
961			},
962			onLayout = function(isotopeObj, startIndex) {
963				isotopeObj.css('opacity', 1);
964				isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1);
965				setTimeout(function() {
966					window.dispatchEvent(UNCODE.boxEvent);
967					UNCODE.adaptive();
968					$(isotopeObj).find('audio,video').each(function() {
969						$(this).mediaelementplayer({
970 							pauseOtherPlayers: false,
971						});
972					});
973					if ($(isotopeObj).find('.nested-carousel').length) {
974						UNCODE.carousel($(isotopeObj).find('.nested-carousel'));
975						setTimeout(function() {
976							boxAnimation($('.tmb', isotopeObj), startIndex, true, isotopeObj);
977						}, 200);
978					} else {
979						boxAnimation($('.tmb', isotopeObj), startIndex, true, isotopeObj);
980					}
981				}, 100);
982			},
983			boxAnimation = function(items, startIndex, sequential, container) {
984				var $allItems = items.length - startIndex,
985					showed = 0,
986					index = 0;
987				if (container.closest('.owl-item').length == 1) return false;
988				$.each(items, function(index, val) {
989					var elInner = $('> .t-inside', val);
990					if (val[0]) val = val[0];
991					if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) {
992						new Waypoint({
993							element: val,
994							handler: function() {
995								var element = $('> .t-inside', this.element),
996									parent = $(this.element),
997									currentIndex = parent.index();
998								var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex),
999									delayAttr = parseInt(element.attr('data-delay'));
1000								if (isNaN(delayAttr)) delayAttr = 100;
1001								delay -= showed;
1002								var objTimeout = setTimeout(function() {
1003									element.removeClass('zoom-reverse').addClass('start_animation');
1004									showed = parent.index();
1005								}, delay * delayAttr)
1006								parent.data('objTimeout', objTimeout);
1007								this.destroy();
1008							},
1009							offset: '100%'
1010						})
1011					} else {
1012						if (elInner.hasClass('force-anim')) {
1013							elInner.addClass('start_animation');
1014						} else {
1015							elInner.css('opacity', 1);
1016						}
1017					}
1018					index++;
1019				});
1020			};
1021		if ($('.isotope-pagination').length > 0) {
1022			$('.isotope-system').on('click', '.pagination a', function(evt) {
1023				evt.preventDefault();
1024				var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'),
1025				container = $(this).closest('.isotope-system'),
1026				calc_scroll = container.closest('.uncol').offset().top - (!filterContainer.hasClass('with-bg') ? $('.filter-show-all span', filterContainer).outerHeight(true) : 0);
1027				calc_scroll -= UNCODE.get_scroll_offset();
1028
1029				var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
1030					delta = bodyTop - calc_scroll,
1031					scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
1032				if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
1033
1034				if (scrollSpeed == 0) {
1035					$('html, body').scrollTop(calc_scroll);
1036				} else {
1037					$('html, body').animate({
1038						scrollTop: calc_scroll
1039					},{
1040						easing: 'easeInOutQuad',
1041						duration: scrollSpeed,
1042						complete: function(){
1043							UNCODE.scrolling = false;
1044						}
1045					});
1046				}
1047
1048				loadIsotope($(this));
1049				evt.preventDefault();
1050			});
1051		}
1052		$filters.on('click', 'a', function(evt) {
1053			var $filter = $(this),
1054				filterContainer = $filter.closest('.isotope-filters'),
1055				filterValue = $filter.attr('data-filter'),
1056				container = $filter.closest('.isotope-system').find($('.isotope-layout')),
1057				transitionDuration = container.data().isotope.options.transitionDuration,
1058				delay = 300,
1059				filterItems = [];
1060			if (!$filter.hasClass('active')) {
1061				/** Scroll top with filtering */
1062				if (filterContainer.hasClass('filter-scroll')) {
1063					var calc_scroll = container.closest('.uncol').offset().top - (!filterContainer.hasClass('with-bg') ? $('.filter-show-all span', filterContainer).outerHeight(true) : 0);
1064					calc_scroll -= UNCODE.get_scroll_offset();
1065
1066					var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
1067						delta = bodyTop - calc_scroll,
1068						scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
1069					if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
1070
1071					if (scrollSpeed == 0) {
1072						$('html, body').scrollTop(calc_scroll);
1073						UNCODE.scrolling = false;
1074					} else {
1075						$('html, body').animate({
1076							scrollTop: calc_scroll
1077						},{
1078							easing: 'easeInOutQuad',
1079							duration: scrollSpeed,
1080							complete: function(){
1081								UNCODE.scrolling = false;
1082							}
1083						});
1084					}
1085				}
1086				if (filterValue !== undefined) {
1087					$.each($('> .tmb > .t-inside', container), function(index, val) {
1088						var parent = $(val).parent(),
1089							objTimeout = parent.data('objTimeout');
1090						if (objTimeout) {
1091							$(val).removeClass('zoom-reverse').removeClass('start_animation')
1092							clearTimeout(objTimeout);
1093						}
1094						if (transitionDuration == 0) {
1095							if ($(val).hasClass('animate_when_almost_visible')) {
1096								$(val).addClass('zoom-reverse').removeClass('start_animation');
1097							} else {
1098								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
1099							}
1100						}
1101					});
1102					setTimeout(function() {
1103						container.isotope({
1104							filter: function() {
1105								var block = $(this),
1106								filterable = (filterValue == '*') || block.hasClass(filterValue),
1107								lightboxElements = $('[data-lbox^=ilightbox]', block);
1108								if (filterable) {
1109									if (lightboxElements.length) {
1110										lightboxElements.removeClass('lb-disabled');
1111										container.data('lbox', $(lightboxElements[0]).data('lbox'));
1112									}
1113									filterItems.push(block);
1114								} else {
1115									if (lightboxElements.length) lightboxElements.addClass('lb-disabled');
1116								}
1117								return filterable;
1118							}
1119						});
1120						$('.t-inside.zoom-reverse', container).removeClass('zoom-reverse');
1121					}, delay);
1122					/** once filtered - start **/
1123					container.isotope('once', 'arrangeComplete', function() {
1124						var getLightbox = UNCODE.lightboxArray[container.data('lbox')];
1125						if (typeof getLightbox === 'object') getLightbox.refresh();
1126						if (transitionDuration == 0) {
1127							setTimeout(function() {
1128								boxAnimation(filterItems, 0, false, container);
1129							}, 100);
1130						}
1131						setTimeout(function() {
1132							Waypoint.refreshAll();
1133						}, 2000);
1134					});
1135					/** once filtered - end **/
1136				} else {
1137					$.each($('> .tmb > .t-inside', container), function(index, val) {
1138						var parent = $(val).parent(),
1139							objTimeout = parent.data('objTimeout');
1140						if (objTimeout) {
1141							$(val).removeClass('zoom-reverse').removeClass('start_animation')
1142							clearTimeout(objTimeout);
1143						}
1144						if (transitionDuration == 0) {
1145							if ($(val).hasClass('animate_when_almost_visible')) {
1146								$(val).addClass('zoom-reverse').removeClass('start_animation');
1147							} else {
1148								$(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim');
1149							}
1150						}
1151					});
1152					container.parent().addClass('isotope-loading');
1153					loadIsotope($filter);
1154				}
1155			}
1156			evt.preventDefault();
1157		});
1158		$(window).on("popstate", function(e) {
1159			if (e.originalEvent.state === null) return;
1160			var params = {};
1161			if (location.search) {
1162				var parts = location.search.substring(1).split('&');
1163				for (var i = 0; i < parts.length; i++) {
1164					var nv = parts[i].split('=');
1165					if (!nv[0]) continue;
1166					params[nv[0]] = nv[1] || true;
1167				}
1168			}
1169			if (params.id === undefined) {
1170				$.each($('.isotope-system'), function(index, val) {
1171					loadIsotope($(val));
1172				});
1173			} else loadIsotope($('#' + params.id));
1174		});
1175
1176		var loadIsotope = function($href) {
1177			var href = ($href.is("a") ? $href.attr('href') : location),
1178				isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href),
1179				isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')),
1180				isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')),
1181				isotopeContainer = isotopeSystem.find($('.isotope-layout')),
1182				isotopeId = isotopeSystem.attr('id');
1183			if ($href.is("a")) history.pushState({
1184				myIsotope: true
1185			}, document.title, href);
1186			$.ajax({
1187				url: href
1188			}).done(function(data) {
1189				var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(),
1190					$resultPagination = $(data).find('#' + isotopeId + ' .pagination');
1191				isotopeWrapper.addClass('isotope-reloaded');
1192				setTimeout(function() {
1193					isotopeWrapper.removeClass('isotope-loading');
1194					isotopeWrapper.removeClass('isotope-reloaded');
1195				}, 500);
1196				$.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) {
1197					var parent = $(val).parent(),
1198						objTimeout = parent.data('objTimeout');
1199					if (objTimeout) {
1200						$(val).removeClass('zoom-reverse').removeClass('start_animation')
1201						clearTimeout(objTimeout);
1202					}
1203					if ($(val).hasClass('animate_when_almost_visible')) {
1204						$(val).addClass('zoom-reverse').removeClass('start_animation');
1205					} else {
1206						$(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim');
1207					}
1208				});
1209				setTimeout(function() {
1210					if (isotopeContainer.data('isotope')) {
1211						isotopeContainer.html($resultItems).isotope('reloadItems', onLayout(isotopeContainer, 0));
1212						UNCODE.adaptive();
1213						var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')];
1214						if (typeof getLightbox === 'object') getLightbox.refresh();
1215					}
1216				}, 300);
1217				$('.pagination', isotopeFooter).remove();
1218				isotopeFooter.append($resultPagination);
1219			});
1220		};
1221		$filters.each(function(i, buttonGroup) {
1222			var $buttonGroup = $(buttonGroup);
1223			$buttonGroup.on('click', 'a', function() {
1224				$buttonGroup.find('.active').removeClass('active');
1225				$(this).addClass('active');
1226			});
1227		});
1228		window.addEventListener('boxResized', function(e) {
1229			$.each($('.isotope-layout'), function(index, val) {
1230				var $layoutMode = ($(this).data('layout'));
1231				if ($layoutMode === undefined) $layoutMode = 'masonry';
1232				if ($(this).data('isotope')) {
1233					$(this).isotope({
1234						itemSelector: $itemSelector,
1235						layoutMode: $layoutMode,
1236						transitionDuration: transitionDuration[index],
1237						masonry: {
1238							columnWidth: colWidth(index)
1239						},
1240						vertical: {
1241							horizontalAlignment: 0.5,
1242						},
1243						sortBy: 'original-order',
1244						isOriginLeft: isOriginLeft
1245					});
1246					$(this).isotope('unbindResize');
1247				}
1248				$(this).find('.mejs-video,.mejs-audio').each(function() {
1249					$(this).trigger('resize');
1250				});
1251			});
1252		}, false);
1253		init_isotope();
1254	};
1255}
1256
1257UNCODE.lightbox = function() {
1258	UNCODE.lightboxArray = {};
1259	setTimeout(function() {
1260		var groupsArr = {};
1261		$('[data-lbox^=ilightbox]:not(.lb-disabled)').each(function() {
1262			var group = this.getAttribute("data-lbox"),
1263				values = $(this).data();
1264			groupsArr[group] = values;
1265		});
1266		for (var i in groupsArr) {
1267			var skin = groupsArr[i].skin || 'black',
1268				path = groupsArr[i].dir || 'horizontal',
1269				thumbs = !groupsArr[i].notmb || false,
1270				arrows = !groupsArr[i].noarr || false,
1271				social = groupsArr[i].social || false,
1272				deeplink = groupsArr[i].deep || false,
1273				counter = $('[data-lbox="' + i + '"]:not(.lb-disabled)').length;
1274			if (social) social = {
1275				facebook: true,
1276				twitter: true,
1277				googleplus: true,
1278				reddit: true,
1279				digg: true,
1280				delicious: true
1281			};
1282			UNCODE.lightboxArray[i] = $('[data-lbox="' + i + '"]:not(.lb-disabled)').iLightBox({
1283				skin: skin,
1284				path: path,
1285				linkId: deeplink,
1286				infinite: false,
1287				//fullViewPort: 'fit',
1288				smartRecognition: false,
1289				fullAlone: false,
1290				maxScale: 1,
1291				minScale: .02,
1292				//fullStretchTypes: 'flash, video',
1293				overlay: {
1294					opacity: .94
1295				},
1296				controls: {
1297					arrows: (counter > 1 ? arrows : false),
1298					fullscreen: true,
1299					thumbnail: thumbs,
1300					slideshow: (counter > 1 ? true : false)
1301				},
1302				show: {
1303					speed: 200
1304				},
1305				hide: {
1306					speed: 200
1307				},
1308				social: {
1309					start: false,
1310					buttons: social
1311				},
1312				caption: {
1313					start: false
1314				},
1315				styles: {
1316					nextOpacity: 1,
1317					nextScale: 1,
1318					prevOpacity: 1,
1319					prevScale: 1
1320				},
1321				effects: {
1322					switchSpeed: 400
1323				},
1324				slideshow: {
1325					pauseTime: 5000
1326				},
1327				thumbnails: {
1328					maxWidth: 60,
1329					maxHeight: 60,
1330					activeOpacity: .2
1331				},
1332				html5video: {
1333					preload: true
1334				}
1335			});
1336		};
1337	}, 100);
1338};
1339
1340UNCODE.backVideo = function() {
1341	$(function() {
1342		$.each($('.background-video-shortcode'), function() {
1343			var video_id = $(this).attr('id');
1344			if (typeof MediaElement === "function") {
1345				new MediaElement(video_id, {
1346					startVolume: 0,
1347					loop: true,
1348					success: function(mediaElement, domObject) {
1349						mediaElement.play();
1350						$(mediaElement).closest('.uncode-video-container').css('opacity','1');
1351						domObject.volume = 0;
1352					},
1353					// fires when a problem is detected
1354					error: function() {}
1355				});
1356			}
1357		});
1358	});
1359};
1360
1361UNCODE.carousel = function(container) {
1362	var $owlSelector = $('.owl-carousel-container > [class*="owl-carousel"]', container),
1363		values = {},
1364		tempTimeStamp,
1365		currentIndex,
1366		$owlInsideEqual = [];
1367	$owlSelector.each(function() {
1368		var itemID = $(this).attr('id'),
1369			$elSelector = $(('#' + itemID).toString());
1370		values['id'] = itemID;
1371		values['items'] = 1;
1372		values['columns'] = 3;
1373		values['fade'] = false;
1374		values['nav'] = false;
1375		values['navmobile'] = false;
1376		values['navskin'] = 'light';
1377		values['navspeed'] = 400;
1378		values['dots'] = false;
1379		values['dotsmobile'] = false;
1380		values['loop'] = false;
1381		values['autoplay'] = false;
1382		values['timeout'] = 3000;
1383		values['autoheight'] = false;
1384		values['margin'] = 0;
1385		values['lg'] = 1;
1386		values['md'] = 1;
1387		values['sm'] = 1;
1388		$.each($(this).data(), function(i, v) {
1389			values[i] = v;
1390		});
1391
1392		if ($(this).closest('.uncode-slider').length) {
1393			values['navskin'] = '';
1394			values['navmobile'] = false;
1395			values['dotsmobile'] = true;
1396		} else {
1397			values['navskin'] = ' style-'+values['navskin']+' style-override';
1398		}
1399
1400		/** Initialized */
1401		$elSelector.on('initialized.owl.carousel', function(event) {
1402
1403			var thiis = $(event.currentTarget),
1404				// get the time from the data method
1405				time = thiis.data("timer-id");
1406			if (time) {
1407				clearTimeout(time);
1408			}
1409
1410			thiis.addClass('showControls');
1411			var new_time = setTimeout(function() {
1412				thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading');
1413				if (thiis.hasClass('owl-height-equal')) setItemsHeight(event.currentTarget);
1414				if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent());
1415				if (thiis.closest('.unequal, .unexpand').length) {
1416					var rowParent = thiis.closest('.row-parent');
1417					UNCODE.setRowHeight(rowParent[0], true);
1418				}
1419			}, 350);
1420			// save the new time
1421			thiis.data("timer-id", new_time);
1422
1423			var scrolltop = $(document).scrollTop();
1424			$(event.currentTarget).closest('.uncode-slider').find('video').removeAttr('poster');
1425
1426			//if (!UNCODE.isMobile) {
1427				/** fix autoplay when visible **/
1428				if ($(event.currentTarget).data('autoplay')) {
1429					$(event.currentTarget).trigger('stop.autoplay.owl');
1430				}
1431				var carouselInView = new Waypoint.Inview({
1432				  element: $(event.currentTarget)[0],
1433				  enter: function(direction) {
1434				    var el = $(this.element);
1435						if (el.data('autoplay')) {
1436							el.trigger('play.owl.autoplay');
1437							el.data('stopped','false');
1438						}
1439				  },
1440				  exited: function() {
1441				    if ($(this.element).data('autoplay')) {
1442							$(this.element).trigger('stop.owl.autoplay');
1443							$(this.element).data('stopped','true');
1444						}
1445				  }
1446				});
1447			//}
1448
1449			if (!$(event.currentTarget).closest('.isotope-system').length) {
1450				setTimeout(function() {
1451					animate_thumb($('.t-inside', el), event);
1452				}, 400);
1453			}
1454
1455			var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
1456			currentIndex = $(currentItem).attr('data-index');
1457
1458			$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
1459				if ($(val).closest('.uncode-slider').length) {
1460					$(val).removeClass('start_animation');
1461				}
1462			});
1463
1464			$.each($('.owl-item:not(.active)', event.currentTarget), function(index, val) {
1465				if ($(val).hasClass('cloned')) {
1466					$('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true);
1467				}
1468				if ($(val).attr('data-index') != currentIndex) {
1469					$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
1470				}
1471				if ($(val).attr('data-index') == currentIndex) {
1472					$('.animate_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
1473				}
1474			});
1475
1476			if ($(event.currentTarget).closest('.uncode-slider').length) {
1477				var el = $(event.currentTarget).closest('.row-parent')[0];
1478				if ($(el).data('imgready')) {
1479					firstLoaded(el, event);
1480				} else {
1481					el.addEventListener("imgLoaded", function(el) {
1482						firstLoaded(el.target, event);
1483					}, false);
1484				}
1485				var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder;
1486				if (transHeight != null) {
1487					setTimeout(function() {
1488						$(event.currentTarget).closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px');
1489					}, 100);
1490				}
1491			} else {
1492				var el = $(event.currentTarget);
1493				el.closest('.uncode-slider').addClass('slider-loaded');
1494			}
1495
1496			setTimeout(function() {
1497				window.uncode_textfill(thiis);
1498				if ($(event.currentTarget).closest('.uncode-slider').length) {
1499					if ($(event.currentTarget).data('autoplay')) pauseOnHover(event.currentTarget);
1500				}
1501			}, 500);
1502
1503			if ($(event.currentTarget).closest('.unequal').length) {
1504				$owlInsideEqual.push($(event.currentTarget).closest('.row-parent'));
1505			}
1506
1507		});
1508
1509		/** Resizing */
1510		$elSelector.on('resized.owl.carousel', function(event) {
1511			if ($(this).closest('.nested-carousel').length) {
1512				setTimeout(function() {
1513					window.dispatchEvent(UNCODE.boxEvent);
1514				}, 200);
1515			}
1516			if ($(event.currentTarget).hasClass('owl-height-equal')) setItemsHeight(event.currentTarget);
1517		});
1518
1519		/** Change */
1520		$elSelector.on('change.owl.carousel', function(event) {
1521			if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget);
1522		});
1523
1524		/** Changed */
1525		$elSelector.on('changed.owl.carousel', function(event) {
1526			if (tempTimeStamp != event.timeStamp) {
1527				var scrolltop = $(document).scrollTop();
1528				var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[(event.item.index != null) ? event.item.index : 0];
1529				if ($(event.currentTarget).closest('.row-slider').length) {
1530					if (currentItem == undefined) {
1531						currentItem = $(event.currentTarget).children()[0];
1532					}
1533					if ($(currentItem).closest('#page-header').length) {
1534						if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) {
1535							UNCODE.switchColorsMenu(scrolltop, 'dark');
1536						} else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) {
1537							UNCODE.switchColorsMenu(scrolltop, 'light');
1538						}
1539					}
1540				}
1541			}
1542			tempTimeStamp = event.timeStamp;
1543		});
1544
1545		$elSelector.on('translate.owl.carousel', function(event) {
1546			if (UNCODE.isMobile) {
1547				$(event.currentTarget).addClass('owl-translating');
1548			}
1549		});
1550
1551		/** Translated */
1552		$elSelector.on('translated.owl.carousel', function(event) {
1553
1554			var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
1555				currentIndex = $(currentItem).attr('data-index');
1556
1557			if (!UNCODE.isMobile) {
1558				UNCODE.owlPlayVideo(event.currentTarget);
1559			}
1560
1561			setTimeout(function() {
1562				var lastDelayElems = animate_elems($('.owl-item.active', event.currentTarget));
1563				var lastDelayThumb = animate_thumb($('.owl-item.active .t-inside', event.currentTarget), event);
1564				if ($(event.currentTarget).closest('.uncode-slider').length && $(event.currentTarget).data('autoplay')) {
1565					if (lastDelayElems == undefined) lastDelayElems = 0;
1566					if (lastDelayThumb == undefined) lastDelayThumb = 0;
1567					var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
1568					$(event.currentTarget).trigger('stop.owl.autoplay');
1569					setTimeout(function() {
1570						if (!$(event.currentTarget).hasClass('owl-mouseenter') && $(event.currentTarget).data('stopped') != 'true') $(event.currentTarget).trigger('play.owl.autoplay');
1571					}, maxDelay);
1572				}
1573			}, 200);
1574
1575			$.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) {
1576				if ($(val).closest('.uncode-slider').length) {
1577					$(val).removeClass('start_animation');
1578				}
1579			});
1580
1581			$.each($('.owl-item:not(.active)', event.currentTarget), function(index, val) {
1582				if ($(val).attr('data-index') != currentIndex) {
1583					$('.start_animation:not(.t-inside)', val).removeClass('start_animation');
1584				}
1585				if ($(val).attr('data-index') == currentIndex) {
1586					$('.animate_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
1587				}
1588			});
1589
1590			if (UNCODE.isMobile) {
1591				$(event.currentTarget).removeClass('owl-translating');
1592			}
1593
1594			// } else {
1595			// 	$(event.currentTarget).removeClass('owl-translating');
1596			// }
1597		});
1598
1599		/** Init carousel */
1600		$elSelector.owlCarousel({
1601			items: values['items'],
1602			animateOut: (values['fade'] == true) ? 'fadeOut' : null,
1603			nav: values['nav'],
1604			dots: values['dots'],
1605			loop: values['loop'],
1606			margin: 0,
1607			video: true,
1608			autoWidth: false,
1609			autoplay: false,
1610			autoplayTimeout: values['timeout'],
1611			autoplaySpeed: values['navspeed'],
1612			autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true,
1613			autoHeight: ($(this).hasClass('owl-height-equal') || $(this).hasClass('owl-height-auto')) ? true : values['autoheight'],
1614			rtl: $('body').hasClass('rtl') ? true : false,
1615			fluidSpeed: true,
1616			navSpeed: values['navspeed'],
1617			navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ],
1618			navText: ['<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-right"></i></div>'],
1619			navContainer: values['nav'] ? $elSelector : false,
1620			responsiveClass: true,
1621			responsiveBaseElement: '.box-container',
1622			responsive: {
1623				0: {
1624					items: values['sm'],
1625					nav: values['navmobile'],
1626					dots: values['dotsmobile']
1627				},
1628				480: {
1629					items: values['sm'],
1630					nav: values['navmobile'],
1631					dots: values['dotsmobile']
1632				},
1633				570: {
1634					items: values['md'],
1635					nav: values['navmobile'],
1636					dots: values['dotsmobile']
1637				},
1638				960: {
1639					items: values['lg']
1640				}
1641			},
1642		});
1643
1644		setTimeout(function() {
1645			for (var i = $owlInsideEqual.length - 1; i >= 0; i--) {
1646				UNCODE.setRowHeight($owlInsideEqual[i]);
1647			};
1648		}, 300);
1649	});
1650
1651	function firstLoaded(el, event) {
1652		var el = $(el),
1653		uncode_slider = el.find('.uncode-slider');
1654		el.find('.owl-carousel').css('opacity', 1);
1655		uncode_slider.addClass('slider-loaded');
1656		window.uncode_textfill(el.find('.owl-item.active'));
1657		//if (!UNCODE.isMobile) {
1658			setTimeout(function() {
1659				var lastDelayElems = animate_elems(el.find('.owl-item.active'));
1660				var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event);
1661				if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) {
1662					if (lastDelayElems == undefined) lastDelayElems = 0;
1663					if (lastDelayThumb == undefined) lastDelayThumb = 0;
1664					var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
1665					$('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay');
1666					setTimeout(function() {
1667						$('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay');
1668					}, maxDelay);
1669				}
1670			}, 500);
1671		//}
1672	}
1673
1674	function navHover(el) {
1675		var $owlCont = el,
1676			$owlPrev = $owlCont.find('.owl-prev'),
1677			$owlNext = $owlCont.find('.owl-next'),
1678			$owlDots = $owlCont.find('.owl-dots-inside .owl-dots'),
1679			$owlPagination = $owlCont.next(),
1680			owlPrevW = $owlPrev.outerWidth(),
1681			owlNextW = $owlNext.outerWidth(),
1682			owlDotsH = $owlDots.innerHeight(),
1683			owlTime = 400,
1684			owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
1685		$owlPrev.css("margin-left", -owlPrevW);
1686		$owlNext.css("margin-right", -owlNextW);
1687		if (!owlNested) $owlDots.css("bottom", -owlDotsH);
1688		$owlCont.mouseenter(function() {
1689			owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
1690			$owlPrev.css({
1691				marginLeft: 0
1692			});
1693			$owlNext.css({
1694				marginRight: 0
1695			});
1696			if (!owlNested) {
1697				$owlDots.css({
1698					opacity: 1,
1699					bottom: 0
1700				});
1701			}
1702		}).mouseleave(function() {
1703			owlNested = $owlCont.parent().parent().hasClass('nested-carousel');
1704			$owlPrev.css({
1705				marginLeft: -owlPrevW
1706			});
1707			$owlNext.css({
1708				marginRight: -owlNextW
1709			});
1710			if (!owlNested) {
1711				$owlDots.css({
1712					opacity: 1,
1713					bottom: -owlDotsH
1714				});
1715			}
1716		});
1717	};
1718
1719	function animate_elems($this) {
1720		var lastDelay;
1721		$.each($('.animate_when_almost_visible:not(.t-inside)', $this), function(index, val) {
1722			var element = $(val),
1723				delayAttr = element.attr('data-delay');
1724			if (delayAttr == undefined) delayAttr = 0;
1725			setTimeout(function() {
1726				element.addClass('start_animation');
1727			}, delayAttr);
1728			lastDelay = delayAttr;
1729		});
1730		return lastDelay;
1731	}
1732
1733	function animate_thumb(items, event) {
1734		var lastDelay,
1735		itemIndex,
1736		tempIndex = ($(event.currentTarget).data('tempIndex') == undefined) ? $('.owl-item.active', event.currentTarget).first().index() : $(event.currentTarget).data('tempIndex'),
1737		numActives = $('.owl-item.active', event.currentTarget).length;
1738		$(event.currentTarget).data('tempIndex', event.item.index);
1739			$.each(items, function(index, val) {
1740				var parent = $(val).closest('.owl-item');
1741				if (!$(val).hasClass('start_animation')) {
1742					if (parent.hasClass('active')) {
1743						var thumbInView = new Waypoint.Inview({
1744						  element: val,
1745						  enter: function(direction) {
1746						    var element = $(this.element),
1747									delayAttr = parseInt(element.attr('data-delay')),
1748									itemIndex = element.closest('.owl-item').index() + 1,
1749									diffItem = Math.abs(itemIndex - tempIndex) - 1;
1750								if (itemIndex > tempIndex) {
1751									$(event.currentTarget).data('tempIndex', itemIndex);
1752								}
1753								if (isNaN(delayAttr)) delayAttr = 100;
1754								$('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', event.currentTarget).addClass('start_animation');
1755								var objTimeout = setTimeout(function() {
1756									element.addClass('start_animation');
1757								}, diffItem * delayAttr);
1758								lastDelay = diffItem * delayAttr;
1759								parent.data('objTimeout', objTimeout);
1760								this.destroy();
1761						  }
1762						});
1763					}
1764				}
1765			});
1766			return lastDelay;
1767		}
1768
1769	function setItemsHeight(item) {
1770		$.each($('.owl-item', item), function(index, val) {
1771			var availableThumbHeight = $('.t-inside', $(val)).height(),
1772			innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(),
1773			difference = availableThumbHeight - innerThumbHeight;
1774			if ($('.tmb-content-under', val).length) {
1775				var visualPart = $('.t-entry-visual', val);
1776				if (visualPart.length) {
1777					difference -= $('.t-entry-visual', val).height();
1778				}
1779			}
1780			$('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' );
1781		});
1782	}
1783
1784	function pauseOnHover(slider) {
1785		$('.owl-dots, .owl-prev, .owl-next', slider).on({
1786	    mouseenter: function () {
1787	    	$(slider).addClass('owl-mouseenter');
1788	    	$(slider).trigger('stop.owl.autoplay');
1789	    },
1790	    mouseleave: function () {
1791	    	$(slider).removeClass('owl-mouseenter')
1792	      $(slider).trigger('play.owl.autoplay');
1793	    }
1794		});
1795	}
1796};
1797
1798UNCODE.owlPlayVideo = function(carousel) {
1799	var player, iframe;
1800	$('.owl-item.active .uncode-video-container', carousel).each(function(index, val) {
1801		var content = $(val).html();
1802		if (content == '') {
1803			var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone();
1804			$(val).append(getCloned);
1805		}
1806		if ($(this).attr('data-provider') == 'vimeo') {
1807			iframe = $(this).find('iframe');
1808			player = $f(iframe[0]);
1809			player.api('play');
1810		} else if ($(this).attr('data-provider') == 'youtube') {
1811			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo();
1812		} else {
1813			var player = $(this).find('video');
1814			if (player.length) {
1815				$(this).find('video')[0].volume = 0;
1816				$(this).find('video')[0].play();
1817				$(val).css('opacity', 1);
1818			}
1819		}
1820	});
1821};
1822
1823UNCODE.owlStopVideo = function(carousel) {
1824	$('.owl-item .uncode-video-container', carousel).each(function(index, val) {
1825		var player, iframe;
1826		if ($(this).attr('data-provider') == 'vimeo') {
1827			iframe = $(this).find('iframe');
1828			player = $f(iframe[0]);
1829			player.api('pause');
1830		} else if ($(this).attr('data-provider') == 'youtube') {
1831			if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo();
1832		} else {
1833			var player = $(this).find('video');
1834			if (player.length) {
1835				$(this).find('video')[0].volume = 0;
1836				$(this).find('video')[0].play();
1837			}
1838		}
1839	});
1840};
1841
1842UNCODE.animations = function() {
1843	//if (!UNCODE.isMobile) {
1844		$.each($('.header-content-inner'), function(index, val) {
1845			var element = $(val),
1846				transition = '';
1847			if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom';
1848			if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top';
1849			if (element.hasClass('left-t-right')) transition = 'left-t-right';
1850			if (element.hasClass('right-t-left')) transition = 'right-t-left';
1851			if (element.hasClass('zoom-in')) transition = 'zoom-in';
1852			if (element.hasClass('zoom-out')) transition = 'zoom-out';
1853			if (element.hasClass('alpha-anim')) transition = 'alpha-anim';
1854			if (transition != '') {
1855				$(val).removeClass(transition);
1856				var container = element,
1857					containerDelay = container.attr('data-delay'),
1858					containerSpeed = container.attr('data-speed'),
1859					items = $('.header-title > *, .post-info', container);
1860				$.each(items, function(index, val) {
1861					var element = $(val),
1862						//speedAttr = (containerSpeed == undefined) ? containerSpeed : '',
1863						delayAttr = (containerDelay != undefined) ? containerDelay : 400;
1864					if (!element.hasClass('animate_when_almost_visible')) {
1865						delayAttr = Number(delayAttr) + (400 * index);
1866						if (containerSpeed != undefined) element.attr('data-speed', containerSpeed);
1867						element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr);
1868					}
1869				});
1870				container.css('opacity', 1);
1871			}
1872		});
1873	//}
1874
1875	if (!window.waypoint_animation) {
1876		window.waypoint_animation = function() {
1877			$.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside), .tmb-media .animate_when_almost_visible:not(.start_animation)'), function(index, val) {
1878				var run = true;
1879				if ($(val).closest('.owl-carousel').length > 0) run = false;
1880				if (run) {
1881					new Waypoint({
1882						element: val,
1883						handler: function() {
1884							var element = $(this.element),
1885								index = element.index(),
1886								delayAttr = element.attr('data-delay');
1887							if (delayAttr == undefined) delayAttr = 0;
1888							setTimeout(function() {
1889								element.addClass('start_animation');
1890							}, delayAttr);
1891							this.destroy();
1892						},
1893						offset: '90%'
1894					});
1895				}
1896			});
1897		}
1898	}
1899	setTimeout(function() {
1900		window.waypoint_animation();
1901	}, 100);
1902}
1903
1904UNCODE.tapHover = function() {
1905
1906    var $el = $('html.touch .tmb:not(.tmb-no-double-tap) .t-entry-v
1906isual-cont > a'), //.length //html.touch a.btn
1907        elClass = "hover";
1908
1909    $el.on("click", function(e) { // cambia click con touch start 'touchstart'
1910        var link = $(this);
1911        if (link.hasClass(elClass)) {
1912            return true;
1913        } else {
1914            link.addClass("hover");
1915            $el.not(this).removeClass(elClass);
1916            e.preventDefault();
1917            return false;
1918        }
1919    });
1920};
1921
1922
1923UNCODE.onePage = function(isMobile) {
1924	var current = 0,
1925		last = 0,
1926		lastScrollTop = 0,
1927		forceScroll = false,
1928		lastScrolled = 0,
1929		isSectionscroller = ($('.main-onepage').length) ? true : false,
1930		getOffset = (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0);
1931
1932	function init_onepage() {
1933		if (isSectionscroller && !isMobile) {
1934			$("<ul class='onepage-pagination'></ul>").prependTo("body");
1935		}
1936		last = $('.onepage-section').length - 1;
1937		$.each($('div[data-parent=true]'), function(index, val) {
1938			$(this).attr('data-section', index);
1939			if (isMobile) return;
1940			var sectionDown = new Waypoint({
1941				element: val,
1942				handler: function(direction) {
1943					if (direction == 'down') {
1944						changeMenuActive(this.element, index);
1945					}
1946				},
1947				offset: 1 + getOffset
1948			});
1949			var sectionUp = new Waypoint({
1950				element: val,
1951				handler: function(direction) {
1952					if (direction == 'up') {
1953						changeMenuActive(this.element, index);
1954					}
1955				},
1956				offset: -1 + getOffset
1957			});
1958
1959			if (isSectionscroller) {
1960				var label;
1961				if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label');
1962				else label = '';
1963				var getName = $(this).attr('data-name');
1964				if (getName == undefined) getName = index;
1965				if (label != '') {
1966					label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>';
1967					$('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>");
1968				}
1969			}
1970		});
1971
1972		if (isSectionscroller) {
1973			$.each($('ul.onepage-pagination li'), function(index, val) {
1974				var $this = $(val);
1975				$this.on('click', function(evt) {
1976					var el = $('a', evt.currentTarget);
1977					current = lastScrolled = parseInt(el.attr('data-index'));
1978					lastScrolled += 1;
1979					scrollBody(current);
1980				});
1981			});
1982		}
1983
1984		var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, ''));
1985		if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '') {
1986			goToSection = String(window.location.hash).replace(/^#/, "");
1987			goToSection = Number($('[data-name=' + goToSection + ']').attr('data-section'));
1988		}
1989
1990		if (typeof goToSection === 'number' && !isNaN(goToSection)) {
1991			current = lastScrolled = goToSection;
1992			setTimeout(function() {
1993				scrollBody(goToSection);
1994			}, 500);
1995		}
1996
1997	}
1998
1999	function changeMenuActive(section, index) {
2000		current = lastScrolled = parseInt($(section).attr('data-section'));
2001		if (isSectionscroller) {
2002			var newSection = $('.onepage-pagination li a[data-index=' + index + ']');
2003			if (newSection.length) {
2004				$('ul.onepage-pagination li a').removeClass('is-selected');
2005				newSection.addClass('is-selected');
2006			}
2007		}
2008		var getName = $('[data-section=' + index + ']').attr('data-name');
2009		if (getName != undefined) {
2010			$.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) {
2011				var get_href = $(val).attr('href');
2012				if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
2013					$(val).closest('ul').find('.active').removeClass('active');
2014					$(val).parent().addClass('active');
2015				}
2016			});
2017		}
2018	}
2019
2020	if (isSectionscroller) {
2021		$(window).on('scroll', function() {
2022			var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'];
2023			if (bodyTop == 0) {
2024				$('ul.onepage-pagination li a').removeClass('is-selected');
2025				$('.onepage-pagination li a[data-index=0]').addClass('is-selected');
2026				var getName = $('[data-section=0]').attr('data-name');
2027				if (getName != undefined) {
2028					$.each($('.menu-container .menu-item > a'), function(i, val) {
2029						var get_href = $(val).attr('href');
2030						if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) {
2031							$(val).closest('ul').find('.active').removeClass('active');
2032							$(val).parent().addClass('active');
2033						}
2034					});
2035				}
2036			} else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) {
2037				var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]');
2038				if (lastSection.length) {
2039					$('ul.onepage-pagination li a').removeClass('is-selected');
2040					lastSection.addClass('is-selected');
2041				}
2042			}
2043		});
2044	}
2045
2046	var scrollBody = function(index) {
2047		$('ul.onepage-pagination li a').removeClass('is-selected');
2048		$('.onepage-pagination li a[data-index=' + index + ']').addClass('is-selected');
2049		var body = $("html, body"),
2050		bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'],
2051		delta = bodyTop - $('[data-section=' + index + ']').offset().top,
2052		scrollTo = $('[data-section=' + index + ']').offset().top;
2053		scrollTo -= UNCODE.get_scroll_offset();
2054
2055		var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed;
2056		if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000;
2057
2058		if (index != 0) {
2059			UNCODE.scrolling = true;
2060		}
2061		if (scrollSpeed == 0) {
2062			body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo);
2063			UNCODE.scrolling = false;
2064		} else {
2065			body.animate({
2066				scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo
2067			}, scrollSpeed, 'easeInOutQuad', function() {
2068				setTimeout(function(){
2069					UNCODE.scrolling = false;
2070				}, 100);
2071			});
2072		}
2073
2074	};
2075
2076	init_onepage();
2077};
2078
2079UNCODE.stickyElements = function() {
2080	if (!UNCODE.isMobile) {
2081		setTimeout(function() {
2082			if ($('.sticky-element').length) {
2083				var getRowPadding = $('.sticky-element.sticky-sidebar').closest('.row-parent').css("padding-top"),
2084					sideOffset = (getRowPadding != undefined) ? parseInt(getRowPadding.replace("px", "")) : 0;
2085				sideOffset += UNCODE.bodyBorder;
2086				if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight;
2087				if ($('.menu-sticky .menu-container:not(.menu-hide)').length) {
2088					if ($('.menu-shrink').length) {
2089						sideOffset += $('.navbar-brand').data('minheight') + 36;
2090					} else sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight));
2091				}
2092				if ($(window).width() > UNCODE.mediaQuery) {
2093					$(".sticky-element").stick_in_parent({
2094						sticky_class: 'is_stucked',
2095						offset_top: sideOffset,
2096						bottoming: true,
2097						inner_scrolling: false
2098					});
2099				}
2100				$(window).on('resize', function(event) {
2101					if ($(window).width() > UNCODE.mediaQuery) {
2102						$(".sticky-element").stick_in_parent({
2103							sticky_class: 'is_stucked',
2104							offset_top: sideOffset,
2105							bottoming: true,
2106							inner_scrolling: false
2107						});
2108					} else {
2109						$(".sticky-element").trigger("sticky_kit:detach");
2110					}
2111				});
2112			}
2113		}, 1000);
2114	}
2115};
2116
2117UNCODE.scrollEnance = function() {
2118  //
2119  // SmoothScroll for websites v1.4.4 (Balazs Galambosi)
2120  // http://www.smoothscroll.net/
2121  //
2122  // Licensed under the terms of the MIT license.
2123  //
2124  // You may use it in your theme if you credit me.
2125  // It is also free to use on any individual website.
2126  //
2127  // Exception:
2128  // The only restriction is to not publish any
2129  // extension for browsers or native application
2130  // without getting a written permission first.
2131  //
2132  UNCODE.navigating = false;
2133  (function () {
2134
2135  // Scroll Variables (tweakable)
2136  var defaultOptions = {
2137
2138      // Scrolling Core
2139      frameRate        : 150, // [Hz]
2140      animationTime    : 500, // [ms]
2141      stepSize         : 100, // [px]
2142
2143      // Pulse (less tweakable)
2144      // ratio of "tail" to "acceleration"
2145      pulseAlgorithm   : true,
2146      pulseScale       : 4,
2147      pulseNormalize   : 1,
2148
2149      // Acceleration
2150      accelerationDelta : 50,  // 50
2151      accelerationMax   : 3,   // 3
2152
2153      // Keyboard Settings
2154      keyboardSupport   : true,  // option
2155      arrowScroll       : 50,    // [px]
2156
2157      // Other
2158      touchpadSupport   : false, // ignore touchpad by default
2159      fixedBackground   : true,
2160      excluded          : ''
2161  };
2162
2163  var options = defaultOptions;
2164
2165
2166  // Other Variables
2167  var isExcluded = false;
2168  var isFrame = false;
2169  var direction = { x: 0, y: 0 };
2170  var initDone  = false;
2171  var root = document.documentElement;
2172  var activeElement;
2173  var observer;
2174  var refreshSize;
2175  var deltaBuffer = [];
2176  var isMac = /^Mac/.test(navigator.platform);
2177
2178  var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32,
2179              pageup: 33, pagedown: 34, end: 35, home: 36 };
2180  var arrowKeys = { 37: 1, 38: 1, 39: 1, 40: 1 };
2181
2182  /***********************************************
2183   * INITIALIZE
2184   ***********************************************/
2185
2186  /**
2187   * Tests if smooth scrolling is allowed. Shuts down everything if not.
2188   */
2189  function initTest() {
2190      if (options.keyboardSupport) {
2191          addEvent('keydown', keydown);
2192      }
2193  }
2194
2195  /**
2196   * Sets up scrolls array, determines if frames are involved.
2197   */
2198  function init() {
2199
2200      if (initDone || !document.body) return;
2201
2202      initDone = true;
2203
2204      var body = document.body;
2205      var html = document.documentElement;
2206      var windowHeight = window.innerHeight;
2207      var scrollHeight = body.scrollHeight;
2208
2209      // check compat mode for root element
2210      root = (document.compatMode.indexOf('CSS') >= 0) ? html : body;
2211      activeElement = body;
2212
2213      initTest();
2214
2215      // Checks if this script is running in a frame
2216      if (top != self) {
2217          isFrame = true;
2218      }
2219
2220      /**
2221       * Please duplicate this radar for a Safari fix!
2222       * rdar://22376037
2223       * https://openradar.appspot.com/radar?id=4965070979203072
2224       *
2225       * Only applies to Safari now, Chrome fixed it in v45:
2226       * This fixes a bug where the areas left and right to
2227       * the content does not trigger the onmousewheel event
2228       * on some pages. e.g.: html, body { height: 100% }
2229       */
2230      else if (scrollHeight > windowHeight &&
2231              (body.offsetHeight <= windowHeight ||
2232               html.offsetHeight <= windowHeight)) {
2233
2234          var fullPageElem = document.createElement('div');
2235          fullPageElem.style.cssText = 'position:absolute; z-index:-10000; ' +
2236                                       'top:0; left:0; right:0; height:' +
2237                                        root.scrollHeight + 'px';
2238          document.body.appendChild(fullPageElem);
2239
2240          // DOM changed (throttled) to fix height
2241          var pendingRefresh;
2242          refreshSize = function () {
2243              if (pendingRefresh) return; // could also be: clearTimeout(pendingRefresh);
2244              pendingRefresh = setTimeout(function () {
2245                  if (isExcluded) return; // could be running after cleanup
2246                  fullPageElem.style.height = '0';
2247                  fullPageElem.style.height = root.scrollHeight + 'px';
2248                  pendingRefresh = null;
2249              }, 500); // act rarely to stay fast
2250          };
2251
2252          setTimeout(refreshSize, 10);
2253
2254          addEvent('resize', refreshSize);
2255
2256          // TODO: attributeFilter?
2257          var config = {
2258              attributes: true,
2259              childList: true,
2260              characterData: false
2261              // subtree: true
2262          };
2263
2264          observer = new MutationObserver(refreshSize);
2265          observer.observe(body, config);
2266
2267          if (root.offsetHeight <= windowHeight) {
2268              var clearfix = document.createElement('div');
2269              clearfix.style.clear = 'both';
2270              body.appendChild(clearfix);
2271          }
2272      }
2273
2274      // disable fixed background
vendor: 5,278 bytes, lines 2275-2465
2275      if (!options.fixedBackground && !isExcluded) {
2276          body.style.backgroundAttachment = 'scroll';
2277          html.style.backgroundAttachment = 'scroll';
2278      }
2279  }
2280
2281  /**
2282   * Removes event listeners and other traces left on the page.
2283   */
2284  function cleanup() {
2285      observer && observer.disconnect();
2286      removeEvent(wheelEvent, wheel);
2287      removeEvent('mousedown', mousedown);
2288      removeEvent('keydown', keydown);
2289      removeEvent('resize', refreshSize);
2290      removeEvent('load', init);
2291  }
2292
2293
2294  /************************************************
2295   * SCROLLING
2296   ************************************************/
2297
2298  var que = [];
2299  var pending = false;
2300  var lastScroll = Date.now();
2301
2302  /**
2303   * Pushes scroll actions to the scrolling queue.
2304   */
2305  function scrollArray(elem, left, top) {
2306
2307      directionCheck(left, top);
2308
2309      if (options.accelerationMax != 1) {
2310          var now = Date.now();
2311          var elapsed = now - lastScroll;
2312          if (elapsed < options.accelerationDelta) {
2313              var factor = (1 + (50 / elapsed)) / 2;
2314              if (factor > 1) {
2315                  factor = Math.min(factor, options.accelerationMax);
2316                  left *= factor;
2317                  top  *= factor;
2318              }
2319          }
2320          lastScroll = Date.now();
2321      }
2322
2323      // push a scroll command
2324      que.push({
2325          x: left,
2326          y: top,
2327          lastX: (left < 0) ? 0.99 : -0.99,
2328          lastY: (top  < 0) ? 0.99 : -0.99,
2329          start: Date.now()
2330      });
2331
2332      // don't act if there's a pending queue
2333      if (pending) {
2334          return;
2335      }
2336
2337      var scrollWindow = (elem === document.body);
2338
2339      var step = function (time) {
2340
2341          var now = Date.now();
2342          var scrollX = 0;
2343          var scrollY = 0;
2344
2345          for (var i = 0; i < que.length; i++) {
2346
2347              var item = que[i];
2348              var elapsed  = now - item.start;
2349              var finished = (elapsed >= options.animationTime);
2350
2351              // scroll position: [0, 1]
2352              var position = (finished) ? 1 : elapsed / options.animationTime;
2353
2354              // easing [optional]
2355              if (options.pulseAlgorithm) {
2356                  position = pulse(position);
2357              }
2358
2359              // only need the difference
2360              var x = (item.x * position - item.lastX) >> 0;
2361              var y = (item.y * position - item.lastY) >> 0;
2362
2363              // add this to the total scrolling
2364              scrollX += x;
2365              scrollY += y;
2366
2367              // update last values
2368              item.lastX += x;
2369              item.lastY += y;
2370
2371              // delete and step back if it's over
2372              if (finished) {
2373                  que.splice(i, 1); i--;
2374              }
2375          }
2376
2377          // scroll left and top
2378          if (scrollWindow) {
2379              window.scrollBy(scrollX, scrollY);
2380          }
2381          else {
2382              if (scrollX) elem.scrollLeft += scrollX;
2383              if (scrollY) elem.scrollTop  += scrollY;
2384          }
2385
2386          // clean up if there's nothing left to do
2387          if (!left && !top) {
2388              que = [];
2389          }
2390
2391          if (que.length) {
2392              requestFrame(step, elem, (1000 / options.frameRate + 1));
2393          } else {
2394              pending = false;
2395          }
2396      };
2397
2398      // start a new queue of actions
2399      requestFrame(step, elem, 0);
2400      pending = true;
2401  }
2402
2403
2404  /***********************************************
2405   * EVENTS
2406   ***********************************************/
2407
2408  /**
2409   * Mouse wheel handler.
2410   * @param {Object} event
2411   */
2412  function wheel(event) {
2413
2414      if (!initDone) {
2415          init();
2416      }
2417
2418      var target = event.target;
2419      var overflowing = overflowingAncestor(target);
2420
2421      // use default if there's no overflowing
2422      // element or default action is prevented
2423      // or it's a zooming event with CTRL
2424      if (!overflowing || event.defaultPrevented || event.ctrlKey) {
2425          return true;
2426      }
2427
2428      // leave embedded content alone (flash & pdf)
2429      if (isNodeName(activeElement, 'embed') ||
2430         (isNodeName(target, 'embed') && /\.pdf/i.test(target.src)) ||
2431          isNodeName(activeElement, 'object') ||
2432          target.shadowRoot) {
2433          return true;
2434      }
2435
2436      var deltaX = -event.wheelDeltaX || event.deltaX || 0;
2437      var deltaY = -event.wheelDeltaY || event.deltaY || 0;
2438
2439      if (isMac) {
2440          if (event.wheelDeltaX && isDivisible(event.wheelDeltaX, 120)) {
2441              deltaX = -120 * (event.wheelDeltaX / Math.abs(event.wheelDeltaX));
2442          }
2443          if (event.wheelDeltaY && isDivisible(event.wheelDeltaY, 120)) {
2444              deltaY = -120 * (event.wheelDeltaY / Math.abs(event.wheelDeltaY));
2445          }
2446      }
2447
2448      // use wheelDelta if deltaX/Y is not available
2449      if (!deltaX && !deltaY) {
2450          deltaY = -event.wheelDelta || 0;
2451      }
2452
2453      // line based scrolling (Firefox mostly)
2454      if (event.deltaMode === 1) {
2455          deltaX *= 40;
2456          deltaY *= 40;
2457      }
2458
2459      // check if it's a touchpad scroll that should be ignored
2460      if (!options.touchpadSupport && isTouchpad(deltaY)) {
2461          return true;
2462      }
2463
2464      // scale by step size
2465      // delta is 120 most of the time
2466      // synaptics seems to send 1 sometimes
2467      if (Math.abs(deltaX) > 1.2) {
2468          deltaX *= options.stepSize / 120;
2469      }
2470      if (Math.abs(deltaY) > 1.2) {
2471          deltaY *= options.stepSize / 120;
2472      }
2473
2474      scrollArray(overflowing, deltaX, deltaY);
2475
2476      if (Math.abs(deltaX) > 10 && !UNCODE.navigating) {
2477        if (deltaX > 0) {
2478          UNCODE.navigating = true;
2479          window.history.forward();
2480        } else {
2481          UNCODE.navigating = true;
2482          window.history.back();
2483        }
2484      } else event.preventDefault();
2485      scheduleClearCache();
2486  }
2487
2488  /**
2489   * Keydown event handler.
2490   * @param {Object} event
2491   */
2492  function keydown(event) {
2493
2494      var target   = event.target;
2495      var modifier = event.ctrlKey || event.altKey || event.metaKey ||
2496                    (event.shiftKey && event.keyCode !== key.spacebar);
2497
2498      // our own tracked active element could've been removed from the DOM
2499      if (!document.body.contains(activeElement)) {
2500          activeElement = document.activeElement;
2501      }
2502
2503      // do nothing if user is editing text
2504      // or using a modifier key (except shift)
2505      // or in a dropdown
2506      // or inside interactive elements
2507      var inputNodeNames = /^(textarea|select|embed|object)$/i;
2508      var buttonTypes = /^(button|submit|radio|checkbox|file|color|image)$/i;
2509      if ( event.defaultPrevented ||
2510           inputNodeNames.test(target.nodeName) ||
2511           isNodeName(target, 'input') && !buttonTypes.test(target.type) ||
2512           isNodeName(activeElement, 'video') ||
2513           isInsideYoutubeVideo(event) ||
2514           target.isContentEditable ||
2515           modifier ) {
2516        return true;
2517      }
2518
2519      // [spacebar] should trigger button press, leave it alone
2520      if ((isNodeName(target, 'button') ||
2521           isNodeName(target, 'input') && buttonTypes.test(target.type)) &&
2522          event.keyCode === key.spacebar) {
2523        return true;
2524      }
2525
2526      // [arrwow keys] on radio buttons should be left alone
2527      if (isNodeName(target, 'input') && target.type == 'radio' &&
2528          arrowKeys[event.keyCode])  {
2529        return true;
2530      }
2531
2532      var shift, x = 0, y = 0;
2533      var elem = overflowingAncestor(activeElement);
2534      var clientHeight = elem.clientHeight;
2535
2536      if (elem == document.body) {
2537          clientHeight = window.innerHeight;
2538      }
2539
2540      switch (event.keyCode) {
2541          case key.up:
2542              y = -options.arrowScroll;
2543              break;
2544          case key.down:
2545              y = options.arrowScroll;
2546              break;
2547          case key.spacebar: // (+ shift)
2548              shift = event.shiftKey ? 1 : -1;
2549              y = -shift * clientHeight * 0.9;
2550              break;
2551          case key.pageup:
2552              y = -clientHeight * 0.9;
2553              break;
2554          case key.pagedown:
2555              y = clientHeight * 0.9;
2556              break;
2557          case key.home:
2558              y = -elem.scrollTop;
2559              break;
2560          case key.end:
2561              var damt = elem.scrollHeight - elem.scrollTop - clientHeight;
2562              y = (damt > 0) ? damt+10 : 0;
2563              break;
2564          case key.left:
2565              x = -options.arrowScroll;
2566              break;
2567          case key.right:
2568              x = options.arrowScroll;
2569              break;
2570          default:
2571              return true; // a key we don't care about
2572      }
2573
2574      scrollArray(elem, x, y);
2575      event.preventDefault();
2576      scheduleClearCache();
2577  }
2578
2579  /**
2580   * Mousedown event only for updating activeElement
2581   */
2582  function mousedown(event) {
2583      activeElement = event.target;
2584  }
2585
2586
2587  /***********************************************
2588   * OVERFLOW
2589   ***********************************************/
2590
2591  var uniqueID = (function () {
2592      var i = 0;
2593      return function (el) {
2594          return el.uniqueID || (el.uniqueID = i++);
2595      };
2596  })();
2597
2598  var cache = {}; // cleared out after a scrolling session
2599  var clearCacheTimer;
2600
2601  //setInterval(function () { cache = {}; }, 10 * 1000);
2602
2603  function scheduleClearCache() {
2604      clearTimeout(clearCacheTimer);
2605      clearCacheTimer = setInterval(function () { cache = {}; }, 1*1000);
2606  }
2607
2608  function setCache(elems, overflowing) {
2609      for (var i = elems.length; i--;)
2610          cache[uniqueID(elems[i])] = overflowing;
2611      return overflowing;
2612  }
2613
2614  //  (body)                (root)
2615  //         | hidden | visible | scroll |  auto  |
2616  // hidden  |   no   |    no   |   YES  |   YES  |
2617  // visible |   no   |   YES   |   YES  |   YES  |
2618  // scroll  |   no   |   YES   |   YES  |   YES  |
2619  // auto    |   no   |   YES   |   YES  |   YES  |
2620
2621  function overflowingAncestor(el) {
2622      var elems = [];
2623      var body = document.body;
2624      var rootScrollHeight = root.scrollHeight;
2625      do {
2626          var cached = cache[uniqueID(el)];
2627          if (cached) {
2628              return setCache(elems, cached);
2629          }
2630          elems.push(el);
2631          if (rootScrollHeight === el.scrollHeight) {
2632              var topOverflowsNotHidden = overflowNotHidden(root) && overflowNotHidden(body);
2633              var isOverflowCSS = topOverflowsNotHidden || overflowAutoOrScroll(root);
2634              if (isFrame && isContentOverflowing(root) ||
2635                 !isFrame && isOverflowCSS) {
2636                  return setCache(elems, getScrollRoot());
2637              }
2638          } else if (isContentOverflowing(el) && overflowAutoOrScroll(el)) {
2639              return setCache(elems, el);
2640          }
2641      } while (el = el.parentElement);
2642  }
2643
2644  function isContentOverflowing(el) {
2645      return (el.clientHeight + 10 < el.scrollHeight);
2646  }
2647
2648  // typically for <body> and <html>
2649  function overflowNotHidden(el) {
2650      var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y');
2651      return (overflow !== 'hidden');
2652  }
2653
2654  // for all other elements
2655  function overflowAutoOrScroll(el) {
2656      var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y');
2657      return (overflow === 'scroll' || overflow === 'auto');
2658  }
2659
2660
2661  /***********************************************
2662   * HELPERS
2663   ***********************************************/
2664
2665  function addEvent(type, fn) {
2666      window.addEventListener(type, fn, false);
2667  }
2668
2669  function removeEvent(type, fn) {
2670      window.removeEventListener(type, fn, false);
2671  }
2672
2673  function isNodeName(el, tag) {
2674      return (el.nodeName||'').toLowerCase() === tag.toLowerCase();
2675  }
2676
2677  function directionCheck(x, y) {
2678      x = (x > 0) ? 1 : -1;
2679      y = (y > 0) ? 1 : -1;
2680      if (direction.x !== x || direction.y !== y) {
2681          direction.x = x;
2682          direction.y = y;
2683          que = [];
2684          lastScroll = 0;
2685      }
2686  }
2687
2688  var deltaBufferTimer;
2689
2690  if (window.localStorage && localStorage.SS_deltaBuffer) {
2691      deltaBuffer = localStorage.SS_deltaBuffer.split(',');
2692  }
2693
2694  function isTouchpad(deltaY) {
2695      if (!deltaY) return;
2696      if (!deltaBuffer.length) {
2697          deltaBuffer = [deltaY, deltaY, deltaY];
2698      }
2699      deltaY = Math.abs(deltaY);
2700      deltaBuffer.push(deltaY);
2701      deltaBuffer.shift();
2702      clearTimeout(deltaBufferTimer);
2703      deltaBufferTimer = setTimeout(function () {
2704          if (window.localStorage) {
2705              localStorage.SS_deltaBuffer = deltaBuffer.join(',');
2706          }
2707      }, 1000);
2708      return !allDeltasDivisableBy(120) && !allDeltasDivisableBy(100);
2709  }
2710
2711  function isDivisible(n, divisor) {
2712      return (Math.floor(n / divisor) == n / divisor);
2713  }
2714
2715  function allDeltasDivisableBy(divisor) {
2716      return (isDivisible(deltaBuffer[0], divisor) &&
2717              isDivisible(deltaBuffer[1], divisor) &&
2718              isDivisible(deltaBuffer[2], divisor));
2719  }
2720
2721  function isInsideYoutubeVideo(event) {
2722      var elem = event.target;
2723      var isControl = false;
2724      if (document.URL.indexOf ('www.youtube.com/watch') != -1) {
2725          do {
2726              isControl = (elem.classList &&
2727                           elem.classList.contains('html5-video-controls'));
2728              if (isControl) break;
2729          } while (elem = elem.parentNode);
2730      }
2731      return isControl;
2732  }
2733
2734  var requestFrame = (function () {
2735        return (window.requestAnimationFrame       ||
2736                window.webkitRequestAnimationFrame ||
2737                window.mozRequestAnimationFrame    ||
2738                function (callback, element, delay) {
2739                   window.setTimeout(callback, delay || (1000/60));
2740               });
2741  })();
2742
2743  var MutationObserver = (window.MutationObserver ||
2744                          window.WebKitMutationObserver ||
2745                          window.MozMutationObserver);
2746
2747  var getScrollRoot = (function() {
2748    var SCROLL_ROOT;
2749    return function() {
2750      if (!SCROLL_ROOT) {
2751        var dummy = document.createElement('div');
2752        dummy.style.cssText = 'height:10000px;width:1px;';
2753        document.body.appendChild(dummy);
2754        var bodyScrollTop  = document.body.scrollTop;
2755        var docElScrollTop = document.documentElement.scrollTop;
2756        window.scrollBy(0, 3);
2757        if (document.body.scrollTop != bodyScrollTop)
2758          (SCROLL_ROOT = document.body);
2759        else
2760          (SCROLL_ROOT = document.documentElement);
2761        window.scrollBy(0, -3);
2762        document.body.removeChild(dummy);
2763      }
2764      return SCROLL_ROOT;
2765    };
2766  })();
2767
2768
2769  /***********************************************
2770   * PULSE (by Michael Herf)
2771   ***********************************************/
2772
2773  /**
2774   * Viscous fluid with a pulse for part and decay for the rest.
2775   * - Applies a fixed force over an interval (a damped acceleration), and
2776   * - Lets the exponential bleed away the velocity over a longer interval
2777   * - Michael Herf, http://stereopsis.com/stopping/
2778   */
2779  function pulse_(x) {
2780      var val, start, expx;
2781      // test
2782      x = x * options.pulseScale;
2783      if (x < 1) { // acceleartion
2784          val = x - (1 - Math.exp(-x));
2785      } else {     // tail
2786          // the previous animation ended here:
2787          start = Math.exp(-1);
2788          // simple viscous drag
2789          x -= 1;
2790          expx = 1 - Math.exp(-x);
2791          val = start + (expx * (1 - start));
2792      }
2793      return val * options.pulseNormalize;
2794  }
2795
2796  function pulse(x) {
2797      if (x >= 1) return 1;
2798      if (x <= 0) return 0;
2799
2800      if (options.pulseNormalize == 1) {
2801          options.pulseNormalize /= pulse_(1);
2802      }
2803      return pulse_(x);
2804  }
2805
2806
2807  /***********************************************
2808   * FIRST RUN
2809   ***********************************************/
2810
2811  var userAgent = window.navigator.userAgent;
2812  var isEdge    = /Edge/.test(userAgent); // thank you MS
2813  var isChrome  = /chrome/i.test(userAgent) && !isEdge;
2814  var isSafari  = /safari/i.test(userAgent) && !isEdge;
2815  var isMobile  = /mobile/i.test(userAgent);
2816  var isIEWin7  = /Windows NT 6.1/i.test(userAgent) && /rv:11/i.test(userAgent);
2817  var isEnabledForBrowser = (isChrome || isSafari || isIEWin7) && !isMobile;
2818
2819  var wheelEvent;
2820  if ('onwheel' in document.createElement('div'))
2821      wheelEvent = 'wheel';
2822  else if ('onmousewheel' in document.createElement('div'))
2823      wheelEvent = 'mousewheel';
2824
2825  if (wheelEvent && isEnabledForBrowser) {
2826      addEvent(wheelEvent, wheel);
2827      addEvent('mousedown', mousedown);
2828      addEvent('load', init);
2829  }
2830
2831
2832  /***********************************************
2833   * PUBLIC INTERFACE
2834   ***********************************************/
2835
2836  function SmoothScroll(optionsToSet) {
2837      for (var key in optionsToSet)
2838          if (defaultOptions.hasOwnProperty(key))
2839              options[key] = optionsToSet[key];
2840  }
2841  SmoothScroll.destroy = cleanup;
2842
2843  if (window.SmoothScrollOptions) // async API
2844      SmoothScroll(window.SmoothScrollOptions);
2845
2846  if (typeof define === 'function' && define.amd)
2847      define(function() {
2848          return SmoothScroll;
2849      });
2850  else if ('object' == typeof exports)
2851      module.exports = SmoothScroll;
2852  else
2853      window.SmoothScroll = SmoothScroll;
2854
2855  })();
2856};
2857
2858UNCODE.twentytwenty = function() {
2859
2860  if (!$('.twentytwenty-container').length) return;
2861
2862  // jquery.event.move
2863  //
2864  // 1.3.6
2865  //
2866  // Stephen Band
2867  //
2868  // Triggers 'movestart', 'move' and 'moveend' events after
2869  // mousemoves following a mousedown cross a distance threshold,
2870  // similar to the native 'dragstart', 'drag' and 'dragend' events.
2871  // Move events are throttled to animation frames. Move event objects
2872  // have the properties:
2873  //
2874  // pageX:
2875  // pageY:   Page coordinates of pointer.
2876  // startX:
2877  // startY:  Page coordinates of pointer at movestart.
2878  // distX:
2879  // distY:  Distance the pointer has moved since movestart.
2880  // deltaX:
2881  // deltaY:  Distance the finger has moved since last event.
2882  // velocityX:
2883  // velocityY:  Average velocity over last few events.
2884
2885
2886  (function (module) {
2887    if (typeof define === 'function' && define.amd) {
2888      // AMD. Register as an anonymous module.
2889      define(['jquery'], module);
2890    } else {
2891      // Browser globals
2892      module(jQuery);
2893    }
2894  })(function(jQuery, undefined){
2895
2896    var // Number of pixels a pressed pointer travels before movestart
2897        // event is fired.
2898        threshold = 6,
2899
2900        add = jQuery.event.add,
2901
2902        remove = jQuery.event.remove,
2903
2904        // Just sugar, so we can have arguments in the same order as
2905        // add and remove.
2906        trigger = function(node, type, data) {
2907          jQuery.event.trigger(type, data, node);
2908        },
2909
2910        // Shim for requestAnimationFrame, falling back to timer. See:
2911        // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
2912        requestFrame = (function(){
2913          return (
2914            window.requestAnimationFrame ||
2915            window.webkitRequestAnimationFrame ||
2916            window.mozRequestAnimationFrame ||
2917            window.oRequestAnimationFrame ||
2918            window.msRequestAnimationFrame ||
2919            function(fn, element){
2920              return window.setTimeout(function(){
2921                fn();
2922              }, 25);
2923            }
2924          );
2925        })(),
2926
2927        ignoreTags = {
2928          textarea: true,
2929          input: true,
2930          select: true,
2931          button: true
2932        },
2933
2934        mouseevents = {
2935          move: 'mousemove',
2936          cancel: 'mouseup dragstart',
2937          end: 'mouseup'
2938        },
2939
2940        touchevents = {
2941          move: 'touchmove',
2942          cancel: 'touchend',
2943          end: 'touchend'
2944        };
2945
2946
2947    // Constructors
2948
2949    function Timer(fn){
2950      var callback = fn,
2951          active = false,
2952          running = false;
2953
2954      function trigger(time) {
2955        if (active){
2956          callback();
2957          requestFrame(trigger);
2958          running = true;
2959          active = false;
2960        }
2961        else {
2962          running = false;
2963        }
2964      }
2965
2966      this.kick = function(fn) {
2967        active = true;
2968        if (!running) { trigger(); }
2969      };
2970
2971      this.end = function(fn) {
2972        var cb = callback;
2973
2974        if (!fn) { return; }
2975
2976        // If the timer is not running, simply call the end callback.
2977        if (!running) {
2978          fn();
2979        }
2980        // If the timer is running, and has been kicked lately, then
2981        // queue up the current callback and the end callback, otherwise
2982        // just the end callback.
2983        else {
2984          callback = active ?
2985            function(){ cb(); fn(); } :
2986            fn ;
2987
2988          active = true;
2989        }
2990      };
2991    }
2992
2993
2994    // Functions
2995
2996    function returnTrue() {
2997      return true;
2998    }
2999
3000    function returnFalse() {
3001      return false;
3002    }
3003
3004    function preventDefault(e) {
3005      e.preventDefault();
3006    }
3007
3008    function preventIgnoreTags(e) {
3009      // Don't prevent interaction with form elements.
3010      if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
3011
3012      e.preventDefault();
3013    }
3014
3015    function isLeftButton(e) {
3016      // Ignore mousedowns on any button other than the left (or primary)
3017      // mouse button, or when a modifier key is pressed.
3018      return (e.which === 1 && !e.ctrlKey && !e.altKey);
3019    }
3020
3021    function identifiedTouch(touchList, id) {
3022      var i, l;
3023
3024      if (touchList.identifiedTouch) {
3025        return touchList.identifiedTouch(id);
3026      }
3027
3028      // touchList.identifiedTouch() does not exist in
3029      // webkit yet… we must do the search ourselves...
3030
3031      i = -1;
3032      l = touchList.length;
3033
3034      while (++i < l) {
3035        if (touchList[i].identifier === id) {
3036          return touchList[i];
3037        }
3038      }
3039    }
3040
3041    function changedTouch(e, event) {
3042      var touch = identifiedTouch(e.changedTouches, event.identifier);
3043
3044      // This isn't the touch you're looking for.
3045      if (!touch) { return; }
3046
3047      // Chrome Android (at least) includes touches that have not
3048      // changed in e.changedTouches. That's a bit annoying. Check
3049      // that this touch has changed.
3050      if (touch.pageX === event.pageX && touch.pageY === event.pageY) { return; }
3051
3052      return touch;
3053    }
3054
3055
3056    // Handlers that decide when the first movestart is triggered
3057
3058    function mousedown(e){
3059      var data;
3060
3061      if (!isLeftButton(e)) { return; }
3062
3063      data = {
3064        target: e.target,
3065        startX: e.pageX,
3066        startY: e.pageY,
3067        timeStamp: e.timeStamp
3068      };
3069
3070      add(document, mouseevents.move, mousemove, data);
3071      add(document, mouseevents.cancel, mouseend, data);
3072    }
3073
3074    function mousemove(e){
3075      var data = e.data;
3076
3077      checkThreshold(e, data, e, removeMouse);
3078    }
3079
3080    function mouseend(e) {
3081      removeMouse();
3082    }
3083
3084    function removeMouse() {
3085      remove(document, mouseevents.move, mousemove);
3086      remove(document, mouseevents.cancel, mouseend);
3087    }
3088
3089    function touchstart(e) {
3090      var touch, template;
3091
3092      // Don't get in the way of interaction with form elements.
3093      if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
3094
3095      touch = e.changedTouches[0];
3096
3097      // iOS live updates the touch objects whereas Android gives us copies.
3098      // That means we can't trust the touchstart object to stay the same,
3099      // so we must copy the data. This object acts as a template for
3100      // movestart, move and moveend event objects.
3101      template = {
3102        target: touch.target,
3103        startX: touch.pageX,
3104        startY: touch.pageY,
3105        timeStamp: e.timeStamp,
3106        identifier: touch.identifier
3107      };
3108
3109      // Use the touch identifier as a namespace, so that we can later
3110      // remove handlers pertaining only to this touch.
3111      add(document, touchevents.move + '.' + touch.identifier, touchmove, template);
3112      add(document, touchevents.cancel + '.' + touch.identifier, touchend, template);
3113    }
3114
3115    function touchmove(e){
3116      var data = e.data,
3117          touch = changedTouch(e, data);
3118
3119      if (!touch) { return; }
3120
3121      checkThreshold(e, data, touch, removeTouch);
3122    }
3123
3124    function touchend(e) {
3125      var template = e.data,
3126          touch = identifiedTouch(e.changedTouches, template.identifier);
3127
3128      if (!touch) { return; }
3129
3130      removeTouch(template.identifier);
3131    }
3132
3133    function removeTouch(identifier) {
3134      remove(document, '.' + identifier, touchmove);
3135      remove(document, '.' + identifier, touchend);
3136    }
3137
3138
3139    // Logic for deciding when to trigger a movestart.
3140
3141    function checkThreshold(e, template, touch, fn) {
3142      var distX = touch.pageX - template.startX,
3143          distY = touch.pageY - template.startY;
3144
3145      // Do nothing if the threshold has not been crossed.
3146      if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
3147
3148      triggerStart(e, template, touch, distX, distY, fn);
3149    }
3150
3151    function handled() {
3152      // this._handled should return false once, and after return true.
3153      this._handled = returnTrue;
3154      return false;
3155    }
3156
3157    function flagAsHandled(e) {
3158      e._handled();
3159    }
3160
3161    function triggerStart(e, template, touch, distX, distY, fn) {
3162      var node = template.target,
3163          touches, time;
3164
3165      touches = e.targetTouches;
3166      time = e.timeStamp - template.timeStamp;
3167
3168      // Create a movestart object with some special properties that
3169      // are passed only to the movestart handlers.
3170      template.type = 'movestart';
3171      template.distX = distX;
3172      template.distY = distY;
3173      template.deltaX = distX;
3174      template.deltaY = distY;
3175      template.pageX = touch.pageX;
3176      template.pageY = touch.pageY;
3177      template.velocityX = distX / time;
3178      template.velocityY = distY / time;
3179      template.targetTouches = touches;
3180      template.finger = touches ?
3181        touches.length :
3182        1 ;
3183
3184      // The _handled method is fired to tell the default movestart
3185      // handler that one of the move events is bound.
3186      template._handled = handled;
3187
3188      // Pass the touchmove event so it can be prevented if or when
3189      // movestart is handled.
3190      template._preventTouchmoveDefault = function() {
3191        e.preventDefault();
3192      };
3193
3194      // Trigger the movestart event.
3195      trigger(template.target, template);
3196
3197      // Unbind handlers that tracked the touch or mouse up till now.
3198      fn(template.identifier);
3199    }
3200
3201
3202    // Handlers that control what happens following a movestart
3203
3204    function activeMousemove(e) {
3205      var timer = e.data.timer;
3206
3207      e.data.touch = e;
3208      e.data.timeStamp = e.timeStamp;
3209      timer.kick();
3210    }
3211
3212    function activeMouseend(e) {
3213      var event = e.data.event,
3214          timer = e.data.timer;
3215
3216      removeActiveMouse();
3217
3218      endEvent(event, timer, function() {
3219        // Unbind the click suppressor, waiting until after mouseup
3220        // has been handled.
3221        setTimeout(function(){
3222          remove(event.target, 'click', returnFalse);
3223        }, 0);
3224      });
3225    }
3226
3227    function removeActiveMouse(event) {
3228      remove(document, mouseevents.move, activeMousemove);
3229      remove(document, mouseevents.end, activeMouseend);
3230    }
3231
3232    function activeTouchmove(e) {
3233      var event = e.data.event,
3234          timer = e.data.timer,
3235          touch = changedTouch(e, event);
3236
3237      if (!touch) { return; }
3238
3239      // Stop the interface from gesturing
3240      e.preventDefault();
3241
3242      event.targetTouches = e.targetTouches;
3243      e.data.touch = touch;
3244      e.data.timeStamp = e.timeStamp;
3245      timer.kick();
3246    }
3247
3248    function activeTouchend(e) {
3249      var event = e.data.event,
3250          timer = e.data.timer,
3251          touch = identifiedTouch(e.changedTouches, event.identifier);
3252
3253      // This isn't the touch you're looking for.
3254      if (!touch) { return; }
3255
3256      removeActiveTouch(event);
3257      endEvent(event, timer);
3258    }
3259
3260    function removeActiveTouch(event) {
3261      remove(document, '.' + event.identifier, activeTouchmove);
3262      remove(document, '.' + event.identifier, activeTouchend);
3263    }
3264
3265
3266    // Logic for triggering move and moveend events
3267
3268    function updateEvent(event, touch, timeStamp, timer) {
3269      var time = timeStamp - event.timeStamp;
3270
3271      event.type = 'move';
3272      event.distX =  touch.pageX - event.startX;
3273      event.distY =  touch.pageY - event.startY;
3274      event.deltaX = touch.pageX - event.pageX;
3275      event.deltaY = touch.pageY - event.pageY;
3276
3277      // Average the velocity of the last few events using a decay
3278      // curve to even out spurious jumps in values.
3279      event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
3280      event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
3281      event.pageX =  touch.pageX;
3282      event.pageY =  touch.pageY;
3283    }
3284
3285    function endEvent(event, timer, fn) {
3286      timer.end(function(){
3287        event.type = 'moveend';
3288
3289        trigger(event.target, event);
3290
3291        return fn && fn();
3292      });
3293    }
3294
3295
3296    // jQuery special event definition
3297
3298    function setup(data, namespaces, eventHandle) {
3299      // Stop the node from being dragged
3300      //add(this, 'dragstart.move drag.move', preventDefault);
3301
3302      // Prevent text selection and touch interface scrolling
3303      //add(this, 'mousedown.move', preventIgnoreTags);
3304
3305      // Tell movestart default handler that we've handled this
3306      add(this, 'movestart.move', flagAsHandled);
3307
3308      // Don't bind to the DOM. For speed.
3309      return true;
3310    }
3311
3312    function teardown(namespaces) {
3313      remove(this, 'dragstart drag', preventDefault);
3314      remove(this, 'mousedown touchstart', preventIgnoreTags);
3315      remove(this, 'movestart', flagAsHandled);
3316
3317      // Don't bind to the DOM. For speed.
3318      return true;
3319    }
3320
3321    function addMethod(handleObj) {
3322      // We're not interested in preventing defaults for handlers that
3323      // come from internal move or moveend bindings
3324      if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
3325        return;
3326      }
3327
3328      // Stop the node from being dragged
3329      add(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid, preventDefault, undefined, handleObj.selector);
3330
3331      // Prevent text selection and touch interface scrolling
3332      add(this, 'mousedown.' + handleObj.guid, preventIgnoreTags, undefined, handleObj.selector);
3333    }
3334
3335    function removeMethod(handleObj) {
3336      if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
3337        return;
3338      }
3339
3340      remove(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid);
3341      remove(this, 'mousedown.' + handleObj.guid);
3342    }
3343
3344    jQuery.event.special.movestart = {
3345      setup: setup,
3346      teardown: teardown,
3347      add: addMethod,
3348      remove: removeMethod,
3349
3350      _default: function(e) {
3351        var event, data;
3352
3353        // If no move events were bound to any ancestors of this
3354        // target, high tail it out of here.
3355        if (!e._handled()) { return; }
3356
3357        function update(time) {
3358          updateEvent(event, data.touch, data.timeStamp);
3359          trigger(e.target, event);
3360        }
3361
3362        event = {
3363          target: e.target,
3364          startX: e.startX,
3365          startY: e.startY,
3366          pageX: e.pageX,
3367          pageY: e.pageY,
3368          distX: e.distX,
3369          distY: e.distY,
3370          deltaX: e.deltaX,
3371          deltaY: e.deltaY,
3372          velocityX: e.velocityX,
3373          velocityY: e.velocityY,
3374          timeStamp: e.timeStamp,
3375          identifier: e.identifier,
3376          targetTouches: e.targetTouches,
3377          finger: e.finger
3378        };
3379
3380        data = {
3381          event: event,
3382          timer: new Timer(update),
3383          touch: undefined,
3384          timeStamp: undefined
3385        };
3386
3387        if (e.identifier === undefined) {
3388          // We're dealing with a mouse
3389          // Stop clicks from propagating during a move
3390          add(e.target, 'click', returnFalse);
3391          add(document, mouseevents.move, activeMousemove, data);
3392          add(document, mouseevents.end, activeMouseend, data);
3393        }
3394        else {
3395          // We're dealing with a touch. Stop touchmove doing
3396          // anything defaulty.
3397          e._preventTouchmoveDefault();
3398          add(document, touchevents.move + '.' + e.identifier, activeTouchmove, data);
3399          add(document, touchevents.end + '.' + e.identifier, activeTouchend, data);
3400        }
3401      }
3402    };
3403
3404    jQuery.event.special.move = {
3405      setup: function() {
3406        // Bind a noop to movestart. Why? It's the movestart
3407        // setup that decides whether other move events are fired.
3408        add(this, 'movestart.move', jQuery.noop);
3409      },
3410
3411      teardown: function() {
3412        remove(this, 'movestart.move', jQuery.noop);
3413      }
3414    };
3415
3416    jQuery.event.special.moveend = {
3417      setup: function() {
3418        // Bind a noop to movestart. Why? It's the movestart
3419        // setup that decides whether other move events are fired.
3420        add(this, 'movestart.moveend', jQuery.noop);
3421      },
3422
3423      teardown: function() {
3424        remove(this, 'movestart.moveend', jQuery.noop);
3425      }
3426    };
3427
3428    add(document, 'mousedown.move', mousedown);
3429    add(document, 'touchstart.move', touchstart);
3430
3431    // Make jQuery copy touch event properties over to the jQuery event
3432    // object, if they are not already listed. But only do the ones we
3433    // really need. IE7/8 do not have Array#indexOf(), but nor do they
3434    // have touch events, so let's assume we can ignore them.
3435    if (typeof Array.prototype.indexOf === 'function') {
3436      (function(jQuery, undefined){
3437        var props = ["changedTouches", "targetTouches"],
3438            l = props.length;
3439
3440        while (l--) {
3441          if (jQuery.event.props.indexOf(props[l]) === -1) {
3442            jQuery.event.props.push(props[l]);
3443          }
3444        }
3445      })(jQuery);
3446    };
3447  });
3448
3449  $.fn.twentytwenty = function(options) {
3450    var options = $.extend({default_offset_pct: 0.5, orientation: 'horizontal'}, options);
3451    return this.each(function() {
3452
3453      var sliderPct = options.default_offset_pct;
3454      var container = $(this);
3455      var sliderOrientation = options.orientation;
3456      var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left';
3457      var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right';
3458
3459      container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>");
3460      container.append("<div class='twentytwenty-overlay'></div>");
3461      var beforeImg = container.find("img:first");
3462      var afterImg = container.find("img:last");
3463      container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>");
3464      var slider = container.find(".twentytwenty-handle");
3465      slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>");
3466      slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>");
3467      container.addClass("twentytwenty-container");
3468      beforeImg.addClass("twentytwenty-before");
3469      afterImg.addClass("twentytwenty-after");
3470
3471      var overlay = container.find(".twentytwenty-overlay");
3472      overlay.append("<div class='twentytwenty-before-label'></div>");
3473      overlay.append("<div class='twentytwenty-after-label'></div>");
3474
3475      var calcOffset = function(dimensionPct) {
3476        var w = beforeImg.width();
3477        var h = beforeImg.height();
3478        return {
3479          w: w+"px",
3480          h: h+"px",
3481          cw: (dimensionPct*w)+"px",
3482          ch: (dimensionPct*h)+"px"
3483        };
3484      };
3485
3486      var adjustContainer = function(offset) {
3487      	if (sliderOrientation === 'vertical') {
3488      	  beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)");
3489      	}
3490      	else {
3491          beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)");
3492    	}
3493        container.css("height", offset.h);
3494      };
3495
3496      var adjustSlider = function(pct) {
3497        var offset = calcOffset(pct);
3498        slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw);
3499        adjustContainer(offset);
3500      }
3501
3502      $(window).on("resize.twentytwenty", function(e) {
3503        adjustSlider(sliderPct);
3504      });
3505
3506      var offsetX = 0,
3507      offsetY = 0,
3508      imgWidth = 0,
3509      imgHeight = 0;
3510
3511      slider.on("movestart", function(e) {
3512        if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') {
3513          e.preventDefault();
3514        }
3515        else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') {
3516          e.preventDefault();
3517        }
3518        container.addClass("active");
3519        offsetX = container.offset().left;
3520        offsetY = container.offset().top;
3521        imgWidth = beforeImg.width();
3522        imgHeight = beforeImg.height();
3523      });
3524
3525      slider.on("moveend", function(e) {
3526        container.removeClass("active");
3527      });
3528
3529      slider.on("move", function(e) {
3530        if (container.hasClass("active")) {
3531          sliderPct = (sliderOrientation === 'vertical') ? (e.pageY-offsetY)/imgHeight : (e.pageX-offsetX)/imgWidth;
3532          if (sliderPct < 0) {
3533            sliderPct = 0;
3534          }
3535          if (sliderPct > 1) {
3536            sliderPct = 1;
3537          }
3538          adjustSlider(sliderPct);
3539        }
3540      });
3541
3542      container.find("img").on("mousedown", function(event) {
3543        event.preventDefault();
3544      });
3545
3546      $(window).trigger("resize.twentytwenty");
3547    });
3548  };
3549
3550  $('.twentytwenty-container').twentytwenty();
3551
3552}
3553
3554	UNCODE.init = function() {
3555		UNCODE.utils();
3556		UNCODE.menuSystem();
3557		UNCODE.okvideo();
3558		UNCODE.tapHover();
3559		UNCODE.isotopeLayout();
3560		UNCODE.lightbox();
3561		UNCODE.backVideo();
3562		UNCODE.carousel($('body'));
3563		UNCODE.animations();
3564		UNCODE.stickyElements();
3565		UNCODE.twentytwenty();
3566		UNCODE.disableHoverScroll();
3567		UNCODE.onePage(UNCODE.isMobile);
3568		if ($('body.smooth-scroller').length) {
3569			setTimeout(function(){
3570				UNCODE.scrollEnance();
3571			}, 300);
3572		}
3573	}
3574	UNCODE.init();
3575})(jQuery);
3576

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.