/*global jQuery */ /*jshint browser:true */ /*! * FitVids 1.1 * * Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ * Released under the WTFPL license - http://sam.zoy.org/wtfpl/ * */ ;(function( $ ){ 'use strict'; $.fn.fitVids = function( options ) { var settings = { customSelector: null, ignore: null }; if(!document.getElementById('fit-vids-style')) { // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js var head = document.head || document.getElementsByTagName('head')[0]; var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}'; var div = document.createElement("div"); div.innerHTML = '

x

'; head.appendChild(div.childNodes[1]); } if ( options ) { $.extend( settings, options ); } return this.each(function(){ var selectors = [ 'iframe[src*="player.vimeo.com"]', 'iframe[src*="youtube.com"]', 'iframe[src*="youtube-nocookie.com"]', 'iframe[src*="kickstarter.com"][src*="video.html"]', 'object', 'embed' ]; if (settings.customSelector) { selectors.push(settings.customSelector); } var ignoreList = '.fitvidsignore'; if(settings.ignore) { ignoreList = ignoreList + ', ' + settings.ignore; } var $allVideos = $(this).find(selectors.join(',')); $allVideos = $allVideos.not('object object'); // SwfObj conflict patch $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. $allVideos.each(function(count){ var $this = $(this); if($this.parents(ignoreList).length > 0) { return; // Disable FitVids on this video. } if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) { $this.attr('height', 9); $this.attr('width', 16); } var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), aspectRatio = height / width; if(!$this.attr('id')){ var videoID = 'fitvid' + count; $this.attr('id', videoID); } $this.wrap('
').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%'); $this.removeAttr('height').removeAttr('width'); }); }); }; })( window.jQuery || window.Zepto ); // Menu (function ($) { "use strict"; $.bombnav = function (selector, options) { var settings = $.extend({ indicator: true, speed: 300, delay: 0, hideClickOut: true, submenuTrigger: "hover", responsiveHandle: false, verticalHandle: false, mainIndicator: "", subIndicator: "" }, options); var menu = $(selector); if (settings.indicator === true) { if (settings.verticalHandle === true) { $(menu).children("li").children("a").each(function () { if ($(this).siblings(".sub-menu, .megamenu").length > 0) { $(this).append("" + settings.mainIndicator + ""); } }); } $(menu).find(".sub-menu").children("li").children("a").each(function () { if ($(this).siblings(".sub-menu").length > 0) { $(this).append("" + settings.subIndicator + ""); } }); } start(); $(window).resize(function () { if (settings.verticalHandle === false) { if (settings.responsiveHandle === true) { if ($(window).width() < 943) { unbindEvents(); bindClick(); $(menu).addClass("bombver"); } else { unbindEvents(); bindHover(); $(menu).removeClass("bombver"); } } else { unbindEvents(); bindHover(); } } else { unbindEvents(); bindClick(); $(menu).addClass("bombver"); } }); function start() { if (settings.verticalHandle === false) { if (settings.responsiveHandle === true) { if ($(window).width() < 943) { bindClick(); $(menu).addClass("bombver"); } else { bindHover(); $(menu).removeClass("bombver"); } } else { bindHover(); } } else { bindClick(); $(menu).addClass("bombver"); } } function unbindEvents() { $(menu).find("li, a").unbind(); $(document).unbind("click.menu touchstart.menu"); $(menu).find(".sub-menu, .megamenu").hide(0); } function bindHover() { if (navigator.userAgent.match(/Mobi/i) || window.navigator.msMaxTouchPoints > 0 || settings.submenuTrigger === "click") { $(menu).find("a").on("click touchstart", function (e) { e.stopPropagation(); e.preventDefault(); $(this).parent("li").siblings("li").find(".sub-menu, .megamenu").stop(true, true).fadeOut(settings.speed); if ($(this).siblings(".sub-menu, .megamenu").css("display") === "none") { $(this).siblings(".sub-menu, .megamenu").stop(true, true).delay(settings.delay).slideDown(settings.speed); return false; } else { $(this).siblings(".sub-menu, .megamenu").stop(true, true).fadeOut(settings.speed); $(this).siblings(".sub-menu").find(".sub-menu").stop(true, true).fadeOut(settings.speed); } window.location.href = $(this).attr("href"); }); $(menu).find("li").bind("mouseleave", function () { $(this).children(".sub-menu, .megamenu").stop(true, true).fadeOut(settings.speed); }); if (settings.hideClickOut === true) { $(document).bind("click.menu touchstart.menu", function (ev) { if ($(ev.target).closest(menu).length === 0) { $(menu).find(".sub-menu, .megamenu").fadeOut(settings.speed); } }); } } else { $(menu).find("li").bind("mouseenter", function () { $(this).children(".sub-menu, .megamenu").stop(true, true).delay(settings.delay).slideDown(settings.speed); }).bind("mouseleave", function () { $(this).children(".sub-menu, .megamenu").stop(true, true).fadeOut(settings.speed); }); } } function bindClick() { $(menu).find(".indicator").each(function () { if ($(this).parent("a").siblings(".sub-menu, .megamenu").length > 0) { $(this).bind("click", function (e) { if ($(this).parent().prop("tagName") === "A") { e.preventDefault(); } if ($(this).parent("a").siblings(".sub-menu, .megamenu").css("display") === "none") { $(this).parent("a").siblings(".sub-menu, .megamenu").delay(settings.delay).slideDown(settings.speed); $(this).parent("a").parent("li").siblings("li").find(".sub-menu, .megamenu").slideUp(settings.speed); } else { $(this).parent("a").siblings(".sub-menu, .megamenu").slideUp(settings.speed); } }); } }); } }; })(jQuery); // ----------------------------------- // Slidebars // Version 0.10.2 // http://plugins.adchsm.me/slidebars/ // // Written by Adam Smith // http://www.adchsm.me/ // // Released under MIT License // http://plugins.adchsm.me/slidebars/license.txt // // --------------------- (function ($) { "use strict"; $.slidebars = function (options) { // ---------------------- // 001 - Default Settings var settings = $.extend({ siteClose: true, // true or false - Enable closing of Slidebars by clicking on #sb-site. scrollLock: false, // true or false - Prevent scrolling of site when a Slidebar is open. disableOver: false, // integer or false - Hide Slidebars over a specific width. hideControlClasses: false // true or false - Hide controls at same width as disableOver. }, options); // ----------------------- // 002 - Feature Detection var test = document.createElement('div').style, // Create element to test on. supportTransition = false, // Variable for testing transitions. supportTransform = false; // variable for testing transforms. // Test for CSS Transitions if (test.MozTransition === '' || test.WebkitTransition === '' || test.OTransition === '' || test.transition === '') supportTransition = true; // Test for CSS Transforms if (test.MozTransform === '' || test.WebkitTransform === '' || test.OTransform === '' || test.transform === '') supportTransform = true; // ----------------- // 003 - User Agents var ua = navigator.userAgent, // Get user agent string. android = false, // Variable for storing android version. iOS = false; // Variable for storing iOS version. if (/Android/.test(ua)) { // Detect Android in user agent string. android = ua.substr(ua.indexOf('Android') + 8, 3); // Set version of Android. } else if (/(iPhone|iPod|iPad)/.test(ua)) { // Detect iOS in user agent string. iOS = ua.substr(ua.indexOf('OS ') + 3, 3).replace('_', '.'); // Set version of iOS. } if (android && android < 3 || iOS && iOS < 5) $('html').addClass('sb-static'); // Add helper class for older versions of Android & iOS. // ----------- // 004 - Setup // Site container var $site = $('#sb-site, .sb-site-container'); // Cache the selector. // Left Slidebar if ($('.sb-left').length) { // Check if the left Slidebar exists. var $left = $('.sb-left'), // Cache the selector. leftActive = false; // Used to check whether the left Slidebar is open or closed. } // Right Slidebar if ($('.sb-right').length) { // Check if the right Slidebar exists. var $right = $('.sb-right'), // Cache the selector. rightActive = false; // Used to check whether the right Slidebar is open or closed. } var init = false, // Initialisation variable. windowWidth = $(window).width(), // Get width of window. $controls = $('.sb-toggle-left, .sb-toggle-right, .sb-open-left, .sb-open-right, .sb-close'), // Cache the control classes. $slide = $('.sb-slide'); // Cache users elements to animate. // Initailise Slidebars function initialise() { if (!settings.disableOver || (typeof settings.disableOver === 'number' && settings.disableOver >= windowWidth)) { // False or larger than window size. init = true; // true enabled Slidebars to open. $('html').addClass('sb-init'); // Add helper class. if (settings.hideControlClasses) $controls.removeClass('sb-hide'); // Remove class just incase Slidebars was originally disabled. css(); // Set required inline styles. if (leftActive || rightActive) close(); // Close Slidebars if open. } else if (typeof settings.disableOver === 'number' && settings.disableOver < windowWidth) { // Less than window size. init = false; // false stop Slidebars from opening. $('html').removeClass('sb-init'); // Remove helper class. if (settings.hideControlClasses) $controls.addClass('sb-hide'); // Hide controls $site.css('minHeight', ''); // Remove minimum height. if (leftActive || rightActive) close(); // Close Slidebars if open. } } initialise(); // Inline CSS function css() { // Set minimum height. $site.css('minHeight', ''); // Reset minimum height. //$site.css('minHeight', $('html').height() + 'px'); // Set minimum height of the site to the minimum height of the html. // Custom Slidebar widths. if ($left && $left.hasClass('sb-width-custom')) $left.css('width', $left.attr('data-sb-width')); // Set user custom width. if ($right && $right.hasClass('sb-width-custom')) $right.css('width', $right.attr('data-sb-width')); // Set user custom width. // Set off-canvas margins for Slidebars with push and overlay animations. if ($left && ($left.hasClass('sb-style-push') || $left.hasClass('sb-style-overlay'))) $left.css('marginLeft', '-' + $left.css('width')); if ($right && ($right.hasClass('sb-style-push') || $right.hasClass('sb-style-overlay'))) $right.css('marginRight', '-' + $right.css('width')); // Site scroll locking. if (settings.scrollLock) $('html').addClass('sb-scroll-lock'); } // Resize Functions $(window).resize(function () { var resizedWindowWidth = $(window).width(); // Get resized window width. if (windowWidth !== resizedWindowWidth) { // Slidebars is running and window was actually resized. windowWidth = resizedWindowWidth; // Set the new window width. initialise(); // Call initalise to see if Slidebars should still be running. if (leftActive) open('left'); // If left Slidebar is open, calling open will ensure it is the correct size. if (rightActive) open('right'); // If right Slidebar is open, calling open will ensure it is the correct size. } }); // I may include a height check along side a width check here in future. // --------------- // 005 - Animation var animation; // Animation type. // Set animation type. if (supportTransition && supportTransform) { // Browser supports css transitions and transforms. animation = 'translate'; // Translate for browsers that support it. if (android && android < 4.4) animation = 'side'; // Android supports both, but can't translate any fixed positions, so use left instead. } else { animation = 'jQuery'; // Browsers that don't support css transitions and transitions. } // Animate mixin. function animate(object, amount, side) { // Choose selectors depending on animation style. var selector; if (object.hasClass('sb-style-push')) { selector = $site.add(object).add($slide); // Push - Animate site, Slidebar and user elements. } else if (object.hasClass('sb-style-overlay')) { selector = object; // Overlay - Animate Slidebar only. } else { selector = $site.add($slide); // Reveal - Animate site and user elements. } // Apply animation if (animation === 'translate') { selector.css('transform', 'translate(' + amount + ')'); // Apply the animation. } else if (animation === 'side') { if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for side animations. if (amount !== '0px') selector.css(side, '0px'); // Add a 0 value so css transition works. setTimeout(function () { // Set a timeout to allow the 0 value to be applied above. selector.css(side, amount); // Apply the animation. }, 1); } else if (animation === 'jQuery') { if (amount[0] === '-') amount = amount.substr(1); // Remove the '-' from the passed amount for jQuery animations. var properties = {}; properties[side] = amount; selector.stop().animate(properties, 400); // Stop any current jQuery animation before starting another. } // If closed, remove the inline styling on completion of the animation. setTimeout(function () { if (amount === '0px') { selector.removeAttr('style'); css(); } }, 400); } // ---------------- // 006 - Operations // Open a Slidebar function open(side) { // Check to see if opposite Slidebar is open. if (side === 'left' && $left && rightActive || side === 'right' && $right && leftActive) { // It's open, close it, then continue. close(); setTimeout(proceed, 400); } else { // Its not open, continue. proceed(); } // Open function proceed() { if (init && side === 'left' && $left) { // Slidebars is initiated, left is in use and called to open. $('html').addClass('sb-active sb-active-left'); // Add active classes. $left.addClass('sb-active'); animate($left, $left.css('width'), 'left'); // Animation setTimeout(function () { leftActive = true; }, 400); // Set active variables. } else if (init && side === 'right' && $right) { // Slidebars is initiated, right is in use and called to open. $('html').addClass('sb-active sb-active-right'); // Add active classes. $right.addClass('sb-active'); animate($right, '-' + $right.css('width'), 'right'); // Animation setTimeout(function () { rightActive = true; }, 400); // Set active variables. } } } // Close either Slidebar function close(link) { if (leftActive || rightActive) { // If a Slidebar is open. if (leftActive) { animate($left, '0px', 'left'); // Animation leftActive = false; } if (rightActive) { animate($right, '0px', 'right'); // Animation rightActive = false; } setTimeout(function () { // Wait for closing animation to finish. $('html').removeClass('sb-active sb-active-left sb-active-right'); // Remove active classes. if ($left) $left.removeClass('sb-active'); if ($right) $right.removeClass('sb-active'); if (typeof link !== 'undefined') window.location = link; // If a link has been passed to the function, go to it. }, 400); } } // Toggle either Slidebar function toggle(side) { if (side === 'left' && $left) { // If left Slidebar is called and in use. if (!leftActive) { open('left'); // Slidebar is closed, open it. } else { close(); // Slidebar is open, close it. } } if (side === 'right' && $right) { // If right Slidebar is called and in use. if (!rightActive) { open('right'); // Slidebar is closed, open it. } else { close(); // Slidebar is open, close it. } } } // --------- // 007 - API this.slidebars = { open: open, // Maps user variable name to the open method. close: close, // Maps user variable name to the close method. toggle: toggle, // Maps user variable name to the toggle method. init: function () { // Returns true or false whether Slidebars are running or not. return init; // Returns true or false whether Slidebars are running. }, active: function (side) { // Returns true or false whether Slidebar is open or closed. if (side === 'left' && $left) return leftActive; if (side === 'right' && $right) return rightActive; }, destroy: function (side) { // Removes the Slidebar from the DOM. if (side === 'left' && $left) { if (leftActive) close(); // Close if its open. setTimeout(function () { $left.remove(); // Remove it. $left = false; // Set variable to false so it cannot be opened again. }, 400); } if (side === 'right' && $right) { if (rightActive) close(); // Close if its open. setTimeout(function () { $right.remove(); // Remove it. $right = false; // Set variable to false so it cannot be opened again. }, 400); } } }; // ---------------- // 008 - User Input function eventHandler(event, selector) { event.stopPropagation(); // Stop event bubbling. event.preventDefault(); // Prevent default behaviour. //if (event.type === 'touchend') selector.off('click'); // If event type was touch, turn off clicks to prevent phantom clicks. } // Toggle left Slidebar $('.sb-toggle-left').click(function(event) { eventHandler(event, $(this)); // Handle the event. toggle('left'); // Toggle the left Slidbar. }); // Toggle right Slidebar $('.sb-toggle-right').click(function(event) { eventHandler(event, $(this)); // Handle the event. toggle('right'); // Toggle the right Slidbar. }); // Open left Slidebar $('.sb-open-left').click(function(event) { eventHandler(event, $(this)); // Handle the event. open('left'); // Open the left Slidebar. }); // Open right Slidebar $('.sb-open-right').click(function(event) { eventHandler(event, $(this)); // Handle the event. open('right'); // Open the right Slidebar. }); // Close Slidebar $('.sb-close').on('touchend click', function (event) { if ($(this).is('a') || $(this).children().is('a')) { // Is a link or contains a link. if (event.type === 'click') { // Make sure the user wanted to follow the link. event.preventDefault(); // Stop default behaviour. var href = ($(this).is('a') ? $(this).attr('href') : $(this).find('a').attr('href')); // Get the href. close(href); // Close Slidebar and pass link. } } else { // Just a normal control class. eventHandler(event, $(this)); // Handle the event. close(); // Close Slidebar. } }); // Close Slidebar via site $site.on('touchend click', function (event) { if (settings.siteClose && (leftActive || rightActive)) { // If settings permit closing by site and left or right Slidebar is open. eventHandler(event, $(this)); // Handle the event. close(); // Close it. } }); }; // End Slidebars function. })(jQuery); /* A simple jQuery modal (http://github.com/kylefox/jquery-modal) Version 0.5.5 */ (function ($) { "use strict"; var current = null; $.modal = function (el, options) { $.modal.close(); // Close any open modals. var remove, target; this.$body = $('body'); this.options = $.extend({}, $.modal.defaults, options); this.options.doFade = !isNaN(parseInt(this.options.fadeDuration, 10)); if (el.is('a')) { target = el.attr('href'); //Select element by id from href if (/^#/.test(target)) { this.$elm = $(target); if (this.$elm.length !== 1) return null; this.open(); //AJAX } else { this.$elm = $('
'); this.$body.append(this.$elm); remove = function (event, modal) { modal.elm.remove(); }; this.showSpinner(); el.trigger($.modal.AJAX_SEND); $.get(target).done(function (html) { if (!current) return; el.trigger($.modal.AJAX_SUCCESS); current.$elm.empty().append(html).on($.modal.CLOSE, remove); current.hideSpinner(); current.open(); el.trigger($.modal.AJAX_COMPLETE); }).fail(function () { el.trigger($.modal.AJAX_FAIL); current.hideSpinner(); el.trigger($.modal.AJAX_COMPLETE); }); } } else { this.$elm = el; this.open(); } }; $.modal.prototype = { constructor: $.modal, open: function () { var m = this; if (this.options.doFade) { this.block(); setTimeout(function () { m.show(); }, this.options.fadeDuration * this.options.fadeDelay); } else { this.block(); this.show(); } if (this.options.escapeClose) { $(document).on('keydown.modal', function (event) { if (event.which == 27) $.modal.close(); }); } if (this.options.clickClose) this.blocker.click($.modal.close); }, close: function () { this.unblock(); this.hide(); $(document).off('keydown.modal'); }, block: function () { var initialOpacity = this.options.doFade ? 0 : this.options.opacity; this.$elm.trigger($.modal.BEFORE_BLOCK, [this._ctx()]); this.blocker = $('
').css({ top: 0, right: 0, bottom: 0, left: 0, width: "100%", height: "100%", position: "fixed", zIndex: this.options.zIndex, background: this.options.overlay, opacity: initialOpacity }); this.$body.append(this.blocker); if (this.options.doFade) { this.blocker.animate({ opacity: this.options.opacity }, this.options.fadeDuration); } this.$elm.trigger($.modal.BLOCK, [this._ctx()]); }, unblock: function () { if (this.options.doFade) { this.blocker.fadeOut(this.options.fadeDuration, function () { $(this).remove(); }); } else { this.blocker.remove(); } }, show: function () { this.$elm.trigger($.modal.BEFORE_OPEN, [this._ctx()]); if (this.options.showClose) { this.closeButton = $('' + this.options.closeText + ''); this.$elm.append(this.closeButton); } this.$elm.addClass(this.options.modalClass + ' current'); this.center(); if (this.options.doFade) { this.$elm.fadeIn(this.options.fadeDuration); } else { this.$elm.show(); } this.$elm.trigger($.modal.OPEN, [this._ctx()]); }, hide: function () { this.$elm.trigger($.modal.BEFORE_CLOSE, [this._ctx()]); if (this.closeButton) this.closeButton.remove(); this.$elm.removeClass('current'); if (this.options.doFade) { this.$elm.fadeOut(this.options.fadeDuration); } else { this.$elm.hide(); } this.$elm.trigger($.modal.CLOSE, [this._ctx()]); }, showSpinner: function () { if (!this.options.showSpinner) return; this.spinner = this.spinner || $('
') .append(this.options.spinnerHtml); this.$body.append(this.spinner); this.spinner.show(); }, hideSpinner: function () { if (this.spinner) this.spinner.remove(); }, center: function () { this.$elm.css({ position: 'fixed', top: "50%", left: "50%", marginTop: -(this.$elm.outerHeight() / 2), marginLeft: -(this.$elm.outerWidth() / 2), zIndex: this.options.zIndex + 1 }); }, //Return context for custom events _ctx: function () { return { elm: this.$elm, blocker: this.blocker, options: this.options }; } }; //resize is alias for center for now $.modal.prototype.resize = $.modal.prototype.center; $.modal.close = function (event) { if (!current) return; if (event) event.preventDefault(); current.close(); var that = current.$elm; current = null; return that; }; $.modal.resize = function () { if (!current) return; current.resize(); }; // Returns if there currently is an active modal $.modal.isActive = function () { return current ? true : false; }; $.modal.defaults = { overlay: "#000", opacity: 0.5, zIndex: 9999, escapeClose: true, clickClose: true, closeText: '', closeClass: '', modalClass: "modal", spinnerHtml: null, showSpinner: false, showClose: true, fadeDuration: 100, // Number of milliseconds the fade animation takes. fadeDelay: 1.0 // Point during the overlay's fade-in that the modal begins to fade in (.5 = 50%, 1.5 = 150%, etc.) }; // Event constants $.modal.BEFORE_BLOCK = 'modal:before-block'; $.modal.BLOCK = 'modal:block'; $.modal.BEFORE_OPEN = 'modal:before-open'; $.modal.OPEN = 'modal:open'; $.modal.BEFORE_CLOSE = 'modal:before-close'; $.modal.CLOSE = 'modal:close'; $.modal.AJAX_SEND = 'modal:ajax:send'; $.modal.AJAX_SUCCESS = 'modal:ajax:success'; $.modal.AJAX_FAIL = 'modal:ajax:fail'; $.modal.AJAX_COMPLETE = 'modal:ajax:complete'; $.fn.modal = function (options) { if (this.length === 1) { current = new $.modal(this, options); } return this; }; // Automatically bind links with rel="modal:close" to, well, close the modal. $(document).on('click.modal', 'a[rel="modal:close"]', $.modal.close); $(document).on('click.modal', 'a[rel="modal:open"]', function (event) { event.preventDefault(); $(this).modal(); }); })(jQuery); /* * jQuery OwlCarousel v1.31 * * Copyright (c) 2013 Bartosz Wojciechowski * http://www.owlgraphic.com/owlcarousel/ * * Licensed under MIT * */ if (typeof Object.create !== "function") { Object.create = function (obj) { function F() {} F.prototype = obj; return new F(); }; } (function ($, window, document, undefined) { var Carousel = { init: function (options, el) { var base = this; base.$elem = $(el); // options passed via js override options passed via data attributes base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options); base.userOptions = options; base.loadContent(); }, loadContent: function () { var base = this; if (typeof base.options.beforeInit === "function") { base.options.beforeInit.apply(this, [base.$elem]); } if (typeof base.options.jsonPath === "string") { var url = base.options.jsonPath; function getData(data) { if (typeof base.options.jsonSuccess === "function") { base.options.jsonSuccess.apply(this, [data]); } else { var content = ""; for (var i in data["owl"]) { content += data["owl"][i]["item"]; } base.$elem.html(content); } base.logIn(); } $.getJSON(url, getData); } else { base.logIn(); } }, logIn: function (action) { var base = this; base.$elem.data("owl-originalStyles", base.$elem.attr("style")) .data("owl-originalClasses", base.$elem.attr("class")); base.$elem.css({ opacity: 0 }); base.orignalItems = base.options.items; base.checkBrowser(); base.wrapperWidth = 0; base.checkVisible; base.setVars(); }, setVars: function () { var base = this; if (base.$elem.children().length === 0) { return false; } base.baseClass(); base.eventTypes(); base.$userItems = base.$elem.children(); base.itemsAmount = base.$userItems.length; base.wrapItems(); base.$owlItems = base.$elem.find(".owl-item"); base.$owlWrapper = base.$elem.find(".owl-wrapper"); base.playDirection = "next"; base.prevItem = 0; base.prevArr = [0]; base.currentItem = 0; base.customEvents(); base.onStartup(); }, onStartup: function () { var base = this; base.updateItems(); base.calculateAll(); base.buildControls(); base.updateControls(); base.response(); base.moveEvents(); base.stopOnHover(); base.owlStatus(); if (base.options.transitionStyle !== false) { base.transitionTypes(base.options.transitionStyle); } if (base.options.autoPlay === true) { base.options.autoPlay = 5000; } base.play(); base.$elem.find(".owl-wrapper").css("display", "block"); if (!base.$elem.is(":visible")) { base.watchVisibility(); } else { base.$elem.css("opacity", 1); } base.onstartup = false; base.eachMoveUpdate(); if (typeof base.options.afterInit === "function") { base.options.afterInit.apply(this, [base.$elem]); } }, eachMoveUpdate: function () { var base = this; if (base.options.lazyLoad === true) { base.lazyLoad(); } if (base.options.autoHeight === true) { base.autoHeight(); } base.onVisibleItems(); if (typeof base.options.afterAction === "function") { base.options.afterAction.apply(this, [base.$elem]); } }, updateVars: function () { var base = this; if (typeof base.options.beforeUpdate === "function") { base.options.beforeUpdate.apply(this, [base.$elem]); } base.watchVisibility(); base.updateItems(); base.calculateAll(); base.updatePosition(); base.updateControls(); base.eachMoveUpdate(); if (typeof base.options.afterUpdate === "function") { base.options.afterUpdate.apply(this, [base.$elem]); } }, reload: function (elements) { var base = this; setTimeout(function () { base.updateVars(); }, 0); }, watchVisibility: function () { var base = this; if (base.$elem.is(":visible") === false) { base.$elem.css({ opacity: 0 }); clearInterval(base.autoPlayInterval); clearInterval(base.checkVisible); } else { return false; } base.checkVisible = setInterval(function () { if (base.$elem.is(":visible")) { base.reload(); base.$elem.animate({ opacity: 1 }, 200); clearInterval(base.checkVisible); } }, 500); }, wrapItems: function () { var base = this; base.$userItems.wrapAll("
").wrap("
"); base.$elem.find(".owl-wrapper").wrap("
"); base.wrapperOuter = base.$elem.find(".owl-wrapper-outer"); base.$elem.css("display", "block"); }, baseClass: function () { var base = this; var hasBaseClass = base.$elem.hasClass(base.options.baseClass); var hasThemeClass = base.$elem.hasClass(base.options.theme); if (!hasBaseClass) { base.$elem.addClass(base.options.baseClass); } if (!hasThemeClass) { base.$elem.addClass(base.options.theme); } }, updateItems: function () { var base = this; if (base.options.responsive === false) { return false; } if (base.options.singleItem === true) { base.options.items = base.orignalItems = 1; base.options.itemsCustom = false; base.options.itemsDesktop = false; base.options.itemsDesktopSmall = false; base.options.itemsTablet = false; base.options.itemsTabletSmall = false; base.options.itemsMobile = false; return false; } var width = $(base.options.responsiveBaseWidth).width(); if (width > (base.options.itemsDesktop[0] || base.orignalItems)) { base.options.items = base.orignalItems; } if (typeof (base.options.itemsCustom) !== 'undefined' && base.options.itemsCustom !== false) { //Reorder array by screen size base.options.itemsCustom.sort(function (a, b) { return a[0] - b[0]; }); for (var i in base.options.itemsCustom) { if (typeof (base.options.itemsCustom[i]) !== 'undefined' && base.options.itemsCustom[i][0] <= width) { base.options.items = base.options.itemsCustom[i][1]; } } } else { if (width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false) { base.options.items = base.options.itemsDesktop[1]; } if (width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false) { base.options.items = base.options.itemsDesktopSmall[1]; } if (width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false) { base.options.items = base.options.itemsTablet[1]; } if (width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false) { base.options.items = base.options.itemsTabletSmall[1]; } if (width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false) { base.options.items = base.options.itemsMobile[1]; } } //if number of items is less than declared if (base.options.items > base.itemsAmount && base.options.itemsScaleUp === true) { base.options.items = base.itemsAmount; } }, response: function () { var base = this, smallDelay; if (base.options.responsive !== true) { return false; } var lastWindowWidth = $(window).width(); base.resizer = function () { if ($(window).width() !== lastWindowWidth) { if (base.options.autoPlay !== false) { clearInterval(base.autoPlayInterval); } clearTimeout(smallDelay); smallDelay = setTimeout(function () { lastWindowWidth = $(window).width(); base.updateVars(); }, base.options.responsiveRefreshRate); } }; $(window).resize(base.resizer); }, updatePosition: function () { var base = this; base.jumpTo(base.currentItem); if (base.options.autoPlay !== false) { base.checkAp(); } }, appendItemsSizes: function () { var base = this; var roundPages = 0; var lastItem = base.itemsAmount - base.options.items; base.$owlItems.each(function (index) { var $this = $(this); $this .css({ "width": base.itemWidth }) .data("owl-item", Number(index)); if (index % base.options.items === 0 || index === lastItem) { if (!(index > lastItem)) { roundPages += 1; } } $this.data("owl-roundPages", roundPages); }); }, appendWrapperSizes: function () { var base = this, width = base.$owlItems.length * base.itemWidth, cssObj; base.options['direction'] == "rtl" ? cssObj = { "right": 0, direction: "rtl" } : cssObj = { "left": 0 }; base.$owlWrapper.css({ "width": width }); base.$owlWrapper.css(cssObj); base.appendItemsSizes(); }, calculateAll: function () { var base = this; base.calculateWidth(); base.appendWrapperSizes(); base.loops(); base.max(); }, calculateWidth: function () { var base = this; base.itemWidth = Math.round(base.$elem.width() / base.options.items); }, max: function () { var base = this; var maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1; if (base.options.items > base.itemsAmount) { base.maximumItem = 0; maximum = 0; base.maximumPixels = 0; } else { base.maximumItem = base.itemsAmount - base.options.items; base.maximumPixels = maximum; } return maximum; }, min: function () { return 0; }, loops: function () { var base = this; base.positionsInArray = [0]; base.pagesInArray = []; var prev = 0; var elWidth = 0; for (var i = 0; i < base.itemsAmount; i++) { elWidth += base.itemWidth; base.positionsInArray.push(-elWidth); if (base.options.scrollPerPage === true) { var item = $(base.$owlItems[i]); var roundPageNum = item.data("owl-roundPages"); if (roundPageNum !== prev) { base.pagesInArray[prev] = base.positionsInArray[i]; prev = roundPageNum; } } } }, buildControls: function () { var base = this; if (base.options.navigation === true || base.options.pagination === true) { base.owlControls = $("
").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem); } if (base.options.pagination === true) { base.buildPagination(); } if (base.options.navigation === true) { base.buildButtons(); } }, buildButtons: function () { var base = this; var buttonsWrapper = $("
"); base.owlControls.append(buttonsWrapper); base.buttonPrev = $("
", { "class": "owl-prev", "html": base.options.navigationText[0] || "" }); base.buttonNext = $("
", { "class": "owl-next", "html": base.options.navigationText[1] || "" }); buttonsWrapper .append(base.buttonPrev) .append(base.buttonNext); buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function (event) { event.preventDefault(); }); buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function (event) { event.preventDefault(); if ($(this).hasClass("owl-next")) { base.next(); } else { base.prev(); } }); }, buildPagination: function () { var base = this; base.paginationWrapper = $("
"); base.owlControls.append(base.paginationWrapper); base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function (event) { event.preventDefault(); if (Number($(this).data("owl-page")) !== base.currentItem) { base.goTo(Number($(this).data("owl-page")), true); } }); }, updatePagination: function () { var base = this; if (base.options.pagination === false) { return false; } base.paginationWrapper.html(""); var counter = 0; var lastPage = base.itemsAmount - base.itemsAmount % base.options.items; for (var i = 0; i < base.itemsAmount; i++) { if (i % base.options.items === 0) { counter += 1; if (lastPage === i) { var lastItem = base.itemsAmount - base.options.items; } var paginationButton = $("
", { "class": "owl-page" }); var paginationButtonInner = $("", { "text": base.options.paginationNumbers === true ? counter : "", "class": base.options.paginationNumbers === true ? "owl-numbers" : "" }); paginationButton.append(paginationButtonInner); paginationButton.data("owl-page", lastPage === i ? lastItem : i); paginationButton.data("owl-roundPages", counter); base.paginationWrapper.append(paginationButton); } } base.checkPagination(); }, checkPagination: function () { var base = this; if (base.options.pagination === false) { return false; } base.paginationWrapper.find(".owl-page").each(function (i, v) { if ($(this).data("owl-roundPages") === $(base.$owlItems[base.currentItem]).data("owl-roundPages")) { base.paginationWrapper .find(".owl-page") .removeClass("active"); $(this).addClass("active"); } }); }, checkNavigation: function () { var base = this; if (base.options.navigation === false) { return false; } if (base.options.rewindNav === false) { if (base.currentItem === 0 && base.maximumItem === 0) { base.buttonPrev.addClass("disabled"); base.buttonNext.addClass("disabled"); } else if (base.currentItem === 0 && base.maximumItem !== 0) { base.buttonPrev.addClass("disabled"); base.buttonNext.removeClass("disabled"); } else if (base.currentItem === base.maximumItem) { base.buttonPrev.removeClass("disabled"); base.buttonNext.addClass("disabled"); } else if (base.currentItem !== 0 && base.currentItem !== base.maximumItem) { base.buttonPrev.removeClass("disabled"); base.buttonNext.removeClass("disabled"); } } }, updateControls: function () { var base = this; base.updatePagination(); base.checkNavigation(); if (base.owlControls) { if (base.options.items >= base.itemsAmount) { base.owlControls.hide(); } else { base.owlControls.show(); } } }, destroyControls: function () { var base = this; if (base.owlControls) { base.owlControls.remove(); } }, next: function (speed) { var base = this; if (base.isTransition) { return false; } base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1; if (base.currentItem > base.maximumItem + (base.options.scrollPerPage === true ? (base.options.items - 1) : 0)) { if (base.options.rewindNav === true) { base.currentItem = 0; speed = "rewind"; } else { base.currentItem = base.maximumItem; return false; } } base.goTo(base.currentItem, speed); }, prev: function (speed) { var base = this; if (base.isTransition) { return false; } if (base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items) { base.currentItem = 0; } else { base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1; } if (base.currentItem < 0) { if (base.options.rewindNav === true) { base.currentItem = base.maximumItem; speed = "rewind"; } else { base.currentItem = 0; return false; } } base.goTo(base.currentItem, speed); }, goTo: function (position, speed, drag) { var base = this; if (base.isTransition) { return false; } if (typeof base.options.beforeMove === "function") { base.options.beforeMove.apply(this, [base.$elem]); } if (position >= base.maximumItem) { position = base.maximumItem; } else if (position <= 0) { position = 0; } base.currentItem = base.owl.currentItem = position; if (base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true) { base.swapSpeed(0); if (base.browser.support3d === true) { base.transition3d(base.positionsInArray[position]); } else { base.css2slide(base.positionsInArray[position], 1); } base.afterGo(); base.singleItemTransition(); return false; } var goToPixel = base.positionsInArray[position]; if (base.browser.support3d === true) { base.isCss3Finish = false; if (speed === true) { base.swapSpeed("paginationSpeed"); setTimeout(function () { base.isCss3Finish = true; }, base.options.paginationSpeed); } else if (speed === "rewind") { base.swapSpeed(base.options.rewindSpeed); setTimeout(function () { base.isCss3Finish = true; }, base.options.rewindSpeed); } else { base.swapSpeed("slideSpeed"); setTimeout(function () { base.isCss3Finish = true; }, base.options.slideSpeed); } base.transition3d(goToPixel); } else { if (speed === true) { base.css2slide(goToPixel, base.options.paginationSpeed); } else if (speed === "rewind") { base.css2slide(goToPixel, base.options.rewindSpeed); } else { base.css2slide(goToPixel, base.options.slideSpeed); } } base.afterGo(); }, jumpTo: function (position) { var base = this; if (typeof base.options.beforeMove === "function") { base.options.beforeMove.apply(this, [base.$elem]); } if (position >= base.maximumItem || position === -1) { position = base.maximumItem; } else if (position <= 0) { position = 0; } base.swapSpeed(0); if (base.browser.support3d === true) { base.transition3d(base.positionsInArray[position]); } else { base.css2slide(base.positionsInArray[position], 1); } base.currentItem = base.owl.currentItem = position; base.afterGo(); }, afterGo: function () { var base = this; base.prevArr.push(base.currentItem); base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length - 2]; base.prevArr.shift(0); if (base.prevItem !== base.currentItem) { base.checkPagination(); base.checkNavigation(); base.eachMoveUpdate(); if (base.options.autoPlay !== false) { base.checkAp(); } } if (typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) { base.options.afterMove.apply(this, [base.$elem]); } }, stop: function () { var base = this; base.apStatus = "stop"; clearInterval(base.autoPlayInterval); }, checkAp: function () { var base = this; if (base.apStatus !== "stop") { base.play(); } }, play: function () { var base = this; base.apStatus = "play"; if (base.options.autoPlay === false) { return false; } clearInterval(base.autoPlayInterval); base.autoPlayInterval = setInterval(function () { base.next(true); }, base.options.autoPlay); }, swapSpeed: function (action) { var base = this; if (action === "slideSpeed") { base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed)); } else if (action === "paginationSpeed") { base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed)); } else if (typeof action !== "string") { base.$owlWrapper.css(base.addCssSpeed(action)); } }, addCssSpeed: function (speed) { var base = this; return { "-webkit-transition": "all " + speed + "ms ease", "-moz-transition": "all " + speed + "ms ease", "-o-transition": "all " + speed + "ms ease", "transition": "all " + speed + "ms ease" }; }, removeTransition: function () { return { "-webkit-transition": "", "-moz-transition": "", "-o-transition": "", "transition": "" }; }, doTranslate: function (pixels) { var base = this; base.options['direction'] == "rtl" ? pixels = -pixels : pixels = pixels; return { "-webkit-transform": "translate3d(" + pixels + "px, 0px, 0px)", "-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)", "-o-transform": "translate3d(" + pixels + "px, 0px, 0px)", "-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)", "transform": "translate3d(" + pixels + "px, 0px,0px)" }; }, transition3d: function (value) { var base = this; base.$owlWrapper.css(base.doTranslate(value)); }, css2move: function (value) { var base = this, cssObj; base.options['direction'] == "rtl" ? cssObj = { "right": value } : cssObj = { "left": value }; base.$owlWrapper.css(cssObj); }, css2slide: function (value, speed) { var base = this, cssObj; base.options['direction'] == "rtl" ? cssObj = { "right": value } : cssObj = { "left": value }; base.isCssFinish = false; base.$owlWrapper.stop(true, true).animate(cssObj, { duration: speed || base.options.slideSpeed, complete: function () { base.isCssFinish = true; } }); }, checkBrowser: function () { var base = this; //Check 3d support var translate3D = "translate3d(0px, 0px, 0px)", tempElem = document.createElement("div"); tempElem.style.cssText = " -moz-transform:" + translate3D + "; -ms-transform:" + translate3D + "; -o-transform:" + translate3D + "; -webkit-transform:" + translate3D + "; transform:" + translate3D; var regex = /translate3d\(0px, 0px, 0px\)/g, asSupport = tempElem.style.cssText.match(regex), support3d = (asSupport !== null && asSupport.length === 1); var isTouch = "ontouchstart" in window || navigator.msMaxTouchPoints; base.browser = { "support3d": support3d, "isTouch": isTouch }; }, moveEvents: function () { var base = this; if (base.options.mouseDrag !== false || base.options.touchDrag !== false) { base.gestures(); base.disabledEvents(); } }, eventTypes: function () { var base = this; var types = ["s", "e", "x"]; base.ev_types = {}; if (base.options.mouseDrag === true && base.options.touchDrag === true) { types = [ "touchstart.owl mousedown.owl", "touchmove.owl mousemove.owl", "touchend.owl touchcancel.owl mouseup.owl" ]; } else if (base.options.mouseDrag === false && base.options.touchDrag === true) { types = [ "touchstart.owl", "touchmove.owl", "touchend.owl touchcancel.owl" ]; } else if (base.options.mouseDrag === true && base.options.touchDrag === false) { types = [ "mousedown.owl", "mousemove.owl", "mouseup.owl" ]; } base.ev_types["start"] = types[0]; base.ev_types["move"] = types[1]; base.ev_types["end"] = types[2]; }, disabledEvents: function () { var base = this; base.$elem.on("dragstart.owl", function (event) { event.preventDefault(); }); base.$elem.on("mousedown.disableTextSelect", function (e) { return $(e.target).is('input, textarea, select, option'); }); }, gestures: function () { var base = this; var locals = { offsetX: 0, offsetY: 0, baseElWidth: 0, relativePos: 0, position: null, minSwipe: null, maxSwipe: null, sliding: null, dargging: null, targetElement: null }; base.isCssFinish = true; function getTouches(event) { if (event.touches) { return { x: event.touches[0].pageX, y: event.touches[0].pageY }; } else { if (event.pageX !== undefined) { return { x: event.pageX, y: event.pageY }; } else { return { x: event.clientX, y: event.clientY }; } } } function swapEvents(type) { if (type === "on") { $(document).on(base.ev_types["move"], dragMove); $(document).on(base.ev_types["end"], dragEnd); } else if (type === "off") { $(document).off(base.ev_types["move"]); $(document).off(base.ev_types["end"]); } } function dragStart(event) { var event = event.originalEvent || event || window.event; if (event.which === 3) { return false; } if (base.itemsAmount <= base.options.items) { return; } if (base.isCssFinish === false && !base.options.dragBeforeAnimFinish) { return false; } if (base.isCss3Finish === false && !base.options.dragBeforeAnimFinish) { return false; } if (base.options.autoPlay !== false) { clearInterval(base.autoPlayInterval); } if (base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")) { base.$owlWrapper.addClass("grabbing"); } base.newPosX = 0; base.newRelativeX = 0; $(this).css(base.removeTransition()); /*Bilal*/ var position = $(this).position(); if (base.options['direction'] == "rtl") { positionRight = base.$owlItems.eq(0).width() * base.currentItem; locals.relativePos = positionRight; locals.offsetX = -getTouches(event).x + positionRight; } else { locals.relativePos = position.left; locals.offsetX = getTouches(event).x - position.left; } locals.offsetY = getTouches(event).y - position.top; swapEvents("on"); locals.sliding = false; locals.targetElement = event.target || event.srcElement; } function dragMove(event) { var event = event.originalEvent || event || window.event; if (base.options['direction'] == "rtl") { base.newPosX = -getTouches(event).x - locals.offsetX; base.newPosY = getTouches(event).y - locals.offsetY; base.newRelativeX = base.newPosX + locals.relativePos; } else { base.newPosX = getTouches(event).x - locals.offsetX; base.newPosY = getTouches(event).y - locals.offsetY; base.newRelativeX = base.newPosX - locals.relativePos; } if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) { locals.dragging = true; base.options.startDragging.apply(base, [base.$elem]); } if (base.newRelativeX > 8 || base.newRelativeX < -8 && base.browser.isTouch === true) { event.preventDefault ? event.preventDefault() : event.returnValue = false; locals.sliding = true; } if ((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false) { $(document).off("touchmove.owl"); } var minSwipe = function () { return base.newRelativeX / 5; }; var maxSwipe = function () { return base.maximumPixels + base.newRelativeX / 5; }; base.newPosX = Math.max(Math.min(base.newPosX, minSwipe()), maxSwipe()); if (base.browser.support3d === true) { base.transition3d(base.newPosX); } else { base.css2move(base.newPosX); } } function dragEnd(event) { var event = event.originalEvent || event || window.event; event.target = event.target || event.srcElement; locals.dragging = false; if (base.browser.isTouch !== true) { base.$owlWrapper.removeClass("grabbing"); } if (base.options['direction'] == "rtl") { if (base.newRelativeX < 0) { base.dragDirection = base.owl.dragDirection = "right"; } else { base.dragDirection = base.owl.dragDirection = "left"; } } else { if (base.newRelativeX < 0) { base.dragDirection = base.owl.dragDirection = "left"; } else { base.dragDirection = base.owl.dragDirection = "right"; } } if (base.newRelativeX !== 0) { var newPosition = base.getNewPosition(); base.goTo(newPosition, false, "drag"); if (locals.targetElement === event.target && base.browser.isTouch !== true) { $(event.target).on("click.disable", function (ev) { ev.stopImmediatePropagation(); ev.stopPropagation(); ev.preventDefault(); $(event.target).off("click.disable"); }); var handlers = $._data(event.target, "events")["click"]; var owlStopEvent = handlers.pop(); handlers.splice(0, 0, owlStopEvent); } } swapEvents("off"); } base.$elem.on(base.ev_types["start"], ".owl-wrapper", dragStart); }, getNewPosition: function () { var base = this, newPosition; newPosition = base.closestItem(); if (newPosition > base.maximumItem) { base.currentItem = base.maximumItem; newPosition = base.maximumItem; } else if (base.newPosX >= 0) { newPosition = 0; base.currentItem = 0; } return newPosition; }, closestItem: function () { var base = this, array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray, goal = base.newPosX, closest = null; $.each(array, function (i, v) { if (goal - (base.itemWidth / 20) > array[i + 1] && goal - (base.itemWidth / 20) < v && base.moveDirection() === "left") { closest = v; if (base.options.scrollPerPage === true) { base.currentItem = $.inArray(closest, base.positionsInArray); } else { base.currentItem = i; } } else if (goal + (base.itemWidth / 20) < v && goal + (base.itemWidth / 20) > (array[i + 1] || array[i] - base.itemWidth) && base.moveDirection() === "right") { if (base.options.scrollPerPage === true) { closest = array[i + 1] || array[array.length - 1]; base.currentItem = $.inArray(closest, base.positionsInArray); } else { closest = array[i + 1]; base.currentItem = i + 1; } } }); return base.currentItem; }, moveDirection: function () { var base = this, direction; if (base.newRelativeX < 0) { direction = "right"; base.playDirection = "next"; } else { direction = "left"; base.playDirection = "prev"; } return direction; }, customEvents: function () { var base = this; base.$elem.on("owl.next", function () { base.next(); }); base.$elem.on("owl.prev", function () { base.prev(); }); base.$elem.on("owl.play", function (event, speed) { base.options.autoPlay = speed; base.play(); base.hoverStatus = "play"; }); base.$elem.on("owl.stop", function () { base.stop(); base.hoverStatus = "stop"; }); base.$elem.on("owl.goTo", function (event, item) { base.goTo(item); }); base.$elem.on("owl.jumpTo", function (event, item) { base.jumpTo(item); }); }, stopOnHover: function () { var base = this; if (base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false) { base.$elem.on("mouseover", function () { base.stop(); }); base.$elem.on("mouseout", function () { if (base.hoverStatus !== "stop") { base.play(); } }); } }, lazyLoad: function () { var base = this; if (base.options.lazyLoad === false) { return false; } for (var i = 0; i < base.itemsAmount; i++) { var $item = $(base.$owlItems[i]); if ($item.data("owl-loaded") === "loaded") { continue; } var itemNumber = $item.data("owl-item"), $lazyImg = $item.find(".lazyOwl"), follow; if (typeof $lazyImg.data("src") !== "string") { $item.data("owl-loaded", "loaded"); continue; } if ($item.data("owl-loaded") === undefined) { $lazyImg.hide(); $item.addClass("loading").data("owl-loaded", "checked"); } if (base.options.lazyFollow === true) { follow = itemNumber >= base.currentItem; } else { follow = true; } if (follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length) { base.lazyPreload($item, $lazyImg); } } }, lazyPreload: function ($item, $lazyImg) { var base = this, iterations = 0; if ($lazyImg.prop("tagName") === "DIV") { $lazyImg.css("background-image", "url(" + $lazyImg.data("src") + ")"); var isBackgroundImg = true; } else { $lazyImg[0].src = $lazyImg.data("src"); } checkLazyImage(); function checkLazyImage() { iterations += 1; if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) { showImage(); } else if (iterations <= 100) { //if image loads in less than 10 seconds setTimeout(checkLazyImage, 100); } else { showImage(); } } function showImage() { $item.data("owl-loaded", "loaded").removeClass("loading"); $lazyImg.removeAttr("data-src"); base.options.lazyEffect === "fade" ? $lazyImg.fadeIn(400) : $lazyImg.show(); if (typeof base.options.afterLazyLoad === "function") { base.options.afterLazyLoad.apply(this, [base.$elem]); } } }, autoHeight: function () { var base = this; var $currentimg = $(base.$owlItems[base.currentItem]).find("img"); if ($currentimg.get(0) !== undefined) { var iterations = 0; checkImage(); } else { addHeight(); } function checkImage() { iterations += 1; if (base.completeImg($currentimg.get(0))) { addHeight(); } else if (iterations <= 100) { //if image loads in less than 10 seconds setTimeout(checkImage, 100); } else { base.wrapperOuter.css("height", ""); //Else remove height attribute } } function addHeight() { var $currentItem = $(base.$owlItems[base.currentItem]).height(); base.wrapperOuter.css("height", $currentItem + "px"); if (!base.wrapperOuter.hasClass("autoHeight")) { setTimeout(function () { base.wrapperOuter.addClass("autoHeight"); }, 0); } } }, completeImg: function (img) { if (!img.complete) { return false; } if (typeof img.naturalWidth !== "undefined" && img.naturalWidth === 0) { return false; } return true; }, onVisibleItems: function () { var base = this; if (base.options.addClassActive === true) { base.$owlItems.removeClass("active"); } base.visibleItems = []; for (var i = base.currentItem; i < base.currentItem + base.options.items; i++) { base.visibleItems.push(i); if (base.options.addClassActive === true) { $(base.$owlItems[i]).addClass("active"); } } base.owl.visibleItems = base.visibleItems; }, transitionTypes: function (className) { var base = this; //Currently available: "fade","backSlide","goDown","fadeUp" base.outClass = "owl-" + className + "-out"; base.inClass = "owl-" + className + "-in"; }, singleItemTransition: function () { var base = this; base.isTransition = true; var outClass = base.outClass, inClass = base.inClass, $currentItem = base.$owlItems.eq(base.currentItem), $prevItem = base.$owlItems.eq(base.prevItem), prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem], origin = Math.abs(base.positionsInArray[base.currentItem]) + base.itemWidth / 2; base.$owlWrapper .addClass('owl-origin') .css({ "-webkit-transform-origin": origin + "px", "-moz-perspective-origin": origin + "px", "perspective-origin": origin + "px" }); function transStyles(prevPos, zindex) { return { "position": "relative", "left": prevPos + "px" }; } var animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend'; $prevItem .css(transStyles(prevPos, 10)) .addClass(outClass) .on(animEnd, function () { base.endPrev = true; $prevItem.off(animEnd); base.clearTransStyle($prevItem, outClass); }); $currentItem .addClass(inClass) .on(animEnd, function () { base.endCurrent = true; $currentItem.off(animEnd); base.clearTransStyle($currentItem, inClass); }); }, clearTransStyle: function (item, classToRemove) { var base = this; item.css({ "position": "", "left": "" }) .removeClass(classToRemove); if (base.endPrev && base.endCurrent) { base.$owlWrapper.removeClass('owl-origin'); base.endPrev = false; base.endCurrent = false; base.isTransition = false; } }, owlStatus: function () { var base = this; base.owl = { "userOptions": base.userOptions, "baseElement": base.$elem, "userItems": base.$userItems, "owlItems": base.$owlItems, "currentItem": base.currentItem, "prevItem": base.prevItem, "visibleItems": base.visibleItems, "isTouch": base.browser.isTouch, "browser": base.browser, "dragDirection": base.dragDirection }; }, clearEvents: function () { var base = this; base.$elem.off(".owl owl mousedown.disableTextSelect"); $(document).off(".owl owl"); $(window).off("resize", base.resizer); }, unWrap: function () { var base = this; if (base.$elem.children().length !== 0) { base.$owlWrapper.unwrap(); base.$userItems.unwrap().unwrap(); if (base.owlControls) { base.owlControls.remove(); } } base.clearEvents(); base.$elem .attr("style", base.$elem.data("owl-originalStyles") || "") .attr("class", base.$elem.data("owl-originalClasses")); }, destroy: function () { var base = this; base.stop(); clearInterval(base.checkVisible); base.unWrap(); base.$elem.removeData(); }, reinit: function (newOptions) { var base = this; var options = $.extend({}, base.userOptions, newOptions); base.unWrap(); base.init(options, base.$elem); }, addItem: function (htmlString, targetPosition) { var base = this, position; if (!htmlString) { return false; } if (base.$elem.children().length === 0) { base.$elem.append(htmlString); base.setVars(); return false; } base.unWrap(); if (targetPosition === undefined || targetPosition === -1) { position = -1; } else { position = targetPosition; } if (position >= base.$userItems.length || position === -1) { base.$userItems.eq(-1).after(htmlString); } else { base.$userItems.eq(position).before(htmlString); } base.setVars(); }, removeItem: function (targetPosition) { var base = this, position; if (base.$elem.children().length === 0) { return false; } if (targetPosition === undefined || targetPosition === -1) { position = -1; } else { position = targetPosition; } base.unWrap(); base.$userItems.eq(position).remove(); base.setVars(); } }; $.fn.owlCarousel = function (options) { return this.each(function () { if ($(this).data("owl-init") === true) { return false; } $(this).data("owl-init", true); var carousel = Object.create(Carousel); carousel.init(options, this); $.data(this, "owlCarousel", carousel); }); }; $.fn.owlCarousel.options = { direction: 'ltr', items: 5, itemsCustom: false, itemsDesktop: [1199, 4], itemsDesktopSmall: [979, 3], itemsTablet: [768, 2], itemsTabletSmall: false, itemsMobile: [479, 1], singleItem: false, itemsScaleUp: false, slideSpeed: 200, paginationSpeed: 800, rewindSpeed: 1000, autoPlay: false, stopOnHover: false, navigation: false, navigationText: ["prev", "next"], rewindNav: true, scrollPerPage: false, pagination: true, paginationNumbers: false, responsive: true, responsiveRefreshRate: 200, responsiveBaseWidth: window, baseClass: "owl-carousel", theme: "owl-theme", lazyLoad: false, lazyFollow: true, lazyEffect: "fade", autoHeight: false, jsonPath: false, jsonSuccess: false, dragBeforeAnimFinish: true, mouseDrag: true, touchDrag: true, addClassActive: false, transitionStyle: false, beforeUpdate: false, afterUpdate: false, beforeInit: false, afterInit: false, beforeMove: false, afterMove: false, afterAction: false, startDragging: false, afterLazyLoad: false }; })(jQuery, window, document); /** * Tabslet | tabs jQuery plugin * * @copyright Copyright 2012, Dimitris Krestos * @license Apache License, Version 2.0 (http://www.opensource.org/licenses/apache2.0.php) * @link http://vdw.staytuned.gr * @version v1.4.4 */ (function($, window, undefined) { "use strict"; $.fn.tabslet = function(options) { var defaults = { mouseevent: 'click', attribute: 'href', animation: false, autorotate: false, pauseonhover: true, delay: 2000, active: 1, controls: { prev: '.prev', next: '.next' } }; var options = $.extend(defaults, options); return this.each(function() { var $this = $(this); // Autorotate var elements = $this.find('> ul li'), i = options.active - 1; // ungly if ( !$this.data( 'tabslet-init' ) ) { $this.data( 'tabslet-init', true ); // Ungly overwrite options.mouseevent = $this.data('mouseevent') || options.mouseevent; options.attribute = $this.data('attribute') || options.attribute; options.animation = $this.data('animation') || options.animation; options.autorotate = $this.data('autorotate') || options.autorotate; options.pauseonhover = $this.data('pauseonhover') || options.pauseonhover; options.delay = $this.data('delay') || options.delay; options.active = $this.data('active') || options.active; $this.find('> div').hide(); $this.find('> div').eq(options.active - 1).show(); $this.find('> ul li').eq(options.active - 1).addClass('active'); var fn = eval( function() { $(this).trigger('_before'); $this.find('> ul li').removeClass('active'); $(this).addClass('active'); $this.find('> div').hide(); i = elements.index($(this)); var currentTab = $(this).find('a').attr(options.attribute); if (options.animation) { $this.find(currentTab).animate( { opacity: 'show' }, 'slow', function() { $(this).trigger('_after'); }); } else { $this.find(currentTab).show(); $(this).trigger('_after'); } return false; } ); var init = eval("$this.find('> ul li')." + options.mouseevent + "(fn)"); init; var forward = function() { i = ++i % elements.length; // wrap around options.mouseevent == 'hover' ? elements.eq(i).trigger('mouseover') : elements.eq(i).click(); var t = setTimeout(forward, options.delay); $this.mouseover(function () { if (options.pauseonhover) clearTimeout(t); }); } if (options.autorotate) { setTimeout(forward, 0); if (options.pauseonhover) $this.on( "mouseleave", function() { setTimeout(forward, 1000); }); } var move = function(direction) { if (direction == 'forward') i = ++i % elements.length; // wrap around if (direction == 'backward') i = --i % elements.length; // wrap around elements.eq(i).click(); } $this.find(options.controls.next).click(function() { move('forward'); }); $this.find(options.controls.prev).click(function() { move('backward'); }); $this.on ('destroy', function() { $(this).removeData(); }); } }); }; $(document).ready(function () { $('[data-toggle="tabslet"]').tabslet(); }); })(jQuery); /*! Magnific Popup - v0.9.9 - 2014-09-06 * http://dimsemenov.com/plugins/magnific-popup/ * Copyright (c) 2014 Dmitry Semenov; */ (function(e){var t,n,i,o,r,a,s,l="Close",c="BeforeClose",d="AfterClose",u="BeforeAppend",p="MarkupParse",f="Open",m="Change",g="mfp",h="."+g,v="mfp-ready",C="mfp-removing",y="mfp-prevent-close",w=function(){},b=!!window.jQuery,I=e(window),x=function(e,n){t.ev.on(g+e+h,n)},k=function(t,n,i,o){var r=document.createElement("div");return r.className="mfp-"+t,i&&(r.innerHTML=i),o?n&&n.appendChild(r):(r=e(r),n&&r.appendTo(n)),r},T=function(n,i){t.ev.triggerHandler(g+n,i),t.st.callbacks&&(n=n.charAt(0).toLowerCase()+n.slice(1),t.st.callbacks[n]&&t.st.callbacks[n].apply(t,e.isArray(i)?i:[i]))},E=function(n){return n===s&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=e(t.st.closeMarkup.replace("%title%",t.st.tClose)),s=n),t.currTemplate.closeBtn},_=function(){e.magnificPopup.instance||(t=new w,t.init(),e.magnificPopup.instance=t)},S=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1};w.prototype={constructor:w,init:function(){var n=navigator.appVersion;t.isIE7=-1!==n.indexOf("MSIE 7."),t.isIE8=-1!==n.indexOf("MSIE 8."),t.isLowIE=t.isIE7||t.isIE8,t.isAndroid=/android/gi.test(n),t.isIOS=/iphone|ipad|ipod/gi.test(n),t.supportsTransition=S(),t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),o=e(document),t.popupsCache={}},open:function(n){i||(i=e(document.body));var r;if(n.isObj===!1){t.items=n.items.toArray(),t.index=0;var s,l=n.items;for(r=0;l.length>r;r++)if(s=l[r],s.parsed&&(s=s.el[0]),s===n.el[0]){t.index=r;break}}else t.items=e.isArray(n.items)?n.items:[n.items],t.index=n.index||0;if(t.isOpen)return t.updateItemHTML(),void 0;t.types=[],a="",t.ev=n.mainEl&&n.mainEl.length?n.mainEl.eq(0):o,n.key?(t.popupsCache[n.key]||(t.popupsCache[n.key]={}),t.currTemplate=t.popupsCache[n.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopup.defaults,n),t.fixedContentPos="auto"===t.st.fixedContentPos?!t.probablyMobile:t.st.fixedContentPos,t.st.modal&&(t.st.closeOnContentClick=!1,t.st.closeOnBgClick=!1,t.st.showCloseBtn=!1,t.st.enableEscapeKey=!1),t.bgOverlay||(t.bgOverlay=k("bg").on("click"+h,function(){t.close()}),t.wrap=k("wrap").attr("tabindex",-1).on("click"+h,function(e){t._checkIfClose(e.target)&&t.close()}),t.container=k("container",t.wrap)),t.contentContainer=k("content"),t.st.preloader&&(t.preloader=k("preloader",t.container,t.st.tLoading));var c=e.magnificPopup.modules;for(r=0;c.length>r;r++){var d=c[r];d=d.charAt(0).toUpperCase()+d.slice(1),t["init"+d].call(t)}T("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(x(p,function(e,t,n,i){n.close_replaceWith=E(i.type)}),a+=" mfp-close-btn-in"):t.wrap.append(E())),t.st.alignTop&&(a+=" mfp-align-top"),t.fixedContentPos?t.wrap.css({overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}):t.wrap.css({top:I.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:o.height(),position:"absolute"}),t.st.enableEscapeKey&&o.on("keyup"+h,function(e){27===e.keyCode&&t.close()}),I.on("resize"+h,function(){t.updateSize()}),t.st.closeOnContentClick||(a+=" mfp-auto-cursor"),a&&t.wrap.addClass(a);var u=t.wH=I.height(),m={};if(t.fixedContentPos&&t._hasScrollBar(u)){var g=t._getScrollbarSize();g&&(m.marginRight=g)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):m.overflow="hidden");var C=t.st.mainClass;return t.isIE7&&(C+=" mfp-ie7"),C&&t._addClassToMFP(C),t.updateItemHTML(),T("BuildControls"),e("html").css(m),t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo||i),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(v),t._setFocus()):t.bgOverlay.addClass(v),o.on("focusin"+h,t._onFocusIn)},16),t.isOpen=!0,t.updateSize(u),T(f),n},close:function(){t.isOpen&&(T(c),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(C),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){T(l);var n=C+" "+v+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(n+=t.st.mainClass+" "),t._removeClassFromMFP(n),t.fixedContentPos){var i={marginRight:""};t.isIE7?e("body, html").css("overflow",""):i.overflow="",e("html").css(i)}o.off("keyup"+h+" focusin"+h),t.ev.off(h),t.wrap.attr("class","mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","mfp-bg"),t.container.attr("class","mfp-container"),!t.st.showCloseBtn||t.st.closeBtnInside&&t.currTemplate[t.currItem.type]!==!0||t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach(),t._lastFocusedEl&&e(t._lastFocusedEl).focus(),t.currItem=null,t.content=null,t.currTemplate=null,t.prevHeight=0,T(d)},updateSize:function(e){if(t.isIOS){var n=document.documentElement.clientWidth/window.innerWidth,i=window.innerHeight*n;t.wrap.css("height",i),t.wH=i}else t.wH=e||I.height();t.fixedContentPos||t.wrap.css("height",t.wH),T("Resize")},updateItemHTML:function(){var n=t.items[t.index];t.contentContainer.detach(),t.content&&t.content.detach(),n.parsed||(n=t.parseEl(t.index));var i=n.type;if(T("BeforeChange",[t.currItem?t.currItem.type:"",i]),t.currItem=n,!t.currTemplate[i]){var o=t.st[i]?t.st[i].markup:!1;T("FirstMarkupParse",o),t.currTemplate[i]=o?e(o):!0}r&&r!==n.type&&t.container.removeClass("mfp-"+r+"-holder");var a=t["get"+i.charAt(0).toUpperCase()+i.slice(1)](n,t.currTemplate[i]);t.appendContent(a,i),n.preloaded=!0,T(m,n),r=n.type,t.container.prepend(t.contentContainer),T("AfterChange")},appendContent:function(e,n){t.content=e,e?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[n]===!0?t.content.find(".mfp-close").length||t.content.append(E()):t.content=e:t.content="",T(u),t.container.addClass("mfp-"+n+"-holder"),t.contentContainer.append(t.content)},parseEl:function(n){var i,o=t.items[n];if(o.tagName?o={el:e(o)}:(i=o.type,o={data:o,src:o.src}),o.el){for(var r=t.types,a=0;r.length>a;a++)if(o.el.hasClass("mfp-"+r[a])){i=r[a];break}o.src=o.el.attr("data-mfp-src"),o.src||(o.src=o.el.attr("href"))}return o.type=i||t.st.type||"inline",o.index=n,o.parsed=!0,t.items[n]=o,T("ElementParse",o),t.items[n]},addGroup:function(e,n){var i=function(i){i.mfpEl=this,t._openClick(i,e,n)};n||(n={});var o="click.magnificPopup";n.mainEl=e,n.items?(n.isObj=!0,e.off(o).on(o,i)):(n.isObj=!1,n.delegate?e.off(o).on(o,n.delegate,i):(n.items=e,e.off(o).on(o,i)))},_openClick:function(n,i,o){var r=void 0!==o.midClick?o.midClick:e.magnificPopup.defaults.midClick;if(r||2!==n.which&&!n.ctrlKey&&!n.metaKey){var a=void 0!==o.disableOn?o.disableOn:e.magnificPopup.defaults.disableOn;if(a)if(e.isFunction(a)){if(!a.call(t))return!0}else if(a>I.width())return!0;n.type&&(n.preventDefault(),t.isOpen&&n.stopPropagation()),o.el=e(n.mfpEl),o.delegate&&(o.items=i.find(o.delegate)),t.open(o)}},updateStatus:function(e,i){if(t.preloader){n!==e&&t.container.removeClass("mfp-s-"+n),i||"loading"!==e||(i=t.st.tLoading);var o={status:e,text:i};T("UpdateStatus",o),e=o.status,i=o.text,t.preloader.html(i),t.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),t.container.addClass("mfp-s-"+e),n=e}},_checkIfClose:function(n){if(!e(n).hasClass(y)){var i=t.st.closeOnContentClick,o=t.st.closeOnBgClick;if(i&&o)return!0;if(!t.content||e(n).hasClass("mfp-close")||t.preloader&&n===t.preloader[0])return!0;if(n===t.content[0]||e.contains(t.content[0],n)){if(i)return!0}else if(o&&e.contains(document,n))return!0;return!1}},_addClassToMFP:function(e){t.bgOverlay.addClass(e),t.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),t.wrap.removeClass(e)},_hasScrollBar:function(e){return(t.isIE7?o.height():document.body.scrollHeight)>(e||I.height())},_setFocus:function(){(t.st.focus?t.content.find(t.st.focus).eq(0):t.wrap).focus()},_onFocusIn:function(n){return n.target===t.wrap[0]||e.contains(t.wrap[0],n.target)?void 0:(t._setFocus(),!1)},_parseMarkup:function(t,n,i){var o;i.data&&(n=e.extend(i.data,n)),T(p,[t,n,i]),e.each(n,function(e,n){if(void 0===n||n===!1)return!0;if(o=e.split("_"),o.length>1){var i=t.find(h+"-"+o[0]);if(i.length>0){var r=o[1];"replaceWith"===r?i[0]!==n[0]&&i.replaceWith(n):"img"===r?i.is("img")?i.attr("src",n):i.replaceWith(''):i.attr(o[1],n)}}else t.find(h+"-"+e).html(n)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopup={instance:null,proto:w.prototype,modules:[],open:function(t,n){return _(),t=t?e.extend(!0,{},t):{},t.isObj=!0,t.index=n||0,this.instance.open(t)},close:function(){return e.magnificPopup.instance&&e.magnificPopup.instance.close()},registerModule:function(t,n){n.options&&(e.magnificPopup.defaults[t]=n.options),e.extend(this.proto,n.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopup=function(n){_();var i=e(this);if("string"==typeof n)if("open"===n){var o,r=b?i.data("magnificPopup"):i[0].magnificPopup,a=parseInt(arguments[1],10)||0;r.items?o=r.items[a]:(o=i,r.delegate&&(o=o.find(r.delegate)),o=o.eq(a)),t._openClick({mfpEl:o},i,r)}else t.isOpen&&t[n].apply(t,Array.prototype.slice.call(arguments,1));else n=e.extend(!0,{},n),b?i.data("magnificPopup",n):i[0].magnificPopup=n,t.addGroup(i,n);return i};var P,O,z,M="inline",B=function(){z&&(O.after(z.addClass(P)).detach(),z=null)};e.magnificPopup.registerModule(M,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(M),x(l+"."+M,function(){B()})},getInline:function(n,i){if(B(),n.src){var o=t.st.inline,r=e(n.src);if(r.length){var a=r[0].parentNode;a&&a.tagName&&(O||(P=o.hiddenClass,O=k(P),P="mfp-"+P),z=r.after(O).detach().removeClass(P)),t.updateStatus("ready")}else t.updateStatus("error",o.tNotFound),r=e("
");return n.inlineElement=r,r}return t.updateStatus("ready"),t._parseMarkup(i,{},n),i}}});var F,H="ajax",L=function(){F&&i.removeClass(F)},A=function(){L(),t.req&&t.req.abort()};e.magnificPopup.registerModule(H,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'The content could not be loaded.'},proto:{initAjax:function(){t.types.push(H),F=t.st.ajax.cursor,x(l+"."+H,A),x("BeforeChange."+H,A)},getAjax:function(n){F&&i.addClass(F),t.updateStatus("loading");var o=e.extend({url:n.src,success:function(i,o,r){var a={data:i,xhr:r};T("ParseAjax",a),t.appendContent(e(a.data),H),n.finished=!0,L(),t._setFocus(),setTimeout(function(){t.wrap.addClass(v)},16),t.updateStatus("ready"),T("AjaxContentAdded")},error:function(){L(),n.finished=n.loadError=!0,t.updateStatus("error",t.st.ajax.tError.replace("%url%",n.src))}},t.st.ajax.settings);return t.req=e.ajax(o),""}}});var j,N=function(n){if(n.data&&void 0!==n.data.title)return n.data.title;var i=t.st.image.titleSrc;if(i){if(e.isFunction(i))return i.call(t,n);if(n.el)return n.el.attr(i)||""}return""};e.magnificPopup.registerModule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'The image could not be loaded.'},proto:{initImage:function(){var e=t.st.image,n=".image";t.types.push("image"),x(f+n,function(){"image"===t.currItem.type&&e.cursor&&i.addClass(e.cursor)}),x(l+n,function(){e.cursor&&i.removeClass(e.cursor),I.off("resize"+h)}),x("Resize"+n,t.resizeImage),t.isLowIE&&x("AfterChange",t.resizeImage)},resizeImage:function(){var e=t.currItem;if(e&&e.img&&t.st.image.verticalFit){var n=0;t.isLowIE&&(n=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",t.wH-n)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,j&&clearInterval(j),e.isCheckingImgSize=!1,T("ImageHasSize",e),e.imgHidden&&(t.content&&t.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var n=0,i=e.img[0],o=function(r){j&&clearInterval(j),j=setInterval(function(){return i.naturalWidth>0?(t._onImageHasSize(e),void 0):(n>200&&clearInterval(j),n++,3===n?o(10):40===n?o(50):100===n&&o(500),void 0)},r)};o(1)},getImage:function(n,i){var o=0,r=function(){n&&(n.img[0].complete?(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("ready")),n.hasSize=!0,n.loaded=!0,T("ImageLoadComplete")):(o++,200>o?setTimeout(r,100):a()))},a=function(){n&&(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("error",s.tError.replace("%url%",n.src))),n.hasSize=!0,n.loaded=!0,n.loadError=!0)},s=t.st.image,l=i.find(".mfp-img");if(l.length){var c=document.createElement("img");c.className="mfp-img",n.img=e(c).on("load.mfploader",r).on("error.mfploader",a),c.src=n.src,l.is("img")&&(n.img=n.img.clone()),c=n.img[0],c.naturalWidth>0?n.hasSize=!0:c.width||(n.hasSize=!1)}return t._parseMarkup(i,{title:N(n),img_replaceWith:n.img},n),t.resizeImage(),n.hasSize?(j&&clearInterval(j),n.loadError?(i.addClass("mfp-loading"),t.updateStatus("error",s.tError.replace("%url%",n.src))):(i.removeClass("mfp-loading"),t.updateStatus("ready")),i):(t.updateStatus("loading"),n.loading=!0,n.hasSize||(n.imgHidden=!0,i.addClass("mfp-loading"),t.findImageSize(n)),i)}}});var W,R=function(){return void 0===W&&(W=void 0!==document.createElement("p").style.MozTransform),W};e.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(e){return e.is("img")?e:e.find("img")}},proto:{initZoom:function(){var e,n=t.st.zoom,i=".zoom";if(n.enabled&&t.supportsTransition){var o,r,a=n.duration,s=function(e){var t=e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),i="all "+n.duration/1e3+"s "+n.easing,o={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},r="transition";return o["-webkit-"+r]=o["-moz-"+r]=o["-o-"+r]=o[r]=i,t.css(o),t},d=function(){t.content.css("visibility","visible")};x("BuildControls"+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.content.css("visibility","hidden"),e=t._getItemToZoom(),!e)return d(),void 0;r=s(e),r.css(t._getOffset()),t.wrap.append(r),o=setTimeout(function(){r.css(t._getOffset(!0)),o=setTimeout(function(){d(),setTimeout(function(){r.remove(),e=r=null,T("ZoomAnimationEnded")},16)},a)},16)}}),x(c+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.st.removalDelay=a,!e){if(e=t._getItemToZoom(),!e)return;r=s(e)}r.css(t._getOffset(!0)),t.wrap.append(r),t.content.css("visibility","hidden"),setTimeout(function(){r.css(t._getOffset())},16)}}),x(l+i,function(){t._allowZoom()&&(d(),r&&r.remove(),e=null)})}},_allowZoom:function(){return"image"===t.currItem.type},_getItemToZoom:function(){return t.currItem.hasSize?t.currItem.img:!1},_getOffset:function(n){var i;i=n?t.currItem.img:t.st.zoom.opener(t.currItem.el||t.currItem);var o=i.offset(),r=parseInt(i.css("padding-top"),10),a=parseInt(i.css("padding-bottom"),10);o.top-=e(window).scrollTop()-r;var s={width:i.width(),height:(b?i.innerHeight():i[0].offsetHeight)-a-r};return R()?s["-moz-transform"]=s.transform="translate("+o.left+"px,"+o.top+"px)":(s.left=o.left,s.top=o.top),s}}});var Z="iframe",q="//about:blank",D=function(e){if(t.currTemplate[Z]){var n=t.currTemplate[Z].find("iframe");n.length&&(e||(n[0].src=q),t.isIE8&&n.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(Z,{options:{markup:'
',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(Z),x("BeforeChange",function(e,t,n){t!==n&&(t===Z?D():n===Z&&D(!0))}),x(l+"."+Z,function(){D()})},getIframe:function(n,i){var o=n.src,r=t.st.iframe;e.each(r.patterns,function(){return o.indexOf(this.index)>-1?(this.id&&(o="string"==typeof this.id?o.substr(o.lastIndexOf(this.id)+this.id.length,o.length):this.id.call(this,o)),o=this.src.replace("%id%",o),!1):void 0});var a={};return r.srcAction&&(a[r.srcAction]=o),t._parseMarkup(i,a,n),t.updateStatus("ready"),i}}});var K=function(e){var n=t.items.length;return e>n-1?e-n:0>e?n+e:e},Y=function(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=t.st.gallery,i=".mfp-gallery",r=Boolean(e.fn.mfpFastClick);return t.direction=!0,n&&n.enabled?(a+=" mfp-gallery",x(f+i,function(){n.navigateByImgClick&&t.wrap.on("click"+i,".mfp-img",function(){return t.items.length>1?(t.next(),!1):void 0}),o.on("keydown"+i,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),x("UpdateStatus"+i,function(e,n){n.text&&(n.text=Y(n.text,t.currItem.index,t.items.length))}),x(p+i,function(e,i,o,r){var a=t.items.length;o.counter=a>1?Y(n.tCounter,r.index,a):""}),x("BuildControls"+i,function(){if(t.items.length>1&&n.arrows&&!t.arrowLeft){var i=n.arrowMarkup,o=t.arrowLeft=e(i.replace(/%title%/gi,n.tPrev).replace(/%dir%/gi,"left")).addClass(y),a=t.arrowRight=e(i.replace(/%title%/gi,n.tNext).replace(/%dir%/gi,"right")).addClass(y),s=r?"mfpFastClick":"click";o[s](function(){t.prev()}),a[s](function(){t.next()}),t.isIE7&&(k("b",o[0],!1,!0),k("a",o[0],!1,!0),k("b",a[0],!1,!0),k("a",a[0],!1,!0)),t.container.append(o.add(a))}}),x(m+i,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),x(l+i,function(){o.off(i),t.wrap.off("click"+i),t.arrowLeft&&r&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}),void 0):!1},next:function(){t.direction=!0,t.index=K(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=K(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,n=t.st.gallery.preload,i=Math.min(n[0],t.items.length),o=Math.min(n[1],t.items.length);for(e=1;(t.direction?o:i)>=e;e++)t._preloadItem(t.index+e);for(e=1;(t.direction?i:o)>=e;e++)t._preloadItem(t.index-e)},_preloadItem:function(n){if(n=K(n),!t.items[n].preloaded){var i=t.items[n];i.parsed||(i=t.parseEl(n)),T("LazyLoad",i),"image"===i.type&&(i.img=e('').on("load.mfploader",function(){i.hasSize=!0}).on("error.mfploader",function(){i.hasSize=!0,i.loadError=!0,T("LazyLoadError",i)}).attr("src",i.src)),i.preloaded=!0}}}});var U="retina";e.magnificPopup.registerModule(U,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,n=e.ratio;n=isNaN(n)?n():n,n>1&&(x("ImageHasSize."+U,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/n,width:"100%"})}),x("ElementParse."+U,function(t,i){i.src=e.replaceSrc(i,n)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,i=function(){I.off("touchmove"+r+" touchend"+r)},o="mfpFastClick",r="."+o;e.fn.mfpFastClick=function(o){return e(this).each(function(){var a,s=e(this);if(n){var l,c,d,u,p,f;s.on("touchstart"+r,function(e){u=!1,f=1,p=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=p.clientX,d=p.clientY,I.on("touchmove"+r,function(e){p=e.originalEvent?e.originalEvent.touches:e.touches,f=p.length,p=p[0],(Math.abs(p.clientX-c)>10||Math.abs(p.clientY-d)>10)&&(u=!0,i())}).on("touchend"+r,function(e){i(),u||f>1||(a=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){a=!1},t),o())})})}s.on("click"+r,function(){a||o()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+r+" click"+r),n&&I.off("touchmove"+r+" touchend"+r)}}(),_()})(window.jQuery||window.Zepto); // SmoothScroll for websites v1.2.1 // Licensed under the terms of the MIT license. // People involved // - Balazs Galambosi (maintainer) // - Michael Herf (Pulse Algorithm) (function(){ // Scroll Variables (tweakable) var defaultOptions = { // Scrolling Core frameRate : 150, // [Hz] animationTime : 400, // [px] stepSize : 120, // [px] // Pulse (less tweakable) // ratio of "tail" to "acceleration" pulseAlgorithm : true, pulseScale : 8, pulseNormalize : 1, // Acceleration accelerationDelta : 20, // 20 accelerationMax : 1, // 1 // Keyboard Settings keyboardSupport : true, // option arrowScroll : 50, // [px] // Other touchpadSupport : true, fixedBackground : true, excluded : "" }; var options = defaultOptions; // Other Variables var isExcluded = false; var isFrame = false; var direction = { x: 0, y: 0 }; var initDone = false; var root = document.documentElement; var activeElement; var observer; var deltaBuffer = [ 120, 120, 120 ]; var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36 }; /*********************************************** * SETTINGS ***********************************************/ var options = defaultOptions; /*********************************************** * INITIALIZE ***********************************************/ /** * Tests if smooth scrolling is allowed. Shuts down everything if not. */ function initTest() { var disableKeyboard = false; // disable keyboard support if anything above requested it if (disableKeyboard) { removeEvent("keydown", keydown); } if (options.keyboardSupport && !disableKeyboard) { addEvent("keydown", keydown); } } /** * Sets up scrolls array, determines if frames are involved. */ function init() { if (!document.body) return; var body = document.body; var html = document.documentElement; var windowHeight = window.innerHeight; var scrollHeight = body.scrollHeight; // check compat mode for root element root = (document.compatMode.indexOf('CSS') >= 0) ? html : body; activeElement = body; initTest(); initDone = true; // Checks if this script is running in a frame if (top != self) { isFrame = true; } /** * This fixes a bug where the areas left and right to * the content does not trigger the onmousewheel event * on some pages. e.g.: html, body { height: 100% } */ else if (scrollHeight > windowHeight && (body.offsetHeight <= windowHeight || html.offsetHeight <= windowHeight)) { // DOMChange (throttle): fix height var pending = false; var refresh = function () { if (!pending && html.scrollHeight != document.height) { pending = true; // add a new pending action setTimeout(function () { html.style.height = document.height + 'px'; pending = false; }, 500); // act rarely to stay fast } }; html.style.height = 'auto'; setTimeout(refresh, 10); // clearfix if (root.offsetHeight <= windowHeight) { var underlay = document.createElement("div"); underlay.style.clear = "both"; body.appendChild(underlay); } } // disable fixed background if (!options.fixedBackground && !isExcluded) { body.style.backgroundAttachment = "scroll"; html.style.backgroundAttachment = "scroll"; } } /************************************************ * SCROLLING ************************************************/ var que = []; var pending = false; var lastScroll = +new Date; /** * Pushes scroll actions to the scrolling queue. */ function scrollArray(elem, left, top, delay) { delay || (delay = 1000); directionCheck(left, top); if (options.accelerationMax != 1) { var now = +new Date; var elapsed = now - lastScroll; if (elapsed < options.accelerationDelta) { var factor = (1 + (30 / elapsed)) / 2; if (factor > 1) { factor = Math.min(factor, options.accelerationMax); left *= factor; top *= factor; } } lastScroll = +new Date; } // push a scroll command que.push({ x: left, y: top, lastX: (left < 0) ? 0.99 : -0.99, lastY: (top < 0) ? 0.99 : -0.99, start: +new Date }); // don't act if there's a pending queue if (pending) { return; } var scrollWindow = (elem === document.body); var step = function (time) { var now = +new Date; var scrollX = 0; var scrollY = 0; for (var i = 0; i < que.length; i++) { var item = que[i]; var elapsed = now - item.start; var finished = (elapsed >= options.animationTime); // scroll position: [0, 1] var position = (finished) ? 1 : elapsed / options.animationTime; // easing [optional] if (options.pulseAlgorithm) { position = pulse(position); } // only need the difference var x = (item.x * position - item.lastX) >> 0; var y = (item.y * position - item.lastY) >> 0; // add this to the total scrolling scrollX += x; scrollY += y; // update last values item.lastX += x; item.lastY += y; // delete and step back if it's over if (finished) { que.splice(i, 1); i--; } } // scroll left and top if (scrollWindow) { window.scrollBy(scrollX, scrollY); } else { if (scrollX) elem.scrollLeft += scrollX; if (scrollY) elem.scrollTop += scrollY; } // clean up if there's nothing left to do if (!left && !top) { que = []; } if (que.length) { requestFrame(step, elem, (delay / options.frameRate + 1)); } else { pending = false; } }; // start a new queue of actions requestFrame(step, elem, 0); pending = true; } /*********************************************** * EVENTS ***********************************************/ /** * Mouse wheel handler. * @param {Object} event */ function wheel(event) { if (!initDone) { init(); } var target = event.target; var overflowing = overflowingAncestor(target); // use default if there's no overflowing // element or default action is prevented if (!overflowing || event.defaultPrevented || isNodeName(activeElement, "embed") || (isNodeName(target, "embed") && /\.pdf/i.test(target.src))) { return true; } var deltaX = event.wheelDeltaX || 0; var deltaY = event.wheelDeltaY || 0; // use wheelDelta if deltaX/Y is not available if (!deltaX && !deltaY) { deltaY = event.wheelDelta || 0; } // check if it's a touchpad scroll that should be ignored if (!options.touchpadSupport && isTouchpad(deltaY)) { return true; } // scale by step size // delta is 120 most of the time // synaptics seems to send 1 sometimes if (Math.abs(deltaX) > 1.2) { deltaX *= options.stepSize / 120; } if (Math.abs(deltaY) > 1.2) { deltaY *= options.stepSize / 120; } scrollArray(overflowing, -deltaX, -deltaY); event.preventDefault(); } /** * Keydown event handler. * @param {Object} event */ function keydown(event) { var target = event.target; var modifier = event.ctrlKey || event.altKey || event.metaKey || (event.shiftKey && event.keyCode !== key.spacebar); // do nothing if user is editing text // or using a modifier key (except shift) // or in a dropdown if ( /input|textarea|select|embed/i.test(target.nodeName) || target.isContentEditable || event.defaultPrevented || modifier ) { return true; } // spacebar should trigger button press if (isNodeName(target, "button") && event.keyCode === key.spacebar) { return true; } var shift, x = 0, y = 0; var elem = overflowingAncestor(activeElement); var clientHeight = elem.clientHeight; if (elem == document.body) { clientHeight = window.innerHeight; } switch (event.keyCode) { case key.up: y = -options.arrowScroll; break; case key.down: y = options.arrowScroll; break; case key.spacebar: // (+ shift) shift = event.shiftKey ? 1 : -1; y = -shift * clientHeight * 0.9; break; case key.pageup: y = -clientHeight * 0.9; break; case key.pagedown: y = clientHeight * 0.9; break; case key.home: y = -elem.scrollTop; break; case key.end: var damt = elem.scrollHeight - elem.scrollTop - clientHeight; y = (damt > 0) ? damt+10 : 0; break; case key.left: x = -options.arrowScroll; break; case key.right: x = options.arrowScroll; break; default: return true; // a key we don't care about } scrollArray(elem, x, y); event.preventDefault(); } /** * Mousedown event only for updating activeElement */ function mousedown(event) { activeElement = event.target; } /*********************************************** * OVERFLOW ***********************************************/ var cache = {}; // cleared out every once in while setInterval(function () { cache = {}; }, 10 * 1000); var uniqueID = (function () { var i = 0; return function (el) { return el.uniqueID || (el.uniqueID = i++); }; })(); function setCache(elems, overflowing) { for (var i = elems.length; i--;) cache[uniqueID(elems[i])] = overflowing; return overflowing; } function overflowingAncestor(el) { var elems = []; var rootScrollHeight = root.scrollHeight; do { var cached = cache[uniqueID(el)]; if (cached) { return setCache(elems, cached); } elems.push(el); if (rootScrollHeight === el.scrollHeight) { if (!isFrame || root.clientHeight + 10 < rootScrollHeight) { return setCache(elems, document.body); // scrolling root in WebKit } } else if (el.clientHeight + 10 < el.scrollHeight) { overflow = getComputedStyle(el, "").getPropertyValue("overflow-y"); if (overflow === "scroll" || overflow === "auto") { return setCache(elems, el); } } } while (el = el.parentNode); } /*********************************************** * HELPERS ***********************************************/ function addEvent(type, fn, bubble) { window.addEventListener(type, fn, (bubble||false)); } function removeEvent(type, fn, bubble) { window.removeEventListener(type, fn, (bubble||false)); } function isNodeName(el, tag) { return (el.nodeName||"").toLowerCase() === tag.toLowerCase(); } function directionCheck(x, y) { x = (x > 0) ? 1 : -1; y = (y > 0) ? 1 : -1; if (direction.x !== x || direction.y !== y) { direction.x = x; direction.y = y; que = []; lastScroll = 0; } } var deltaBufferTimer; function isTouchpad(deltaY) { if (!deltaY) return; deltaY = Math.abs(deltaY) deltaBuffer.push(deltaY); deltaBuffer.shift(); clearTimeout(deltaBufferTimer); var allDivisable = (isDivisible(deltaBuffer[0], 120) && isDivisible(deltaBuffer[1], 120) && isDivisible(deltaBuffer[2], 120)); return !allDivisable; } function isDivisible(n, divisor) { return (Math.floor(n / divisor) == n / divisor); } var requestFrame = (function () { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || function (callback, element, delay) { window.setTimeout(callback, delay || (1000/60)); }; })(); /*********************************************** * PULSE ***********************************************/ /** * Viscous fluid with a pulse for part and decay for the rest. * - Applies a fixed force over an interval (a damped acceleration), and * - Lets the exponential bleed away the velocity over a longer interval * - Michael Herf, http://stereopsis.com/stopping/ */ function pulse_(x) { var val, start, expx; // test x = x * options.pulseScale; if (x < 1) { // acceleartion val = x - (1 - Math.exp(-x)); } else { // tail // the previous animation ended here: start = Math.exp(-1); // simple viscous drag x -= 1; expx = 1 - Math.exp(-x); val = start + (expx * (1 - start)); } return val * options.pulseNormalize; } function pulse(x) { if (x >= 1) return 1; if (x <= 0) return 0; if (options.pulseNormalize == 1) { options.pulseNormalize /= pulse_(1); } return pulse_(x); } var isChrome = /chrome/i.test(window.navigator.userAgent); var wheelEvent = null; if ("onwheel" in document.createElement("div")) wheelEvent = "wheel"; else if ("onmousewheel" in document.createElement("div")) wheelEvent = "mousewheel"; if (wheelEvent && isChrome) { addEvent(wheelEvent, wheel); addEvent("mousedown", mousedown); addEvent("load", init); } })(); // ---------------------------------------------------------------------------- // Vegas - Fullscreen Backgrounds and Slideshows with jQuery. // v1.3.5 - released 2014-10-13 19:56 // Licensed under the MIT license. // http://vegas.jaysalvat.com/ // ---------------------------------------------------------------------------- // Copyright (C) 2010-2014 Jay Salvat // http://jaysalvat.com/ // ---------------------------------------------------------------------------- (function($) { var $background = $("").addClass("vegas-background"), $overlay = $("
").addClass("vegas-overlay"), $loading = $("
").addClass("vegas-loading"), $current = $(), paused = null, backgrounds = [], step = 0, delay = 5e3, walk = function() {}, timer, methods = { init: function(settings) { var options = { src: getBackground(), align: "center", valign: "center", fade: 0, loading: true, load: function() {}, complete: function() {} }; $.extend(options, $.vegas.defaults.background, settings); if (options.loading) { loading(); } var $new = $background.clone(); $new.css({ position: "fixed", left: "0px", top: "0px" }).bind("load", function() { if ($new == $current) { return; } $(window).bind("load resize.vegas", function(e) { resize($new, options); }); if ($current.is("img")) { $current.stop(); $new.hide().insertAfter($current).fadeIn(options.fade, function() { $(".vegas-background").not(this).remove(); $("body").trigger("vegascomplete", [ this, step - 1 ]); options.complete.apply($new, [ step - 1 ]); }); } else { $new.hide().prependTo("body").fadeIn(options.fade, function() { $("body").trigger("vegascomplete", [ this, step - 1 ]); options.complete.apply(this, [ step - 1 ]); }); } $current = $new; resize($current, options); if (options.loading) { loaded(); } $("body").trigger("vegasload", [ $current.get(0), step - 1 ]); options.load.apply($current.get(0), [ step - 1 ]); if (step) { $("body").trigger("vegaswalk", [ $current.get(0), step - 1 ]); options.walk.apply($current.get(0), [ step - 1 ]); } }).attr("src", options.src); return $.vegas; }, destroy: function(what) { if (!what || what == "background") { $(".vegas-background, .vegas-loading").remove(); $(window).unbind("*.vegas"); $current = $(); } if (!what || what == "overlay") { $(".vegas-overlay").remove(); } clearInterval(timer); return $.vegas; }, overlay: function(settings) { var options = { src: null, opacity: null }; $.extend(options, $.vegas.defaults.overlay, settings); $overlay.remove(); $overlay.css({ margin: "0", padding: "0", position: "fixed", left: "0px", top: "0px", width: "100%", height: "100%" }); if (options.src === false) { $overlay.css("backgroundImage", "none"); } if (options.src) { $overlay.css("backgroundImage", "url(" + options.src + ")"); } if (options.opacity) { $overlay.css("opacity", options.opacity); } $overlay.prependTo("body"); return $.vegas; }, slideshow: function(settings, keepPause) { var options = { step: step, delay: delay, preload: false, loading: true, backgrounds: backgrounds, walk: walk }; $.extend(options, $.vegas.defaults.slideshow, settings); if (options.backgrounds != backgrounds) { if (!settings.step) { options.step = 0; } if (!settings.walk) { options.walk = function() {}; } if (options.preload) { $.vegas("preload", options.backgrounds); } } backgrounds = options.backgrounds; delay = options.delay; step = options.step; walk = options.walk; clearInterval(timer); if (!backgrounds.length) { return $.vegas; } var doSlideshow = function() { if (step < 0) { step = backgrounds.length - 1; } if (step >= backgrounds.length || !backgrounds[step - 1]) { step = 0; } var settings = backgrounds[step++]; settings.walk = options.walk; settings.loading = options.loading; if (typeof settings.fade == "undefined") { settings.fade = options.fade; } if (settings.fade > options.delay) { settings.fade = options.delay; } $.vegas(settings); }; doSlideshow(); if (!keepPause) { paused = false; $("body").trigger("vegasstart", [ $current.get(0), step - 1 ]); } if (!paused) { timer = setInterval(doSlideshow, options.delay); } return $.vegas; }, next: function() { var from = step; if (step) { $.vegas("slideshow", { step: step }, true); $("body").trigger("vegasnext", [ $current.get(0), step - 1, from - 1 ]); } return $.vegas; }, previous: function() { var from = step; if (step) { $.vegas("slideshow", { step: step - 2 }, true); $("body").trigger("vegasprevious", [ $current.get(0), step - 1, from - 1 ]); } return $.vegas; }, jump: function(s) { var from = step; if (step) { $.vegas("slideshow", { step: s }, true); $("body").trigger("vegasjump", [ $current.get(0), step - 1, from - 1 ]); } return $.vegas; }, stop: function() { var from = step; step = 0; paused = null; clearInterval(timer); $("body").trigger("vegasstop", [ $current.get(0), from - 1 ]); return $.vegas; }, pause: function() { paused = true; clearInterval(timer); $("body").trigger("vegaspause", [ $current.get(0), step - 1 ]); return $.vegas; }, get: function(what) { if (what === null || what == "background") { return $current.get(0); } if (what == "overlay") { return $overlay.get(0); } if (what == "step") { return step - 1; } if (what == "paused") { return paused; } }, preload: function(backgrounds) { var cache = []; for (var i in backgrounds) { if (backgrounds[i].src) { var cacheImage = document.createElement("img"); cacheImage.src = backgrounds[i].src; cache.push(cacheImage); } } return $.vegas; } }; function resize($img, settings) { var options = { align: "center", valign: "center" }; $.extend(options, settings); if ($img.height() === 0) { $img.load(function() { resize($(this), settings); }); return; } var vp = getViewportSize(), ww = vp.width, wh = vp.height, iw = $img.width(), ih = $img.height(), rw = wh / ww, ri = ih / iw, newWidth, newHeight, newLeft, newTop, properties; if (rw > ri) { newWidth = wh / ri; newHeight = wh; } else { newWidth = ww; newHeight = ww * ri; } properties = { width: newWidth + "px", height: newHeight + "px", top: "auto", bottom: "auto", left: "auto", right: "auto" }; if (!isNaN(parseInt(options.valign, 10))) { properties.top = 0 - (newHeight - wh) / 100 * parseInt(options.valign, 10) + "px"; } else if (options.valign == "top") { properties.top = 0; } else if (options.valign == "bottom") { properties.bottom = 0; } else { properties.top = (wh - newHeight) / 2; } if (!isNaN(parseInt(options.align, 10))) { properties.left = 0 - (newWidth - ww) / 100 * parseInt(options.align, 10) + "px"; } else if (options.align == "left") { properties.left = 0; } else if (options.align == "right") { properties.right = 0; } else { properties.left = (ww - newWidth) / 2; } $img.css(properties); } function loading() { $loading.prependTo("body").fadeIn(); } function loaded() { $loading.fadeOut("fast", function() { $(this).remove(); }); } function getBackground() { if ($("body").css("backgroundImage")) { return $("body").css("backgroundImage").replace(/url\("?(.*?)"?\)/i, "$1"); } } function getViewportSize() { var elmt = window, prop = "inner"; if (!("innerWidth" in window)) { elmt = document.documentElement || document.body; prop = "client"; } return { width: elmt[prop + "Width"], height: elmt[prop + "Height"] }; } $.vegas = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === "object" || !method) { return methods.init.apply(this, arguments); } else { $.error("Method " + method + " does not exist"); } }; $.vegas.defaults = { background: {}, slideshow: {}, overlay: {} }; })(jQuery); /* Vertical News Ticker 1.15 Original by: Tadas Juozapaitis ( kasp3rito [eta] gmail (dot) com ) http://www.jugbit.com/jquery-vticker-vertical-news-ticker/ Forked/Modified by: Richard Hollis @richhollis - richhollis.co.uk */ (function($){ var defaults = { speed: 700, pause: 4000, showItems: 1, mousePause: true, height: 0, animate: true, margin: 0, padding: 0, startPaused: false }; var internal = { moveUp: function(state, attribs) { internal.animate(state, attribs, 'up'); }, moveDown: function(state, attribs){ internal.animate(state, attribs, 'down'); }, animate: function(state, attribs, dir) { var height = state.itemHeight; var options = state.options; var el = state.element; var obj = el.children('ul'); var selector = (dir === 'up') ? 'li:first' : 'li:last'; el.trigger("vticker.beforeTick"); var clone = obj.children(selector).clone(true); if(options.height > 0) height = obj.children('li:first').height(); height += (options.margin) + (options.padding*2); // adjust for margins & padding if(dir==='down') obj.css('top', '-' + height + 'px').prepend(clone); if(attribs && attribs.animate) { if(state.animating) return; state.animating = true; var opts = (dir === 'up') ? {top: '-=' + height + 'px'} : {top: 0}; obj.animate(opts, options.speed, function() { $(obj).children(selector).remove(); $(obj).css('top', '0px'); state.animating = false; el.trigger("vticker.afterTick"); }); } else { obj.children(selector).remove(); obj.css('top', '0px'); el.trigger("vticker.afterTick"); } if(dir==='up') clone.appendTo(obj); }, nextUsePause: function() { var state = $(this).data('state'); var options = state.options; if(state.isPaused || state.itemCount < 2) return; methods.next.call( this, {animate:options.animate} ); }, startInterval: function() { var state = $(this).data('state'); var options = state.options; var initThis = this; state.intervalId = setInterval(function(){ internal.nextUsePause.call( initThis ); }, options.pause); }, stopInterval: function() { var state = $(this).data('state'); if(!state) return; if(state.intervalId) clearInterval(state.intervalId); state.intervalId = undefined; }, restartInterval: function() { internal.stopInterval.call(this); internal.startInterval.call(this); } }; var methods = { init: function(options) { // if init called second time then stop first, then re-init methods.stop.call(this); // init var defaultsClone = jQuery.extend({}, defaults); var options = $.extend(defaultsClone, options); var el = $(this); var state = { itemCount: el.children('ul').children('li').length, itemHeight: 0, itemMargin: 0, element: el, animating: false, options: options, isPaused: (options.startPaused) ? true : false, pausedByCode: false }; $(this).data('state', state); el.css({overflow: 'hidden', position: 'relative'}) .children('ul').css({position: 'absolute', margin: 0, padding: 0}) .children('li').css({margin: options.margin, padding: options.padding}); if(isNaN(options.height) || options.height === 0) { el.children('ul').children('li').each(function(){ var current = $(this); if(current.height() > state.itemHeight) state.itemHeight = current.height(); }); // set the same height on all child elements el.children('ul').children('li').each(function(){ var current = $(this); current.height(state.itemHeight); }); // set element to total height var box = (options.margin) + (options.padding * 2); el.height(((state.itemHeight + box) * options.showItems) + options.margin); } else { // set the preferred height el.height(options.height); } var initThis = this; if(!options.startPaused) { internal.startInterval.call( initThis ); } if(options.mousePause) { el.bind("mouseenter", function () { //if the automatic scroll is paused, don't change that. if (state.isPaused === true) return; state.pausedByCode = true; // stop interval internal.stopInterval.call( initThis ); methods.pause.call( initThis, true ); }).bind("mouseleave", function () { //if the automatic scroll is paused, don't change that. if (state.isPaused === true && !state.pausedByCode) return; state.pausedByCode = false; methods.pause.call(initThis, false); // restart interval internal.startInterval.call( initThis ); }); } }, pause: function(pauseState) { var state = $(this).data('state'); if(!state) return undefined; if(state.itemCount < 2) return false; state.isPaused = pauseState; var el = state.element; if(pauseState) { $(this).addClass('paused'); el.trigger("vticker.pause"); } else { $(this).removeClass('paused'); el.trigger("vticker.resume"); } }, next: function(attribs) { var state = $(this).data('state'); if(!state) return undefined; if(state.animating || state.itemCount < 2) return false; internal.restartInterval.call( this ); internal.moveUp(state, attribs); }, prev: function(attribs) { var state = $(this).data('state'); if(!state) return undefined; if(state.animating || state.itemCount < 2) return false; internal.restartInterval.call( this ); internal.moveDown(state, attribs); }, stop: function() { var state = $(this).data('state'); if(!state) return undefined; internal.stopInterval.call( this ); }, remove: function() { var state = $(this).data('state'); if(!state) return undefined; internal.stopInterval.call( this ); var el = state.element; el.unbind(); el.remove(); } }; $.fn.vTicker = function( method ) { if ( methods[method] ) { return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); } else if ( typeof method === 'object' || ! method ) { return methods.init.apply( this, arguments ); } else { $.error( 'Method ' + method + ' does not exist on jQuery.vTicker' ); } }; })(jQuery); /*! * Theia Sticky Sidebar v1.2.2 * https://github.com/WeCodePixels/theia-sticky-sidebar * * Glues your website's sidebars, making them permanently visible while scrolling. * * Copyright 2013-2014 WeCodePixels and other contributors * Released under the MIT license */ (function($) { $.fn.theiaStickySidebar = function(options) { var defaults = { 'containerSelector': '', 'additionalMarginTop': 0, 'additionalMarginBottom': 0, 'updateSidebarHeight': true, 'minWidth': 0 }; options = $.extend(defaults, options); // Validate options options.additionalMarginTop = parseInt(options.additionalMarginTop) || 0; options.additionalMarginBottom = parseInt(options.additionalMarginBottom) || 0; // Add CSS //$('head').append($('')); this.each(function() { var o = {}; o.sidebar = $(this); // Save options o.options = options || {}; // Get container o.container = $(o.options.containerSelector); if (o.container.size() == 0) { o.container = o.sidebar.parent(); } // Create sticky sidebar o.sidebar.parents().css('-webkit-transform', 'none'); // Fix for WebKit bug - https://code.google.com/p/chromium/issues/detail?id=20574 o.sidebar.css({ 'position': 'relative', 'overflow': 'visible', // The "box-sizing" must be set to "content-box" because we set a fixed height to this element when the sticky sidebar has a fixed position. '-webkit-box-sizing': 'border-box', '-moz-box-sizing': 'border-box', 'box-sizing': 'border-box' }); // Get the sticky sidebar element. If none has been found, then create one. o.stickySidebar = o.sidebar.find('.theiaStickySidebar'); if (o.stickySidebar.length == 0) { o.sidebar.find('script').remove(); // Remove