flexslider-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f51448a526ee72981d69d34c2ef081a945161d2a
4
+ data.tar.gz: 848085e0513e8fce0584471801dd5ccbf3bc606a
5
+ SHA512:
6
+ metadata.gz: bdb0a04cc02733325ceda2992ae116bd5fccf396ec62613d0e7599385be4a2ddeda1abe2b4519bd116f997b2d17e61a8e68295b1a57568efb53bbd1a73baebc0
7
+ data.tar.gz: 3b89d456aaa72eb30ed29c179f4f69bcf798c200a063c2366a000bfb5470e004567396aa37f8f4189c79bdd3f11153b8fa17bcb6bdaebb3437a1a0ae89d40ae7
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in flexslider-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,35 @@
1
+ FlexSlider license
2
+
3
+ * jQuery FlexSlider v2.2.0
4
+ * http://www.woothemes.com/flexslider/
5
+ *
6
+ * Copyright 2012 WooThemes
7
+ * Free to use under the GPLv2 license.
8
+ * http://www.gnu.org/licenses/gpl-2.0.html
9
+ *
10
+ * Contributing author: Tyler Smith (@mbmufffin)
11
+
12
+ Gem license
13
+
14
+ Copyright (c) 2013 JiriKolarik
15
+
16
+ MIT License
17
+
18
+ Permission is hereby granted, free of charge, to any person obtaining
19
+ a copy of this software and associated documentation files (the
20
+ "Software"), to deal in the Software without restriction, including
21
+ without limitation the rights to use, copy, modify, merge, publish,
22
+ distribute, sublicense, and/or sell copies of the Software, and to
23
+ permit persons to whom the Software is furnished to do so, subject to
24
+ the following conditions:
25
+
26
+ The above copyright notice and this permission notice shall be
27
+ included in all copies or substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
32
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
33
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
34
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
35
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # Flexslider::Rails
2
+
3
+ Flexslider for Rails assets pipeline
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'flexslider-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ ## Usage
16
+
17
+ You will need to include JavaScript
18
+ ```
19
+ #= require jquery.flexslider
20
+
21
+ # Activate Flexslider
22
+ $(".flexslider").flexslider animation: "slide"
23
+ ```
24
+
25
+ And stylesheets
26
+ ```
27
+ @import 'flexslider'
28
+ ```
29
+
30
+ ## Contributing
31
+
32
+ 1. Fork it
33
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
34
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
35
+ 4. Push to the branch (`git push origin my-new-feature`)
36
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'flexslider/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "flexslider-rails"
8
+ spec.version = Flexslider::Rails::VERSION
9
+ spec.authors = ["JiriKolarik"]
10
+ spec.email = ["jiri.kolarik@imin.cz"]
11
+ spec.description = %q{FlexSlider Rails}
12
+ spec.summary = %q{FlexSlider for Rails assets pipeline}
13
+ spec.homepage = "https://github.com/werein/flexslider-rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,8 @@
1
+ require "flexslider/rails/version"
2
+
3
+ module Flexslider
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Flexslider
2
+ module Rails
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>
5
+ This is a custom SVG font generated by IcoMoon.
6
+ <iconset grid="14"></iconset>
7
+ </metadata>
8
+ <defs>
9
+ <font id="flexslider-icon" horiz-adv-x="448" >
10
+ <font-face units-per-em="448" ascent="384" descent="-64" />
11
+ <missing-glyph horiz-adv-x="448" />
12
+ <glyph unicode="&#xf001;" d="M 185.50-9.25l-163.00,162.75q-9.25,9.25 -9.25,22.625t 9.25,22.625l 163.00,162.75q 9.25,9.25 22.625,9.25t 22.625-9.25l 18.75-18.75q 9.25-9.25 9.25-22.625t-9.25-22.625l-121.50-121.50l 121.50-121.25q 9.25-9.50 9.25-22.75t-9.25-22.50l-18.75-18.75q-9.25-9.25 -22.625-9.25t-22.625,9.25z" horiz-adv-x="288" />
13
+ <glyph unicode="&#xf002;" d="M 274.75,176.00q0.00-13.00 -9.25-22.75l-163.00-162.75q-9.25-9.25 -22.50-9.25t-22.50,9.25l-19.00,18.75q-9.25,9.75 -9.25,22.75q0.00,13.25 9.25,22.50l 121.50,121.50l-121.50,121.25q-9.25,9.75 -9.25,22.75q0.00,13.25 9.25,22.50l 19.00,18.75q 9.00,9.50 22.50,9.50t 22.50-9.50l 163.00-162.75q 9.25-9.25 9.25-22.50z" horiz-adv-x="288" />
14
+ <glyph unicode="&#xf003;" d="M 346.00,152.25l-332.00-184.50q-5.75-3.25 -9.875-0.75t-4.125,9.00l0.00,368.00 q0.00,6.50 4.125,9.00t 9.875-0.75l 332.00-184.50q 5.75-3.25 5.75-7.75t-5.75-7.75z" horiz-adv-x="352" />
15
+ <glyph unicode="&#xf004;" d="M 384.00,336.00l0.00-352.00 q0.00-6.50 -4.75-11.25t-11.25-4.75l-128.00,0.00 q-6.50,0.00 -11.25,4.75t-4.75,11.25l0.00,352.00 q0.00,6.50 4.75,11.25t 11.25,4.75l 128.00,0.00 q 6.50,0.00 11.25-4.75t 4.75-11.25zM 160.00,336.00l0.00-352.00 q0.00-6.50 -4.75-11.25t-11.25-4.75l-128.00,0.00 q-6.50,0.00 -11.25,4.75t-4.75,11.25l0.00,352.00 q0.00,6.50 4.75,11.25t 11.25,4.75l 128.00,0.00 q 6.50,0.00 11.25-4.75t 4.75-11.25z" horiz-adv-x="384" />
16
+ <glyph unicode="&#xf005;" d="M 402.75,208.00q0.00-13.25 -9.25-22.50l-162.75-162.75q-9.50-9.50 -22.75-9.50q-13.50,0.00 -22.50,9.50l-162.75,162.75q-9.50,9.00 -9.50,22.50q0.00,13.25 9.50,22.75l 18.50,18.75q 9.75,9.25 22.75,9.25q 13.25,0.00 22.50-9.25l 121.50-121.50l 121.50,121.50q 9.25,9.25 22.50,9.25q 13.00,0.00 22.75-9.25l 18.75-18.75q 9.25-9.75 9.25-22.75z" horiz-adv-x="416" />
17
+ <glyph unicode="&#x20;" horiz-adv-x="224" />
18
+ <glyph class="hidden" unicode="&#xf000;" d="M0,384L 448 -64L0 -64 z" horiz-adv-x="0" />
19
+ </font></defs></svg>
@@ -0,0 +1,5 @@
1
+ /*
2
+ * jQuery FlexSlider v2.2.0
3
+ * Copyright 2012 WooThemes
4
+ * Contributing Author: Tyler Smith
5
+ */(function(e){e.flexslider=function(t,n){var r=e(t);r.vars=e.extend({},e.flexslider.defaults,n);var i=r.vars.namespace,s=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,o=("ontouchstart"in window||s||window.DocumentTouch&&document instanceof DocumentTouch)&&r.vars.touch,u="click touchend MSPointerUp",a="",f,l=r.vars.direction==="vertical",c=r.vars.reverse,h=r.vars.itemWidth>0,p=r.vars.animation==="fade",d=r.vars.asNavFor!=="",v={},m=!0;e.data(t,"flexslider",r);v={init:function(){r.animating=!1;r.currentSlide=parseInt(r.vars.startAt?r.vars.startAt:0);isNaN(r.currentSlide)&&(r.currentSlide=0);r.animatingTo=r.currentSlide;r.atEnd=r.currentSlide===0||r.currentSlide===r.last;r.containerSelector=r.vars.selector.substr(0,r.vars.selector.search(" "));r.slides=e(r.vars.selector,r);r.container=e(r.containerSelector,r);r.count=r.slides.length;r.syncExists=e(r.vars.sync).length>0;r.vars.animation==="slide"&&(r.vars.animation="swing");r.prop=l?"top":"marginLeft";r.args={};r.manualPause=!1;r.stopped=!1;r.started=!1;r.startTimeout=null;r.transitions=!r.vars.video&&!p&&r.vars.useCSS&&function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var n in t)if(e.style[t[n]]!==undefined){r.pfx=t[n].replace("Perspective","").toLowerCase();r.prop="-"+r.pfx+"-transform";return!0}return!1}();r.vars.controlsContainer!==""&&(r.controlsContainer=e(r.vars.controlsContainer).length>0&&e(r.vars.controlsContainer));r.vars.manualControls!==""&&(r.manualControls=e(r.vars.manualControls).length>0&&e(r.vars.manualControls));if(r.vars.randomize){r.slides.sort(function(){return Math.round(Math.random())-.5});r.container.empty().append(r.slides)}r.doMath();r.setup("init");r.vars.controlNav&&v.controlNav.setup();r.vars.directionNav&&v.directionNav.setup();r.vars.keyboard&&(e(r.containerSelector).length===1||r.vars.multipleKeyboard)&&e(document).bind("keyup",function(e){var t=e.keyCode;if(!r.animating&&(t===39||t===37)){var n=t===39?r.getTarget("next"):t===37?r.getTarget("prev"):!1;r.flexAnimate(n,r.vars.pauseOnAction)}});r.vars.mousewheel&&r.bind("mousewheel",function(e,t,n,i){e.preventDefault();var s=t<0?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(s,r.vars.pauseOnAction)});r.vars.pausePlay&&v.pausePlay.setup();r.vars.slideshow&&r.vars.pauseInvisible&&v.pauseInvisible.init();if(r.vars.slideshow){r.vars.pauseOnHover&&r.hover(function(){!r.manualPlay&&!r.manualPause&&r.pause()},function(){!r.manualPause&&!r.manualPlay&&!r.stopped&&r.play()});if(!r.vars.pauseInvisible||!v.pauseInvisible.isHidden())r.vars.initDelay>0?r.startTimeout=setTimeout(r.play,r.vars.initDelay):r.play()}d&&v.asNav.setup();o&&r.vars.touch&&v.touch();(!p||p&&r.vars.smoothHeight)&&e(window).bind("resize orientationchange focus",v.resize);r.find("img").attr("draggable","false");setTimeout(function(){r.vars.start(r)},200)},asNav:{setup:function(){r.asNav=!0;r.animatingTo=Math.floor(r.currentSlide/r.move);r.currentItem=r.currentSlide;r.slides.removeClass(i+"active-slide").eq(r.currentItem).addClass(i+"active-slide");if(!s)r.slides.click(function(t){t.preventDefault();var n=e(this),s=n.index(),o=n.offset().left-e(r).scrollLeft();if(o<=0&&n.hasClass(i+"active-slide"))r.flexAnimate(r.getTarget("prev"),!0);else if(!e(r.vars.asNavFor).data("flexslider").animating&&!n.hasClass(i+"active-slide")){r.direction=r.currentItem<s?"next":"prev";r.flexAnimate(s,r.vars.pauseOnAction,!1,!0,!0)}});else{t._slider=r;r.slides.each(function(){var t=this;t._gesture=new MSGesture;t._gesture.target=t;t.addEventListener("MSPointerDown",function(e){e.preventDefault();e.currentTarget._gesture&&e.currentTarget._gesture.addPointer(e.pointerId)},!1);t.addEventListener("MSGestureTap",function(t){t.preventDefault();var n=e(this),i=n.index();if(!e(r.vars.asNavFor).data("flexslider").animating&&!n.hasClass("active")){r.direction=r.currentItem<i?"next":"prev";r.flexAnimate(i,r.vars.pauseOnAction,!1,!0,!0)}})})}}},controlNav:{setup:function(){r.manualControls?v.controlNav.setupManual():v.controlNav.setupPaging()},setupPaging:function(){var t=r.vars.controlNav==="thumbnails"?"control-thumbs":"control-paging",n=1,s,o;r.controlNavScaffold=e('<ol class="'+i+"control-nav "+i+t+'"></ol>');if(r.pagingCount>1)for(var f=0;f<r.pagingCount;f++){o=r.slides.eq(f);s=r.vars.controlNav==="thumbnails"?'<img src="'+o.attr("data-thumb")+'"/>':"<a>"+n+"</a>";if("thumbnails"===r.vars.controlNav&&!0===r.vars.thumbCaptions){var l=o.attr("data-thumbcaption");""!=l&&undefined!=l&&(s+='<span class="'+i+'caption">'+l+"</span>")}r.controlNavScaffold.append("<li>"+s+"</li>");n++}r.controlsContainer?e(r.controlsContainer).append(r.controlNavScaffold):r.append(r.controlNavScaffold);v.controlNav.set();v.controlNav.active();r.controlNavScaffold.delegate("a, img",u,function(t){t.preventDefault();if(a===""||a===t.type){var n=e(this),s=r.controlNav.index(n);if(!n.hasClass(i+"active")){r.direction=s>r.currentSlide?"next":"prev";r.flexAnimate(s,r.vars.pauseOnAction)}}a===""&&(a=t.type);v.setToClearWatchedEvent()})},setupManual:function(){r.controlNav=r.manualControls;v.controlNav.active();r.controlNav.bind(u,function(t){t.preventDefault();if(a===""||a===t.type){var n=e(this),s=r.controlNav.index(n);if(!n.hasClass(i+"active")){s>r.currentSlide?r.direction="next":r.direction="prev";r.flexAnimate(s,r.vars.pauseOnAction)}}a===""&&(a=t.type);v.setToClearWatchedEvent()})},set:function(){var t=r.vars.controlNav==="thumbnails"?"img":"a";r.controlNav=e("."+i+"control-nav li "+t,r.controlsContainer?r.controlsContainer:r)},active:function(){r.controlNav.removeClass(i+"active").eq(r.animatingTo).addClass(i+"active")},update:function(t,n){r.pagingCount>1&&t==="add"?r.controlNavScaffold.append(e("<li><a>"+r.count+"</a></li>")):r.pagingCount===1?r.controlNavScaffold.find("li").remove():r.controlNav.eq(n).closest("li").remove();v.controlNav.set();r.pagingCount>1&&r.pagingCount!==r.controlNav.length?r.update(n,t):v.controlNav.active()}},directionNav:{setup:function(){var t=e('<ul class="'+i+'direction-nav"><li><a class="'+i+'prev" href="#">'+r.vars.prevText+'</a></li><li><a class="'+i+'next" href="#">'+r.vars.nextText+"</a></li></ul>");if(r.controlsContainer){e(r.controlsContainer).append(t);r.directionNav=e("."+i+"direction-nav li a",r.controlsContainer)}else{r.append(t);r.directionNav=e("."+i+"direction-nav li a",r)}v.directionNav.update();r.directionNav.bind(u,function(t){t.preventDefault();var n;if(a===""||a===t.type){n=e(this).hasClass(i+"next")?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(n,r.vars.pauseOnAction)}a===""&&(a=t.type);v.setToClearWatchedEvent()})},update:function(){var e=i+"disabled";r.pagingCount===1?r.directionNav.addClass(e).attr("tabindex","-1"):r.vars.animationLoop?r.directionNav.removeClass(e).removeAttr("tabindex"):r.animatingTo===0?r.directionNav.removeClass(e).filter("."+i+"prev").addClass(e).attr("tabindex","-1"):r.animatingTo===r.last?r.directionNav.removeClass(e).filter("."+i+"next").addClass(e).attr("tabindex","-1"):r.directionNav.removeClass(e).removeAttr("tabindex")}},pausePlay:{setup:function(){var t=e('<div class="'+i+'pauseplay"><a></a></div>');if(r.controlsContainer){r.controlsContainer.append(t);r.pausePlay=e("."+i+"pauseplay a",r.controlsContainer)}else{r.append(t);r.pausePlay=e("."+i+"pauseplay a",r)}v.pausePlay.update(r.vars.slideshow?i+"pause":i+"play");r.pausePlay.bind(u,function(t){t.preventDefault();if(a===""||a===t.type)if(e(this).hasClass(i+"pause")){r.manualPause=!0;r.manualPlay=!1;r.pause()}else{r.manualPause=!1;r.manualPlay=!0;r.play()}a===""&&(a=t.type);v.setToClearWatchedEvent()})},update:function(e){e==="play"?r.pausePlay.removeClass(i+"pause").addClass(i+"play").html(r.vars.playText):r.pausePlay.removeClass(i+"play").addClass(i+"pause").html(r.vars.pauseText)}},touch:function(){var e,n,i,o,u,a,f=!1,d=0,v=0,m=0;if(!s){t.addEventListener("touchstart",g,!1);function g(s){if(r.animating)s.preventDefault();else if(window.navigator.msPointerEnabled||s.touches.length===1){r.pause();o=l?r.h:r.w;a=Number(new Date);d=s.touches[0].pageX;v=s.touches[0].pageY;i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o;e=l?v:d;n=l?d:v;t.addEventListener("touchmove",y,!1);t.addEventListener("touchend",b,!1)}}function y(t){d=t.touches[0].pageX;v=t.touches[0].pageY;u=l?e-v:e-d;f=l?Math.abs(u)<Math.abs(d-n):Math.abs(u)<Math.abs(v-n);var s=500;if(!f||Number(new Date)-a>s){t.preventDefault();if(!p&&r.transitions){r.vars.animationLoop||(u/=r.currentSlide===0&&u<0||r.currentSlide===r.last&&u>0?Math.abs(u)/o+2:1);r.setProps(i+u,"setTouch")}}}function b(s){t.removeEventListener("touchmove",y,!1);if(r.animatingTo===r.currentSlide&&!f&&u!==null){var l=c?-u:u,h=l>0?r.getTarget("next"):r.getTarget("prev");r.canAdvance(h)&&(Number(new Date)-a<550&&Math.abs(l)>50||Math.abs(l)>o/2)?r.flexAnimate(h,r.vars.pauseOnAction):p||r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,!0)}t.removeEventListener("touchend",b,!1);e=null;n=null;u=null;i=null}}else{t.style.msTouchAction="none";t._gesture=new MSGesture;t._gesture.target=t;t.addEventListener("MSPointerDown",w,!1);t._slider=r;t.addEventListener("MSGestureChange",E,!1);t.addEventListener("MSGestureEnd",S,!1);function w(e){e.stopPropagation();if(r.animating)e.preventDefault();else{r.pause();t._gesture.addPointer(e.pointerId);m=0;o=l?r.h:r.w;a=Number(new Date);i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o}}function E(e){e.stopPropagation();var n=e.target._slider;if(!n)return;var r=-e.translationX,s=-e.translationY;m+=l?s:r;u=m;f=l?Math.abs(m)<Math.abs(-r):Math.abs(m)<Math.abs(-s);if(e.detail===e.MSGESTURE_FLAG_INERTIA){setImmediate(function(){t._gesture.stop()});return}if(!f||Number(new Date)-a>500){e.preventDefault();if(!p&&n.transitions){n.vars.animationLoop||(u=m/(n.currentSlide===0&&m<0||n.currentSlide===n.last&&m>0?Math.abs(m)/o+2:1));n.setProps(i+u,"setTouch")}}}function S(t){t.stopPropagation();var r=t.target._slider;if(!r)return;if(r.animatingTo===r.currentSlide&&!f&&u!==null){var s=c?-u:u,l=s>0?r.getTarget("next"):r.getTarget("prev");r.canAdvance(l)&&(Number(new Date)-a<550&&Math.abs(s)>50||Math.abs(s)>o/2)?r.flexAnimate(l,r.vars.pauseOnAction):p||r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,!0)}e=null;n=null;u=null;i=null;m=0}}},resize:function(){if(!r.animating&&r.is(":visible")){h||r.doMath();if(p)v.smoothHeight();else if(h){r.slides.width(r.computedW);r.update(r.pagingCount);r.setProps()}else if(l){r.viewport.height(r.h);r.setProps(r.h,"setTotal")}else{r.vars.smoothHeight&&v.smoothHeight();r.newSlides.width(r.computedW);r.setProps(r.computedW,"setTotal")}}},smoothHeight:function(e){if(!l||p){var t=p?r:r.viewport;e?t.animate({height:r.slides.eq(r.animatingTo).height()},e):t.height(r.slides.eq(r.animatingTo).height())}},sync:function(t){var n=e(r.vars.sync).data("flexslider"),i=r.animatingTo;switch(t){case"animate":n.flexAnimate(i,r.vars.pauseOnAction,!1,!0);break;case"play":!n.playing&&!n.asNav&&n.play();break;case"pause":n.pause()}},pauseInvisible:{visProp:null,init:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++)e[t]+"Hidden"in document&&(v.pauseInvisible.visProp=e[t]+"Hidden");if(v.pauseInvisible.visProp){var n=v.pauseInvisible.visProp.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(n,function(){v.pauseInvisible.isHidden()?r.startTimeout?clearTimeout(r.startTimeout):r.pause():r.started?r.play():r.vars.initDelay>0?setTimeout(r.play,r.vars.initDelay):r.play()})}},isHidden:function(){return document[v.pauseInvisible.visProp]||!1}},setToClearWatchedEvent:function(){clearTimeout(f);f=setTimeout(function(){a=""},3e3)}};r.flexAnimate=function(t,n,s,u,a){!r.vars.animationLoop&&t!==r.currentSlide&&(r.direction=t>r.currentSlide?"next":"prev");d&&r.pagingCount===1&&(r.direction=r.currentItem<t?"next":"prev");if(!r.animating&&(r.canAdvance(t,a)||s)&&r.is(":visible")){if(d&&u){var f=e(r.vars.asNavFor).data("flexslider");r.atEnd=t===0||t===r.count-1;f.flexAnimate(t,!0,!1,!0,a);r.direction=r.currentItem<t?"next":"prev";f.direction=r.direction;if(Math.ceil((t+1)/r.visible)-1===r.currentSlide||t===0){r.currentItem=t;r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");return!1}r.currentItem=t;r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");t=Math.floor(t/r.visible)}r.animating=!0;r.animatingTo=t;n&&r.pause();r.vars.before(r);r.syncExists&&!a&&v.sync("animate");r.vars.controlNav&&v.controlNav.active();h||r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");r.atEnd=t===0||t===r.last;r.vars.directionNav&&v.directionNav.update();if(t===r.last){r.vars.end(r);r.vars.animationLoop||r.pause()}if(!p){var m=l?r.slides.filter(":first").height():r.computedW,g,y,b;if(h){g=r.vars.itemMargin;b=(r.itemW+g)*r.move*r.animatingTo;y=b>r.limit&&r.visible!==1?r.limit:b}else r.currentSlide===0&&t===r.count-1&&r.vars.animationLoop&&r.direction!=="next"?y=c?(r.count+r.cloneOffset)*m:0:r.currentSlide===r.last&&t===0&&r.vars.animationLoop&&r.direction!=="prev"?y=c?0:(r.count+1)*m:y=c?(r.count-1-t+r.cloneOffset)*m:(t+r.cloneOffset)*m;r.setProps(y,"",r.vars.animationSpeed);if(r.transitions){if(!r.vars.animationLoop||!r.atEnd){r.animating=!1;r.currentSlide=r.animatingTo}r.container.unbind("webkitTransitionEnd transitionend");r.container.bind("webkitTransitionEnd transitionend",function(){r.wrapup(m)})}else r.container.animate(r.args,r.vars.animationSpeed,r.vars.easing,function(){r.wrapup(m)})}else if(!o){r.slides.eq(r.currentSlide).css({zIndex:1}).animate({opacity:0},r.vars.animationSpeed,r.vars.easing);r.slides.eq(t).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing,r.wrapup)}else{r.slides.eq(r.currentSlide).css({opacity:0,zIndex:1});r.slides.eq(t).css({opacity:1,zIndex:2});r.wrapup(m)}r.vars.smoothHeight&&v.smoothHeight(r.vars.animationSpeed)}};r.wrapup=function(e){!p&&!h&&(r.currentSlide===0&&r.animatingTo===r.last&&r.vars.animationLoop?r.setProps(e,"jumpEnd"):r.currentSlide===r.last&&r.animatingTo===0&&r.vars.animationLoop&&r.setProps(e,"jumpStart"));r.animating=!1;r.currentSlide=r.animatingTo;r.vars.after(r)};r.animateSlides=function(){!r.animating&&m&&r.flexAnimate(r.getTarget("next"))};r.pause=function(){clearInterval(r.animatedSlides);r.animatedSlides=null;r.playing=!1;r.vars.pausePlay&&v.pausePlay.update("play");r.syncExists&&v.sync("pause")};r.play=function(){r.playing&&clearInterval(r.animatedSlides);r.animatedSlides=r.animatedSlides||setInterval(r.animateSlides,r.vars.slideshowSpeed);r.started=r.playing=!0;r.vars.pausePlay&&v.pausePlay.update("pause");r.syncExists&&v.sync("play")};r.stop=function(){r.pause();r.stopped=!0};r.canAdvance=function(e,t){var n=d?r.pagingCount-1:r.last;return t?!0:d&&r.currentItem===r.count-1&&e===0&&r.direction==="prev"?!0:d&&r.currentItem===0&&e===r.pagingCount-1&&r.direction!=="next"?!1:e===r.currentSlide&&!d?!1:r.vars.animationLoop?!0:r.atEnd&&r.currentSlide===0&&e===n&&r.direction!=="next"?!1:r.atEnd&&r.currentSlide===n&&e===0&&r.direction==="next"?!1:!0};r.getTarget=function(e){r.direction=e;return e==="next"?r.currentSlide===r.last?0:r.currentSlide+1:r.currentSlide===0?r.last:r.currentSlide-1};r.setProps=function(e,t,n){var i=function(){var n=e?e:(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo,i=function(){if(h)return t==="setTouch"?e:c&&r.animatingTo===r.last?0:c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:r.animatingTo===r.last?r.limit:n;switch(t){case"setTotal":return c?(r.count-1-r.currentSlide+r.cloneOffset)*e:(r.currentSlide+r.cloneOffset)*e;case"setTouch":return c?e:e;case"jumpEnd":return c?e:r.count*e;case"jumpStart":return c?r.count*e:e;default:return e}}();return i*-1+"px"}();if(r.transitions){i=l?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)";n=n!==undefined?n/1e3+"s":"0s";r.container.css("-"+r.pfx+"-transition-duration",n)}r.args[r.prop]=i;(r.transitions||n===undefined)&&r.container.css(r.args)};r.setup=function(t){if(!p){var n,s;if(t==="init"){r.viewport=e('<div class="'+i+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(r).append(r.container);r.cloneCount=0;r.cloneOffset=0;if(c){s=e.makeArray(r.slides).reverse();r.slides=e(s);r.container.empty().append(r.slides)}}if(r.vars.animationLoop&&!h){r.cloneCount=2;r.cloneOffset=1;t!=="init"&&r.container.find(".clone").remove();r.container.append(r.slides.first().clone().addClass("clone").attr("aria-hidden","true")).prepend(r.slides.last().clone().addClass("clone").attr("aria-hidden","true"))}r.newSlides=e(r.vars.selector,r);n=c?r.count-1-r.currentSlide+r.cloneOffset:r.currentSlide+r.cloneOffset;if(l&&!h){r.container.height((r.count+r.cloneCount)*200+"%").css("position","absolute").width("100%");setTimeout(function(){r.newSlides.css({display:"block"});r.doMath();r.viewport.height(r.h);r.setProps(n*r.h,"init")},t==="init"?100:0)}else{r.container.width((r.count+r.cloneCount)*200+"%");r.setProps(n*r.computedW,"init");setTimeout(function(){r.doMath();r.newSlides.css({width:r.computedW,"float":"left",display:"block"});r.vars.smoothHeight&&v.smoothHeight()},t==="init"?100:0)}}else{r.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"});t==="init"&&(o?r.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+r.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(r.currentSlide).css({opacity:1,zIndex:2}):r.slides.css({opacity:0,display:"block",zIndex:1}).eq(r.currentSlide).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing));r.vars.smoothHeight&&v.smoothHeight()}h||r.slides.removeClass(i+"active-slide").eq(r.currentSlide).addClass(i+"active-slide")};r.doMath=function(){var e=r.slides.first(),t=r.vars.itemMargin,n=r.vars.minItems,i=r.vars.maxItems;r.w=r.viewport===undefined?r.width():r.viewport.width();r.h=e.height();r.boxPadding=e.outerWidth()-e.width();if(h){r.itemT=r.vars.itemWidth+t;r.minW=n?n*r.itemT:r.w;r.maxW=i?i*r.itemT-t:r.w;r.itemW=r.minW>r.w?(r.w-t*(n-1))/n:r.maxW<r.w?(r.w-t*(i-1))/i:r.vars.itemWidth>r.w?r.w:r.vars.itemWidth;r.visible=Math.floor(r.w/r.itemW);r.move=r.vars.move>0&&r.vars.move<r.visible?r.vars.move:r.visible;r.pagingCount=Math.ceil((r.count-r.visible)/r.move+1);r.last=r.pagingCount-1;r.limit=r.pagingCount===1?0:r.vars.itemWidth>r.w?r.itemW*(r.count-1)+t*(r.count-1):(r.itemW+t)*r.count-r.w-t}else{r.itemW=r.w;r.pagingCount=r.count;r.last=r.count-1}r.computedW=r.itemW-r.boxPadding};r.update=function(e,t){r.doMath();if(!h){e<r.currentSlide?r.currentSlide+=1:e<=r.currentSlide&&e!==0&&(r.currentSlide-=1);r.animatingTo=r.currentSlide}if(r.vars.controlNav&&!r.manualControls)if(t==="add"&&!h||r.pagingCount>r.controlNav.length)v.controlNav.update("add");else if(t==="remove"&&!h||r.pagingCount<r.controlNav.length){if(h&&r.currentSlide>r.last){r.currentSlide-=1;r.animatingTo-=1}v.controlNav.update("remove",r.last)}r.vars.directionNav&&v.directionNav.update()};r.addSlide=function(t,n){var i=e(t);r.count+=1;r.last=r.count-1;l&&c?n!==undefined?r.slides.eq(r.count-n).after(i):r.container.prepend(i):n!==undefined?r.slides.eq(n).before(i):r.container.append(i);r.update(n,"add");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.added(r)};r.removeSlide=function(t){var n=isNaN(t)?r.slides.index(e(t)):t;r.count-=1;r.last=r.count-1;isNaN(t)?e(t,r.slides).remove():l&&c?r.slides.eq(r.last).remove():r.slides.eq(t).remove();r.doMath();r.update(n,"remove");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.removed(r)};v.init()};e(window).blur(function(e){focused=!1}).focus(function(e){focused=!0});e.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){}};e.fn.flexslider=function(t){t===undefined&&(t={});if(typeof t=="object")return this.each(function(){var n=e(this),r=t.selector?t.selector:".slides > li",i=n.find(r);if(i.length===1&&t.allowOneSlide===!0||i.length===0){i.fadeIn(400);t.start&&t.start(n)}else n.data("flexslider")===undefined&&new e.flexslider(this,t)});var n=e(this).data("flexslider");switch(t){case"play":n.play();break;case"pause":n.pause();break;case"stop":n.stop();break;case"next":n.flexAnimate(n.getTarget("next"),!0);break;case"prev":case"previous":n.flexAnimate(n.getTarget("prev"),!0);break;default:typeof t=="number"&&n.flexAnimate(t,!0)}}})(jQuery);
@@ -0,0 +1,1128 @@
1
+ /*
2
+ * jQuery FlexSlider v2.2.0
3
+ * Copyright 2012 WooThemes
4
+ * Contributing Author: Tyler Smith
5
+ */
6
+ ;
7
+ (function ($) {
8
+
9
+ //FlexSlider: Object Instance
10
+ $.flexslider = function(el, options) {
11
+ var slider = $(el);
12
+
13
+ // making variables public
14
+ slider.vars = $.extend({}, $.flexslider.defaults, options);
15
+
16
+ var namespace = slider.vars.namespace,
17
+ msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
18
+ touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
19
+ // depricating this idea, as devices are being released with both of these events
20
+ //eventType = (touch) ? "touchend" : "click",
21
+ eventType = "click touchend MSPointerUp",
22
+ watchedEvent = "",
23
+ watchedEventClearTimer,
24
+ vertical = slider.vars.direction === "vertical",
25
+ reverse = slider.vars.reverse,
26
+ carousel = (slider.vars.itemWidth > 0),
27
+ fade = slider.vars.animation === "fade",
28
+ asNav = slider.vars.asNavFor !== "",
29
+ methods = {},
30
+ focused = true;
31
+
32
+ // Store a reference to the slider object
33
+ $.data(el, "flexslider", slider);
34
+
35
+ // Private slider methods
36
+ methods = {
37
+ init: function() {
38
+ slider.animating = false;
39
+ // Get current slide and make sure it is a number
40
+ slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0) );
41
+ if ( isNaN( slider.currentSlide ) ) slider.currentSlide = 0;
42
+ slider.animatingTo = slider.currentSlide;
43
+ slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
44
+ slider.containerSelector = slider.vars.selector.substr(0,slider.vars.selector.search(' '));
45
+ slider.slides = $(slider.vars.selector, slider);
46
+ slider.container = $(slider.containerSelector, slider);
47
+ slider.count = slider.slides.length;
48
+ // SYNC:
49
+ slider.syncExists = $(slider.vars.sync).length > 0;
50
+ // SLIDE:
51
+ if (slider.vars.animation === "slide") slider.vars.animation = "swing";
52
+ slider.prop = (vertical) ? "top" : "marginLeft";
53
+ slider.args = {};
54
+ // SLIDESHOW:
55
+ slider.manualPause = false;
56
+ slider.stopped = false;
57
+ //PAUSE WHEN INVISIBLE
58
+ slider.started = false;
59
+ slider.startTimeout = null;
60
+ // TOUCH/USECSS:
61
+ slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function() {
62
+ var obj = document.createElement('div'),
63
+ props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
64
+ for (var i in props) {
65
+ if ( obj.style[ props[i] ] !== undefined ) {
66
+ slider.pfx = props[i].replace('Perspective','').toLowerCase();
67
+ slider.prop = "-" + slider.pfx + "-transform";
68
+ return true;
69
+ }
70
+ }
71
+ return false;
72
+ }());
73
+ // CONTROLSCONTAINER:
74
+ if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
75
+ // MANUAL:
76
+ if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);
77
+
78
+ // RANDOMIZE:
79
+ if (slider.vars.randomize) {
80
+ slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
81
+ slider.container.empty().append(slider.slides);
82
+ }
83
+
84
+ slider.doMath();
85
+
86
+ // INIT
87
+ slider.setup("init");
88
+
89
+ // CONTROLNAV:
90
+ if (slider.vars.controlNav) methods.controlNav.setup();
91
+
92
+ // DIRECTIONNAV:
93
+ if (slider.vars.directionNav) methods.directionNav.setup();
94
+
95
+ // KEYBOARD:
96
+ if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
97
+ $(document).bind('keyup', function(event) {
98
+ var keycode = event.keyCode;
99
+ if (!slider.animating && (keycode === 39 || keycode === 37)) {
100
+ var target = (keycode === 39) ? slider.getTarget('next') :
101
+ (keycode === 37) ? slider.getTarget('prev') : false;
102
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
103
+ }
104
+ });
105
+ }
106
+ // MOUSEWHEEL:
107
+ if (slider.vars.mousewheel) {
108
+ slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
109
+ event.preventDefault();
110
+ var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
111
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
112
+ });
113
+ }
114
+
115
+ // PAUSEPLAY
116
+ if (slider.vars.pausePlay) methods.pausePlay.setup();
117
+
118
+ //PAUSE WHEN INVISIBLE
119
+ if (slider.vars.slideshow && slider.vars.pauseInvisible) methods.pauseInvisible.init();
120
+
121
+ // SLIDSESHOW
122
+ if (slider.vars.slideshow) {
123
+ if (slider.vars.pauseOnHover) {
124
+ slider.hover(function() {
125
+ if (!slider.manualPlay && !slider.manualPause) slider.pause();
126
+ }, function() {
127
+ if (!slider.manualPause && !slider.manualPlay && !slider.stopped) slider.play();
128
+ });
129
+ }
130
+ // initialize animation
131
+ //If we're visible, or we don't use PageVisibility API
132
+ if(!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {
133
+ (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play();
134
+ }
135
+ }
136
+
137
+ // ASNAV:
138
+ if (asNav) methods.asNav.setup();
139
+
140
+ // TOUCH
141
+ if (touch && slider.vars.touch) methods.touch();
142
+
143
+ // FADE&&SMOOTHHEIGHT || SLIDE:
144
+ if (!fade || (fade && slider.vars.smoothHeight)) $(window).bind("resize orientationchange focus", methods.resize);
145
+
146
+ slider.find("img").attr("draggable", "false");
147
+
148
+ // API: start() Callback
149
+ setTimeout(function(){
150
+ slider.vars.start(slider);
151
+ }, 200);
152
+ },
153
+ asNav: {
154
+ setup: function() {
155
+ slider.asNav = true;
156
+ slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
157
+ slider.currentItem = slider.currentSlide;
158
+ slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
159
+ if(!msGesture){
160
+ slider.slides.click(function(e){
161
+ e.preventDefault();
162
+ var $slide = $(this),
163
+ target = $slide.index();
164
+ var posFromLeft = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
165
+ if( posFromLeft <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) {
166
+ slider.flexAnimate(slider.getTarget("prev"), true);
167
+ } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
168
+ slider.direction = (slider.currentItem < target) ? "next" : "prev";
169
+ slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
170
+ }
171
+ });
172
+ }else{
173
+ el._slider = slider;
174
+ slider.slides.each(function (){
175
+ var that = this;
176
+ that._gesture = new MSGesture();
177
+ that._gesture.target = that;
178
+ that.addEventListener("MSPointerDown", function (e){
179
+ e.preventDefault();
180
+ if(e.currentTarget._gesture)
181
+ e.currentTarget._gesture.addPointer(e.pointerId);
182
+ }, false);
183
+ that.addEventListener("MSGestureTap", function (e){
184
+ e.preventDefault();
185
+ var $slide = $(this),
186
+ target = $slide.index();
187
+ if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
188
+ slider.direction = (slider.currentItem < target) ? "next" : "prev";
189
+ slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
190
+ }
191
+ });
192
+ });
193
+ }
194
+ }
195
+ },
196
+ controlNav: {
197
+ setup: function() {
198
+ if (!slider.manualControls) {
199
+ methods.controlNav.setupPaging();
200
+ } else { // MANUALCONTROLS:
201
+ methods.controlNav.setupManual();
202
+ }
203
+ },
204
+ setupPaging: function() {
205
+ var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
206
+ j = 1,
207
+ item,
208
+ slide;
209
+
210
+ slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
211
+
212
+ if (slider.pagingCount > 1) {
213
+ for (var i = 0; i < slider.pagingCount; i++) {
214
+ slide = slider.slides.eq(i);
215
+ item = (slider.vars.controlNav === "thumbnails") ? '<img src="' + slide.attr( 'data-thumb' ) + '"/>' : '<a>' + j + '</a>';
216
+ if ( 'thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions ) {
217
+ var captn = slide.attr( 'data-thumbcaption' );
218
+ if ( '' != captn && undefined != captn ) item += '<span class="' + namespace + 'caption">' + captn + '</span>';
219
+ }
220
+ slider.controlNavScaffold.append('<li>' + item + '</li>');
221
+ j++;
222
+ }
223
+ }
224
+
225
+ // CONTROLSCONTAINER:
226
+ (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
227
+ methods.controlNav.set();
228
+
229
+ methods.controlNav.active();
230
+
231
+ slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
232
+ event.preventDefault();
233
+
234
+ if (watchedEvent === "" || watchedEvent === event.type) {
235
+ var $this = $(this),
236
+ target = slider.controlNav.index($this);
237
+
238
+ if (!$this.hasClass(namespace + 'active')) {
239
+ slider.direction = (target > slider.currentSlide) ? "next" : "prev";
240
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
241
+ }
242
+ }
243
+
244
+ // setup flags to prevent event duplication
245
+ if (watchedEvent === "") {
246
+ watchedEvent = event.type;
247
+ }
248
+ methods.setToClearWatchedEvent();
249
+
250
+ });
251
+ },
252
+ setupManual: function() {
253
+ slider.controlNav = slider.manualControls;
254
+ methods.controlNav.active();
255
+
256
+ slider.controlNav.bind(eventType, function(event) {
257
+ event.preventDefault();
258
+
259
+ if (watchedEvent === "" || watchedEvent === event.type) {
260
+ var $this = $(this),
261
+ target = slider.controlNav.index($this);
262
+
263
+ if (!$this.hasClass(namespace + 'active')) {
264
+ (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
265
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
266
+ }
267
+ }
268
+
269
+ // setup flags to prevent event duplication
270
+ if (watchedEvent === "") {
271
+ watchedEvent = event.type;
272
+ }
273
+ methods.setToClearWatchedEvent();
274
+ });
275
+ },
276
+ set: function() {
277
+ var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a';
278
+ slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
279
+ },
280
+ active: function() {
281
+ slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
282
+ },
283
+ update: function(action, pos) {
284
+ if (slider.pagingCount > 1 && action === "add") {
285
+ slider.controlNavScaffold.append($('<li><a>' + slider.count + '</a></li>'));
286
+ } else if (slider.pagingCount === 1) {
287
+ slider.controlNavScaffold.find('li').remove();
288
+ } else {
289
+ slider.controlNav.eq(pos).closest('li').remove();
290
+ }
291
+ methods.controlNav.set();
292
+ (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
293
+ }
294
+ },
295
+ directionNav: {
296
+ setup: function() {
297
+ var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li><a class="' + namespace + 'prev" href="#">' + slider.vars.prevText + '</a></li><li><a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a></li></ul>');
298
+
299
+ // CONTROLSCONTAINER:
300
+ if (slider.controlsContainer) {
301
+ $(slider.controlsContainer).append(directionNavScaffold);
302
+ slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
303
+ } else {
304
+ slider.append(directionNavScaffold);
305
+ slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
306
+ }
307
+
308
+ methods.directionNav.update();
309
+
310
+ slider.directionNav.bind(eventType, function(event) {
311
+ event.preventDefault();
312
+ var target;
313
+
314
+ if (watchedEvent === "" || watchedEvent === event.type) {
315
+ target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
316
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
317
+ }
318
+
319
+ // setup flags to prevent event duplication
320
+ if (watchedEvent === "") {
321
+ watchedEvent = event.type;
322
+ }
323
+ methods.setToClearWatchedEvent();
324
+ });
325
+ },
326
+ update: function() {
327
+ var disabledClass = namespace + 'disabled';
328
+ if (slider.pagingCount === 1) {
329
+ slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
330
+ } else if (!slider.vars.animationLoop) {
331
+ if (slider.animatingTo === 0) {
332
+ slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
333
+ } else if (slider.animatingTo === slider.last) {
334
+ slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
335
+ } else {
336
+ slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
337
+ }
338
+ } else {
339
+ slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
340
+ }
341
+ }
342
+ },
343
+ pausePlay: {
344
+ setup: function() {
345
+ var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>');
346
+
347
+ // CONTROLSCONTAINER:
348
+ if (slider.controlsContainer) {
349
+ slider.controlsContainer.append(pausePlayScaffold);
350
+ slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
351
+ } else {
352
+ slider.append(pausePlayScaffold);
353
+ slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
354
+ }
355
+
356
+ methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
357
+
358
+ slider.pausePlay.bind(eventType, function(event) {
359
+ event.preventDefault();
360
+
361
+ if (watchedEvent === "" || watchedEvent === event.type) {
362
+ if ($(this).hasClass(namespace + 'pause')) {
363
+ slider.manualPause = true;
364
+ slider.manualPlay = false;
365
+ slider.pause();
366
+ } else {
367
+ slider.manualPause = false;
368
+ slider.manualPlay = true;
369
+ slider.play();
370
+ }
371
+ }
372
+
373
+ // setup flags to prevent event duplication
374
+ if (watchedEvent === "") {
375
+ watchedEvent = event.type;
376
+ }
377
+ methods.setToClearWatchedEvent();
378
+ });
379
+ },
380
+ update: function(state) {
381
+ (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText);
382
+ }
383
+ },
384
+ touch: function() {
385
+ var startX,
386
+ startY,
387
+ offset,
388
+ cwidth,
389
+ dx,
390
+ startT,
391
+ scrolling = false,
392
+ localX = 0,
393
+ localY = 0,
394
+ accDx = 0;
395
+
396
+ if(!msGesture){
397
+ el.addEventListener('touchstart', onTouchStart, false);
398
+
399
+ function onTouchStart(e) {
400
+ if (slider.animating) {
401
+ e.preventDefault();
402
+ } else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
403
+ slider.pause();
404
+ // CAROUSEL:
405
+ cwidth = (vertical) ? slider.h : slider. w;
406
+ startT = Number(new Date());
407
+ // CAROUSEL:
408
+
409
+ // Local vars for X and Y points.
410
+ localX = e.touches[0].pageX;
411
+ localY = e.touches[0].pageY;
412
+
413
+ offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
414
+ (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
415
+ (carousel && slider.currentSlide === slider.last) ? slider.limit :
416
+ (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
417
+ (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
418
+ startX = (vertical) ? localY : localX;
419
+ startY = (vertical) ? localX : localY;
420
+
421
+ el.addEventListener('touchmove', onTouchMove, false);
422
+ el.addEventListener('touchend', onTouchEnd, false);
423
+ }
424
+ }
425
+
426
+ function onTouchMove(e) {
427
+ // Local vars for X and Y points.
428
+
429
+ localX = e.touches[0].pageX;
430
+ localY = e.touches[0].pageY;
431
+
432
+ dx = (vertical) ? startX - localY : startX - localX;
433
+ scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
434
+
435
+ var fxms = 500;
436
+
437
+ if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
438
+ e.preventDefault();
439
+ if (!fade && slider.transitions) {
440
+ if (!slider.vars.animationLoop) {
441
+ dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
442
+ }
443
+ slider.setProps(offset + dx, "setTouch");
444
+ }
445
+ }
446
+ }
447
+
448
+ function onTouchEnd(e) {
449
+ // finish the touch by undoing the touch session
450
+ el.removeEventListener('touchmove', onTouchMove, false);
451
+
452
+ if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
453
+ var updateDx = (reverse) ? -dx : dx,
454
+ target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
455
+
456
+ if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
457
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
458
+ } else {
459
+ if (!fade) slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);
460
+ }
461
+ }
462
+ el.removeEventListener('touchend', onTouchEnd, false);
463
+
464
+ startX = null;
465
+ startY = null;
466
+ dx = null;
467
+ offset = null;
468
+ }
469
+ }else{
470
+ el.style.msTouchAction = "none";
471
+ el._gesture = new MSGesture();
472
+ el._gesture.target = el;
473
+ el.addEventListener("MSPointerDown", onMSPointerDown, false);
474
+ el._slider = slider;
475
+ el.addEventListener("MSGestureChange", onMSGestureChange, false);
476
+ el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
477
+
478
+ function onMSPointerDown(e){
479
+ e.stopPropagation();
480
+ if (slider.animating) {
481
+ e.preventDefault();
482
+ }else{
483
+ slider.pause();
484
+ el._gesture.addPointer(e.pointerId);
485
+ accDx = 0;
486
+ cwidth = (vertical) ? slider.h : slider. w;
487
+ startT = Number(new Date());
488
+ // CAROUSEL:
489
+
490
+ offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
491
+ (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
492
+ (carousel && slider.currentSlide === slider.last) ? slider.limit :
493
+ (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
494
+ (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
495
+ }
496
+ }
497
+
498
+ function onMSGestureChange(e) {
499
+ e.stopPropagation();
500
+ var slider = e.target._slider;
501
+ if(!slider){
502
+ return;
503
+ }
504
+ var transX = -e.translationX,
505
+ transY = -e.translationY;
506
+
507
+ //Accumulate translations.
508
+ accDx = accDx + ((vertical) ? transY : transX);
509
+ dx = accDx;
510
+ scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));
511
+
512
+ if(e.detail === e.MSGESTURE_FLAG_INERTIA){
513
+ setImmediate(function (){
514
+ el._gesture.stop();
515
+ });
516
+
517
+ return;
518
+ }
519
+
520
+ if (!scrolling || Number(new Date()) - startT > 500) {
521
+ e.preventDefault();
522
+ if (!fade && slider.transitions) {
523
+ if (!slider.vars.animationLoop) {
524
+ dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
525
+ }
526
+ slider.setProps(offset + dx, "setTouch");
527
+ }
528
+ }
529
+ }
530
+
531
+ function onMSGestureEnd(e) {
532
+ e.stopPropagation();
533
+ var slider = e.target._slider;
534
+ if(!slider){
535
+ return;
536
+ }
537
+ if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
538
+ var updateDx = (reverse) ? -dx : dx,
539
+ target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
540
+
541
+ if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
542
+ slider.flexAnimate(target, slider.vars.pauseOnAction);
543
+ } else {
544
+ if (!fade) slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true);
545
+ }
546
+ }
547
+
548
+ startX = null;
549
+ startY = null;
550
+ dx = null;
551
+ offset = null;
552
+ accDx = 0;
553
+ }
554
+ }
555
+ },
556
+ resize: function() {
557
+ if (!slider.animating && slider.is(':visible')) {
558
+ if (!carousel) slider.doMath();
559
+
560
+ if (fade) {
561
+ // SMOOTH HEIGHT:
562
+ methods.smoothHeight();
563
+ } else if (carousel) { //CAROUSEL:
564
+ slider.slides.width(slider.computedW);
565
+ slider.update(slider.pagingCount);
566
+ slider.setProps();
567
+ }
568
+ else if (vertical) { //VERTICAL:
569
+ slider.viewport.height(slider.h);
570
+ slider.setProps(slider.h, "setTotal");
571
+ } else {
572
+ // SMOOTH HEIGHT:
573
+ if (slider.vars.smoothHeight) methods.smoothHeight();
574
+ slider.newSlides.width(slider.computedW);
575
+ slider.setProps(slider.computedW, "setTotal");
576
+ }
577
+ }
578
+ },
579
+ smoothHeight: function(dur) {
580
+ if (!vertical || fade) {
581
+ var $obj = (fade) ? slider : slider.viewport;
582
+ (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height());
583
+ }
584
+ },
585
+ sync: function(action) {
586
+ var $obj = $(slider.vars.sync).data("flexslider"),
587
+ target = slider.animatingTo;
588
+
589
+ switch (action) {
590
+ case "animate": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break;
591
+ case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
592
+ case "pause": $obj.pause(); break;
593
+ }
594
+ },
595
+ pauseInvisible: {
596
+ visProp: null,
597
+ init: function() {
598
+ var prefixes = ['webkit','moz','ms','o'];
599
+
600
+ if ('hidden' in document) return 'hidden';
601
+ for (var i = 0; i < prefixes.length; i++) {
602
+ if ((prefixes[i] + 'Hidden') in document)
603
+ methods.pauseInvisible.visProp = prefixes[i] + 'Hidden';
604
+ }
605
+ if (methods.pauseInvisible.visProp) {
606
+ var evtname = methods.pauseInvisible.visProp.replace(/[H|h]idden/,'') + 'visibilitychange';
607
+ document.addEventListener(evtname, function() {
608
+ if (methods.pauseInvisible.isHidden()) {
609
+ if(slider.startTimeout) clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible
610
+ else slider.pause(); //Or just pause
611
+ }
612
+ else {
613
+ if(slider.started) slider.play(); //Initiated before, just play
614
+ else (slider.vars.initDelay > 0) ? setTimeout(slider.play, slider.vars.initDelay) : slider.play(); //Didn't init before: simply init or wait for it
615
+ }
616
+ });
617
+ }
618
+ },
619
+ isHidden: function() {
620
+ return document[methods.pauseInvisible.visProp] || false;
621
+ }
622
+ },
623
+ setToClearWatchedEvent: function() {
624
+ clearTimeout(watchedEventClearTimer);
625
+ watchedEventClearTimer = setTimeout(function() {
626
+ watchedEvent = "";
627
+ }, 3000);
628
+ }
629
+ }
630
+
631
+ // public methods
632
+ slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
633
+ if (!slider.vars.animationLoop && target !== slider.currentSlide) {
634
+ slider.direction = (target > slider.currentSlide) ? "next" : "prev";
635
+ }
636
+
637
+ if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
638
+
639
+ if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
640
+ if (asNav && withSync) {
641
+ var master = $(slider.vars.asNavFor).data('flexslider');
642
+ slider.atEnd = target === 0 || target === slider.count - 1;
643
+ master.flexAnimate(target, true, false, true, fromNav);
644
+ slider.direction = (slider.currentItem < target) ? "next" : "prev";
645
+ master.direction = slider.direction;
646
+
647
+ if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
648
+ slider.currentItem = target;
649
+ slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
650
+ target = Math.floor(target/slider.visible);
651
+ } else {
652
+ slider.currentItem = target;
653
+ slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
654
+ return false;
655
+ }
656
+ }
657
+
658
+ slider.animating = true;
659
+ slider.animatingTo = target;
660
+
661
+ // SLIDESHOW:
662
+ if (pause) slider.pause();
663
+
664
+ // API: before() animation Callback
665
+ slider.vars.before(slider);
666
+
667
+ // SYNC:
668
+ if (slider.syncExists && !fromNav) methods.sync("animate");
669
+
670
+ // CONTROLNAV
671
+ if (slider.vars.controlNav) methods.controlNav.active();
672
+
673
+ // !CAROUSEL:
674
+ // CANDIDATE: slide active class (for add/remove slide)
675
+ if (!carousel) slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');
676
+
677
+ // INFINITE LOOP:
678
+ // CANDIDATE: atEnd
679
+ slider.atEnd = target === 0 || target === slider.last;
680
+
681
+ // DIRECTIONNAV:
682
+ if (slider.vars.directionNav) methods.directionNav.update();
683
+
684
+ if (target === slider.last) {
685
+ // API: end() of cycle Callback
686
+ slider.vars.end(slider);
687
+ // SLIDESHOW && !INFINITE LOOP:
688
+ if (!slider.vars.animationLoop) slider.pause();
689
+ }
690
+
691
+ // SLIDE:
692
+ if (!fade) {
693
+ var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
694
+ margin, slideString, calcNext;
695
+
696
+ // INFINITE LOOP / REVERSE:
697
+ if (carousel) {
698
+ //margin = (slider.vars.itemWidth > slider.w) ? slider.vars.itemMargin * 2 : slider.vars.itemMargin;
699
+ margin = slider.vars.itemMargin;
700
+ calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
701
+ slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
702
+ } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") {
703
+ slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
704
+ } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") {
705
+ slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
706
+ } else {
707
+ slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
708
+ }
709
+ slider.setProps(slideString, "", slider.vars.animationSpeed);
710
+ if (slider.transitions) {
711
+ if (!slider.vars.animationLoop || !slider.atEnd) {
712
+ slider.animating = false;
713
+ slider.currentSlide = slider.animatingTo;
714
+ }
715
+ slider.container.unbind("webkitTransitionEnd transitionend");
716
+ slider.container.bind("webkitTransitionEnd transitionend", function() {
717
+ slider.wrapup(dimension);
718
+ });
719
+ } else {
720
+ slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
721
+ slider.wrapup(dimension);
722
+ });
723
+ }
724
+ } else { // FADE:
725
+ if (!touch) {
726
+ //slider.slides.eq(slider.currentSlide).fadeOut(slider.vars.animationSpeed, slider.vars.easing);
727
+ //slider.slides.eq(target).fadeIn(slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
728
+
729
+ slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
730
+ slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
731
+
732
+ } else {
733
+ slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
734
+ slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
735
+ slider.wrapup(dimension);
736
+ }
737
+ }
738
+ // SMOOTH HEIGHT:
739
+ if (slider.vars.smoothHeight) methods.smoothHeight(slider.vars.animationSpeed);
740
+ }
741
+ }
742
+ slider.wrapup = function(dimension) {
743
+ // SLIDE:
744
+ if (!fade && !carousel) {
745
+ if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) {
746
+ slider.setProps(dimension, "jumpEnd");
747
+ } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) {
748
+ slider.setProps(dimension, "jumpStart");
749
+ }
750
+ }
751
+ slider.animating = false;
752
+ slider.currentSlide = slider.animatingTo;
753
+ // API: after() animation Callback
754
+ slider.vars.after(slider);
755
+ }
756
+
757
+ // SLIDESHOW:
758
+ slider.animateSlides = function() {
759
+ if (!slider.animating && focused ) slider.flexAnimate(slider.getTarget("next"));
760
+ }
761
+ // SLIDESHOW:
762
+ slider.pause = function() {
763
+ clearInterval(slider.animatedSlides);
764
+ slider.animatedSlides = null;
765
+ slider.playing = false;
766
+ // PAUSEPLAY:
767
+ if (slider.vars.pausePlay) methods.pausePlay.update("play");
768
+ // SYNC:
769
+ if (slider.syncExists) methods.sync("pause");
770
+ }
771
+ // SLIDESHOW:
772
+ slider.play = function() {
773
+ if (slider.playing) clearInterval(slider.animatedSlides);
774
+ slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed);
775
+ slider.started = slider.playing = true;
776
+ // PAUSEPLAY:
777
+ if (slider.vars.pausePlay) methods.pausePlay.update("pause");
778
+ // SYNC:
779
+ if (slider.syncExists) methods.sync("play");
780
+ }
781
+ // STOP:
782
+ slider.stop = function () {
783
+ slider.pause();
784
+ slider.stopped = true;
785
+ }
786
+ slider.canAdvance = function(target, fromNav) {
787
+ // ASNAV:
788
+ var last = (asNav) ? slider.pagingCount - 1 : slider.last;
789
+ return (fromNav) ? true :
790
+ (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
791
+ (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
792
+ (target === slider.currentSlide && !asNav) ? false :
793
+ (slider.vars.animationLoop) ? true :
794
+ (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
795
+ (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
796
+ true;
797
+ }
798
+ slider.getTarget = function(dir) {
799
+ slider.direction = dir;
800
+ if (dir === "next") {
801
+ return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
802
+ } else {
803
+ return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
804
+ }
805
+ }
806
+
807
+ // SLIDE:
808
+ slider.setProps = function(pos, special, dur) {
809
+ var target = (function() {
810
+ var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
811
+ posCalc = (function() {
812
+ if (carousel) {
813
+ return (special === "setTouch") ? pos :
814
+ (reverse && slider.animatingTo === slider.last) ? 0 :
815
+ (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
816
+ (slider.animatingTo === slider.last) ? slider.limit : posCheck;
817
+ } else {
818
+ switch (special) {
819
+ case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
820
+ case "setTouch": return (reverse) ? pos : pos;
821
+ case "jumpEnd": return (reverse) ? pos : slider.count * pos;
822
+ case "jumpStart": return (reverse) ? slider.count * pos : pos;
823
+ default: return pos;
824
+ }
825
+ }
826
+ }());
827
+
828
+ return (posCalc * -1) + "px";
829
+ }());
830
+
831
+ if (slider.transitions) {
832
+ target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
833
+ dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
834
+ slider.container.css("-" + slider.pfx + "-transition-duration", dur);
835
+ }
836
+
837
+ slider.args[slider.prop] = target;
838
+ if (slider.transitions || dur === undefined) slider.container.css(slider.args);
839
+ }
840
+
841
+ slider.setup = function(type) {
842
+ // SLIDE:
843
+ if (!fade) {
844
+ var sliderOffset, arr;
845
+
846
+ if (type === "init") {
847
+ slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
848
+ // INFINITE LOOP:
849
+ slider.cloneCount = 0;
850
+ slider.cloneOffset = 0;
851
+ // REVERSE:
852
+ if (reverse) {
853
+ arr = $.makeArray(slider.slides).reverse();
854
+ slider.slides = $(arr);
855
+ slider.container.empty().append(slider.slides);
856
+ }
857
+ }
858
+ // INFINITE LOOP && !CAROUSEL:
859
+ if (slider.vars.animationLoop && !carousel) {
860
+ slider.cloneCount = 2;
861
+ slider.cloneOffset = 1;
862
+ // clear out old clones
863
+ if (type !== "init") slider.container.find('.clone').remove();
864
+ slider.container.append(slider.slides.first().clone().addClass('clone').attr('aria-hidden', 'true')).prepend(slider.slides.last().clone().addClass('clone').attr('aria-hidden', 'true'));
865
+ }
866
+ slider.newSlides = $(slider.vars.selector, slider);
867
+
868
+ sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
869
+ // VERTICAL:
870
+ if (vertical && !carousel) {
871
+ slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
872
+ setTimeout(function(){
873
+ slider.newSlides.css({"display": "block"});
874
+ slider.doMath();
875
+ slider.viewport.height(slider.h);
876
+ slider.setProps(sliderOffset * slider.h, "init");
877
+ }, (type === "init") ? 100 : 0);
878
+ } else {
879
+ slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
880
+ slider.setProps(sliderOffset * slider.computedW, "init");
881
+ setTimeout(function(){
882
+ slider.doMath();
883
+ slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
884
+ // SMOOTH HEIGHT:
885
+ if (slider.vars.smoothHeight) methods.smoothHeight();
886
+ }, (type === "init") ? 100 : 0);
887
+ }
888
+ } else { // FADE:
889
+ slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
890
+ if (type === "init") {
891
+ if (!touch) {
892
+ //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);
893
+ slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
894
+ } else {
895
+ slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
896
+ }
897
+ }
898
+ // SMOOTH HEIGHT:
899
+ if (slider.vars.smoothHeight) methods.smoothHeight();
900
+ }
901
+ // !CAROUSEL:
902
+ // CANDIDATE: active slide
903
+ if (!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
904
+ }
905
+
906
+
907
+ slider.doMath = function() {
908
+ var slide = slider.slides.first(),
909
+ slideMargin = slider.vars.itemMargin,
910
+ minItems = slider.vars.minItems,
911
+ maxItems = slider.vars.maxItems;
912
+
913
+ slider.w = (slider.viewport===undefined) ? slider.width() : slider.viewport.width();
914
+ slider.h = slide.height();
915
+ slider.boxPadding = slide.outerWidth() - slide.width();
916
+
917
+ // CAROUSEL:
918
+ if (carousel) {
919
+ slider.itemT = slider.vars.itemWidth + slideMargin;
920
+ slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
921
+ slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w;
922
+ slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1)))/minItems :
923
+ (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1)))/maxItems :
924
+ (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth;
925
+
926
+ slider.visible = Math.floor(slider.w/(slider.itemW));
927
+ slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible ) ? slider.vars.move : slider.visible;
928
+ slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
929
+ slider.last = slider.pagingCount - 1;
930
+ slider.limit = (slider.pagingCount === 1) ? 0 :
931
+ (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
932
+ } else {
933
+ slider.itemW = slider.w;
934
+ slider.pagingCount = slider.count;
935
+ slider.last = slider.count - 1;
936
+ }
937
+ slider.computedW = slider.itemW - slider.boxPadding;
938
+ }
939
+
940
+
941
+ slider.update = function(pos, action) {
942
+ slider.doMath();
943
+
944
+ // update currentSlide and slider.animatingTo if necessary
945
+ if (!carousel) {
946
+ if (pos < slider.currentSlide) {
947
+ slider.currentSlide += 1;
948
+ } else if (pos <= slider.currentSlide && pos !== 0) {
949
+ slider.currentSlide -= 1;
950
+ }
951
+ slider.animatingTo = slider.currentSlide;
952
+ }
953
+
954
+ // update controlNav
955
+ if (slider.vars.controlNav && !slider.manualControls) {
956
+ if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
957
+ methods.controlNav.update("add");
958
+ } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
959
+ if (carousel && slider.currentSlide > slider.last) {
960
+ slider.currentSlide -= 1;
961
+ slider.animatingTo -= 1;
962
+ }
963
+ methods.controlNav.update("remove", slider.last);
964
+ }
965
+ }
966
+ // update directionNav
967
+ if (slider.vars.directionNav) methods.directionNav.update();
968
+
969
+ }
970
+
971
+ slider.addSlide = function(obj, pos) {
972
+ var $obj = $(obj);
973
+
974
+ slider.count += 1;
975
+ slider.last = slider.count - 1;
976
+
977
+ // append new slide
978
+ if (vertical && reverse) {
979
+ (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
980
+ } else {
981
+ (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
982
+ }
983
+
984
+ // update currentSlide, animatingTo, controlNav, and directionNav
985
+ slider.update(pos, "add");
986
+
987
+ // update slider.slides
988
+ slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
989
+ // re-setup the slider to accomdate new slide
990
+ slider.setup();
991
+
992
+ //FlexSlider: added() Callback
993
+ slider.vars.added(slider);
994
+ }
995
+ slider.removeSlide = function(obj) {
996
+ var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
997
+
998
+ // update count
999
+ slider.count -= 1;
1000
+ slider.last = slider.count - 1;
1001
+
1002
+ // remove slide
1003
+ if (isNaN(obj)) {
1004
+ $(obj, slider.slides).remove();
1005
+ } else {
1006
+ (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
1007
+ }
1008
+
1009
+ // update currentSlide, animatingTo, controlNav, and directionNav
1010
+ slider.doMath();
1011
+ slider.update(pos, "remove");
1012
+
1013
+ // update slider.slides
1014
+ slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
1015
+ // re-setup the slider to accomdate new slide
1016
+ slider.setup();
1017
+
1018
+ // FlexSlider: removed() Callback
1019
+ slider.vars.removed(slider);
1020
+ }
1021
+
1022
+ //FlexSlider: Initialize
1023
+ methods.init();
1024
+ }
1025
+
1026
+ // Ensure the slider isn't focussed if the window loses focus.
1027
+ $( window ).blur( function ( e ) {
1028
+ focused = false;
1029
+ }).focus( function ( e ) {
1030
+ focused = true;
1031
+ });
1032
+
1033
+ //FlexSlider: Default Settings
1034
+ $.flexslider.defaults = {
1035
+ namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
1036
+ selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
1037
+ animation: "fade", //String: Select your animation type, "fade" or "slide"
1038
+ easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
1039
+ direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
1040
+ reverse: false, //{NEW} Boolean: Reverse the animation direction
1041
+ animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
1042
+ smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
1043
+ startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
1044
+ slideshow: true, //Boolean: Animate slider automatically
1045
+ slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
1046
+ animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
1047
+ initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
1048
+ randomize: false, //Boolean: Randomize slide order
1049
+ thumbCaptions: false, //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
1050
+
1051
+ // Usability features
1052
+ pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
1053
+ pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
1054
+ pauseInvisible: true, //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
1055
+ useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available
1056
+ touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
1057
+ video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
1058
+
1059
+ // Primary Controls
1060
+ controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
1061
+ directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
1062
+ prevText: "Previous", //String: Set the text for the "previous" directionNav item
1063
+ nextText: "Next", //String: Set the text for the "next" directionNav item
1064
+
1065
+ // Secondary Navigation
1066
+ keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys
1067
+ multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
1068
+ mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
1069
+ pausePlay: false, //Boolean: Create pause/play dynamic element
1070
+ pauseText: "Pause", //String: Set the text for the "pause" pausePlay item
1071
+ playText: "Play", //String: Set the text for the "play" pausePlay item
1072
+
1073
+ // Special properties
1074
+ controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
1075
+ manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
1076
+ sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
1077
+ asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
1078
+
1079
+ // Carousel Options
1080
+ itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
1081
+ itemMargin: 0, //{NEW} Integer: Margin between carousel items.
1082
+ minItems: 1, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
1083
+ maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
1084
+ move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
1085
+ allowOneSlide: true, //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide
1086
+
1087
+ // Callback API
1088
+ start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
1089
+ before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
1090
+ after: function(){}, //Callback: function(slider) - Fires after each slider animation completes
1091
+ end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
1092
+ added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
1093
+ removed: function(){} //{NEW} Callback: function(slider) - Fires after a slide is removed
1094
+ }
1095
+
1096
+
1097
+ //FlexSlider: Plugin Function
1098
+ $.fn.flexslider = function(options) {
1099
+ if (options === undefined) options = {};
1100
+
1101
+ if (typeof options === "object") {
1102
+ return this.each(function() {
1103
+ var $this = $(this),
1104
+ selector = (options.selector) ? options.selector : ".slides > li",
1105
+ $slides = $this.find(selector);
1106
+
1107
+ if ( ( $slides.length === 1 && options.allowOneSlide === true ) || $slides.length === 0 ) {
1108
+ $slides.fadeIn(400);
1109
+ if (options.start) options.start($this);
1110
+ } else if ($this.data('flexslider') === undefined) {
1111
+ new $.flexslider(this, options);
1112
+ }
1113
+ });
1114
+ } else {
1115
+ // Helper strings to quickly perform functions on the slider
1116
+ var $slider = $(this).data('flexslider');
1117
+ switch (options) {
1118
+ case "play": $slider.play(); break;
1119
+ case "pause": $slider.pause(); break;
1120
+ case "stop": $slider.stop(); break;
1121
+ case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
1122
+ case "prev":
1123
+ case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
1124
+ default: if (typeof options === "number") $slider.flexAnimate(options, true);
1125
+ }
1126
+ }
1127
+ }
1128
+ })(jQuery);