anything_slider-rails 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. data/.gitignore +5 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +1 -0
  4. data/anything_slider.gemspec +22 -0
  5. data/lib/anything_slider-rails.rb +7 -0
  6. data/lib/anything_slider/rails/engine.rb +6 -0
  7. data/lib/anything_slider/rails/version.rb +5 -0
  8. data/readme.markdown +57 -0
  9. data/vendor/assets/images/anythingslider/arrows-metallic.png +0 -0
  10. data/vendor/assets/images/anythingslider/arrows-minimalist.png +0 -0
  11. data/vendor/assets/images/anythingslider/construction.gif +0 -0
  12. data/vendor/assets/images/anythingslider/cs-portfolio.png +0 -0
  13. data/vendor/assets/images/anythingslider/default.png +0 -0
  14. data/vendor/assets/javascripts/anythingslider/jquery.anythingslider.fx.js +188 -0
  15. data/vendor/assets/javascripts/anythingslider/jquery.anythingslider.js +831 -0
  16. data/vendor/assets/javascripts/anythingslider/jquery.anythingslider.video.js +379 -0
  17. data/vendor/assets/javascripts/anythingslider/jquery.easing.1.3.js +205 -0
  18. data/vendor/assets/javascripts/anythingslider/swfobject.js +4 -0
  19. data/vendor/assets/stylesheets/anythingslider/animate.css +3813 -0
  20. data/vendor/assets/stylesheets/anythingslider/anythingslider-ie.css +65 -0
  21. data/vendor/assets/stylesheets/anythingslider/anythingslider.css.erb +202 -0
  22. data/vendor/assets/stylesheets/anythingslider/theme-construction.css.erb +142 -0
  23. data/vendor/assets/stylesheets/anythingslider/theme-cs-portfolio.css.erb +149 -0
  24. data/vendor/assets/stylesheets/anythingslider/theme-metallic.css.erb +146 -0
  25. data/vendor/assets/stylesheets/anythingslider/theme-minimalist-round.css.erb +144 -0
  26. data/vendor/assets/stylesheets/anythingslider/theme-minimalist-square.css.erb +144 -0
  27. metadata +107 -0
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in anything_slider_rails.gemspec
4
+ gemspec
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "anything_slider/rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "anything_slider-rails"
7
+ s.version = AnythingSlider::Rails::VERSION
8
+ s.authors = ["Leif", "Han"]
9
+ s.email = ["leifcr@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{AnythingSlider automated install for Rails 3.1+}
12
+ s.description = %q{Gem installation of jquery plugin, AnythingSlider}
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib", "vendor"]
18
+
19
+ s.add_dependency "railties", ">= 3.1.0"
20
+ s.add_development_dependency "bundler", "~> 1.0.0"
21
+ s.add_development_dependency "rails", "~> 3.1"
22
+ end
@@ -0,0 +1,7 @@
1
+ module AnythingSlider
2
+ module Rails
3
+ end
4
+ end
5
+
6
+ require 'anything_slider/rails/version'
7
+ require 'anything_slider/rails/engine'
@@ -0,0 +1,6 @@
1
+ module AnythingSlider
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module AnythingSlider
2
+ module Rails
3
+ VERSION = "0.0.3"
4
+ end
5
+ end
@@ -0,0 +1,57 @@
1
+ # AnythingSlider for Rails
2
+
3
+ Current AnythingSlider version: v1.7.26
4
+
5
+ **AnythingSliderRails** packages the anything slider jquery plugin and stylesheets and allows you to merely include the required scripts in your manifest in order to start using the plugin.
6
+
7
+ # Included Javascripts
8
+ **minified js files are not included, since the rails asset pipeline sorta necessitates the compiling (and likely minifying) your js files for production**
9
+
10
+ anythingslider/jquery.anythingslider.fx.js
11
+ anythingslider/jquery.anythingslider.js
12
+ anythingslider/jquery.anythingslider.video.js
13
+ anythingslider/jquery.easing.1.3.js
14
+ anythingslider/swfobject.js
15
+
16
+ # Included Stylesheets
17
+
18
+ anythingslider/animate.css
19
+ anythingslider/anythingslider-ie.css
20
+ anythingslider/anythingslider.css
21
+ anythingslider/theme-construction.css
22
+ anythingslider/theme-cs-portfolio.css
23
+ anythingslider/theme-metallic.css
24
+ anythingslider/theme-minimalist-round.css
25
+ anythingslider/theme-minimalist-square.css
26
+
27
+ ### Installation
28
+
29
+ This gem should work out of the box. All you have to do is add the gem to your Gemfile:
30
+
31
+ gem 'anything_slider_rails', :git => 'http://github.com/leifcr/AnythingSliderRails.git'
32
+
33
+ Then bundle install or update (depending on if you want to upgrade an older version of this gem).
34
+
35
+ bundle install
36
+ bundle update
37
+
38
+ In your assets/javascripts/application.js, you will need to add jquery.anythingslider to your manifest:
39
+
40
+ //= require jquery
41
+ .
42
+ .
43
+ //= require anythingslider/jquery.anythingslider
44
+
45
+
46
+ You might want to add the stylesheets to your assets/stylesheets/application.css
47
+ .
48
+ .
49
+ //= require anythingslider/anythingslider
50
+ // And perhaps a theme
51
+ //= require anythingslider/theme-ninimalist-round
52
+ // Animate.css if needed
53
+ //= require anythingslider/animate
54
+
55
+
56
+
57
+
@@ -0,0 +1,188 @@
1
+ /*
2
+ * AnythingSlider Slide FX 1.6 for AnythingSlider v1.7.11+
3
+ * By Rob Garrison (aka Mottie & Fudgey)
4
+ * Dual licensed under the MIT and GPL licenses.
5
+ */
6
+ (function($) {
7
+ $.fn.anythingSliderFx = function(effects, options){
8
+
9
+ // variable sizes shouldn't matter - it's just to get an idea to get the elements out of view
10
+ var wrap = $(this).closest('.anythingSlider'),
11
+ sliderWidth = wrap.width(),
12
+ sliderHeight = wrap.height(),
13
+ getBaseFx = function(s){
14
+ var size = s, size2;
15
+ // allow for start and end sizes/dimensions
16
+ if (s && typeof s === 'string' && s.indexOf(',') > 0) {
17
+ s = s.split(',');
18
+ size = $.trim(s[0]); size2 = $.trim(s[1]);
19
+ }
20
+ return {
21
+ // 'name' : [{ inFx: {effects}, { outFx: {effects} }, selector: []]
22
+ 'top' : [{ inFx: { top: 0 }, outFx: { top: '-' + (size || sliderHeight) } }],
23
+ 'bottom' : [{ inFx: { top: 0 }, outFx: { top: (size || sliderHeight) } }],
24
+ 'left' : [{ inFx: { left: 0 }, outFx: { left: '-' + (size || sliderWidth) } }],
25
+ 'right' : [{ inFx: { left: 0 }, outFx: { left: (size || sliderWidth) } }],
26
+ 'fade' : [{ inFx: { opacity: size || 1 }, outFx: { opacity: 0 } }],
27
+ 'expand' : [{ inFx: { width: size2 || '100%', height: size2 || '100%', top: '0%', left: '0%' } , outFx: { width: (size || '10%'), height: (size || '10%'), top: '50%', left: '50%' } }],
28
+ 'grow' : [{ inFx: { top: 0, fontSize: size || '16px', opacity : 1 }, outFx: { top: '-200px', fontSize: size2 || '80px', opacity: 0 } }],
29
+ 'listLR' : [{ inFx: { left: 0, opacity: 1 }, outFx: [{ left: (size || sliderWidth), opacity: 0 }, { left: '-' + (size || sliderWidth), opacity: 0 }], selector: [':odd', ':even'] }],
30
+ 'listRL' : [{ inFx: { left: 0, opacity: 1 }, outFx: [{ left: (size || sliderWidth), opacity: 0 }, { left: '-' + (size || sliderWidth), opacity: 0 }], selector: [':even', ':odd'] }],
31
+
32
+ 'caption-Top' : [{ inFx: { top: 0, opacity: 0.8 }, outFx: { top: ( '-' + size || -50 ), opacity: 0 } }],
33
+ 'caption-Right' : [{ inFx: { right: 0, opacity: 0.8 }, outFx: { right: ( '-' + size || -150 ), opacity: 0 } }],
34
+ 'caption-Bottom' : [{ inFx: { bottom: 0, opacity: 0.8 }, outFx: { bottom: ( '-' + size || -50 ), opacity: 0 } }],
35
+ 'caption-Left' : [{ inFx: { left: 0, opacity: 0.8 }, outFx: { left: ( '-' + size || -150 ), opacity: 0 } }]
36
+ };
37
+ };
38
+
39
+ return this.each(function(){
40
+
41
+ $(this).data('AnythingSlider').fx = effects; // store fx list to allow dynamic modification
42
+
43
+ var defaults = $.extend({
44
+ easing : 'swing', // Default FX easing
45
+ timeIn : 400, // Default time for in FX animation
46
+ timeOut : 350, // Default time for out FX animation - when using predefined FX, this number gets divided by 2
47
+ stopRepeat : false, // stops repeating FX animation when clicking on the same navigation tab
48
+ outFxBind : 'slide_init', // When outFx animations are called
49
+ inFxBind : 'slide_complete', // When inFx animations are called
50
+ dataAnimate: 'data-animate' // data attribute containing the animate.css class names to add for in and out fx
51
+ }, options),
52
+
53
+ baseFx = getBaseFx(), // get base FX with standard sizes
54
+
55
+ // Animate FX
56
+ animateFx = function(el, opt, isOut, time){
57
+ if (el.length === 0 || typeof opt === 'undefined') { return; } // no fx
58
+ var o = opt[0] || opt,
59
+ s = o[1] || '',
60
+ // time needs to be a number, not a string
61
+ t = time || parseInt( ((s === '') ? o.duration : o[0].duration), 10);
62
+ if (isOut) {
63
+ // don't change caption position from absolute
64
+ if (el.css('position') !== 'absolute') { el.css({ position : 'relative' }); }
65
+ el.stop();
66
+ // multiple selectors for out animation
67
+ if (s !== ''){
68
+ el.filter(opt[1][0]).animate(o[0], { queue : false, duration : t, easing : o[0].easing });
69
+ el.filter(opt[1][1]).animate(s, { queue : true, duration : t, easing : o[0].easing });
70
+ return;
71
+ }
72
+ }
73
+ // animation for no extra selectors
74
+ el.animate(o, { queue : true, duration : t, easing : o.easing });
75
+ },
76
+
77
+ // Extract FX
78
+ getFx = function(opts, isOut){
79
+ // example: '.textSlide h3' : [ 'top fade', '200px' '500', 'easeOutBounce' ],
80
+ var tmp, bfx2,
81
+ ex = (isOut) ? 'outFx' : 'inFx', // object key
82
+ bfx = {}, // base effects
83
+ time = (isOut) ? defaults.timeOut : defaults.timeIn, // default duration settings
84
+ // split & process multiple built-in effects (e.g. 'top fade')
85
+ fx = $.trim(opts[0].replace(/\s+/g,' ')).split(' ');
86
+
87
+ // look for multiple selectors in the Out effects
88
+ if (isOut && fx.length === 1 && baseFx.hasOwnProperty(fx) && typeof (baseFx[fx][0].selector) !== 'undefined') {
89
+ bfx2 = baseFx[fx][0].outFx;
90
+ // add time and easing to first set, the animation will use it for both
91
+ bfx2[0].duration = opts[2] || defaults.timeOut;
92
+ bfx2[0].easing = opts[3] || defaults.easing;
93
+ return [bfx2, baseFx[fx][0].selector || [] ];
94
+ }
95
+
96
+ // combine base effects
97
+ $.each(fx, function(i,f){
98
+ // check if built-in effect exists
99
+ if (baseFx.hasOwnProperty(f)) {
100
+ var t = typeof opts[1] === 'undefined' || opts[1] === '',
101
+ // if size option is defined, get new base fx
102
+ tmp = (t) ? baseFx : getBaseFx(opts[1]);
103
+ $.extend(true, bfx, tmp[f][0][ex]);
104
+ t = opts[2] || bfx.duration || time; // user set time || built-in time || default time set above
105
+ bfx.duration = (isOut) ? t/2 : t; // out animation time is 1/2 of in time for predefined fx only
106
+ bfx.easing = isNaN(opts[3]) ? opts[3] || defaults.easing : opts[4] || defaults.easing;
107
+ }
108
+ });
109
+ return [bfx];
110
+ },
111
+
112
+ base = $(this)
113
+
114
+ // bind events for "OUT" effects - occur when leaving a page
115
+ .bind(defaults.outFxBind, function(e, slider){
116
+ if (defaults.stopRepeat && slider.$lastPage[0] === slider.$targetPage[0]) { return; }
117
+ var el, elOut, time, page = slider.$lastPage.add( slider.$items.eq(slider.exactPage) ).add( slider.$targetPage ),
118
+ FX = slider.fx; // allow dynamically added FX
119
+ if (slider.exactPage === 0) { page = page.add( slider.$items.eq( slider.pages ) ); } // add last (non-cloned) page if on first
120
+ if (slider.options.animationTime < defaults.timeOut) {
121
+ time = slider.options.animationTime || defaults.timeOut;
122
+ }
123
+ page = page.find('*').andSelf(); // include the panel in the selectors
124
+ for (el in FX) {
125
+ if (el === 'outFx') {
126
+ // process "out" custom effects
127
+ for (elOut in FX.outFx) {
128
+ // animate current/last slide, unless it's a clone, then effect the original
129
+ if (page.filter(elOut).length) { animateFx( page.filter(elOut), FX.outFx[elOut], true); }
130
+ }
131
+ } else if (el !== 'inFx') {
132
+ // Use built-in effects
133
+ if ($.isArray(FX[el]) && page.filter(el).length) {
134
+ animateFx( page.filter(el), getFx(FX[el],true), true, time);
135
+ }
136
+ }
137
+ }
138
+ el = page.filter('[' + defaults.dataAnimate + ']');
139
+ if (el.length) {
140
+ el.each(function(){
141
+ FX = $(this).attr(defaults.dataAnimate).split(',');
142
+ if (FX[0] !== '') {
143
+ $(this)
144
+ .removeClass(FX[0])
145
+ .addClass(FX[1] || FX[0]);
146
+ }
147
+ });
148
+ }
149
+ })
150
+
151
+ // bind events for "IN" effects - occurs on target page
152
+ .bind(defaults.inFxBind, function(e, slider){
153
+ if (defaults.stopRepeat && slider.$lastPage[0] === slider.$targetPage[0]) { return; }
154
+ var el, elIn, page = slider.$currentPage.add( slider.$items.eq(slider.exactPage) ),
155
+ FX = slider.fx; // allow dynamically added FX
156
+ page = page.find('*').andSelf(); // include the panel in the selectors
157
+ for (el in FX) {
158
+ if (el === 'inFx') {
159
+ // process "in" custom effects
160
+ for (elIn in FX.inFx) {
161
+ // animate current page
162
+ if (page.filter(elIn).length) { animateFx( page.filter(elIn), FX.inFx[elIn], false); }
163
+ }
164
+ // Use built-in effects
165
+ } else if (el !== 'outFx' && $.isArray(FX[el]) && page.filter(el).length) {
166
+ animateFx( page.filter(el), getFx(FX[el],false), false);
167
+ }
168
+ }
169
+ el = page.filter('[' + defaults.dataAnimate + ']');
170
+ if (el.length) {
171
+ el.each(function(){
172
+ FX = $(this).attr(defaults.dataAnimate).split(',');
173
+ if (FX[0] !== '') {
174
+ $(this)
175
+ .removeClass(FX[1] || FX[0])
176
+ .addClass(FX[0]);
177
+ }
178
+ });
179
+ }
180
+ })
181
+ .data('AnythingSlider');
182
+
183
+ // call gotoPage to trigger intro animation
184
+ $(window).load(function(){ base.gotoPage(base.currentPage, base.playing); });
185
+
186
+ });
187
+ };
188
+ })(jQuery);
@@ -0,0 +1,831 @@
1
+ /*
2
+ AnythingSlider v1.7.26
3
+ Original by Chris Coyier: http://css-tricks.com
4
+ Get the latest version: https://github.com/ProLoser/AnythingSlider
5
+
6
+ To use the navigationFormatter function, you must have a function that
7
+ accepts two paramaters, and returns a string of HTML text.
8
+
9
+ index = integer index (1 based);
10
+ panel = jQuery wrapped LI item this tab references
11
+ @return = Must return a string of HTML/Text
12
+
13
+ navigationFormatter: function(index, panel){
14
+ return "Panel #" + index; // This would have each tab with the text 'Panel #X' where X = index
15
+ }
16
+ */
17
+
18
+ (function($) {
19
+
20
+ $.anythingSlider = function(el, options) {
21
+
22
+ var base = this, o;
23
+
24
+ // Wraps the ul in the necessary divs and then gives Access to jQuery element
25
+ base.el = el;
26
+ base.$el = $(el).addClass('anythingBase').wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');
27
+
28
+ // Add a reverse reference to the DOM object
29
+ base.$el.data("AnythingSlider", base);
30
+
31
+ base.init = function(){
32
+
33
+ // Added "o" to be used in the code instead of "base.options" which doesn't get modifed by the compiler - reduces size by ~1k
34
+ base.options = o = $.extend({}, $.anythingSlider.defaults, options);
35
+
36
+ base.initialized = false;
37
+ if ($.isFunction(o.onBeforeInitialize)) { base.$el.bind('before_initialize', o.onBeforeInitialize); }
38
+ base.$el.trigger('before_initialize', base);
39
+
40
+ // Cache existing DOM elements for later
41
+ // base.$el = original ul
42
+ // for wrap - get parent() then closest in case the ul has "anythingSlider" class
43
+ base.$wrapper = base.$el.parent().closest('div.anythingSlider').addClass('anythingSlider-' + o.theme);
44
+ base.$window = base.$el.closest('div.anythingWindow');
45
+ base.win = window;
46
+ base.$win = $(base.win);
47
+
48
+ base.$controls = $('<div class="anythingControls"></div>').appendTo( (o.appendControlsTo && $(o.appendControlsTo).length) ? $(o.appendControlsTo) : base.$wrapper);
49
+ base.$startStop = $('<a href="#" class="start-stop"></a>');
50
+ if (o.buildStartStop) {
51
+ base.$startStop.appendTo( (o.appendStartStopTo && $(o.appendStartStopTo).length) ? $(o.appendStartStopTo) : base.$controls );
52
+ }
53
+ base.$nav = $('<ul class="thumbNav" />').appendTo( (o.appendNavigationTo && $(o.appendNavigationTo).length) ? $(o.appendNavigationTo) : base.$controls );
54
+
55
+ // Set up a few defaults & get details
56
+ base.flag = false; // event flag to prevent multiple calls (used in control click/focusin)
57
+ base.playing = o.autoPlay; // slideshow state; removed "startStopped" option
58
+ base.slideshow = false; // slideshow flag needed to correctly trigger slideshow events
59
+ base.hovered = false; // actively hovering over the slider
60
+ base.panelSize = []; // will contain dimensions and left position of each panel
61
+ base.currentPage = o.startPanel = parseInt(o.startPanel,10) || 1; // make sure this isn't a string
62
+ o.changeBy = parseInt(o.changeBy,10) || 1;
63
+ base.adj = (o.infiniteSlides) ? 0 : 1; // adjust page limits for infinite or limited modes
64
+ base.width = base.$el.width();
65
+ base.height = base.$el.height();
66
+ base.outerPad = [ base.$wrapper.innerWidth() - base.$wrapper.width(), base.$wrapper.innerHeight() - base.$wrapper.height() ];
67
+ if (o.playRtl) { base.$wrapper.addClass('rtl'); }
68
+
69
+ // Expand slider to fit parent
70
+ if (o.expand) {
71
+ base.$outer = base.$wrapper.parent();
72
+ base.$window.css({ width: '100%', height: '100%' }); // needed for Opera
73
+ base.checkResize();
74
+ }
75
+
76
+ // Build start/stop button
77
+ if (o.buildStartStop) { base.buildAutoPlay(); }
78
+
79
+ // Build forwards/backwards buttons
80
+ if (o.buildArrows) { base.buildNextBackButtons(); }
81
+
82
+ // can't lock autoplay it if it's not enabled
83
+ if (!o.autoPlay) { o.autoPlayLocked = false; }
84
+
85
+ base.updateSlider();
86
+
87
+ // Get index (run time) of this slider on the page
88
+ base.runTimes = $('div.anythingSlider').index(base.$wrapper) + 1;
89
+ base.regex = new RegExp('panel' + base.runTimes + '-(\\d+)', 'i'); // hash tag regex
90
+ if (base.runTimes === 1) { base.makeActive(); } // make the first slider on the page active
91
+
92
+ // Make sure easing function exists.
93
+ if (!$.isFunction($.easing[o.easing])) { o.easing = "swing"; }
94
+
95
+ // If pauseOnHover then add hover effects
96
+ if (o.pauseOnHover) {
97
+ base.$wrapper.hover(function() {
98
+ if (base.playing) {
99
+ base.$el.trigger('slideshow_paused', base);
100
+ base.clearTimer(true);
101
+ }
102
+ }, function() {
103
+ if (base.playing) {
104
+ base.$el.trigger('slideshow_unpaused', base);
105
+ base.startStop(base.playing, true);
106
+ }
107
+ });
108
+ }
109
+
110
+ // If a hash can not be used to trigger the plugin, then go to start panel
111
+ base.setCurrentPage(base.gotoHash() || o.startPage, false);
112
+
113
+ base.$lastPage = base.$targetPage = base.$currentPage;
114
+
115
+ // Hide/Show navigation & play/stop controls
116
+ base.slideControls(false);
117
+ base.$wrapper.bind('mouseenter mouseleave', function(e){
118
+ base.hovered = (e.type === "mouseenter") ? true : false;
119
+ base.slideControls( base.hovered, false );
120
+ });
121
+
122
+ // Add keyboard navigation
123
+ $(document).keyup(function(e){
124
+ // Stop arrow keys from working when focused on form items
125
+ if (o.enableKeyboard && base.$wrapper.is('.activeSlider') && !e.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
126
+ if (!o.vertical && (e.which === 38 || e.which === 40)) { return; }
127
+ switch (e.which) {
128
+ case 39: case 40: // right & down arrow
129
+ base.goForward();
130
+ break;
131
+ case 37: case 38: // left & up arrow
132
+ base.goBack();
133
+ break;
134
+ }
135
+ }
136
+ });
137
+
138
+ // Fix tabbing through the page, but don't change the view if the link is in view (showMultiple = true)
139
+ base.$items.delegate('a', 'focus.AnythingSlider', function(e){
140
+ var panel = $(this).closest('.panel'),
141
+ indx = base.$items.index(panel) + base.adj; // index can be -1 in nested sliders - issue #208
142
+ base.$items.find('.focusedLink').removeClass('focusedLink');
143
+ $(this).addClass('focusedLink');
144
+ base.$window.scrollLeft(0);
145
+ if ( ( indx !== -1 && (indx >= base.currentPage + o.showMultiple || indx < base.currentPage) ) ) {
146
+ base.gotoPage(indx);
147
+ e.preventDefault();
148
+ }
149
+ });
150
+
151
+ // Binds events
152
+ var triggers = "slideshow_paused slideshow_unpaused slide_init slide_begin slideshow_stop slideshow_start initialized swf_completed".split(" ");
153
+ $.each("onShowPause onShowUnpause onSlideInit onSlideBegin onShowStop onShowStart onInitialized onSWFComplete".split(" "), function(i,f){
154
+ if ($.isFunction(o[f])){
155
+ base.$el.bind(triggers[i], o[f]);
156
+ }
157
+ });
158
+ if ($.isFunction(o.onSlideComplete)){
159
+ // Added setTimeout (zero time) to ensure animation is complete... see this bug report: http://bugs.jquery.com/ticket/7157
160
+ base.$el.bind('slide_complete', function(){
161
+ setTimeout(function(){ o.onSlideComplete(base); }, 0);
162
+ });
163
+ }
164
+ base.initialized = true;
165
+ base.$el.trigger('initialized', base);
166
+
167
+ // trigger the slideshow
168
+ base.startStop(base.playing);
169
+
170
+ };
171
+
172
+ // called during initialization & to update the slider if a panel is added or deleted
173
+ base.updateSlider = function(){
174
+ var t;
175
+ // needed for updating the slider
176
+ base.$el.children('.cloned').remove();
177
+ base.$nav.empty();
178
+ // set currentPage to 1 in case it was zero - occurs when adding slides after removing them all
179
+ base.currentPage = base.currentPage || 1;
180
+
181
+ base.$items = base.$el.children();
182
+ base.pages = base.$items.length;
183
+ base.dir = (o.vertical) ? 'top' : 'left';
184
+ o.showMultiple = (o.vertical) ? 1 : parseInt(o.showMultiple,10) || 1; // only integers allowed
185
+ o.navigationSize = (o.navigationSize === false) ? 0 : parseInt(o.navigationSize,10) || 0;
186
+
187
+ if (o.showMultiple > 1) {
188
+ if (o.showMultiple > base.pages) { o.showMultiple = base.pages; }
189
+ base.adjustMultiple = (o.infiniteSlides && base.pages > 1) ? 0 : o.showMultiple - 1;
190
+ base.pages = base.$items.length - base.adjustMultiple;
191
+ }
192
+
193
+ // Hide navigation & player if there is only one page
194
+ base.$controls
195
+ .add(base.$nav)
196
+ .add(base.$startStop)
197
+ .add(base.$forward)
198
+ .add(base.$back)[(base.pages <= 1) ? 'hide' : 'show']();
199
+ if (base.pages > 1) {
200
+ // Build/update navigation tabs
201
+ base.buildNavigation();
202
+ }
203
+
204
+ // Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
205
+ // This supports the "infinite" scrolling, also ensures any cloned elements don't duplicate an ID
206
+ // Moved removeAttr before addClass otherwise IE7 ignores the addClass: http://bugs.jquery.com/ticket/9871
207
+ if (o.infiniteSlides && base.pages > 1) {
208
+ base.$el.prepend( base.$items.filter(':last').clone().addClass('cloned') );
209
+ // Add support for multiple sliders shown at the same time
210
+ if (o.showMultiple > 1) {
211
+ base.$el.append( base.$items.filter(':lt(' + o.showMultiple + ')').clone().addClass('cloned multiple') );
212
+ } else {
213
+ base.$el.append( base.$items.filter(':first').clone().addClass('cloned') );
214
+ }
215
+ base.$el.find('.cloned').each(function(){
216
+ // disable all focusable elements in cloned panels to prevent shifting the panels by tabbing
217
+ $(this).find('a,input,textarea,select,button,area').attr('disabled', 'disabled');
218
+ $(this).find('[id]').andSelf().removeAttr('id');
219
+ });
220
+ }
221
+
222
+ // We just added two items, time to re-cache the list, then get the dimensions of each panel
223
+ base.$items = base.$el.children().addClass('panel' + (o.vertical ? ' vertical' : ''));
224
+ base.setDimensions();
225
+
226
+ // Set the dimensions of each panel
227
+ if (o.resizeContents) {
228
+ base.$items.css('width', base.width);
229
+ base.$wrapper
230
+ .css('width', base.getDim(base.currentPage)[0])
231
+ .add(base.$items).css('height', base.height);
232
+ } else {
233
+ base.$win.load(function(){
234
+ // set dimensions after all images load
235
+ base.setDimensions();
236
+ // make sure the outer wrapper is set properly
237
+ t = base.getDim(base.currentPage);
238
+ base.$wrapper.css({ width: t[0], height: t[1] });
239
+ });
240
+ }
241
+
242
+ if (base.currentPage > base.pages) {
243
+ base.currentPage = base.pages;
244
+ }
245
+ base.setCurrentPage(base.currentPage, false);
246
+ base.$nav.find('a').eq(base.currentPage - 1).addClass('cur'); // update current selection
247
+
248
+ };
249
+
250
+ // Creates the numbered navigation links
251
+ base.buildNavigation = function() {
252
+ if (o.buildNavigation && (base.pages > 1)) {
253
+ var a, c, i, t, $li;
254
+ base.$items.filter(':not(.cloned)').each(function(j){
255
+ $li = $('<li/>');
256
+ i = j + 1;
257
+ c = o.tooltipClass + ((i === 1) ? ' first' : '') + ((i === base.pages) ? ' last' : '');
258
+ a = '<a class="panel' + i + '" href="#"><span>@</span></a>';
259
+ // If a formatter function is present, use it
260
+ if ($.isFunction(o.navigationFormatter)) {
261
+ t = o.navigationFormatter(i, $(this));
262
+ if (typeof(t) === "string") {
263
+ $li.html(a.replace(/@/,t));
264
+ } else {
265
+ $li = $('<li/>', t);
266
+ }
267
+ } else {
268
+ $li.html(a.replace(/@/,i));
269
+ }
270
+ $li
271
+ .appendTo(base.$nav)
272
+ .addClass(c)
273
+ .data('index', i);
274
+ });
275
+ base.$nav.children('li').bind(o.clickControls, function(e) {
276
+ if (!base.flag && o.enableNavigation) {
277
+ // prevent running functions twice (once for click, second time for focusin)
278
+ base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
279
+ base.gotoPage( $(this).data('index') );
280
+ }
281
+ e.preventDefault();
282
+ });
283
+
284
+ // Add navigation tab scrolling - use !! in case someone sets the size to zero
285
+ if (!!o.navigationSize && o.navigationSize < base.pages) {
286
+ if (!base.$controls.find('.anythingNavWindow').length){
287
+ base.$nav
288
+ .before('<ul><li class="prev"><a href="#"><span>' + o.backText + '</span></a></li></ul>')
289
+ .after('<ul><li class="next"><a href="#"><span>' + o.forwardText + '</span></a></li></ul>')
290
+ .wrap('<div class="anythingNavWindow"></div>');
291
+ }
292
+ // include half of the left position to include extra width from themes like tabs-light and tabs-dark (still not perfect)
293
+ base.navWidths = base.$nav.find('li').map(function(){
294
+ return $(this).innerWidth() + Math.ceil(parseInt($(this).find('span').css('left'),10)/2 || 0);
295
+ }).get();
296
+ base.navLeft = base.currentPage;
297
+ // add 5 pixels to make sure the tabs don't wrap to the next line
298
+ base.$nav.width( base.navWidth( 1, base.pages + 1 ) + 5 );
299
+ base.$controls.find('.anythingNavWindow')
300
+ .width( base.navWidth( 1, o.navigationSize + 1 ) ).end()
301
+ .find('.prev,.next').bind(o.clickControls, function(e) {
302
+ if (!base.flag) {
303
+ base.flag = true; setTimeout(function(){ base.flag = false; }, 200);
304
+ base.navWindow( base.navLeft + o.navigationSize * ( $(this).is('.prev') ? -1 : 1 ) );
305
+ }
306
+ e.preventDefault();
307
+ });
308
+ }
309
+
310
+ }
311
+ };
312
+
313
+ base.navWidth = function(x,y){
314
+ var i, s = Math.min(x,y),
315
+ e = Math.max(x,y),
316
+ w = 0;
317
+ for (i = s; i < e; i++) {
318
+ w += base.navWidths[i-1] || 0;
319
+ }
320
+ return w;
321
+ };
322
+
323
+ base.navWindow = function(n){
324
+ if (!!o.navigationSize && o.navigationSize < base.pages && base.navWidths) {
325
+ var p = base.pages - o.navigationSize + 1;
326
+ n = (n <= 1) ? 1 : (n > 1 && n < p) ? n : p;
327
+ if (n !== base.navLeft) {
328
+ base.$controls.find('.anythingNavWindow').animate(
329
+ { scrollLeft: base.navWidth(1, n), width: base.navWidth(n, n + o.navigationSize) },
330
+ { queue: false, duration: o.animationTime });
331
+ base.navLeft = n;
332
+ }
333
+ }
334
+ };
335
+
336
+ // Creates the Forward/Backward buttons
337
+ base.buildNextBackButtons = function() {
338
+ base.$forward = $('<span class="arrow forward"><a href="#"><span>' + o.forwardText + '</span></a></span>');
339
+ base.$back = $('<span class="arrow back"><a href="#"><span>' + o.backText + '</span></a></span>');
340
+
341
+ // Bind to the forward and back buttons
342
+ base.$back.bind(o.clickBackArrow, function(e) {
343
+ // prevent running functions twice (once for click, second time for swipe)
344
+ if (o.enableArrows && !base.flag) {
345
+ base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
346
+ base.goBack();
347
+ }
348
+ e.preventDefault();
349
+ });
350
+ base.$forward.bind(o.clickForwardArrow, function(e) {
351
+ // prevent running functions twice (once for click, second time for swipe)
352
+ if (o.enableArrows && !base.flag) {
353
+ base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
354
+ base.goForward();
355
+ }
356
+ e.preventDefault();
357
+ });
358
+ // using tab to get to arrow links will show they have focus (outline is disabled in css)
359
+ base.$back.add(base.$forward).find('a').bind('focusin focusout',function(){
360
+ $(this).toggleClass('hover');
361
+ });
362
+
363
+ // Append elements to page
364
+ base.$back.appendTo( (o.appendBackTo && $(o.appendBackTo).length) ? $(o.appendBackTo) : base.$wrapper );
365
+ base.$forward.appendTo( (o.appendForwardTo && $(o.appendForwardTo).length) ? $(o.appendForwardTo) : base.$wrapper );
366
+
367
+ base.arrowWidth = base.$forward.width(); // assuming the left & right arrows are the same width - used for toggle
368
+ base.arrowRight = parseInt(base.$forward.css('right'), 10);
369
+ base.arrowLeft = parseInt(base.$back.css('left'), 10);
370
+
371
+ };
372
+
373
+ // Creates the Start/Stop button
374
+ base.buildAutoPlay = function(){
375
+ base.$startStop
376
+ .html('<span>' + (base.playing ? o.stopText : o.startText) + '</span>')
377
+ .bind(o.clickSlideshow, function(e) {
378
+ if (o.enableStartStop) {
379
+ base.startStop(!base.playing);
380
+ base.makeActive();
381
+ if (base.playing && !o.autoPlayDelayed) {
382
+ base.goForward(true);
383
+ }
384
+ }
385
+ e.preventDefault();
386
+ })
387
+ // show button has focus while tabbing
388
+ .bind('focusin focusout',function(){
389
+ $(this).toggleClass('hover');
390
+ });
391
+ };
392
+
393
+ // Adjust slider dimensions on parent element resize
394
+ base.checkResize = function(stopTimer){
395
+ clearTimeout(base.resizeTimer);
396
+ base.resizeTimer = setTimeout(function(){
397
+ var w = base.$outer.width() - base.outerPad[0],
398
+ h = (base.$outer[0].tagName === "BODY" ? base.$win.height() : base.$outer.height()) - base.outerPad[1];
399
+ // base.width = width of one panel, so multiply by # of panels; outerPad is padding added for arrows.
400
+ if (base.width * o.showMultiple !== w || base.height !== h) {
401
+ base.setDimensions(); // adjust panel sizes
402
+ // make sure page is lined up (use -1 animation time, so we can differeniate it from when animationTime = 0)
403
+ base.gotoPage(base.currentPage, base.playing, null, -1);
404
+ }
405
+ if (typeof(stopTimer) === 'undefined'){ base.checkResize(); }
406
+ }, 500);
407
+ };
408
+
409
+ // Set panel dimensions to either resize content or adjust panel to content
410
+ base.setDimensions = function(){
411
+ var w, h, c, t, edge = 0,
412
+ fullsize = { width: '100%', height: '100%' },
413
+ // determine panel width
414
+ pw = (o.showMultiple > 1) ? base.width || base.$window.width()/o.showMultiple : base.$window.width(),
415
+ winw = base.$win.width();
416
+ if (o.expand){
417
+ w = base.$outer.width() - base.outerPad[0];
418
+ base.height = h = base.$outer.height() - base.outerPad[1];
419
+ base.$wrapper.add(base.$window).add(base.$items).css({ width: w, height: h });
420
+ base.width = pw = (o.showMultiple > 1) ? w/o.showMultiple : w;
421
+ }
422
+ base.$items.each(function(i){
423
+ t = $(this);
424
+ c = t.children();
425
+ if (o.resizeContents){
426
+ // resize panel
427
+ w = base.width;
428
+ h = base.height;
429
+ t.css({ width: w, height: h });
430
+ if (c.length) {
431
+ if (c[0].tagName === "EMBED") { c.attr(fullsize); } // needed for IE7; also c.length > 1 in IE7
432
+ if (c[0].tagName === "OBJECT") { c.find('embed').attr(fullsize); }
433
+ // resize panel contents, if solitary (wrapped content or solitary image)
434
+ if (c.length === 1){ c.css(fullsize); }
435
+ }
436
+ } else {
437
+ // get panel width & height and save it
438
+ w = t.width() || base.width; // if image hasn't finished loading, width will be zero, so set it to base width instead
439
+ if (c.length === 1 && w >= winw){
440
+ w = (c.width() >= winw) ? pw : c.width(); // get width of solitary child
441
+ c.css('max-width', w); // set max width for all children
442
+ }
443
+ t.css('width', w); // set width of panel
444
+ h = (c.length === 1 ? c.outerHeight(true) : t.height()); // get height after setting width
445
+ if (h <= base.outerPad[1]) { h = base.height; } // if height less than the outside padding, then set it to the preset height
446
+ t.css('height', h);
447
+ }
448
+ base.panelSize[i] = [w,h,edge];
449
+ edge += (o.vertical) ? h : w;
450
+ });
451
+ // Set total width of slider, Note that this is limited to 32766 by Opera - option removed
452
+ base.$el.css((o.vertical ? 'height' : 'width'), edge);
453
+ };
454
+
455
+ // get dimension of multiple panels, as needed
456
+ base.getDim = function(page){
457
+ if (base.pages < 1 || isNaN(page)) { return [ base.width, base.height ]; } // prevent errors when base.panelSize is empty
458
+ page = (o.infiniteSlides && base.pages > 1) ? page : page - 1;
459
+ var i,
460
+ w = base.panelSize[page][0],
461
+ h = base.panelSize[page][1];
462
+ if (o.showMultiple > 1) {
463
+ for (i=1; i < o.showMultiple; i++) {
464
+ w += base.panelSize[(page + i)%o.showMultiple][0];
465
+ h = Math.max(h, base.panelSize[page + i][1]);
466
+ }
467
+ }
468
+ return [w,h];
469
+ };
470
+
471
+ base.goForward = function(autoplay) {
472
+ base.gotoPage(base.currentPage + o.changeBy * (o.playRtl ? -1 : 1), autoplay);
473
+ };
474
+
475
+ base.goBack = function(autoplay) {
476
+ base.gotoPage(base.currentPage + o.changeBy * (o.playRtl ? 1 : -1), autoplay);
477
+ };
478
+
479
+ base.gotoPage = function(page, autoplay, callback, time) {
480
+ if (autoplay !== true) {
481
+ autoplay = false;
482
+ base.startStop(false);
483
+ base.makeActive();
484
+ }
485
+ // check if page is an id or class name
486
+ if (/^[#|.]/.test(page) && $(page).length) {
487
+ page = $(page).closest('.panel').index() + base.adj;
488
+ }
489
+ // rewind effect occurs here when changeBy > 1
490
+ if (o.changeBy !== 1){
491
+ if (page < 0) { page += base.pages; }
492
+ if (page > base.pages) { page -= base.pages; }
493
+ }
494
+ if (base.pages <= 1) { return; } // prevents animation
495
+ base.$lastPage = base.$currentPage;
496
+ if (typeof(page) !== "number") {
497
+ page = o.startPanel;
498
+ base.setCurrentPage(page);
499
+ }
500
+
501
+ // pause YouTube videos before scrolling or prevent change if playing
502
+ if (autoplay && o.isVideoPlaying(base)) { return; }
503
+
504
+ base.exactPage = page;
505
+ if (page > base.pages + 1 - base.adj) { page = (!o.infiniteSlides && !o.stopAtEnd) ? 1 : base.pages; }
506
+ if (page < base.adj ) { page = (!o.infiniteSlides && !o.stopAtEnd) ? base.pages : 1; }
507
+ if (!o.infiniteSlides) { base.exactPage = page; } // exact page used by the fx extension
508
+ base.currentPage = ( page > base.pages ) ? base.pages : ( page < 1 ) ? 1 : base.currentPage;
509
+ base.$currentPage = base.$items.eq(base.currentPage - base.adj);
510
+ base.targetPage = (page === 0) ? base.pages : (page > base.pages) ? 1 : page;
511
+ base.$targetPage = base.$items.eq( base.targetPage - base.adj);
512
+ time = time || o.animationTime;
513
+ // don't trigger events when time < 0 - to prevent FX from firing multiple times on page resize
514
+ if (time >= 0) { base.$el.trigger('slide_init', base); }
515
+
516
+ base.slideControls(true, false);
517
+
518
+ // When autoplay isn't passed, we stop the timer
519
+ if (autoplay !== true) { autoplay = false; }
520
+ // Stop the slider when we reach the last page, if the option stopAtEnd is set to true
521
+ if (!autoplay || (o.stopAtEnd && page === base.pages)) { base.startStop(false); }
522
+
523
+ if (time >= 0) { base.$el.trigger('slide_begin', base); }
524
+
525
+ // delay starting slide animation
526
+ setTimeout(function(d){
527
+ var p, empty = true;
528
+ // resize slider if content size varies
529
+ if (!o.resizeContents) {
530
+ // animating the wrapper resize before the window prevents flickering in Firefox
531
+ // don't animate the dimension if it hasn't changed - fix for issue #264
532
+ p = base.getDim(page); d = {};
533
+ // prevent animating a dimension to zero
534
+ if (base.$wrapper.width() !== p[0]) { d.width = p[0] || base.width; empty = false; }
535
+ if (base.$wrapper.height() !== p[1]) { d.height = p[1] || base.height; empty = false; }
536
+ if (!empty) {
537
+ base.$wrapper.filter(':not(:animated)').animate(d, { queue: false, duration: (time < 0 ? 0 : time), easing: o.easing });
538
+ }
539
+ }
540
+ d = {};
541
+ d[base.dir] = -base.panelSize[(o.infiniteSlides && base.pages > 1) ? page : page - 1][2];
542
+ // Animate Slider
543
+ base.$el.filter(':not(:animated)').animate(
544
+ d, { queue: false, duration: time, easing: o.easing, complete: function(){ base.endAnimation(page, callback, time); } }
545
+ );
546
+ }, parseInt(o.delayBeforeAnimate, 10) || 0);
547
+ };
548
+
549
+ base.endAnimation = function(page, callback, time){
550
+ if (page === 0) {
551
+ base.$el.css( base.dir, -base.panelSize[base.pages][2]);
552
+ page = base.pages;
553
+ } else if (page > base.pages) {
554
+ // reset back to start position
555
+ base.$el.css( base.dir, -base.panelSize[1][2]);
556
+ page = 1;
557
+ }
558
+ base.exactPage = page;
559
+ base.setCurrentPage(page, false);
560
+ // Add active panel class
561
+ base.$items.removeClass('activePage').eq(page - base.adj).addClass('activePage');
562
+
563
+ if (!base.hovered) { base.slideControls(false); }
564
+
565
+ if (o.hashTags) { base.setHash(page); }
566
+
567
+ if (time >= 0) { base.$el.trigger('slide_complete', base); }
568
+ // callback from external slide control: $('#slider').anythingSlider(4, function(slider){ })
569
+ if (typeof callback === 'function') { callback(base); }
570
+
571
+ // Continue slideshow after a delay
572
+ if (o.autoPlayLocked && !base.playing) {
573
+ setTimeout(function(){
574
+ base.startStop(true);
575
+ // subtract out slide delay as the slideshow waits that additional time.
576
+ }, o.resumeDelay - (o.autoPlayDelayed ? o.delay : 0));
577
+ }
578
+ };
579
+
580
+ base.setCurrentPage = function(page, move) {
581
+ page = parseInt(page, 10);
582
+ if (base.pages < 1 || page === 0 || isNaN(page)) { return; }
583
+ if (page > base.pages + 1 - base.adj) { page = base.pages - base.adj; }
584
+ if (page < base.adj ) { page = 1; }
585
+
586
+ // Set visual
587
+ if (o.buildNavigation){
588
+ base.$nav
589
+ .find('.cur').removeClass('cur').end()
590
+ .find('a').eq(page - 1).addClass('cur');
591
+ }
592
+
593
+ // hide/show arrows based on infinite scroll mode
594
+ if (!o.infiniteSlides && o.stopAtEnd){
595
+ base.$wrapper
596
+ .find('span.forward')[ page === base.pages ? 'addClass' : 'removeClass']('disabled').end()
597
+ .find('span.back')[ page === 1 ? 'addClass' : 'removeClass']('disabled');
598
+ if (page === base.pages && base.playing) { base.startStop(); }
599
+ }
600
+
601
+ // Only change left if move does not equal false
602
+ if (!move) {
603
+ var d = base.getDim(page);
604
+ base.$wrapper
605
+ .css({ width: d[0], height: d[1] })
606
+ .add(base.$window).scrollLeft(0); // reset in case tabbing changed this scrollLeft - probably overly redundant
607
+ base.$el.css( base.dir, -base.panelSize[(o.infiniteSlides && base.pages > 1) ? page : page - 1][2] );
608
+ }
609
+ // Update local variable
610
+ base.currentPage = page;
611
+ base.$currentPage = base.$items.removeClass('activePage').eq(page - base.adj).addClass('activePage');
612
+
613
+ };
614
+
615
+ base.makeActive = function(){
616
+ // Set current slider as active so keyboard navigation works properly
617
+ if (!base.$wrapper.is('.activeSlider')){
618
+ $('.activeSlider').removeClass('activeSlider');
619
+ base.$wrapper.addClass('activeSlider');
620
+ }
621
+ };
622
+
623
+ // This method tries to find a hash that matches an ID and panel-X
624
+ // If either found, it tries to find a matching item
625
+ // If that is found as well, then it returns the page number
626
+ base.gotoHash = function(){
627
+ var h = base.win.location.hash,
628
+ i = h.indexOf('&'),
629
+ n = h.match(base.regex);
630
+ // test for "/#/" or "/#!/" used by the jquery address plugin - $('#/') breaks jQuery
631
+ if (n === null && !/^#&/.test(h) && !/#!?\//.test(h)) {
632
+ // #quote2&panel1-3&panel3-3
633
+ h = h.substring(0, (i >= 0 ? i : h.length));
634
+ // ensure the element is in the same slider
635
+ n = ($(h).length && $(h).closest('.anythingBase')[0] === base.el) ? $(h).closest('.panel').index() : null;
636
+ } else if (n !== null) {
637
+ // #&panel1-3&panel3-3
638
+ n = (o.hashTags) ? parseInt(n[1],10) : null;
639
+ }
640
+ return n;
641
+ };
642
+
643
+ base.setHash = function(n){
644
+ var s = 'panel' + base.runTimes + '-',
645
+ h = base.win.location.hash;
646
+ if ( typeof h !== 'undefined' ) {
647
+ base.win.location.hash = (h.indexOf(s) > 0) ? h.replace(base.regex, s + n) : h + "&" + s + n;
648
+ }
649
+ };
650
+
651
+ // Slide controls (nav and play/stop button up or down)
652
+ base.slideControls = function(toggle){
653
+ var dir = (toggle) ? 'slideDown' : 'slideUp',
654
+ t1 = (toggle) ? 0 : o.animationTime,
655
+ t2 = (toggle) ? o.animationTime: 0,
656
+ op = (toggle) ? 1 : 0,
657
+ sign = (toggle) ? 0 : 1; // 0 = visible, 1 = hidden
658
+ if (o.toggleControls) {
659
+ base.$controls.stop(true,true).delay(t1)[dir](o.animationTime/2).delay(t2);
660
+ }
661
+ if (o.buildArrows && o.toggleArrows) {
662
+ if (!base.hovered && base.playing) { sign = 1; op = 0; } // don't animate arrows during slideshow
663
+ base.$forward.stop(true,true).delay(t1).animate({ right: base.arrowRight + (sign * base.arrowWidth), opacity: op }, o.animationTime/2);
664
+ base.$back.stop(true,true).delay(t1).animate({ left: base.arrowLeft + (sign * base.arrowWidth), opacity: op }, o.animationTime/2);
665
+ }
666
+ };
667
+
668
+ base.clearTimer = function(paused){
669
+ // Clear the timer only if it is set
670
+ if (base.timer) {
671
+ base.win.clearInterval(base.timer);
672
+ if (!paused && base.slideshow) {
673
+ base.$el.trigger('slideshow_stop', base);
674
+ base.slideshow = false;
675
+ }
676
+ }
677
+ };
678
+
679
+ // Pass startStop(false) to stop and startStop(true) to play
680
+ base.startStop = function(playing, paused) {
681
+ if (playing !== true) { playing = false; } // Default if not supplied is false
682
+ base.playing = playing;
683
+
684
+ if (playing && !paused) {
685
+ base.$el.trigger('slideshow_start', base);
686
+ base.slideshow = true;
687
+ }
688
+
689
+ // Toggle playing and text
690
+ if (o.buildStartStop) {
691
+ base.$startStop.toggleClass('playing', playing).find('span').html( playing ? o.stopText : o.startText );
692
+ // add button text to title attribute if it is hidden by text-indent
693
+ if ( base.$startStop.find('span').css('visibility') === "hidden" ) {
694
+ base.$startStop.addClass(o.tooltipClass).attr( 'title', playing ? o.stopText : o.startText );
695
+ }
696
+ }
697
+
698
+ // Pause slideshow while video is playing
699
+ if (playing){
700
+ base.clearTimer(true); // Just in case this was triggered twice in a row
701
+ base.timer = base.win.setInterval(function() {
702
+ // prevent autoplay if video is playing
703
+ if ( !o.isVideoPlaying(base) ) {
704
+ base.goForward(true);
705
+ // stop slideshow if resume if false
706
+ } else if (!o.resumeOnVideoEnd) {
707
+ base.startStop();
708
+ }
709
+ }, o.delay);
710
+ } else {
711
+ base.clearTimer();
712
+ }
713
+ };
714
+
715
+ // Trigger the initialization
716
+ base.init();
717
+ };
718
+
719
+ $.anythingSlider.defaults = {
720
+ // Appearance
721
+ theme : "default", // Theme name, add the css stylesheet manually
722
+ expand : false, // If true, the entire slider will expand to fit the parent element
723
+ resizeContents : true, // If true, solitary images/objects in the panel will expand to fit the viewport
724
+ vertical : false, // If true, all panels will slide vertically; they slide horizontally otherwise
725
+ showMultiple : false, // Set this value to a number and it will show that many slides at once
726
+ easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin or jQuery UI
727
+
728
+ buildArrows : true, // If true, builds the forwards and backwards buttons
729
+ buildNavigation : true, // If true, builds a list of anchor links to link to each panel
730
+ buildStartStop : true, // ** If true, builds the start/stop button
731
+
732
+ /*
733
+ // commented out as this will reduce the size of the minified version
734
+ appendForwardTo : null, // Append forward arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null
735
+ appendBackTo : null, // Append back arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null
736
+ appendControlsTo : null, // Append controls (navigation + start-stop) to a HTML element (jQuery Object, selector or HTMLNode), if not null
737
+ appendNavigationTo : null, // Append navigation buttons to a HTML element (jQuery Object, selector or HTMLNode), if not null
738
+ appendStartStopTo : null, // Append start-stop button to a HTML element (jQuery Object, selector or HTMLNode), if not null
739
+ */
740
+
741
+ toggleArrows : false, // If true, side navigation arrows will slide out on hovering & hide @ other times
742
+ toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
743
+
744
+ startText : "Start", // Start button text
745
+ stopText : "Stop", // Stop button text
746
+ forwardText : "&raquo;", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image)
747
+ backText : "&laquo;", // Link text used to move the slider back (hidden by CSS, replace with arrow image)
748
+ tooltipClass : "tooltip", // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent)
749
+
750
+ // Function
751
+ enableArrows : true, // if false, arrows will be visible, but not clickable.
752
+ enableNavigation : true, // if false, navigation links will still be visible, but not clickable.
753
+ enableStartStop : true, // if false, the play/stop button will still be visible, but not clickable. Previously "enablePlay"
754
+ enableKeyboard : true, // if false, keyboard arrow keys will not work for this slider.
755
+
756
+ // Navigation
757
+ startPanel : 1, // This sets the initial panel
758
+ changeBy : 1, // Amount to go forward or back when changing panels.
759
+ hashTags : true, // Should links change the hashtag in the URL?
760
+ infiniteSlides : true, // if false, the slider will not wrap & not clone any panels
761
+ navigationFormatter : null, // Details at the top of the file on this use (advanced use)
762
+ navigationSize : false, // Set this to the maximum number of visible navigation tabs; false to disable
763
+
764
+ // Slideshow options
765
+ autoPlay : false, // If true, the slideshow will start running; replaces "startStopped" option
766
+ autoPlayLocked : false, // If true, user changing slides will not stop the slideshow
767
+ autoPlayDelayed : false, // If true, starting a slideshow will delay advancing slides; if false, the slider will immediately advance to the next slide when slideshow starts
768
+ pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover
769
+ stopAtEnd : false, // If true & the slideshow is active, the slideshow will stop on the last page. This also stops the rewind effect when infiniteSlides is false.
770
+ playRtl : false, // If true, the slideshow will move right-to-left
771
+
772
+ // Times
773
+ delay : 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds)
774
+ resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
775
+ animationTime : 600, // How long the slideshow transition takes (in milliseconds)
776
+ delayBeforeAnimate : 0, // How long to pause slide animation before going to the desired slide (used if you want your "out" FX to show).
777
+
778
+ /*
779
+ // Callbacks - commented out to reduce size of the minified version - they still work
780
+ onBeforeInitialize : function(e, slider) {}, // Callback before the plugin initializes
781
+ onInitialized : function(e, slider) {}, // Callback when the plugin finished initializing
782
+ onShowStart : function(e, slider) {}, // Callback on slideshow start
783
+ onShowStop : function(e, slider) {}, // Callback after slideshow stops
784
+ onShowPause : function(e, slider) {}, // Callback when slideshow pauses
785
+ onShowUnpause : function(e, slider) {}, // Callback when slideshow unpauses - may not trigger properly if user clicks on any controls
786
+ onSlideInit : function(e, slider) {}, // Callback when slide initiates, before control animation
787
+ onSlideBegin : function(e, slider) {}, // Callback before slide animates
788
+ onSlideComplete : function(slider) {}, // Callback when slide completes - no event variable!
789
+ */
790
+
791
+ // Interactivity
792
+ clickForwardArrow : "click", // Event used to activate forward arrow functionality (e.g. add jQuery mobile's "swiperight")
793
+ clickBackArrow : "click", // Event used to activate back arrow functionality (e.g. add jQuery mobile's "swipeleft")
794
+ clickControls : "click focusin", // Events used to activate navigation control functionality
795
+ clickSlideshow : "click", // Event used to activate slideshow play/stop button
796
+
797
+ // Video
798
+ resumeOnVideoEnd : true, // If true & the slideshow is active & a supported video is playing, it will pause the autoplay until the video is complete
799
+ resumeOnVisible : true, // If true the video will resume playing (if previously paused, except for YouTube iframe - known issue); if false, the video remains paused.
800
+ addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting
801
+ isVideoPlaying : function(base){ return false; } // return true if video is playing or false if not - used by video extension
802
+
803
+ };
804
+
805
+ $.fn.anythingSlider = function(options, callback) {
806
+
807
+ return this.each(function(){
808
+ var page, anySlide = $(this).data('AnythingSlider');
809
+
810
+ // initialize the slider but prevent multiple initializations
811
+ if ((typeof(options)).match('object|undefined')){
812
+ if (!anySlide) {
813
+ (new $.anythingSlider(this, options));
814
+ } else {
815
+ anySlide.updateSlider();
816
+ }
817
+ // If options is a number, process as an external link to page #: $(element).anythingSlider(#)
818
+ } else if (/\d/.test(options) && !isNaN(options) && anySlide) {
819
+ page = (typeof(options) === "number") ? options : parseInt($.trim(options),10); // accepts " 2 "
820
+ // ignore out of bound pages
821
+ if ( page >= 1 && page <= anySlide.pages ) {
822
+ anySlide.gotoPage(page, false, callback); // page #, autoplay, one time callback
823
+ }
824
+ // Accept id or class name
825
+ } else if (/^[#|.]/.test(options) && $(options).length) {
826
+ anySlide.gotoPage(options, false, callback);
827
+ }
828
+ });
829
+ };
830
+
831
+ })(jQuery);