From 64b0a1f9294910f20388f68ad429da46974acd24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Auswo=CC=88ger?= Date: Tue, 18 Nov 2014 12:30:50 +0100 Subject: [PATCH] Updated jQuery plugin to version 1.4.1 --- assets/js/rocksolid-slider.js | 112 +++++++++++++++++++++++++----- assets/js/rocksolid-slider.min.js | 4 +- 2 files changed, 95 insertions(+), 21 deletions(-) diff --git a/assets/js/rocksolid-slider.js b/assets/js/rocksolid-slider.js index 9511c0a..854d4a0 100644 --- a/assets/js/rocksolid-slider.js +++ b/assets/js/rocksolid-slider.js @@ -1,4 +1,4 @@ -/*! rocksolid-slider v1.4.0 */ +/*! rocksolid-slider v1.4.1 */ (function($, window, document) { var Rst = {}; @@ -32,7 +32,10 @@ Rst.Slide = (function() { name: this.content.attr('data-rsts-name') || this.content.attr('title') }; - if (element.nodeName === 'IMG') { + if ( + element.nodeName.toLowerCase() === 'img' + || element.nodeName.toLowerCase() === 'picture' + ) { this.type = 'image'; } this.type = this.content.attr('data-rsts-type') || this.type || 'default'; @@ -63,7 +66,7 @@ Rst.Slide = (function() { || this.slider.device === 'iPod' ) { this.element.find('[data-rsts-background]').each(function() { - if (this.nodeName !== 'VIDEO') { + if (this.nodeName.toLowerCase() !== 'video') { return; } var $this = $(this); @@ -78,15 +81,24 @@ Rst.Slide = (function() { }); } - this.backgrounds = this.element.find('[data-rsts-background]') - .attr('autoplay', true) - .attr('loop', true) - .css({ + this.backgrounds = []; + this.element.find('[data-rsts-background]').each(function() { + var element = $(this); + if (element.is('img') && element.parent().is('picture')) { + element = element.parent(); + } + if (element.is('video')) { + element.attr('autoplay', true).attr('loop', true); + } + element.css({ position: 'absolute', top: 0, left: 0 - }) - .prependTo(this.element); + }); + self.backgrounds.push(element[0]); + }); + + this.backgrounds = $(this.backgrounds).prependTo(this.element); if (this.backgrounds.length) { this.element.children().last().css({ @@ -164,8 +176,8 @@ Rst.Slide = (function() { * @var object regular expressions for video URLs */ Slide.prototype.videoRegExp = { - youtube: /^https?:\/\/(?:www\.youtube\.com\/(?:watch\?v=|v\/|embed\/)|youtu\.be\/)([0-9a-z_\-]{11})(?:$|&|\/)/i, - vimeo: /^https?:\/\/(?:player\.)?vimeo\.com\/(?:video\/)?([0-9]+)/i + youtube: /^https?:\/\/(?:www\.youtube\.com\/(?:watch\?v=|v\/|embed\/)|youtu\.be\/)([0-9a-z_\-]{11})(?:$|&|\?|#|\/)(?:(?:.*[?&#]|)t=([0-9hms]+))?/i, + vimeo: /^https?:\/\/(?:player\.)?vimeo\.com\/(?:video\/)?([0-9]+)(?:.*#t=([0-9hms]+))?/i }; /** @@ -186,6 +198,8 @@ Rst.Slide = (function() { var autoSize = !x || !y; + this.updateResponsiveImages(true); + if (x && ! y) { this.slider.modify(this.element, {width: x, height: ''}); this.resetScaledContent(); @@ -219,6 +233,24 @@ Rst.Slide = (function() { }; + /** + * update responsive images if picturefill or respimage are present + */ + Slide.prototype.updateResponsiveImages = function(reevaluate) { + + var polyfill = window.picturefill || window.respimage; + + if (!polyfill) { + return; + } + + polyfill({ + elements: this.element.find('img').get(), + reevaluate: !!reevaluate + }); + + }; + /** * scale slide contents based on width and height */ @@ -256,7 +288,11 @@ Rst.Slide = (function() { var self = this; this.backgrounds.each(function() { - self.scaleImage($(this), x, y); + var element = $(this); + if (element.is('picture')) { + element = element.find('img').first(); + } + self.scaleImage(element, x, y); }); }; @@ -336,7 +372,7 @@ Rst.Slide = (function() { element = $(element); var size = {}; - if (element[0].nodeName === 'IMG') { + if (element[0].nodeName.toLowerCase() === 'img') { if ('naturalWidth' in new Image()) { size.x = element[0].naturalWidth; @@ -350,7 +386,7 @@ Rst.Slide = (function() { } } - else if (element[0].nodeName === 'VIDEO') { + else if (element[0].nodeName.toLowerCase() === 'video') { size.x = element[0].videoWidth; size.y = element[0].videoHeight; @@ -506,7 +542,7 @@ Rst.Slide = (function() { Slide.prototype.startVideo = function() { var self = this; - var videoId, apiCallback, matches; + var videoId, apiCallback, matches, time; this.slider.stopAutoplay(true); @@ -515,12 +551,21 @@ Rst.Slide = (function() { this.element.addClass(this.slider.options.cssPrefix + 'video-youtube'); videoId = matches[1]; + time = matches[2]; + if (time) { + time = time.split(/[hm]/).reverse(); + time[0] = parseInt(time[0] || 0, 10); + time[1] = parseInt(time[1] || 0, 10); + time[2] = parseInt(time[2] || 0, 10); + time = time[0] + (time[1] * 60) + (time[2] * 60 * 60); + } this.videoElement = $(document.createElement('iframe')) .addClass(this.slider.options.cssPrefix + 'video-iframe') .attr('src', 'http://www.youtube.com/embed/' + videoId + - '?autoplay=1&enablejsapi=1&wmode=opaque' + '?autoplay=1&enablejsapi=1&wmode=opaque' + + (time ? '&start=' + time : '') ) .attr('frameborder', 0) .attr('allowfullscreen', 'allowfullscreen') @@ -559,12 +604,14 @@ Rst.Slide = (function() { this.element.addClass(this.slider.options.cssPrefix + 'video-vimeo'); videoId = matches[1]; + time = matches[2]; this.videoElement = $(document.createElement('iframe')) .addClass(this.slider.options.cssPrefix + 'video-iframe') .attr('src', 'http://player.vimeo.com/video/' + videoId + - '?autoplay=1&api=1' + '?autoplay=1&api=1' + + (time ? '#t=' + time : '') ) .attr('frameborder', 0) .attr('allowfullscreen', 'allowfullscreen') @@ -1942,6 +1989,16 @@ Rst.Slider = (function() { if (pauseAutoplay) { this.pauseAutoplay(); } + if ( + this.elements.main.css('position') === 'static' + || this.elements.main.css('position') === 'relative' + ) { + // Prevent scrolling issues, see #18 + this.elements.main.css( + 'margin-bottom', + this.elements.main.outerHeight(true) + 100 + 'px' + ); + } this.elements.view.css({display: 'none'}); if (this.nav.elements.main) { this.nav.elements.main.css({display: 'none'}); @@ -1963,6 +2020,7 @@ Rst.Slider = (function() { if (this.elements.footer) { this.elements.footer.css({display: ''}); } + this.elements.main.css('margin-bottom', ''); if (pauseAutoplay) { this.playAutoplay(); } @@ -2142,7 +2200,20 @@ Rst.Slider = (function() { move: 'mousemove' }; - if (window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints) { + if (window.navigator.pointerEnabled && window.navigator.maxTouchPoints) { + eventNames = { + start: 'pointerdown', + stop: 'pointerup', + move: 'pointermove' + }; + this.elements.crop.css('touch-action', 'pan-' + (this.options.direction === 'x' ? 'y' : 'x') + ' pinch-zoom double-tap-zoom'); + this.elements.main.on('pointerdown', function(event) { + if (event.originalEvent.pointerType === 'touch') { + self.setTouch(true); + } + }); + } + else if (window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints) { eventNames = { start: 'MSPointerDown', stop: 'MSPointerUp', @@ -2196,7 +2267,10 @@ Rst.Slider = (function() { } // detect mouse or touch event - if (window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints) { + if (window.navigator.pointerEnabled && window.navigator.maxTouchPoints) { + this.setTouch(event.originalEvent.pointerType === 'touch'); + } + else if (window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints) { this.setTouch(event.originalEvent.pointerType === event.originalEvent.MSPOINTER_TYPE_TOUCH); } else { diff --git a/assets/js/rocksolid-slider.min.js b/assets/js/rocksolid-slider.min.js index eedd34f..05e9644 100644 --- a/assets/js/rocksolid-slider.min.js +++ b/assets/js/rocksolid-slider.min.js @@ -1,5 +1,5 @@ -/*! rocksolid-slider v1.4.0 */ -(function(d,c,a){var b={};b.Slide=(function(){function e(i,j){var h=this;this.slider=j;this.content=d(i);this.data={name:this.content.attr("data-rsts-name")||this.content.attr("title")};if(i.nodeName==="IMG"){this.type="image"}this.type=this.content.attr("data-rsts-type")||this.type||"default";this.centerContent=this.content.attr("data-rsts-center")!==undefined?this.content.attr("data-rsts-center"):j.options.centerContent;if(this.centerContent!=="x"&&this.centerContent!=="y"){this.centerContent=!!this.centerContent}if(this.type==="image"||this.type==="video"){this.centerContent=false}this.element=d(a.createElement("div")).addClass(j.options.cssPrefix+"slide").addClass(j.options.cssPrefix+"slide-"+this.type).append(i);if(!a.createElement("video").canPlayType||this.slider.device==="iPhone"||this.slider.device==="iPod"){this.element.find("[data-rsts-background]").each(function(){if(this.nodeName!=="VIDEO"){return}var k=d(this);if(k.attr("poster")){d(a.createElement("img")).attr("src",k.attr("poster")).attr("data-rsts-background","").attr("data-rsts-scale-mode",k.attr("data-rsts-scale-mode")).insertBefore(k)}k.detach()})}this.backgrounds=this.element.find("[data-rsts-background]").attr("autoplay",true).attr("loop",true).css({position:"absolute",top:0,left:0}).prependTo(this.element);if(this.backgrounds.length){this.element.children().last().css({position:"relative"});if(this.backgrounds.filter("video").length){this.element.children().last().css({"-webkit-transform":"translateZ(0)"})}}this.element.find("video[autoplay]").each(function(){if(this.pause){this.pause()}});if(this.type==="image"){this.data.name=this.data.name||this.element.find("img").last().attr("alt")}if(this.data.name&&j.options.captions){d(a.createElement("div")).addClass(j.options.cssPrefix+"caption").text(this.data.name).appendTo(this.element)}var g=function(){j.resize();if(j.css3Supported){j.elements.crop.css("transform","");j.elements.crop.css("transform");j.elements.crop.css("transform","translateZ(0)")}};this.element.find("img").on("load",g);this.element.find("video").on("loadedmetadata",g);var f=this.element.find("h1,h2,h3,h4,h5,h6");if(!this.data.name&&f.length){this.data.name=f.text()}if(this.type==="video"){this.data.video=this.content.attr("data-rsts-video");d(a.createElement("a")).attr("href",this.data.video).text("play").addClass(this.slider.options.cssPrefix+"video-play").on("click",function(k){k.preventDefault();h.startVideo()}).appendTo(this.element)}this.setState("inactive")}e.prototype.videoRegExp={youtube:/^https?:\/\/(?:www\.youtube\.com\/(?:watch\?v=|v\/|embed\/)|youtu\.be\/)([0-9a-z_\-]{11})(?:$|&|\/)/i,vimeo:/^https?:\/\/(?:player\.)?vimeo\.com\/(?:video\/)?([0-9]+)/i};e.prototype.isInjected=function(){return !!(this.element.get(0).parentNode&&this.element.get(0).parentNode.tagName)};e.prototype.size=function(g,i,h){var f=!g||!i;if(g&&!i){this.slider.modify(this.element,{width:g,height:""});this.resetScaledContent();if(h||this.backgrounds.length){i=this.element.outerHeight()}}else{if(i&&!g){this.slider.modify(this.element,{height:i,width:""});this.resetScaledContent();if(h||this.backgrounds.length){g=this.element.outerWidth()}}else{if(g&&i){this.slider.modify(this.element,{width:g,height:i})}else{this.resetScaledContent();g=this.element.outerWidth();i=this.element.outerHeight()}}}this.scaleContent(g,i,f);this.scaleBackground(g,i);return{x:g,y:i}};e.prototype.scaleContent=function(g,h,f){if(this.centerContent){if(this.content.css("display")==="inline"){this.content.css("display","inline-block")}if(this.centerContent!=="y"&&g){this.content.css("margin-left",Math.round((g-this.content.outerWidth())/2))}if(this.centerContent!=="x"&&h){this.content.css("margin-top",Math.round((h-this.content.outerHeight())/2))}}if(!f&&(this.type==="image"||this.type==="video")){this.scaleImage(this.element.find("img").last(),g,h)}};e.prototype.scaleBackground=function(f,h){var g=this;this.backgrounds.each(function(){g.scaleImage(d(this),f,h)})};e.prototype.scaleImage=function(f,m,l){var n=f.attr("data-rsts-scale-mode")||this.slider.options.scaleMode;var g=f.attr("data-rsts-position")||this.slider.options.imagePosition;var i=this.getOriginalSize(f);if(!i.x||!i.y){return}var j=i.x/i.y;var k=m/l;var h={width:i.x,height:i.y,"min-width":0,"min-height":0,"max-width":"none","max-height":"none"};if(n==="fit"||n==="crop"){if((j>=k&&n==="fit")||(j<=k&&n==="crop")){h.width=m;h.height=m/j}else{h.width=l*j;h.height=l}}else{if(n==="scale"){h.width=m;h.height=l}}h["margin-top"]=(l-h.height)/2;h["margin-left"]=(m-h.width)/2;if(g==="top"||g==="top-left"||g==="top-right"){h["margin-top"]=0}else{if(g==="bottom"||g==="bottom-left"||g==="bottom-right"){h["margin-top"]=l-h.height}}if(g==="left"||g==="top-left"||g==="bottom-left"){h["margin-left"]=0}else{if(g==="right"||g==="top-right"||g==="bottom-right"){h["margin-left"]=m-h.width}}f.css(h)};e.prototype.getOriginalSize=function(h){h=d(h);var g={};if(h[0].nodeName==="IMG"){if("naturalWidth" in new Image()){g.x=h[0].naturalWidth;g.y=h[0].naturalHeight}else{var f=new Image();f.src=h[0].src;g.x=f.width;g.y=f.height}}else{if(h[0].nodeName==="VIDEO"){g.x=h[0].videoWidth;g.y=h[0].videoHeight}}if(!g.x||!g.y){if(h.attr("width")||h.attr("height")){g.x=parseFloat(h.attr("width")||h.attr("height"));g.y=parseFloat(h.attr("height")||h.attr("width"))}else{g.x=g.y=0}}return g};e.prototype.resetScaledContent=function(f,h){var g=this.element.find("img").last();if(this.type==="image"||this.type==="video"){g.css({width:"",height:"","min-width":"","min-height":"","max-width":"","max-height":"","margin-left":"","margin-top":""})}if(this.centerContent){this.content.css({"margin-left":"","margin-top":""})}};e.prototype.setState=function(g){if(g==="active"&&g!==this.state&&this.state!=="preactive"){this.setState("preactive");this.element.css("opacity")}if(this.type==="video"&&this.state&&g==="inactive"&&g!==this.state){this.stopVideo()}if(this.type==="video"&&this.state&&g==="active"&&g!==this.state&&this.slider.options.videoAutoplay){this.startVideo()}if((g==="preactive"||g==="active")&&g!==this.state){this.element.find("video[autoplay]").each(function(){if(this.play){this.play()}})}else{if(g!=="active"&&g!=="preactive"&&(this.state==="active"||this.state==="preactive")){this.element.find("video").each(function(){if(this.pause){this.pause()}})}}this.state=g;var f=this.slider.options.cssPrefix;this.element.removeClass(f+"active").removeClass(f+"inactive").removeClass(f+"preactive").removeClass(f+"postactive").addClass(f+g)};e.prototype.stopVideo=function(g,f){if(this.eventNamespace){d(c).off("message."+this.eventNamespace);delete this.eventNamespace}if(this.videoElement){this.videoElement.attr("src","");this.videoElement.remove();delete this.videoElement}if(this.videoStopButton){this.videoStopButton.remove();delete this.videoStopButton}this.slider.elements.main.removeClass(this.slider.options.cssPrefix+"video-playing");if(g&&this.slider.options.autoplayRestart){this.slider.autoplay(200)}else{if(f){this.slider.stopAutoplay()}}};e.prototype.startVideo=function(){var f=this;var i,g,h;this.slider.stopAutoplay(true);if((h=this.data.video.match(this.videoRegExp.youtube))){this.element.addClass(this.slider.options.cssPrefix+"video-youtube");i=h[1];this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src","http://www.youtube.com/embed/"+i+"?autoplay=1&enablejsapi=1&wmode=opaque").attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element);g=function(){if(f.videoElement&&c.YT){new YT.Player(f.videoElement.get(0),{events:{onStateChange:function(j){if(j.data===YT.PlayerState.ENDED){f.stopVideo(true)}}}})}};if(c.YT&&YT.Player){g()}else{d(a.createElement("script")).attr("src","//www.youtube.com/iframe_api").appendTo(a.head);c.onYouTubeIframeAPIReady=function(){delete c.onYouTubeIframeAPIReady;g()}}}else{if((h=this.data.video.match(this.videoRegExp.vimeo))){this.element.addClass(this.slider.options.cssPrefix+"video-vimeo");i=h[1];this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src","http://player.vimeo.com/video/"+i+"?autoplay=1&api=1").attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element);this.eventNamespace="rsts"+new Date().getTime();d(c).on("message."+this.eventNamespace,function(j){var k=JSON.parse(j.originalEvent.data);if(k&&k.event){if(k.event==="ready"){f.videoElement.get(0).contentWindow.postMessage('{"method":"addEventListener","value":"finish"}',f.videoElement.attr("src").split("?")[0])}else{if(k.event==="finish"){f.stopVideo(true)}}}})}else{this.element.addClass(this.slider.options.cssPrefix+"video-unknown");this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src",this.data.video).attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element)}}if(this.slider.device==="iPad"){this.element.addClass(this.slider.options.cssPrefix+"video-ipad")}this.videoStopButton=d(a.createElement("a")).attr("href",this.data.video).text("stop").addClass(this.slider.options.cssPrefix+"video-stop").on("click",function(j){j.preventDefault();f.stopVideo(false,true)}).appendTo(this.element);this.slider.elements.main.addClass(this.slider.options.cssPrefix+"video-playing")};e.prototype.setIndex=function(f){this.data.index=f};e.prototype.getData=function(){return this.data};return e})();b.Slider=(function(){function e(i,h){var g=this;this.slides=[];this.elements={};this.elements.main=i;this.options=d.extend({},this.defaultOptions,h);if(this.options.height==="auto"&&this.options.direction==="y"){throw new Error('height "auto" with direction "y" ist not possible')}if(this.options.type!=="slide"){this.options.visibleArea=1;this.options.visibleAreaMax=0;this.options.slideMaxCount=0;this.options.slideMinSize=0}this.checkCss3Support();this.readSlides();if(this.options.random){this.slides.sort(function(){return Math.random()-0.5})}d.each(this.slides,function(k){this.setIndex(k)});this.slideIndex=this.getIndexFromUrl();if(this.slideIndex===false){this.slideIndex=0}this.activeSlideOffset=0;d(c).on("hashchange.rsts",function(){var k=g.getIndexFromUrl();if(k!==false&&k!==g.slideIndex){g.goTo(k)}});this.elements.main.addClass(this.options.cssPrefix+"main").addClass(this.options.cssPrefix+"direction-"+this.options.direction).addClass(this.options.cssPrefix+"type-"+this.options.type).addClass(this.options.cssPrefix+"skin-"+this.options.skin);if(this.options.direction==="x"&&this.options.height==="normalize"){this.normalizeSize=true;this.options.height="auto"}else{if(this.options.direction==="x"&&(this.options.height==="auto"||(this.options.height==="css"&&this.elements.main.height()<1))){this.autoSize=true}else{if(this.options.direction==="y"&&this.options.width==="normalize"){this.normalizeSize=true;this.options.width="auto"}else{if(this.options.direction==="y"&&(this.options.width==="auto"||(this.options.width==="css"&&this.elements.main.width()<1))){this.autoSize=true}}}}var j=this.options.width.match(/([0-9.]+)[^0-9.]*x[^0-9.]*([0-9.]+)/i);if(j){this.proportion=j[1]/j[2];delete this.options.width}j=this.options.height.match(/([0-9.]+)[^0-9.]*x[^0-9.]*([0-9.]+)/i);if(j){this.proportion=j[1]/j[2];delete this.options.height}if(this.options.width&&this.options.width!=="css"){this.elements.main.css({width:this.options.width});if(this.options.width==="auto"){this.options.width="css"}}if(this.options.height&&this.options.height!=="css"){this.elements.main.css({height:this.options.height})}if(this.elements.header){this.elements.header.addClass(this.options.cssPrefix+"header").appendTo(this.elements.main)}this.elements.view=d(a.createElement("div")).addClass(this.options.cssPrefix+"view").appendTo(this.elements.main);this.elements.crop=d(a.createElement("div")).addClass(this.options.cssPrefix+"crop").on("scroll",function(){d(this).scrollLeft(0).scrollTop(0)}).appendTo(this.elements.view);this.elements.slides=d(a.createElement("div")).addClass(this.options.cssPrefix+"slides").appendTo(this.elements.crop);if(this.options.autoplay&&this.options.autoplayProgress){this.elements.progress=d(a.createElement("div")).addClass(this.options.cssPrefix+"progress").appendTo(this.elements.view);this.elements.progressBar=d(a.createElement("div")).appendTo(this.elements.progress)}if(this.options.visibleArea<1||this.options.visibleAreaMax){this.elements.overlayPrev=d(a.createElement("div")).addClass(this.options.cssPrefix+"overlay-prev").appendTo(this.elements.view);this.elements.overlayNext=d(a.createElement("div")).addClass(this.options.cssPrefix+"overlay-next").appendTo(this.elements.view)}this.nav=new b.SliderNav(this);if(this.elements.footer){this.elements.footer.addClass(this.options.cssPrefix+"footer").appendTo(this.elements.main)}this.preloadSlides(this.slideIndex);this.cleanupSlides();d(c).on("resize.rsts",function(){g.resize()});this.resize();this.nav.combineItems();if(this.options.type==="slide"){this.setDragEvents()}else{this.modify(this.slides[this.slideIndex].element,{opacity:1})}if(this.css3Supported){this.elements.slides.on("transitionend webkitTransitionEnd oTransitionEnd msTransitionEnd",function(k){if((g.options.type==="slide"&&k.target===g.elements.slides.get(0))||(g.options.type!=="slide"&&k.target.parentNode===g.elements.slides.get(0))){g.cleanupSlides()}});this.elements.crop.css({transform:"translateZ(0)"})}this.autoplay();if(this.options.pauseAutoplayOnHover){this.elements.view.on("mouseenter",function(){if(!g.isTouch){g.pauseAutoplay()}});this.elements.view.on("mouseleave",function(){g.playAutoplay()})}this.isVisible=true;d(a).on("visibilitychange webkitvisibilitychange",function(k){g.checkVisibility()});var f;d(c).on("scroll",function(k){clearTimeout(f);f=setTimeout(function(){g.checkVisibility()},100)});this.checkVisibility();if(this.options.keyboard){d(a.body).on("keydown.rsts",function(m){var l=g.options.direction==="x"?37:38;var k=g.options.direction==="x"?39:40;if((m.which===l||m.which===k)&&(m.target===a.body||d(m.target).closest(g.elements.main).length)){if(m.which===l){g.prev()}else{g.next()}}})}}e.prototype.defaultOptions={type:"slide",direction:"x",visibleArea:1,visibleAreaMax:0,random:false,loop:false,cssPrefix:"rsts-",skin:"default",width:"css",height:"css",preloadSlides:2,slideMaxCount:0,slideMinSize:0,combineNavItems:true,prevNextSteps:0,centerContent:false,gapSize:20,duration:400,autoplay:false,videoAutoplay:false,autoplayRestart:false,autoplayProgress:false,pauseAutoplayOnHover:false,navType:"bullets",controls:true,scaleMode:"fit",imagePosition:"center",deepLinkPrefix:false,keyboard:true,captions:true};e.prototype.goTo=function(n,u,g){var v=this;if(!g){this.stopAutoplay()}var s=this.getVisibleSlidesCount();var j=false;var m=0;var q=this.slideIndex;var p=n-this.slideIndex<0?-1:n===this.slideIndex?0:1;if((n<0||n>this.slides.length-1)&&this.options.loop){m=n-this.slideIndex;while(n<0){n+=this.slides.length}while(n>this.slides.length-1){n-=this.slides.length}}else{if((n<0||n>this.slides.length-s)&&!this.options.loop){if(this.options.type!=="slide"){return}j=n<0?-1:1;n=n<0?0:this.slides.length-s}}if(!j&&this.slideIndex===n&&!u){return}var o=[];for(var l=this.slideIndex;l<=this.slideIndex+s-1;l++){o.push(l>=this.slides.length?l-this.slides.length:l)}var r=[];for(l=n;l<=n+s-1;l++){r.push(l>=this.slides.length?l-this.slides.length:l)}d.each(o,function(x,y){if(d.inArray(y,r)===-1){v.slides[y].setState("postactive")}});d.each(r,function(x,y){if(d.inArray(y,o)===-1){v.slides[y].setState("preactive")}});var h=this.slideSize+this.getGapSize();if(m){this.activeSlideOffset+=h*m}else{if(n>this.slideIndex&&n-this.slideIndex-s>this.options.preloadSlides*2){this.activeSlideOffset+=(this.options.preloadSlides*2+s)*h}else{if(nthis.options.preloadSlides*2){this.activeSlideOffset-=(this.options.preloadSlides*2+s)*h}else{this.activeSlideOffset+=(n-this.slideIndex)*h}}}this.slideIndex=n;var f=true;if(!u){f=false}else{d.each(r,function(x,y){if(!v.slides[y].isInjected()||Math.round(v.slides[y].element.position()[{x:"left",y:"top"}[v.options.direction]])!==Math.round(v.getSlideOffset(v.slideIndex+x))){f=false;return false}})}if(f){this.preloadOnCleanup=true}else{this.preloadSlides(n,q)}var w=this.getViewSize(n);var k;var t=-this.getSlideOffset(n)+Math.round(w[this.options.direction]*(1-this.visibleAreaRate)/2);if(u&&!j){k=Math.abs((this.getOffset(this.elements.slides)-t)/h)}else{if(u&&j){k=0.7}}if(this.options.type==="slide"){this.modify(this.elements.slides,{offset:t},true,k,u,!u&&j)}else{if(this.options.type==="fade"){this.modify(this.slides[this.slideIndex].element,{opacity:1},true)}else{if(this.options.type==="side-slide"){this.modify(this.slides[this.slideIndex].element,{offset:p*this.slideSize});this.slides[this.slideIndex].element.position();this.modify(this.slides[this.slideIndex].element,{offset:0},true)}else{this.modify(this.slides[this.slideIndex].element,{},true)}}}if(this.autoSize){this.modify(this.elements.crop,{width:w.x,height:w.y},true,k,u)}this.elements.main.trigger({type:"rsts-slidestart",rstSlider:this})};e.prototype.getIndexFromUrl=function(){if(!this.options.deepLinkPrefix){return false}var f="#"+this.options.deepLinkPrefix;if(c.location.hash.substr(0,f.length)===f){var g=Math.abs(parseInt(c.location.hash.substr(f.length),10));if(g){if(g>this.slides.length){g=this.slides.length}return g-1}}return 0};e.prototype.stopAutoplay=function(g){var f=this;clearTimeout(this.autoplayTimeout);clearInterval(this.autoplayInterval);this.autoplayStopped=true;if(this.options.autoplay&&this.options.autoplayProgress){this.elements.progress.removeClass(this.options.cssPrefix+"progress-active")}if(this.options.autoplayRestart&&!g){this.autoplayTimeout=setTimeout(function(){f.autoplay()},this.options.autoplayRestart-this.options.autoplay)}};e.prototype.pauseAutoplay=function(){if(!this.options.autoplay||this.autoplayPaused){return}if(!this.autoplayStopped){clearTimeout(this.autoplayTimeout);clearInterval(this.autoplayInterval)}this.autoplayPaused=true;if(this.options.autoplay&&this.options.autoplayProgress&&!this.autoplayStopped){this.pauseAutoplayProgressBar()}};e.prototype.playAutoplay=function(){if(!this.options.autoplay||!this.autoplayPaused){return}this.autoplayPaused=false;if(!this.autoplayStopped){this.autoplay((1-(this.options.autoplayProgress?this.elements.progressBar.outerWidth()/this.elements.progress.width():0))*this.options.autoplay)}};e.prototype.autoplay=function(g){var f=this;if(!this.options.autoplay){return}clearTimeout(this.autoplayTimeout);clearInterval(this.autoplayInterval);this.autoplayStopped=false;if(this.autoplayPaused){this.pauseAutoplayProgressBar(0);return}g=(g||g===0)?g:(this.options.autoplay-this.options.duration);this.startAutoplayProgressBar(g);var h=function(){var j=f.getVisibleSlidesCount();var i=f.slideIndex+(Math.min(f.options.prevNextSteps,j)||j);if(i>f.slides.length-j&&!f.options.loop){if(f.slideIndexthis.slides.length-g&&this.slideIndex0){f=0}this.goTo(f)};e.prototype.readSlides=function(){var f=this;this.elements.main.children().each(function(){var g=d(this);if(g.is('h1, h2, h3, h4, h5, h6, [data-rsts-type="header"]')){if(!f.elements.header){f.elements.header=d(a.createElement("div"))}g.appendTo(f.elements.header)}else{if(g.is('[data-rsts-type="footer"]')){if(!f.elements.footer){f.elements.footer=d(a.createElement("div"))}g.appendTo(f.elements.footer)}else{f.slides.push(new b.Slide(this,f))}}});this.elements.main.empty();if(this.slides.length===0){throw new Error("No slides found")}};e.prototype.preloadSlides=function(j,k){var o=this;var p=this.getViewSizeFixed();p[this.options.direction]=this.slideSize;var n=this.getVisibleSlidesCount();var f=0;if(this.options.type==="slide"){if(this.options.loop){f=Math.min(Math.floor((this.slides.length-n)/2),this.options.preloadSlides)}else{f=this.options.preloadSlides}}var m=[];for(var g=j;g<=j+n-1;g++){m.push(g>=this.slides.length?g-this.slides.length:g)}var h,l;for(g=j-f;g<=j+f+n-1;g++){l=g<0?g+this.slides.length:g>=this.slides.length?g-this.slides.length:g;h=this.slides[l];if(o.options.type==="slide"){if(!this.options.loop&&(g<0||g>=this.slides.length)){continue}if(k!==undefined&&d.inArray(l,m)===-1&&(g<0||g>=this.slides.length)&&h.isInjected()){this.preloadOnCleanup=true;continue}o.modify(h.element,{offset:o.getSlideOffset(g)})}if(!h.isInjected()){if(o.options.type==="fade"){o.modify(h.element,{opacity:0})}o.elements.slides.append(h.element);h.size(p.x,p.y)}else{if(o.options.type!=="slide"&&g===o.slideIndex&&h.element.next().length){if(o.options.type==="fade"){if(h.element.next().length===1){o.modify(h.element,{opacity:1-h.element.next().css("opacity")});o.modify(h.element.next(),{opacity:1})}else{o.modify(h.element,{opacity:0})}}o.elements.slides.append(h.element)}}}};e.prototype.cleanupSlides=function(){clearTimeout(this.cleanupSlidesTimeout);var g=this;var k=this.getVisibleSlidesCount();var l=this.options.type==="slide"?this.options.preloadSlides:0;var h=[];var m=[];for(var j=this.slideIndex-l;j<=this.slideIndex+l+k-1;j++){h.push(j<0?j+this.slides.length:j>=this.slides.length?j-this.slides.length:j)}for(j=this.slideIndex;j<=this.slideIndex+k-1;j++){m.push(j>=this.slides.length?j-this.slides.length:j)}d.each(this.slides,function(o,n){if(n.isInjected()&&d.inArray(o,h)===-1){if(g.options.type==="fade"&&g.slides[g.slideIndex].element.css("opacity")<1){return}if(g.options.type==="side-slide"){var p=g.options.direction==="x"?"left":"top";if(g.slides[g.slideIndex].element.position()[p]!==0){return}}n.element.detach()}if(d.inArray(o,m)===-1&&n.state!=="inactive"){n.setState("inactive")}});this.nav.setActive(m);d.each(m,function(n,o){g.slides[o].setState("active")});if(this.options.deepLinkPrefix&&this.getIndexFromUrl()!==this.slideIndex){if(this.slideIndex){c.location.hash="#"+this.options.deepLinkPrefix+(this.slideIndex+1)}else{if(c.history&&c.history.pushState){c.history.pushState("",a.title,c.location.pathname+c.location.search)}else{var f={x:d(c).scrollLeft(),y:d(c).scrollTop()};c.location.hash="";d(c).scrollLeft(f.x);d(c).scrollTop(f.y)}}}if(this.preloadOnCleanup){this.preloadOnCleanup=false;this.preloadSlides(this.slideIndex)}this.elements.main.trigger({type:"rsts-slidestop",rstSlider:this})};e.prototype.getSlideOffset=function(f){var g=this.getViewSizeFixed(true);return(f-this.slideIndex)*(this.slideSize+this.getGapSize())+this.activeSlideOffset};e.prototype.getVisibleSlidesCount=function(){if(!this.options.slideMaxCount&&!this.options.slideMinSize){return 1}var f=Math.round(this.getViewSizeFixed(true)[this.options.direction]*this.visibleAreaRate);var h=this.getGapSize();var g=this.options.slideMaxCount;if(!g||(f-(h*(g-1)))/gthis.options.visibleAreaMax){this.visibleAreaRate=this.options.visibleAreaMax/(this.options.direction==="x"?f:j)}var i=this.getGapSize();var h=this.getVisibleSlidesCount();this.slideSize=Math.round((((this.options.direction==="x"?f:j)*this.visibleAreaRate)-(i*(h-1)))/h);return d.extend({},this.viewSizeFixedCache)};e.prototype.getViewSize=function(j){j=j||0;var n=this.getViewSizeFixed();var o=n[this.options.direction];n[this.options.direction]=this.slideSize;if(!n.x||!n.y){var l=this.getVisibleSlidesCount();var k=!n.x?"x":"y";var m,g,h;for(var f=j;f<=j+l-1;f++){m=f>=this.slides.length?f-this.slides.length:f;g=this.slides[m].size(n.x,n.y,true);h=Math.max(h||0,g[k])}n[k]=Math.max(10,h||0)}n[this.options.direction]=o;return n};e.prototype.getGapSize=function(){var f=this.options.gapSize;if(typeof f==="string"&&f.slice(-1)==="%"){f=f.split("%")[0].split(",").join(".")*this.getViewSizeFixed(true)[this.options.direction]/100}return Math.round(parseFloat(f))||0};e.prototype.resize=function(){var i=this;var l=this.getVisibleSlidesCount();var k,f;var h=!this.autoplayPaused;if(this.options.direction==="x"&&this.options.height==="css"){if(h){this.pauseAutoplay()}this.elements.view.css({display:"none"});if(this.nav.elements.main){this.nav.elements.main.css({display:"none"})}if(this.elements.header){this.elements.header.css({display:"none"})}if(this.elements.footer){this.elements.footer.css({display:"none"})}this.autoSize=this.elements.main.height()<1;this.elements.view.css({display:""});if(this.nav.elements.main){this.nav.elements.main.css({display:""})}if(this.elements.header){this.elements.header.css({display:""})}if(this.elements.footer){this.elements.footer.css({display:""})}if(h){this.playAutoplay()}}var j=this.getViewSize(this.slideIndex);if(this.normalizeSize){this.normalizedSize=0;d.each(this.slides,function(o,m){var n=true;if(!m.isInjected()){n=false;i.elements.slides.append(m.element)}i.normalizedSize=Math.max(i.normalizedSize,m.size(i.options.direction==="x"?i.slideSize:null,i.options.direction==="y"?i.slideSize:null,true)[i.options.direction==="x"?"y":"x"]);if(!n){m.element.detach()}});j=this.getViewSize(this.slideIndex)}this.modify(this.elements.crop,{width:j.x,height:j.y});if(this.elements.overlayPrev&&this.elements.overlayNext){if(this.options.direction==="x"){this.modify(this.elements.overlayPrev,{width:Math.round(j.x*(1-this.visibleAreaRate)/2)});this.modify(this.elements.overlayNext,{width:Math.round(j.x*(1-this.visibleAreaRate)/2)})}else{this.modify(this.elements.overlayPrev,{height:Math.round(j.y*(1-this.visibleAreaRate)/2)});this.modify(this.elements.overlayNext,{height:Math.round(j.y*(1-this.visibleAreaRate)/2)})}}var g=j[this.options.direction];j[this.options.direction]=this.slideSize;if(!this.autoSize||this.options.direction==="x"){k=j.x}if(!this.autoSize||this.options.direction==="y"){f=j.y}d.each(this.slides,function(n,m){if(m.isInjected()){m.size(k,f);if(i.options.type==="slide"){i.modify(m.element,{offset:i.getSlideOffset(n)})}}});this.preloadSlides(this.slideIndex);if(this.options.type==="slide"){this.modify(this.elements.slides,{offset:-i.getSlideOffset(this.slideIndex)+Math.round(g*(1-this.visibleAreaRate)/2)})}if(l!==this.getVisibleSlidesCount()){this.nav.combineItems();this.cleanupSlides()}this.checkVisibility()};e.prototype.checkVisibility=function(){var g=!(a.hidden||a.webkitHidden);var h=false;var f=this.elements.main;var j=f.offset();var i=d(c);if(g&&j.lefti.scrollLeft()&&j.topi.scrollTop()){h=true}if(this.isVisible!==h){this.isVisible=h;if(h){this.playAutoplay()}else{this.pauseAutoplay()}}};e.prototype.getSlides=function(){return this.slides};e.prototype.setTouch=function(f){if(f!==this.isTouch){if(f){this.elements.main.addClass(this.options.cssPrefix+"touch").removeClass(this.options.cssPrefix+"no-touch")}else{this.elements.main.addClass(this.options.cssPrefix+"no-touch").removeClass(this.options.cssPrefix+"touch")}}if(f){this.lastTouchTime=new Date().getTime()}this.isTouch=f};e.prototype.setDragEvents=function(){var f=this;this.lastTouchTime=0;this.setTouch(false);var g={start:"mousedown",stop:"mouseup",move:"mousemove"};if(c.navigator.msPointerEnabled&&c.navigator.msMaxTouchPoints){g={start:"MSPointerDown",stop:"MSPointerUp",move:"MSPointerMove"};this.elements.crop.css("-ms-touch-action","pan-"+(this.options.direction==="x"?"y":"x")+" pinch-zoom double-tap-zoom");this.elements.main.on("MSPointerDown",function(h){if(h.originalEvent.pointerType===h.originalEvent.MSPOINTER_TYPE_TOUCH){f.setTouch(true)}})}else{if("ontouchstart" in c||"ontouchend" in a){g={start:g.start+" touchstart",stop:g.stop+" touchend touchcancel",move:g.move+" touchmove"};this.elements.main.on("touchstart",function(h){f.setTouch(true)})}}this.elements.crop.on(g.start,function(h){return f.onDragStart(h)});d(a).on(g.stop+".rsts",function(h){return f.onDragStop(h)});d(a).on(g.move+".rsts",function(h){return f.onDragMove(h)})};e.prototype.onDragStart=function(f){if(this.isDragging||(f.type==="mousedown"&&f.which!==1)||d(f.target).closest(".no-drag,a,button,input,select,textarea",this.elements.slides).length){return}if(c.navigator.msPointerEnabled&&c.navigator.msMaxTouchPoints){this.setTouch(f.originalEvent.pointerType===f.originalEvent.MSPOINTER_TYPE_TOUCH)}else{this.setTouch(f.type!=="mousedown"||new Date().getTime()-this.lastTouchTime<1000)}var g=this.getPositionFromEvent(f);if(!this.isTouch){f.preventDefault();this.stopAutoplay()}this.elements.main.addClass(this.options.cssPrefix+"dragging");this.isDragging=true;this.dragStartPos={x:g.x-this.elements.slides.offset().left+this.elements.crop.offset().left,y:g.y-this.elements.slides.offset().top+this.elements.crop.offset().top};this.dragLastPos=g[this.options.direction];this.dragLastDiff=0;this.touchStartPos=g;this.touchAxis="";this.modify(this.elements.slides,{offset:g[this.options.direction]-this.dragStartPos[this.options.direction]});this.onDragMove(f)};e.prototype.onDragStop=function(f){if(!this.isDragging){return}this.isDragging=false;this.elements.main.removeClass(this.options.cssPrefix+"dragging");var g=this.slideIndex+Math.floor((-this.getOffset(this.elements.slides)-this.activeSlideOffset+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))/(this.slideSize+this.getGapSize()));if(this.dragLastDiff<=0){this.goTo(g,true)}else{this.goTo(g+1,true)}};e.prototype.onDragMove=function(j){if(!this.isDragging||(this.isTouch&&j.type==="mousemove")){return}var k=this.getPositionFromEvent(j);var g;if(this.isTouch){if(!this.touchAxis){g=Math.abs(k.x-this.touchStartPos.x)-Math.abs(k.y-this.touchStartPos.y);if(g>4){this.touchAxis="x"}else{if(g<-4){this.touchAxis="y"}}}if(this.touchAxis===this.options.direction){j.preventDefault();this.stopAutoplay()}else{if(!this.touchAxis){return}else{return this.onDragStop()}}if(j.originalEvent.touches&&j.originalEvent.touches[1]){return this.onDragStop()}}else{j.preventDefault();this.stopAutoplay()}var f=this.dragLastPos-k[this.options.direction];var i=k[this.options.direction]-this.dragStartPos[this.options.direction];var h=this.getVisibleSlidesCount();if(!this.options.loop){if(i>-this.getSlideOffset(0)+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2)){i=(i*0.4)-((this.getSlideOffset(0)-(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))*0.6)}if(i<-this.getSlideOffset(this.slides.length-h)+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2)){i=(i*0.4)-((this.getSlideOffset(this.slides.length-h)-(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))*0.6)}}this.modify(this.elements.slides,{offset:i});if(f<0||f>0){this.dragLastDiff=f}this.dragLastPos=k[this.options.direction]};e.prototype.getPositionFromEvent=function(f){var g={x:f.pageX,y:f.pageY};if(typeof g.x!=="number"){g={x:f.originalEvent.pageX,y:f.originalEvent.pageY}}if(f.originalEvent.touches&&f.originalEvent.touches[0]){g={x:f.originalEvent.touches[0].pageX,y:f.originalEvent.touches[0].pageY}}return g};return e})();b.SliderNav=(function(){function e(h){var g=this;this.slider=h;this.elements={};if(h.options.controls){this.elements.prev=d(a.createElement("a")).attr("href","").text("prev").addClass(h.options.cssPrefix+"prev").on("click",function(i){i.preventDefault();g.slider.prev()});this.elements.next=d(a.createElement("a")).attr("href","").text("next").on("click",function(i){i.preventDefault();g.slider.next()}).addClass(h.options.cssPrefix+"next");h.elements.view.append(this.elements.prev).append(this.elements.next)}if(h.options.navType!=="none"){this.elements.main=d(a.createElement("div")).addClass(h.options.cssPrefix+"nav "+h.options.cssPrefix+"nav-"+h.options.navType);this.elements.mainPrev=d(a.createElement("a")).attr("href","").text("prev").on("click",function(i){i.preventDefault();g.slider.prev()}).appendTo(d(a.createElement("li")).addClass(h.options.cssPrefix+"nav-prev"));this.elements.mainNext=d(a.createElement("a")).attr("href","").text("next").on("click",function(i){i.preventDefault();g.slider.next()}).appendTo(d(a.createElement("li")).addClass(h.options.cssPrefix+"nav-next"));var f=a.createElement("ul");d.each(this.slider.getSlides(),function(k,j){g.elements[k]=g.createNavItem(k,j.getData()).appendTo(f)});this.elements.mainPrev.parent().prependTo(f);this.elements.mainNext.parent().appendTo(f);this.elements.main.append(f);h.elements.main.append(this.elements.main)}}e.prototype.setActive=function(g){var f=this;var h=this.slider.getSlides();if(this.activeIndexes){d.each(this.activeIndexes,function(k,j){if(!f.elements[j]){return}f.elements[j].children("a").removeClass("active")})}if(this.elements[h.length]&&d.inArray(h.length-1,g)!==-1){g=[h.length]}this.activeIndexes=g;var i=false;d.each(this.activeIndexes,function(k,j){if(!f.elements[j]){return}if(f.elements[j][0].style.display!=="none"){i=true}f.elements[j].children("a").addClass("active")});if(!i&&this.elements[h.length]){d.each(this.activeIndexes,function(k,j){if(!f.elements[j]){return}f.elements[j].children("a").removeClass("active")});this.activeIndexes=[h.length];this.elements[h.length].children("a").addClass("active")}};e.prototype.combineItems=function(){if(!this.elements[0]){return}var h=this.slider.getVisibleSlidesCount();var j=this.slider.getSlides();if(this.elements[j.length]){this.elements[j.length].remove();delete this.elements[j.length]}d.each(this.elements,function(){this.css("display","")});if(h<2||!this.slider.options.combineNavItems){return}var k;for(var g=0;this.elements[g];g++){if((g-Math.floor((h-1)/2))%h||(g-Math.floor((h-1)/2))>j.length-h){this.elements[g].css("display","none")}else{k=g}}if(j.length%h===0){this.elements[j.length-h+Math.floor((h-1)/2)].css("display","")}else{var f=j.length-(j.length%h||h)+Math.floor((h-1)/2);this.elements[j.length]=this.createNavItem(f,j[f>=j.length?j.length-1:f].getData()).insertAfter(this.elements[j.length-1])}};e.prototype.createNavItem=function(g,h){var f=this;return d(a.createElement("li")).addClass(f.slider.options.cssPrefix+"nav-item").append(d(a.createElement("a")).attr("href","").text((f.slider.options.navType!=="numbers"&&h.name)?h.name:(h.index+1)).on("click",function(j){j.preventDefault();var i=f.slider.getVisibleSlidesCount();var k=g-Math.floor((i-1)/2);if(!f.slider.options.loop){k=Math.min(f.slider.slides.length-i,Math.max(0,k))}else{if(k<0){k+=f.slider.slides.length}else{if(k>=f.slider.slides.length){k-=f.slider.slides.length}}}f.slider.goTo(k)}))};e.prototype.getSize=function(){if(!this.elements.main||this.elements.main.css("position")==="absolute"){return{x:0,y:0}}return{x:this.elements.main.outerWidth(true),y:this.elements.main.outerHeight(true)}};return e})();d.fn.rstSlider=function(f){var e=arguments;return this.each(function(){var h=d(this);if(typeof f==="string"){var g=h.data("rstSlider");if(g&&g[f]){return g[f].apply(g,Array.prototype.slice.call(e,1))}}else{if(!h.data("rstSlider")){h.data("rstSlider",new b.Slider(h,f))}}})}})(jQuery,window,document); +/*! rocksolid-slider v1.4.1 */ +(function(d,c,a){var b={};b.Slide=(function(){function e(i,j){var h=this;this.slider=j;this.content=d(i);this.data={name:this.content.attr("data-rsts-name")||this.content.attr("title")};if(i.nodeName.toLowerCase()==="img"||i.nodeName.toLowerCase()==="picture"){this.type="image"}this.type=this.content.attr("data-rsts-type")||this.type||"default";this.centerContent=this.content.attr("data-rsts-center")!==undefined?this.content.attr("data-rsts-center"):j.options.centerContent;if(this.centerContent!=="x"&&this.centerContent!=="y"){this.centerContent=!!this.centerContent}if(this.type==="image"||this.type==="video"){this.centerContent=false}this.element=d(a.createElement("div")).addClass(j.options.cssPrefix+"slide").addClass(j.options.cssPrefix+"slide-"+this.type).append(i);if(!a.createElement("video").canPlayType||this.slider.device==="iPhone"||this.slider.device==="iPod"){this.element.find("[data-rsts-background]").each(function(){if(this.nodeName.toLowerCase()!=="video"){return}var k=d(this);if(k.attr("poster")){d(a.createElement("img")).attr("src",k.attr("poster")).attr("data-rsts-background","").attr("data-rsts-scale-mode",k.attr("data-rsts-scale-mode")).insertBefore(k)}k.detach()})}this.backgrounds=[];this.element.find("[data-rsts-background]").each(function(){var k=d(this);if(k.is("img")&&k.parent().is("picture")){k=k.parent()}if(k.is("video")){k.attr("autoplay",true).attr("loop",true)}k.css({position:"absolute",top:0,left:0});h.backgrounds.push(k[0])});this.backgrounds=d(this.backgrounds).prependTo(this.element);if(this.backgrounds.length){this.element.children().last().css({position:"relative"});if(this.backgrounds.filter("video").length){this.element.children().last().css({"-webkit-transform":"translateZ(0)"})}}this.element.find("video[autoplay]").each(function(){if(this.pause){this.pause()}});if(this.type==="image"){this.data.name=this.data.name||this.element.find("img").last().attr("alt")}if(this.data.name&&j.options.captions){d(a.createElement("div")).addClass(j.options.cssPrefix+"caption").text(this.data.name).appendTo(this.element)}var g=function(){j.resize();if(j.css3Supported){j.elements.crop.css("transform","");j.elements.crop.css("transform");j.elements.crop.css("transform","translateZ(0)")}};this.element.find("img").on("load",g);this.element.find("video").on("loadedmetadata",g);var f=this.element.find("h1,h2,h3,h4,h5,h6");if(!this.data.name&&f.length){this.data.name=f.text()}if(this.type==="video"){this.data.video=this.content.attr("data-rsts-video");d(a.createElement("a")).attr("href",this.data.video).text("play").addClass(this.slider.options.cssPrefix+"video-play").on("click",function(k){k.preventDefault();h.startVideo()}).appendTo(this.element)}this.setState("inactive")}e.prototype.videoRegExp={youtube:/^https?:\/\/(?:www\.youtube\.com\/(?:watch\?v=|v\/|embed\/)|youtu\.be\/)([0-9a-z_\-]{11})(?:$|&|\?|#|\/)(?:(?:.*[?&#]|)t=([0-9hms]+))?/i,vimeo:/^https?:\/\/(?:player\.)?vimeo\.com\/(?:video\/)?([0-9]+)(?:.*#t=([0-9hms]+))?/i};e.prototype.isInjected=function(){return !!(this.element.get(0).parentNode&&this.element.get(0).parentNode.tagName)};e.prototype.size=function(g,i,h){var f=!g||!i;this.updateResponsiveImages(true);if(g&&!i){this.slider.modify(this.element,{width:g,height:""});this.resetScaledContent();if(h||this.backgrounds.length){i=this.element.outerHeight()}}else{if(i&&!g){this.slider.modify(this.element,{height:i,width:""});this.resetScaledContent();if(h||this.backgrounds.length){g=this.element.outerWidth()}}else{if(g&&i){this.slider.modify(this.element,{width:g,height:i})}else{this.resetScaledContent();g=this.element.outerWidth();i=this.element.outerHeight()}}}this.scaleContent(g,i,f);this.scaleBackground(g,i);return{x:g,y:i}};e.prototype.updateResponsiveImages=function(g){var f=c.picturefill||c.respimage;if(!f){return}f({elements:this.element.find("img").get(),reevaluate:!!g})};e.prototype.scaleContent=function(g,h,f){if(this.centerContent){if(this.content.css("display")==="inline"){this.content.css("display","inline-block")}if(this.centerContent!=="y"&&g){this.content.css("margin-left",Math.round((g-this.content.outerWidth())/2))}if(this.centerContent!=="x"&&h){this.content.css("margin-top",Math.round((h-this.content.outerHeight())/2))}}if(!f&&(this.type==="image"||this.type==="video")){this.scaleImage(this.element.find("img").last(),g,h)}};e.prototype.scaleBackground=function(f,h){var g=this;this.backgrounds.each(function(){var i=d(this);if(i.is("picture")){i=i.find("img").first()}g.scaleImage(i,f,h)})};e.prototype.scaleImage=function(f,m,l){var n=f.attr("data-rsts-scale-mode")||this.slider.options.scaleMode;var g=f.attr("data-rsts-position")||this.slider.options.imagePosition;var i=this.getOriginalSize(f);if(!i.x||!i.y){return}var j=i.x/i.y;var k=m/l;var h={width:i.x,height:i.y,"min-width":0,"min-height":0,"max-width":"none","max-height":"none"};if(n==="fit"||n==="crop"){if((j>=k&&n==="fit")||(j<=k&&n==="crop")){h.width=m;h.height=m/j}else{h.width=l*j;h.height=l}}else{if(n==="scale"){h.width=m;h.height=l}}h["margin-top"]=(l-h.height)/2;h["margin-left"]=(m-h.width)/2;if(g==="top"||g==="top-left"||g==="top-right"){h["margin-top"]=0}else{if(g==="bottom"||g==="bottom-left"||g==="bottom-right"){h["margin-top"]=l-h.height}}if(g==="left"||g==="top-left"||g==="bottom-left"){h["margin-left"]=0}else{if(g==="right"||g==="top-right"||g==="bottom-right"){h["margin-left"]=m-h.width}}f.css(h)};e.prototype.getOriginalSize=function(h){h=d(h);var g={};if(h[0].nodeName.toLowerCase()==="img"){if("naturalWidth" in new Image()){g.x=h[0].naturalWidth;g.y=h[0].naturalHeight}else{var f=new Image();f.src=h[0].src;g.x=f.width;g.y=f.height}}else{if(h[0].nodeName.toLowerCase()==="video"){g.x=h[0].videoWidth;g.y=h[0].videoHeight}}if(!g.x||!g.y){if(h.attr("width")||h.attr("height")){g.x=parseFloat(h.attr("width")||h.attr("height"));g.y=parseFloat(h.attr("height")||h.attr("width"))}else{g.x=g.y=0}}return g};e.prototype.resetScaledContent=function(f,h){var g=this.element.find("img").last();if(this.type==="image"||this.type==="video"){g.css({width:"",height:"","min-width":"","min-height":"","max-width":"","max-height":"","margin-left":"","margin-top":""})}if(this.centerContent){this.content.css({"margin-left":"","margin-top":""})}};e.prototype.setState=function(g){if(g==="active"&&g!==this.state&&this.state!=="preactive"){this.setState("preactive");this.element.css("opacity")}if(this.type==="video"&&this.state&&g==="inactive"&&g!==this.state){this.stopVideo()}if(this.type==="video"&&this.state&&g==="active"&&g!==this.state&&this.slider.options.videoAutoplay){this.startVideo()}if((g==="preactive"||g==="active")&&g!==this.state){this.element.find("video[autoplay]").each(function(){if(this.play){this.play()}})}else{if(g!=="active"&&g!=="preactive"&&(this.state==="active"||this.state==="preactive")){this.element.find("video").each(function(){if(this.pause){this.pause()}})}}this.state=g;var f=this.slider.options.cssPrefix;this.element.removeClass(f+"active").removeClass(f+"inactive").removeClass(f+"preactive").removeClass(f+"postactive").addClass(f+g)};e.prototype.stopVideo=function(g,f){if(this.eventNamespace){d(c).off("message."+this.eventNamespace);delete this.eventNamespace}if(this.videoElement){this.videoElement.attr("src","");this.videoElement.remove();delete this.videoElement}if(this.videoStopButton){this.videoStopButton.remove();delete this.videoStopButton}this.slider.elements.main.removeClass(this.slider.options.cssPrefix+"video-playing");if(g&&this.slider.options.autoplayRestart){this.slider.autoplay(200)}else{if(f){this.slider.stopAutoplay()}}};e.prototype.startVideo=function(){var f=this;var j,g,h,i;this.slider.stopAutoplay(true);if((h=this.data.video.match(this.videoRegExp.youtube))){this.element.addClass(this.slider.options.cssPrefix+"video-youtube");j=h[1];i=h[2];if(i){i=i.split(/[hm]/).reverse();i[0]=parseInt(i[0]||0,10);i[1]=parseInt(i[1]||0,10);i[2]=parseInt(i[2]||0,10);i=i[0]+(i[1]*60)+(i[2]*60*60)}this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src","http://www.youtube.com/embed/"+j+"?autoplay=1&enablejsapi=1&wmode=opaque"+(i?"&start="+i:"")).attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element);g=function(){if(f.videoElement&&c.YT){new YT.Player(f.videoElement.get(0),{events:{onStateChange:function(k){if(k.data===YT.PlayerState.ENDED){f.stopVideo(true)}}}})}};if(c.YT&&YT.Player){g()}else{d(a.createElement("script")).attr("src","//www.youtube.com/iframe_api").appendTo(a.head);c.onYouTubeIframeAPIReady=function(){delete c.onYouTubeIframeAPIReady;g()}}}else{if((h=this.data.video.match(this.videoRegExp.vimeo))){this.element.addClass(this.slider.options.cssPrefix+"video-vimeo");j=h[1];i=h[2];this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src","http://player.vimeo.com/video/"+j+"?autoplay=1&api=1"+(i?"#t="+i:"")).attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element);this.eventNamespace="rsts"+new Date().getTime();d(c).on("message."+this.eventNamespace,function(k){var l=JSON.parse(k.originalEvent.data);if(l&&l.event){if(l.event==="ready"){f.videoElement.get(0).contentWindow.postMessage('{"method":"addEventListener","value":"finish"}',f.videoElement.attr("src").split("?")[0])}else{if(l.event==="finish"){f.stopVideo(true)}}}})}else{this.element.addClass(this.slider.options.cssPrefix+"video-unknown");this.videoElement=d(a.createElement("iframe")).addClass(this.slider.options.cssPrefix+"video-iframe").attr("src",this.data.video).attr("frameborder",0).attr("allowfullscreen","allowfullscreen").appendTo(this.element)}}if(this.slider.device==="iPad"){this.element.addClass(this.slider.options.cssPrefix+"video-ipad")}this.videoStopButton=d(a.createElement("a")).attr("href",this.data.video).text("stop").addClass(this.slider.options.cssPrefix+"video-stop").on("click",function(k){k.preventDefault();f.stopVideo(false,true)}).appendTo(this.element);this.slider.elements.main.addClass(this.slider.options.cssPrefix+"video-playing")};e.prototype.setIndex=function(f){this.data.index=f};e.prototype.getData=function(){return this.data};return e})();b.Slider=(function(){function e(i,h){var g=this;this.slides=[];this.elements={};this.elements.main=i;this.options=d.extend({},this.defaultOptions,h);if(this.options.height==="auto"&&this.options.direction==="y"){throw new Error('height "auto" with direction "y" ist not possible')}if(this.options.type!=="slide"){this.options.visibleArea=1;this.options.visibleAreaMax=0;this.options.slideMaxCount=0;this.options.slideMinSize=0}this.checkCss3Support();this.readSlides();if(this.options.random){this.slides.sort(function(){return Math.random()-0.5})}d.each(this.slides,function(k){this.setIndex(k)});this.slideIndex=this.getIndexFromUrl();if(this.slideIndex===false){this.slideIndex=0}this.activeSlideOffset=0;d(c).on("hashchange.rsts",function(){var k=g.getIndexFromUrl();if(k!==false&&k!==g.slideIndex){g.goTo(k)}});this.elements.main.addClass(this.options.cssPrefix+"main").addClass(this.options.cssPrefix+"direction-"+this.options.direction).addClass(this.options.cssPrefix+"type-"+this.options.type).addClass(this.options.cssPrefix+"skin-"+this.options.skin);if(this.options.direction==="x"&&this.options.height==="normalize"){this.normalizeSize=true;this.options.height="auto"}else{if(this.options.direction==="x"&&(this.options.height==="auto"||(this.options.height==="css"&&this.elements.main.height()<1))){this.autoSize=true}else{if(this.options.direction==="y"&&this.options.width==="normalize"){this.normalizeSize=true;this.options.width="auto"}else{if(this.options.direction==="y"&&(this.options.width==="auto"||(this.options.width==="css"&&this.elements.main.width()<1))){this.autoSize=true}}}}var j=this.options.width.match(/([0-9.]+)[^0-9.]*x[^0-9.]*([0-9.]+)/i);if(j){this.proportion=j[1]/j[2];delete this.options.width}j=this.options.height.match(/([0-9.]+)[^0-9.]*x[^0-9.]*([0-9.]+)/i);if(j){this.proportion=j[1]/j[2];delete this.options.height}if(this.options.width&&this.options.width!=="css"){this.elements.main.css({width:this.options.width});if(this.options.width==="auto"){this.options.width="css"}}if(this.options.height&&this.options.height!=="css"){this.elements.main.css({height:this.options.height})}if(this.elements.header){this.elements.header.addClass(this.options.cssPrefix+"header").appendTo(this.elements.main)}this.elements.view=d(a.createElement("div")).addClass(this.options.cssPrefix+"view").appendTo(this.elements.main);this.elements.crop=d(a.createElement("div")).addClass(this.options.cssPrefix+"crop").on("scroll",function(){d(this).scrollLeft(0).scrollTop(0)}).appendTo(this.elements.view);this.elements.slides=d(a.createElement("div")).addClass(this.options.cssPrefix+"slides").appendTo(this.elements.crop);if(this.options.autoplay&&this.options.autoplayProgress){this.elements.progress=d(a.createElement("div")).addClass(this.options.cssPrefix+"progress").appendTo(this.elements.view);this.elements.progressBar=d(a.createElement("div")).appendTo(this.elements.progress)}if(this.options.visibleArea<1||this.options.visibleAreaMax){this.elements.overlayPrev=d(a.createElement("div")).addClass(this.options.cssPrefix+"overlay-prev").appendTo(this.elements.view);this.elements.overlayNext=d(a.createElement("div")).addClass(this.options.cssPrefix+"overlay-next").appendTo(this.elements.view)}this.nav=new b.SliderNav(this);if(this.elements.footer){this.elements.footer.addClass(this.options.cssPrefix+"footer").appendTo(this.elements.main)}this.preloadSlides(this.slideIndex);this.cleanupSlides();d(c).on("resize.rsts",function(){g.resize()});this.resize();this.nav.combineItems();if(this.options.type==="slide"){this.setDragEvents()}else{this.modify(this.slides[this.slideIndex].element,{opacity:1})}if(this.css3Supported){this.elements.slides.on("transitionend webkitTransitionEnd oTransitionEnd msTransitionEnd",function(k){if((g.options.type==="slide"&&k.target===g.elements.slides.get(0))||(g.options.type!=="slide"&&k.target.parentNode===g.elements.slides.get(0))){g.cleanupSlides()}});this.elements.crop.css({transform:"translateZ(0)"})}this.autoplay();if(this.options.pauseAutoplayOnHover){this.elements.view.on("mouseenter",function(){if(!g.isTouch){g.pauseAutoplay()}});this.elements.view.on("mouseleave",function(){g.playAutoplay()})}this.isVisible=true;d(a).on("visibilitychange webkitvisibilitychange",function(k){g.checkVisibility()});var f;d(c).on("scroll",function(k){clearTimeout(f);f=setTimeout(function(){g.checkVisibility()},100)});this.checkVisibility();if(this.options.keyboard){d(a.body).on("keydown.rsts",function(m){var l=g.options.direction==="x"?37:38;var k=g.options.direction==="x"?39:40;if((m.which===l||m.which===k)&&(m.target===a.body||d(m.target).closest(g.elements.main).length)){if(m.which===l){g.prev()}else{g.next()}}})}}e.prototype.defaultOptions={type:"slide",direction:"x",visibleArea:1,visibleAreaMax:0,random:false,loop:false,cssPrefix:"rsts-",skin:"default",width:"css",height:"css",preloadSlides:2,slideMaxCount:0,slideMinSize:0,combineNavItems:true,prevNextSteps:0,centerContent:false,gapSize:20,duration:400,autoplay:false,videoAutoplay:false,autoplayRestart:false,autoplayProgress:false,pauseAutoplayOnHover:false,navType:"bullets",controls:true,scaleMode:"fit",imagePosition:"center",deepLinkPrefix:false,keyboard:true,captions:true};e.prototype.goTo=function(n,u,g){var v=this;if(!g){this.stopAutoplay()}var s=this.getVisibleSlidesCount();var j=false;var m=0;var q=this.slideIndex;var p=n-this.slideIndex<0?-1:n===this.slideIndex?0:1;if((n<0||n>this.slides.length-1)&&this.options.loop){m=n-this.slideIndex;while(n<0){n+=this.slides.length}while(n>this.slides.length-1){n-=this.slides.length}}else{if((n<0||n>this.slides.length-s)&&!this.options.loop){if(this.options.type!=="slide"){return}j=n<0?-1:1;n=n<0?0:this.slides.length-s}}if(!j&&this.slideIndex===n&&!u){return}var o=[];for(var l=this.slideIndex;l<=this.slideIndex+s-1;l++){o.push(l>=this.slides.length?l-this.slides.length:l)}var r=[];for(l=n;l<=n+s-1;l++){r.push(l>=this.slides.length?l-this.slides.length:l)}d.each(o,function(x,y){if(d.inArray(y,r)===-1){v.slides[y].setState("postactive")}});d.each(r,function(x,y){if(d.inArray(y,o)===-1){v.slides[y].setState("preactive")}});var h=this.slideSize+this.getGapSize();if(m){this.activeSlideOffset+=h*m}else{if(n>this.slideIndex&&n-this.slideIndex-s>this.options.preloadSlides*2){this.activeSlideOffset+=(this.options.preloadSlides*2+s)*h}else{if(nthis.options.preloadSlides*2){this.activeSlideOffset-=(this.options.preloadSlides*2+s)*h}else{this.activeSlideOffset+=(n-this.slideIndex)*h}}}this.slideIndex=n;var f=true;if(!u){f=false}else{d.each(r,function(x,y){if(!v.slides[y].isInjected()||Math.round(v.slides[y].element.position()[{x:"left",y:"top"}[v.options.direction]])!==Math.round(v.getSlideOffset(v.slideIndex+x))){f=false;return false}})}if(f){this.preloadOnCleanup=true}else{this.preloadSlides(n,q)}var w=this.getViewSize(n);var k;var t=-this.getSlideOffset(n)+Math.round(w[this.options.direction]*(1-this.visibleAreaRate)/2);if(u&&!j){k=Math.abs((this.getOffset(this.elements.slides)-t)/h)}else{if(u&&j){k=0.7}}if(this.options.type==="slide"){this.modify(this.elements.slides,{offset:t},true,k,u,!u&&j)}else{if(this.options.type==="fade"){this.modify(this.slides[this.slideIndex].element,{opacity:1},true)}else{if(this.options.type==="side-slide"){this.modify(this.slides[this.slideIndex].element,{offset:p*this.slideSize});this.slides[this.slideIndex].element.position();this.modify(this.slides[this.slideIndex].element,{offset:0},true)}else{this.modify(this.slides[this.slideIndex].element,{},true)}}}if(this.autoSize){this.modify(this.elements.crop,{width:w.x,height:w.y},true,k,u)}this.elements.main.trigger({type:"rsts-slidestart",rstSlider:this})};e.prototype.getIndexFromUrl=function(){if(!this.options.deepLinkPrefix){return false}var f="#"+this.options.deepLinkPrefix;if(c.location.hash.substr(0,f.length)===f){var g=Math.abs(parseInt(c.location.hash.substr(f.length),10));if(g){if(g>this.slides.length){g=this.slides.length}return g-1}}return 0};e.prototype.stopAutoplay=function(g){var f=this;clearTimeout(this.autoplayTimeout);clearInterval(this.autoplayInterval);this.autoplayStopped=true;if(this.options.autoplay&&this.options.autoplayProgress){this.elements.progress.removeClass(this.options.cssPrefix+"progress-active")}if(this.options.autoplayRestart&&!g){this.autoplayTimeout=setTimeout(function(){f.autoplay()},this.options.autoplayRestart-this.options.autoplay)}};e.prototype.pauseAutoplay=function(){if(!this.options.autoplay||this.autoplayPaused){return}if(!this.autoplayStopped){clearTimeout(this.autoplayTimeout);clearInterval(this.autoplayInterval)}this.autoplayPaused=true;if(this.options.autoplay&&this.options.autoplayProgress&&!this.autoplayStopped){this.pauseAutoplayProgressBar()}};e.prototype.playAutoplay=function(){if(!this.options.autoplay||!this.autoplayPaused){return}this.autoplayPaused=false;if(!this.autoplayStopped){this.autoplay((1-(this.options.autoplayProgress?this.elements.progressBar.outerWidth()/this.elements.progress.width():0))*this.options.autoplay)}};e.prototype.autoplay=function(g){var f=this;if(!this.options.autoplay){return}clearTimeout(this.autoplayTimeout);clearInterval(this.autoplayInterval);this.autoplayStopped=false;if(this.autoplayPaused){this.pauseAutoplayProgressBar(0);return}g=(g||g===0)?g:(this.options.autoplay-this.options.duration);this.startAutoplayProgressBar(g);var h=function(){var j=f.getVisibleSlidesCount();var i=f.slideIndex+(Math.min(f.options.prevNextSteps,j)||j);if(i>f.slides.length-j&&!f.options.loop){if(f.slideIndexthis.slides.length-g&&this.slideIndex0){f=0}this.goTo(f)};e.prototype.readSlides=function(){var f=this;this.elements.main.children().each(function(){var g=d(this);if(g.is('h1, h2, h3, h4, h5, h6, [data-rsts-type="header"]')){if(!f.elements.header){f.elements.header=d(a.createElement("div"))}g.appendTo(f.elements.header)}else{if(g.is('[data-rsts-type="footer"]')){if(!f.elements.footer){f.elements.footer=d(a.createElement("div"))}g.appendTo(f.elements.footer)}else{f.slides.push(new b.Slide(this,f))}}});this.elements.main.empty();if(this.slides.length===0){throw new Error("No slides found")}};e.prototype.preloadSlides=function(j,k){var o=this;var p=this.getViewSizeFixed();p[this.options.direction]=this.slideSize;var n=this.getVisibleSlidesCount();var f=0;if(this.options.type==="slide"){if(this.options.loop){f=Math.min(Math.floor((this.slides.length-n)/2),this.options.preloadSlides)}else{f=this.options.preloadSlides}}var m=[];for(var g=j;g<=j+n-1;g++){m.push(g>=this.slides.length?g-this.slides.length:g)}var h,l;for(g=j-f;g<=j+f+n-1;g++){l=g<0?g+this.slides.length:g>=this.slides.length?g-this.slides.length:g;h=this.slides[l];if(o.options.type==="slide"){if(!this.options.loop&&(g<0||g>=this.slides.length)){continue}if(k!==undefined&&d.inArray(l,m)===-1&&(g<0||g>=this.slides.length)&&h.isInjected()){this.preloadOnCleanup=true;continue}o.modify(h.element,{offset:o.getSlideOffset(g)})}if(!h.isInjected()){if(o.options.type==="fade"){o.modify(h.element,{opacity:0})}o.elements.slides.append(h.element);h.size(p.x,p.y)}else{if(o.options.type!=="slide"&&g===o.slideIndex&&h.element.next().length){if(o.options.type==="fade"){if(h.element.next().length===1){o.modify(h.element,{opacity:1-h.element.next().css("opacity")});o.modify(h.element.next(),{opacity:1})}else{o.modify(h.element,{opacity:0})}}o.elements.slides.append(h.element)}}}};e.prototype.cleanupSlides=function(){clearTimeout(this.cleanupSlidesTimeout);var g=this;var k=this.getVisibleSlidesCount();var l=this.options.type==="slide"?this.options.preloadSlides:0;var h=[];var m=[];for(var j=this.slideIndex-l;j<=this.slideIndex+l+k-1;j++){h.push(j<0?j+this.slides.length:j>=this.slides.length?j-this.slides.length:j)}for(j=this.slideIndex;j<=this.slideIndex+k-1;j++){m.push(j>=this.slides.length?j-this.slides.length:j)}d.each(this.slides,function(o,n){if(n.isInjected()&&d.inArray(o,h)===-1){if(g.options.type==="fade"&&g.slides[g.slideIndex].element.css("opacity")<1){return}if(g.options.type==="side-slide"){var p=g.options.direction==="x"?"left":"top";if(g.slides[g.slideIndex].element.position()[p]!==0){return}}n.element.detach()}if(d.inArray(o,m)===-1&&n.state!=="inactive"){n.setState("inactive")}});this.nav.setActive(m);d.each(m,function(n,o){g.slides[o].setState("active")});if(this.options.deepLinkPrefix&&this.getIndexFromUrl()!==this.slideIndex){if(this.slideIndex){c.location.hash="#"+this.options.deepLinkPrefix+(this.slideIndex+1)}else{if(c.history&&c.history.pushState){c.history.pushState("",a.title,c.location.pathname+c.location.search)}else{var f={x:d(c).scrollLeft(),y:d(c).scrollTop()};c.location.hash="";d(c).scrollLeft(f.x);d(c).scrollTop(f.y)}}}if(this.preloadOnCleanup){this.preloadOnCleanup=false;this.preloadSlides(this.slideIndex)}this.elements.main.trigger({type:"rsts-slidestop",rstSlider:this})};e.prototype.getSlideOffset=function(f){var g=this.getViewSizeFixed(true);return(f-this.slideIndex)*(this.slideSize+this.getGapSize())+this.activeSlideOffset};e.prototype.getVisibleSlidesCount=function(){if(!this.options.slideMaxCount&&!this.options.slideMinSize){return 1}var f=Math.round(this.getViewSizeFixed(true)[this.options.direction]*this.visibleAreaRate);var h=this.getGapSize();var g=this.options.slideMaxCount;if(!g||(f-(h*(g-1)))/gthis.options.visibleAreaMax){this.visibleAreaRate=this.options.visibleAreaMax/(this.options.direction==="x"?f:j)}var i=this.getGapSize();var h=this.getVisibleSlidesCount();this.slideSize=Math.round((((this.options.direction==="x"?f:j)*this.visibleAreaRate)-(i*(h-1)))/h);return d.extend({},this.viewSizeFixedCache)};e.prototype.getViewSize=function(j){j=j||0;var n=this.getViewSizeFixed();var o=n[this.options.direction];n[this.options.direction]=this.slideSize;if(!n.x||!n.y){var l=this.getVisibleSlidesCount();var k=!n.x?"x":"y";var m,g,h;for(var f=j;f<=j+l-1;f++){m=f>=this.slides.length?f-this.slides.length:f;g=this.slides[m].size(n.x,n.y,true);h=Math.max(h||0,g[k])}n[k]=Math.max(10,h||0)}n[this.options.direction]=o;return n};e.prototype.getGapSize=function(){var f=this.options.gapSize;if(typeof f==="string"&&f.slice(-1)==="%"){f=f.split("%")[0].split(",").join(".")*this.getViewSizeFixed(true)[this.options.direction]/100}return Math.round(parseFloat(f))||0};e.prototype.resize=function(){var i=this;var l=this.getVisibleSlidesCount();var k,f;var h=!this.autoplayPaused;if(this.options.direction==="x"&&this.options.height==="css"){if(h){this.pauseAutoplay()}if(this.elements.main.css("position")==="static"||this.elements.main.css("position")==="relative"){this.elements.main.css("margin-bottom",this.elements.main.outerHeight(true)+100+"px")}this.elements.view.css({display:"none"});if(this.nav.elements.main){this.nav.elements.main.css({display:"none"})}if(this.elements.header){this.elements.header.css({display:"none"})}if(this.elements.footer){this.elements.footer.css({display:"none"})}this.autoSize=this.elements.main.height()<1;this.elements.view.css({display:""});if(this.nav.elements.main){this.nav.elements.main.css({display:""})}if(this.elements.header){this.elements.header.css({display:""})}if(this.elements.footer){this.elements.footer.css({display:""})}this.elements.main.css("margin-bottom","");if(h){this.playAutoplay()}}var j=this.getViewSize(this.slideIndex);if(this.normalizeSize){this.normalizedSize=0;d.each(this.slides,function(o,m){var n=true;if(!m.isInjected()){n=false;i.elements.slides.append(m.element)}i.normalizedSize=Math.max(i.normalizedSize,m.size(i.options.direction==="x"?i.slideSize:null,i.options.direction==="y"?i.slideSize:null,true)[i.options.direction==="x"?"y":"x"]);if(!n){m.element.detach()}});j=this.getViewSize(this.slideIndex)}this.modify(this.elements.crop,{width:j.x,height:j.y});if(this.elements.overlayPrev&&this.elements.overlayNext){if(this.options.direction==="x"){this.modify(this.elements.overlayPrev,{width:Math.round(j.x*(1-this.visibleAreaRate)/2)});this.modify(this.elements.overlayNext,{width:Math.round(j.x*(1-this.visibleAreaRate)/2)})}else{this.modify(this.elements.overlayPrev,{height:Math.round(j.y*(1-this.visibleAreaRate)/2)});this.modify(this.elements.overlayNext,{height:Math.round(j.y*(1-this.visibleAreaRate)/2)})}}var g=j[this.options.direction];j[this.options.direction]=this.slideSize;if(!this.autoSize||this.options.direction==="x"){k=j.x}if(!this.autoSize||this.options.direction==="y"){f=j.y}d.each(this.slides,function(n,m){if(m.isInjected()){m.size(k,f);if(i.options.type==="slide"){i.modify(m.element,{offset:i.getSlideOffset(n)})}}});this.preloadSlides(this.slideIndex);if(this.options.type==="slide"){this.modify(this.elements.slides,{offset:-i.getSlideOffset(this.slideIndex)+Math.round(g*(1-this.visibleAreaRate)/2)})}if(l!==this.getVisibleSlidesCount()){this.nav.combineItems();this.cleanupSlides()}this.checkVisibility()};e.prototype.checkVisibility=function(){var g=!(a.hidden||a.webkitHidden);var h=false;var f=this.elements.main;var j=f.offset();var i=d(c);if(g&&j.lefti.scrollLeft()&&j.topi.scrollTop()){h=true}if(this.isVisible!==h){this.isVisible=h;if(h){this.playAutoplay()}else{this.pauseAutoplay()}}};e.prototype.getSlides=function(){return this.slides};e.prototype.setTouch=function(f){if(f!==this.isTouch){if(f){this.elements.main.addClass(this.options.cssPrefix+"touch").removeClass(this.options.cssPrefix+"no-touch")}else{this.elements.main.addClass(this.options.cssPrefix+"no-touch").removeClass(this.options.cssPrefix+"touch")}}if(f){this.lastTouchTime=new Date().getTime()}this.isTouch=f};e.prototype.setDragEvents=function(){var f=this;this.lastTouchTime=0;this.setTouch(false);var g={start:"mousedown",stop:"mouseup",move:"mousemove"};if(c.navigator.pointerEnabled&&c.navigator.maxTouchPoints){g={start:"pointerdown",stop:"pointerup",move:"pointermove"};this.elements.crop.css("touch-action","pan-"+(this.options.direction==="x"?"y":"x")+" pinch-zoom double-tap-zoom");this.elements.main.on("pointerdown",function(h){if(h.originalEvent.pointerType==="touch"){f.setTouch(true)}})}else{if(c.navigator.msPointerEnabled&&c.navigator.msMaxTouchPoints){g={start:"MSPointerDown",stop:"MSPointerUp",move:"MSPointerMove"};this.elements.crop.css("-ms-touch-action","pan-"+(this.options.direction==="x"?"y":"x")+" pinch-zoom double-tap-zoom");this.elements.main.on("MSPointerDown",function(h){if(h.originalEvent.pointerType===h.originalEvent.MSPOINTER_TYPE_TOUCH){f.setTouch(true)}})}else{if("ontouchstart" in c||"ontouchend" in a){g={start:g.start+" touchstart",stop:g.stop+" touchend touchcancel",move:g.move+" touchmove"};this.elements.main.on("touchstart",function(h){f.setTouch(true)})}}}this.elements.crop.on(g.start,function(h){return f.onDragStart(h)});d(a).on(g.stop+".rsts",function(h){return f.onDragStop(h)});d(a).on(g.move+".rsts",function(h){return f.onDragMove(h)})};e.prototype.onDragStart=function(f){if(this.isDragging||(f.type==="mousedown"&&f.which!==1)||d(f.target).closest(".no-drag,a,button,input,select,textarea",this.elements.slides).length){return}if(c.navigator.pointerEnabled&&c.navigator.maxTouchPoints){this.setTouch(f.originalEvent.pointerType==="touch")}else{if(c.navigator.msPointerEnabled&&c.navigator.msMaxTouchPoints){this.setTouch(f.originalEvent.pointerType===f.originalEvent.MSPOINTER_TYPE_TOUCH)}else{this.setTouch(f.type!=="mousedown"||new Date().getTime()-this.lastTouchTime<1000)}}var g=this.getPositionFromEvent(f);if(!this.isTouch){f.preventDefault();this.stopAutoplay()}this.elements.main.addClass(this.options.cssPrefix+"dragging");this.isDragging=true;this.dragStartPos={x:g.x-this.elements.slides.offset().left+this.elements.crop.offset().left,y:g.y-this.elements.slides.offset().top+this.elements.crop.offset().top};this.dragLastPos=g[this.options.direction];this.dragLastDiff=0;this.touchStartPos=g;this.touchAxis="";this.modify(this.elements.slides,{offset:g[this.options.direction]-this.dragStartPos[this.options.direction]});this.onDragMove(f)};e.prototype.onDragStop=function(f){if(!this.isDragging){return}this.isDragging=false;this.elements.main.removeClass(this.options.cssPrefix+"dragging");var g=this.slideIndex+Math.floor((-this.getOffset(this.elements.slides)-this.activeSlideOffset+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))/(this.slideSize+this.getGapSize()));if(this.dragLastDiff<=0){this.goTo(g,true)}else{this.goTo(g+1,true)}};e.prototype.onDragMove=function(j){if(!this.isDragging||(this.isTouch&&j.type==="mousemove")){return}var k=this.getPositionFromEvent(j);var g;if(this.isTouch){if(!this.touchAxis){g=Math.abs(k.x-this.touchStartPos.x)-Math.abs(k.y-this.touchStartPos.y);if(g>4){this.touchAxis="x"}else{if(g<-4){this.touchAxis="y"}}}if(this.touchAxis===this.options.direction){j.preventDefault();this.stopAutoplay()}else{if(!this.touchAxis){return}else{return this.onDragStop()}}if(j.originalEvent.touches&&j.originalEvent.touches[1]){return this.onDragStop()}}else{j.preventDefault();this.stopAutoplay()}var f=this.dragLastPos-k[this.options.direction];var i=k[this.options.direction]-this.dragStartPos[this.options.direction];var h=this.getVisibleSlidesCount();if(!this.options.loop){if(i>-this.getSlideOffset(0)+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2)){i=(i*0.4)-((this.getSlideOffset(0)-(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))*0.6)}if(i<-this.getSlideOffset(this.slides.length-h)+(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2)){i=(i*0.4)-((this.getSlideOffset(this.slides.length-h)-(this.getViewSizeFixed(true)[this.options.direction]*(1-this.visibleAreaRate)/2))*0.6)}}this.modify(this.elements.slides,{offset:i});if(f<0||f>0){this.dragLastDiff=f}this.dragLastPos=k[this.options.direction]};e.prototype.getPositionFromEvent=function(f){var g={x:f.pageX,y:f.pageY};if(typeof g.x!=="number"){g={x:f.originalEvent.pageX,y:f.originalEvent.pageY}}if(f.originalEvent.touches&&f.originalEvent.touches[0]){g={x:f.originalEvent.touches[0].pageX,y:f.originalEvent.touches[0].pageY}}return g};return e})();b.SliderNav=(function(){function e(h){var g=this;this.slider=h;this.elements={};if(h.options.controls){this.elements.prev=d(a.createElement("a")).attr("href","").text("prev").addClass(h.options.cssPrefix+"prev").on("click",function(i){i.preventDefault();g.slider.prev()});this.elements.next=d(a.createElement("a")).attr("href","").text("next").on("click",function(i){i.preventDefault();g.slider.next()}).addClass(h.options.cssPrefix+"next");h.elements.view.append(this.elements.prev).append(this.elements.next)}if(h.options.navType!=="none"){this.elements.main=d(a.createElement("div")).addClass(h.options.cssPrefix+"nav "+h.options.cssPrefix+"nav-"+h.options.navType);this.elements.mainPrev=d(a.createElement("a")).attr("href","").text("prev").on("click",function(i){i.preventDefault();g.slider.prev()}).appendTo(d(a.createElement("li")).addClass(h.options.cssPrefix+"nav-prev"));this.elements.mainNext=d(a.createElement("a")).attr("href","").text("next").on("click",function(i){i.preventDefault();g.slider.next()}).appendTo(d(a.createElement("li")).addClass(h.options.cssPrefix+"nav-next"));var f=a.createElement("ul");d.each(this.slider.getSlides(),function(k,j){g.elements[k]=g.createNavItem(k,j.getData()).appendTo(f)});this.elements.mainPrev.parent().prependTo(f);this.elements.mainNext.parent().appendTo(f);this.elements.main.append(f);h.elements.main.append(this.elements.main)}}e.prototype.setActive=function(g){var f=this;var h=this.slider.getSlides();if(this.activeIndexes){d.each(this.activeIndexes,function(k,j){if(!f.elements[j]){return}f.elements[j].children("a").removeClass("active")})}if(this.elements[h.length]&&d.inArray(h.length-1,g)!==-1){g=[h.length]}this.activeIndexes=g;var i=false;d.each(this.activeIndexes,function(k,j){if(!f.elements[j]){return}if(f.elements[j][0].style.display!=="none"){i=true}f.elements[j].children("a").addClass("active")});if(!i&&this.elements[h.length]){d.each(this.activeIndexes,function(k,j){if(!f.elements[j]){return}f.elements[j].children("a").removeClass("active")});this.activeIndexes=[h.length];this.elements[h.length].children("a").addClass("active")}};e.prototype.combineItems=function(){if(!this.elements[0]){return}var h=this.slider.getVisibleSlidesCount();var j=this.slider.getSlides();if(this.elements[j.length]){this.elements[j.length].remove();delete this.elements[j.length]}d.each(this.elements,function(){this.css("display","")});if(h<2||!this.slider.options.combineNavItems){return}var k;for(var g=0;this.elements[g];g++){if((g-Math.floor((h-1)/2))%h||(g-Math.floor((h-1)/2))>j.length-h){this.elements[g].css("display","none")}else{k=g}}if(j.length%h===0){this.elements[j.length-h+Math.floor((h-1)/2)].css("display","")}else{var f=j.length-(j.length%h||h)+Math.floor((h-1)/2);this.elements[j.length]=this.createNavItem(f,j[f>=j.length?j.length-1:f].getData()).insertAfter(this.elements[j.length-1])}};e.prototype.createNavItem=function(g,h){var f=this;return d(a.createElement("li")).addClass(f.slider.options.cssPrefix+"nav-item").append(d(a.createElement("a")).attr("href","").text((f.slider.options.navType!=="numbers"&&h.name)?h.name:(h.index+1)).on("click",function(j){j.preventDefault();var i=f.slider.getVisibleSlidesCount();var k=g-Math.floor((i-1)/2);if(!f.slider.options.loop){k=Math.min(f.slider.slides.length-i,Math.max(0,k))}else{if(k<0){k+=f.slider.slides.length}else{if(k>=f.slider.slides.length){k-=f.slider.slides.length}}}f.slider.goTo(k)}))};e.prototype.getSize=function(){if(!this.elements.main||this.elements.main.css("position")==="absolute"){return{x:0,y:0}}return{x:this.elements.main.outerWidth(true),y:this.elements.main.outerHeight(true)}};return e})();d.fn.rstSlider=function(f){var e=arguments;return this.each(function(){var h=d(this);if(typeof f==="string"){var g=h.data("rstSlider");if(g&&g[f]){return g[f].apply(g,Array.prototype.slice.call(e,1))}}else{if(!h.data("rstSlider")){h.data("rstSlider",new b.Slider(h,f))}}})}})(jQuery,window,document); /*! * jQuery UI Effects 1.10.1 * http://jqueryui.com