spree_slider 1.0.0

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 (126) hide show
  1. data/.gitignore +11 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +13 -0
  4. data/Gemfile.lock +210 -0
  5. data/LICENSE +26 -0
  6. data/README.textile +43 -0
  7. data/Rakefile +1 -0
  8. data/Versionfile +10 -0
  9. data/app/controllers/spree/admin/slides_controller.rb +8 -0
  10. data/app/models/spree/slide.rb +4 -0
  11. data/app/overrides/add_slider_to_layout.rb +8 -0
  12. data/app/overrides/add_slides_to_admin_configurations_menu.rb +9 -0
  13. data/app/overrides/add_slides_to_admin_configurations_sidebar_menu.rb +7 -0
  14. data/app/views/spree/admin/slides/_form.html.erb +21 -0
  15. data/app/views/spree/admin/slides/edit.html.erb +10 -0
  16. data/app/views/spree/admin/slides/index.html.erb +35 -0
  17. data/app/views/spree/admin/slides/new.html.erb +9 -0
  18. data/app/views/spree/admin/slides/show.html.erb +41 -0
  19. data/app/views/spree/home/index.html.erb +14 -0
  20. data/config/locales/en.yml +5 -0
  21. data/config/routes.rb +5 -0
  22. data/db/migrate/20120222184238_create_slides.rb +16 -0
  23. data/lib/generators/spree_slider/install_anything_generator.rb +30 -0
  24. data/lib/generators/spree_slider/install_nivo_generator.rb +34 -0
  25. data/lib/generators/spree_slider/templates/anything_slider.html.erb +26 -0
  26. data/lib/generators/spree_slider/templates/nivo_slider.html.erb +38 -0
  27. data/lib/spree_slider/engine.rb +23 -0
  28. data/lib/spree_slider.rb +2 -0
  29. data/script/rails +5 -0
  30. data/spec/spec_helper.rb +32 -0
  31. data/spree_slider.gemspec +26 -0
  32. data/vendor/assets/anything-slider/README.textile +13 -0
  33. data/vendor/assets/anything-slider/css/anythingslider-ie.css +45 -0
  34. data/vendor/assets/anything-slider/css/anythingslider.css +204 -0
  35. data/vendor/assets/anything-slider/css/theme-construction.css +142 -0
  36. data/vendor/assets/anything-slider/css/theme-cs-portfolio.css +148 -0
  37. data/vendor/assets/anything-slider/css/theme-metallic.css +146 -0
  38. data/vendor/assets/anything-slider/css/theme-minimalist-round.css +144 -0
  39. data/vendor/assets/anything-slider/css/theme-minimalist-square.css +144 -0
  40. data/vendor/assets/anything-slider/demos/colorbox/border.png +0 -0
  41. data/vendor/assets/anything-slider/demos/colorbox/colorbox.css +62 -0
  42. data/vendor/assets/anything-slider/demos/colorbox/controls.png +0 -0
  43. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomCenter.png +0 -0
  44. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomLeft.png +0 -0
  45. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderBottomRight.png +0 -0
  46. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderMiddleLeft.png +0 -0
  47. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderMiddleRight.png +0 -0
  48. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopCenter.png +0 -0
  49. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopLeft.png +0 -0
  50. data/vendor/assets/anything-slider/demos/colorbox/internet_explorer/borderTopRight.png +0 -0
  51. data/vendor/assets/anything-slider/demos/colorbox/jquery.colorbox-min.js +4 -0
  52. data/vendor/assets/anything-slider/demos/colorbox/jquery.colorbox.js +769 -0
  53. data/vendor/assets/anything-slider/demos/colorbox/loading.gif +0 -0
  54. data/vendor/assets/anything-slider/demos/colorbox/loading_background.png +0 -0
  55. data/vendor/assets/anything-slider/demos/colorbox/overlay.png +0 -0
  56. data/vendor/assets/anything-slider/demos/css/page.css +148 -0
  57. data/vendor/assets/anything-slider/demos/images/251356.jpg +0 -0
  58. data/vendor/assets/anything-slider/demos/images/apple-touch-icon.png +0 -0
  59. data/vendor/assets/anything-slider/demos/images/favicon.ico +0 -0
  60. data/vendor/assets/anything-slider/demos/images/slide-civil-1.jpg +0 -0
  61. data/vendor/assets/anything-slider/demos/images/slide-civil-2.jpg +0 -0
  62. data/vendor/assets/anything-slider/demos/images/slide-env-1.jpg +0 -0
  63. data/vendor/assets/anything-slider/demos/images/slide-env-2.jpg +0 -0
  64. data/vendor/assets/anything-slider/demos/images/slide-tele-1.jpg +0 -0
  65. data/vendor/assets/anything-slider/demos/images/slide-tele-2.jpg +0 -0
  66. data/vendor/assets/anything-slider/demos/images/th-slide-civil-1.jpg +0 -0
  67. data/vendor/assets/anything-slider/demos/images/th-slide-civil-2.jpg +0 -0
  68. data/vendor/assets/anything-slider/demos/images/th-slide-env-1.jpg +0 -0
  69. data/vendor/assets/anything-slider/demos/images/th-slide-env-2.jpg +0 -0
  70. data/vendor/assets/anything-slider/demos/js/demo.js +132 -0
  71. data/vendor/assets/anything-slider/demos/video/movie.mp4 +0 -0
  72. data/vendor/assets/anything-slider/demos/video/movie.ogg +0 -0
  73. data/vendor/assets/anything-slider/demos/video/movie.webm +0 -0
  74. data/vendor/assets/anything-slider/demos.html +740 -0
  75. data/vendor/assets/anything-slider/expand.html +97 -0
  76. data/vendor/assets/anything-slider/images/arrows-metallic.png +0 -0
  77. data/vendor/assets/anything-slider/images/arrows-minimalist.png +0 -0
  78. data/vendor/assets/anything-slider/images/construction.gif +0 -0
  79. data/vendor/assets/anything-slider/images/cs-portfolio.png +0 -0
  80. data/vendor/assets/anything-slider/images/default.png +0 -0
  81. data/vendor/assets/anything-slider/index.html +470 -0
  82. data/vendor/assets/anything-slider/js/jquery.anythingslider.fx.js +165 -0
  83. data/vendor/assets/anything-slider/js/jquery.anythingslider.fx.min.js +6 -0
  84. data/vendor/assets/anything-slider/js/jquery.anythingslider.js +791 -0
  85. data/vendor/assets/anything-slider/js/jquery.anythingslider.min.js +7 -0
  86. data/vendor/assets/anything-slider/js/jquery.anythingslider.video.js +367 -0
  87. data/vendor/assets/anything-slider/js/jquery.anythingslider.video.min.js +8 -0
  88. data/vendor/assets/anything-slider/js/jquery.easing.1.2.js +140 -0
  89. data/vendor/assets/anything-slider/js/jquery.min.js +18 -0
  90. data/vendor/assets/anything-slider/js/swfobject.js +4 -0
  91. data/vendor/assets/anything-slider/license.txt +165 -0
  92. data/vendor/assets/anything-slider/simple.html +79 -0
  93. data/vendor/assets/anything-slider/video.html +341 -0
  94. data/vendor/assets/nivo-slider/README +1 -0
  95. data/vendor/assets/nivo-slider/demo/demo.html +39 -0
  96. data/vendor/assets/nivo-slider/demo/images/dev7logo.png +0 -0
  97. data/vendor/assets/nivo-slider/demo/images/nemo.jpg +0 -0
  98. data/vendor/assets/nivo-slider/demo/images/toystory.jpg +0 -0
  99. data/vendor/assets/nivo-slider/demo/images/up.jpg +0 -0
  100. data/vendor/assets/nivo-slider/demo/images/walle.jpg +0 -0
  101. data/vendor/assets/nivo-slider/demo/scripts/jquery-1.6.1.min.js +18 -0
  102. data/vendor/assets/nivo-slider/demo/style.css +100 -0
  103. data/vendor/assets/nivo-slider/jquery.nivo.slider.js +685 -0
  104. data/vendor/assets/nivo-slider/jquery.nivo.slider.pack.js +67 -0
  105. data/vendor/assets/nivo-slider/license.txt +22 -0
  106. data/vendor/assets/nivo-slider/nivo-slider.css +89 -0
  107. data/vendor/assets/nivo-slider/themes/default/arrows.png +0 -0
  108. data/vendor/assets/nivo-slider/themes/default/bullets.png +0 -0
  109. data/vendor/assets/nivo-slider/themes/default/default.css +74 -0
  110. data/vendor/assets/nivo-slider/themes/default/loading.gif +0 -0
  111. data/vendor/assets/nivo-slider/themes/orman/arrows.png +0 -0
  112. data/vendor/assets/nivo-slider/themes/orman/bullets.png +0 -0
  113. data/vendor/assets/nivo-slider/themes/orman/loading.gif +0 -0
  114. data/vendor/assets/nivo-slider/themes/orman/orman.css +98 -0
  115. data/vendor/assets/nivo-slider/themes/orman/readme.txt +1 -0
  116. data/vendor/assets/nivo-slider/themes/orman/ribbon.png +0 -0
  117. data/vendor/assets/nivo-slider/themes/orman/slider.png +0 -0
  118. data/vendor/assets/nivo-slider/themes/pascal/bullets.png +0 -0
  119. data/vendor/assets/nivo-slider/themes/pascal/controlnav.png +0 -0
  120. data/vendor/assets/nivo-slider/themes/pascal/featured.png +0 -0
  121. data/vendor/assets/nivo-slider/themes/pascal/loading.gif +0 -0
  122. data/vendor/assets/nivo-slider/themes/pascal/pascal.css +102 -0
  123. data/vendor/assets/nivo-slider/themes/pascal/readme.txt +1 -0
  124. data/vendor/assets/nivo-slider/themes/pascal/ribbon.png +0 -0
  125. data/vendor/assets/nivo-slider/themes/pascal/slider.png +0 -0
  126. metadata +236 -0
@@ -0,0 +1,791 @@
1
+ /*
2
+ AnythingSlider v1.7.13
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 !== null && $(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 !== null && $(o.appendStartStopTo).length) ? $(o.appendStartStopTo) : base.$controls );
52
+ }
53
+ base.$nav = $('<ul class="thumbNav" />').appendTo( (o.appendNavigationTo !== null && $(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
+ base.$lastPage = base.$currentPage;
88
+
89
+ // Get index (run time) of this slider on the page
90
+ base.runTimes = $('div.anythingSlider').index(base.$wrapper) + 1;
91
+ base.regex = new RegExp('panel' + base.runTimes + '-(\\d+)', 'i'); // hash tag regex
92
+ if (base.runTimes === 1) { base.makeActive(); } // make the first slider on the page active
93
+
94
+ // Make sure easing function exists.
95
+ if (!$.isFunction($.easing[o.easing])) { o.easing = "swing"; }
96
+
97
+ // If pauseOnHover then add hover effects
98
+ if (o.pauseOnHover) {
99
+ base.$wrapper.hover(function() {
100
+ if (base.playing) {
101
+ base.$el.trigger('slideshow_paused', base);
102
+ base.clearTimer(true);
103
+ }
104
+ }, function() {
105
+ if (base.playing) {
106
+ base.$el.trigger('slideshow_unpaused', base);
107
+ base.startStop(base.playing, true);
108
+ }
109
+ });
110
+ }
111
+
112
+ // If a hash can not be used to trigger the plugin, then go to start panel
113
+ base.setCurrentPage(base.gotoHash() || o.startPage, false);
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;
142
+ base.$items.find('.focusedLink').removeClass('focusedLink');
143
+ $(this).addClass('focusedLink');
144
+ base.$window.scrollLeft(0);
145
+ if ( (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
+ // needed for updating the slider
175
+ base.$el.children('.cloned').remove();
176
+ base.$nav.empty();
177
+ // set currentPage to 1 in case it was zero - occurs when adding slides after removing them all
178
+ base.currentPage = base.currentPage || 1;
179
+
180
+ base.$items = base.$el.children();
181
+ base.pages = base.$items.length;
182
+ base.dir = (o.vertical) ? 'top' : 'left';
183
+ o.showMultiple = (o.vertical) ? 1 : parseInt(o.showMultiple,10) || 1; // only integers allowed
184
+
185
+ if (o.showMultiple > 1) {
186
+ if (o.showMultiple > base.pages) { o.showMultiple = base.pages; }
187
+ base.adjustMultiple = (o.infiniteSlides && base.pages > 1) ? 0 : o.showMultiple - 1;
188
+ base.pages = base.$items.length - base.adjustMultiple;
189
+ }
190
+
191
+ // Hide navigation & player if there is only one page
192
+ base.$controls
193
+ .add(base.$nav)
194
+ .add(base.$startStop)
195
+ .add(base.$forward)
196
+ .add(base.$back)[(base.pages <= 1) ? 'hide' : 'show']();
197
+ if (base.pages > 1) {
198
+ // Build/update navigation tabs
199
+ base.buildNavigation();
200
+ }
201
+
202
+ // Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
203
+ // This supports the "infinite" scrolling, also ensures any cloned elements don't duplicate an ID
204
+ // Moved removeAttr before addClass otherwise IE7 ignores the addClass: http://bugs.jquery.com/ticket/9871
205
+ if (o.infiniteSlides && base.pages > 1) {
206
+ base.$el.prepend( base.$items.filter(':last').clone().removeAttr('id').addClass('cloned') );
207
+ // Add support for multiple sliders shown at the same time
208
+ if (o.showMultiple > 1) {
209
+ base.$el.append( base.$items.filter(':lt(' + o.showMultiple + ')').clone().removeAttr('id').addClass('cloned').addClass('multiple') );
210
+ } else {
211
+ base.$el.append( base.$items.filter(':first').clone().removeAttr('id').addClass('cloned') );
212
+ }
213
+ base.$el.find('.cloned').each(function(){
214
+ // disable all focusable elements in cloned panels to prevent shifting the panels by tabbing
215
+ $(this).find('a,input,textarea,select,button,area').attr('disabled', 'disabled');
216
+ $(this).find('[id]').removeAttr('id');
217
+ });
218
+ }
219
+
220
+ // We just added two items, time to re-cache the list, then get the dimensions of each panel
221
+ base.$items = base.$el.children().addClass('panel' + (o.vertical ? ' vertical' : ''));
222
+ base.setDimensions();
223
+
224
+ // Set the dimensions of each panel
225
+ if (o.resizeContents) {
226
+ base.$items.css('width', base.width);
227
+ base.$wrapper.css('width', base.getDim(base.currentPage)[0]);
228
+ base.$wrapper.add(base.$items).css('height', base.height);
229
+ } else {
230
+ base.$win.load(function(){ base.setDimensions(); }); // set dimensions after all images load
231
+ }
232
+
233
+ if (base.currentPage > base.pages) {
234
+ base.currentPage = base.pages;
235
+ }
236
+ base.setCurrentPage(base.currentPage, false);
237
+ base.$nav.find('a').eq(base.currentPage - 1).addClass('cur'); // update current selection
238
+
239
+ };
240
+
241
+ // Creates the numbered navigation links
242
+ base.buildNavigation = function() {
243
+ if (o.buildNavigation && (base.pages > 1)) {
244
+ var t, $a;
245
+ base.$items.filter(':not(.cloned)').each(function(i) {
246
+ var index = i + 1;
247
+ t = ((index === 1) ? 'first' : '') + ((index === base.pages) ? 'last' : '');
248
+ $a = $('<a href="#"></a>').addClass('panel' + index).wrap('<li class="' + t + '" />');
249
+ base.$nav.append($a.parent()); // use $a.parent() so it will add <li> instead of only the <a> to the <ul>
250
+
251
+ // If a formatter function is present, use it
252
+ if ($.isFunction(o.navigationFormatter)) {
253
+ t = o.navigationFormatter(index, $(this));
254
+ $a.html('<span>' + t + '</span>');
255
+ // Add formatting to title attribute if text is hidden
256
+ if (parseInt($a.find('span').css('text-indent'),10) < 0) { $a.addClass(o.tooltipClass).attr('title', t); }
257
+ } else {
258
+ $a.html('<span>' + index + '</span>');
259
+ }
260
+
261
+ $a.bind(o.clickControls, function(e) {
262
+ if (!base.flag && o.enableNavigation) {
263
+ // prevent running functions twice (once for click, second time for focusin)
264
+ base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
265
+ base.gotoPage(index);
266
+ if (o.hashTags) { base.setHash(index); }
267
+ }
268
+ e.preventDefault();
269
+ });
270
+ });
271
+
272
+ // Add navigation tab scrolling
273
+ if (o.navigationSize !== false && parseInt(o.navigationSize,10) < base.pages) {
274
+ if (!base.$controls.find('.anythingNavWindow').length){
275
+ base.$nav
276
+ .before('<ul><li class="prev"><a href="#"><span>' + o.backText + '</span></a></li></ul>')
277
+ .after('<ul><li class="next"><a href="#"><span>' + o.forwardText + '</span></a></li></ul>')
278
+ .wrap('<div class="anythingNavWindow"></div>');
279
+ }
280
+ // include half of the left position to include extra width from themes like tabs-light and tabs-dark (still not perfect)
281
+ base.navWidths = base.$nav.find('li').map(function(){
282
+ return $(this).innerWidth() + Math.ceil(parseInt($(this).find('span').css('left'),10)/2 || 0);
283
+ }).get();
284
+ base.navLeft = 1;
285
+ // add 5 pixels to make sure the tabs don't wrap to the next line
286
+ base.$nav.width( base.navWidth( 1, base.pages + 1 ) + 5 );
287
+ base.$controls.find('.anythingNavWindow')
288
+ .width( base.navWidth( 1, o.navigationSize + 1 ) ).end()
289
+ .find('.prev,.next').bind(o.clickControls, function(e) {
290
+ if (!base.flag) {
291
+ base.flag = true; setTimeout(function(){ base.flag = false; }, 200);
292
+ base.navWindow( base.navLeft + o.navigationSize * ( $(this).is('.prev') ? -1 : 1 ) );
293
+ }
294
+ e.preventDefault();
295
+ });
296
+ }
297
+
298
+ }
299
+ };
300
+
301
+ base.navWidth = function(x,y){
302
+ var i, s = Math.min(x,y),
303
+ e = Math.max(x,y),
304
+ w = 0;
305
+ for (i = s; i < e; i++) {
306
+ w += base.navWidths[i-1] || 0;
307
+ }
308
+ return w;
309
+ };
310
+
311
+ base.navWindow = function(n){
312
+ var p = base.pages - o.navigationSize + 1;
313
+ n = (n <= 1) ? 1 : (n > 1 && n < p) ? n : p;
314
+ if (n !== base.navLeft) {
315
+ base.$controls.find('.anythingNavWindow').animate(
316
+ { scrollLeft: base.navWidth(1, n), width: base.navWidth(n, n + o.navigationSize) },
317
+ { queue: false, duration: o.animationTime });
318
+ base.navLeft = n;
319
+ }
320
+ };
321
+
322
+ // Creates the Forward/Backward buttons
323
+ base.buildNextBackButtons = function() {
324
+ base.$forward = $('<span class="arrow forward"><a href="#"><span>' + o.forwardText + '</span></a></span>');
325
+ base.$back = $('<span class="arrow back"><a href="#"><span>' + o.backText + '</span></a></span>');
326
+
327
+ // Bind to the forward and back buttons
328
+ base.$back.bind(o.clickBackArrow, function(e) {
329
+ // prevent running functions twice (once for click, second time for swipe)
330
+ if (o.enableArrows && !base.flag) {
331
+ base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
332
+ base.goBack();
333
+ }
334
+ e.preventDefault();
335
+ });
336
+ base.$forward.bind(o.clickForwardArrow, function(e) {
337
+ // prevent running functions twice (once for click, second time for swipe)
338
+ if (o.enableArrows && !base.flag) {
339
+ base.flag = true; setTimeout(function(){ base.flag = false; }, 100);
340
+ base.goForward();
341
+ }
342
+ e.preventDefault();
343
+ });
344
+ // using tab to get to arrow links will show they have focus (outline is disabled in css)
345
+ base.$back.add(base.$forward).find('a').bind('focusin focusout',function(){
346
+ $(this).toggleClass('hover');
347
+ });
348
+
349
+ // Append elements to page
350
+ base.$back.appendTo( (o.appendBackTo !== null && $(o.appendBackTo).length) ? $(o.appendBackTo) : base.$wrapper );
351
+ base.$forward.appendTo( (o.appendForwardTo !== null && $(o.appendForwardTo).length) ? $(o.appendForwardTo) : base.$wrapper );
352
+
353
+ base.$arrowWidth = base.$forward.width(); // assuming the left & right arrows are the same width - used for toggle
354
+ };
355
+
356
+ // Creates the Start/Stop button
357
+ base.buildAutoPlay = function(){
358
+ base.$startStop
359
+ .html('<span>' + (base.playing ? o.stopText : o.startText) + '</span>')
360
+ .bind(o.clickSlideshow, function(e) {
361
+ if (o.enableStartStop) {
362
+ base.startStop(!base.playing);
363
+ base.makeActive();
364
+ if (base.playing && !o.autoPlayDelayed) {
365
+ base.goForward(true);
366
+ }
367
+ }
368
+ e.preventDefault();
369
+ })
370
+ // show button has focus while tabbing
371
+ .bind('focusin focusout',function(){
372
+ $(this).toggleClass('hover');
373
+ });
374
+ };
375
+
376
+ // Adjust slider dimensions on parent element resize
377
+ base.checkResize = function(stopTimer){
378
+ clearTimeout(base.resizeTimer);
379
+ base.resizeTimer = setTimeout(function(){
380
+ var w = base.$outer.width() - base.outerPad[0],
381
+ h = (base.$outer[0].tagName === "BODY" ? base.$win.height() : base.$outer.height()) - base.outerPad[1];
382
+ // base.width = width of one panel, so multiply by # of panels; outerPad is padding added for arrows.
383
+ if (base.width * o.showMultiple !== w || base.height !== h) {
384
+ base.setDimensions(); // adjust panel sizes
385
+ // make sure page is lined up (use -1 animation time, so we can differeniate it from when animationTime = 0)
386
+ base.gotoPage(base.currentPage, base.playing, null, -1);
387
+ }
388
+ if (typeof(stopTimer) === 'undefined'){ base.checkResize(); }
389
+ }, 500);
390
+ };
391
+
392
+ // Set panel dimensions to either resize content or adjust panel to content
393
+ base.setDimensions = function(){
394
+ var w, h, c, edge = 0,
395
+ fullsize = { width: '100%', height: '100%' },
396
+ // determine panel width
397
+ pw = (o.showMultiple > 1) ? base.width || base.$window.width()/o.showMultiple : base.$window.width(),
398
+ winw = base.$win.width();
399
+ if (o.expand){
400
+ w = base.$outer.width() - base.outerPad[0];
401
+ base.height = h = base.$outer.height() - base.outerPad[1];
402
+ base.$wrapper.add(base.$window).add(base.$items).css({ width: w, height: h });
403
+ base.width = pw = (o.showMultiple > 1) ? w/o.showMultiple : w;
404
+ }
405
+ base.$items.each(function(i){
406
+ c = $(this).children();
407
+ if (o.resizeContents){
408
+ // resize panel
409
+ w = base.width;
410
+ h = base.height;
411
+ $(this).css({ width: w, height: h });
412
+ if (c.length && c[0].tagName === "EMBED") { c.attr(fullsize); } // needed for IE7; also c.length > 1 in IE7
413
+ if (c[0].tagName === "OBJECT") { c.find('embed').attr(fullsize); }
414
+ // resize panel contents, if solitary (wrapped content or solitary image)
415
+ if (c.length === 1){
416
+ c.css(fullsize);
417
+ }
418
+ } else {
419
+ // get panel width & height and save it
420
+ w = $(this).width() || base.width; // if image hasn't finished loading, width will be zero, so set it to base width instead
421
+ if (c.length === 1 && w >= winw){
422
+ w = (c.width() >= winw) ? pw : c.width(); // get width of solitary child
423
+ c.css('max-width', w); // set max width for all children
424
+ }
425
+ $(this).css('width', w); // set width of panel
426
+ h = (c.length === 1 ? c.outerHeight(true) : $(this).height()); // get height after setting width
427
+ if (h <= base.outerPad) { h = base.height; } // if height less than the outside padding, then set it to the preset height
428
+ $(this).css('height', h);
429
+ }
430
+ base.panelSize[i] = [w,h,edge];
431
+ edge += (o.vertical) ? h : w;
432
+ });
433
+ // Set total width of slider, Note that this is limited to 32766 by Opera - option removed
434
+ base.$el.css((o.vertical ? 'height' : 'width'), edge);
435
+ };
436
+
437
+ // get dimension of multiple panels, as needed
438
+ base.getDim = function(page){
439
+ if (base.pages < 1 || isNaN(page)) { return [ base.width, base.height ]; } // prevent errors when base.panelSize is empty
440
+ page = (o.infiniteSlides && base.pages > 1) ? page : page - 1;
441
+ var i,
442
+ w = base.panelSize[page][0],
443
+ h = base.panelSize[page][1];
444
+ if (o.showMultiple > 1) {
445
+ for (i=1; i < o.showMultiple; i++) {
446
+ w += base.panelSize[(page + i)%o.showMultiple][0];
447
+ h = Math.max(h, base.panelSize[page + i][1]);
448
+ }
449
+ }
450
+ return [w,h];
451
+ };
452
+
453
+ base.goForward = function(autoplay) {
454
+ base.gotoPage(base.currentPage + o.changeBy * (o.playRtl ? -1 : 1), autoplay);
455
+ };
456
+
457
+ base.goBack = function(autoplay) {
458
+ base.gotoPage(base.currentPage + o.changeBy * (o.playRtl ? 1 : -1), autoplay);
459
+ };
460
+
461
+ base.gotoPage = function(page, autoplay, callback, time) {
462
+ if (autoplay !== true) {
463
+ autoplay = false;
464
+ base.startStop(false);
465
+ base.makeActive();
466
+ }
467
+ // check if page is an id or class name
468
+ if (/^[#|.]/.test(page) && $(page).length) {
469
+ page = $(page).closest('.panel').index() + base.adj;
470
+ }
471
+ // rewind effect occurs here when changeBy > 1
472
+ if (o.changeBy !== 1){
473
+ if (page < 0) { page += base.pages; }
474
+ if (page > base.pages) { page -= base.pages; }
475
+ }
476
+ if (base.pages <= 1) { return; } // prevents animation
477
+ base.$lastPage = base.$currentPage;
478
+ if (typeof(page) !== "number") {
479
+ page = o.startPanel;
480
+ base.setCurrentPage(page);
481
+ }
482
+
483
+ // pause YouTube videos before scrolling or prevent change if playing
484
+ if (autoplay && o.isVideoPlaying(base)) { return; }
485
+
486
+ if (page > base.pages + 1 - base.adj) { page = (!o.infiniteSlides && !o.stopAtEnd) ? 1 : base.pages; }
487
+ if (page < base.adj ) { page = (!o.infiniteSlides && !o.stopAtEnd) ? base.pages : 1; }
488
+ base.currentPage = ( page > base.pages ) ? base.pages : ( page < 1 ) ? 1 : base.currentPage;
489
+ base.$currentPage = base.$items.eq(base.currentPage - base.adj);
490
+ base.exactPage = page;
491
+ base.targetPage = (page === 0) ? base.pages - base.adj : (page > base.pages) ? 1 - base.adj : page - base.adj;
492
+ base.$targetPage = base.$items.eq( base.targetPage );
493
+ time = time || o.animationTime;
494
+ // don't trigger events when time = 1 - to prevent FX from firing multiple times on page resize
495
+ if (time >= 0) { base.$el.trigger('slide_init', base); }
496
+
497
+ base.slideControls(true, false);
498
+
499
+ // When autoplay isn't passed, we stop the timer
500
+ if (autoplay !== true) { autoplay = false; }
501
+ // Stop the slider when we reach the last page, if the option stopAtEnd is set to true
502
+ if (!autoplay || (o.stopAtEnd && page === base.pages)) { base.startStop(false); }
503
+
504
+ if (time >= 0) { base.$el.trigger('slide_begin', base); }
505
+
506
+ // delay starting slide animation
507
+ setTimeout(function(d){
508
+ // resize slider if content size varies
509
+ if (!o.resizeContents) {
510
+ // animating the wrapper resize before the window prevents flickering in Firefox
511
+ d = base.getDim(page);
512
+ base.$wrapper.filter(':not(:animated)').animate(
513
+ // prevent animating a dimension to zero
514
+ { width: d[0] || base.width, height: d[1] || base.height },
515
+ { queue: false, duration: (time < 0 ? 0 : time), easing: o.easing }
516
+ );
517
+ }
518
+ d = {};
519
+ d[base.dir] = -base.panelSize[(o.infiniteSlides && base.pages > 1) ? page : page - 1][2];
520
+ // Animate Slider
521
+ base.$el.filter(':not(:animated)').animate(
522
+ d, { queue: false, duration: time, easing: o.easing, complete: function(){ base.endAnimation(page, callback, time); } }
523
+ );
524
+ }, parseInt(o.delayBeforeAnimate, 10) || 0);
525
+ };
526
+
527
+ base.endAnimation = function(page, callback, time){
528
+ if (page === 0) {
529
+ base.$el.css( base.dir, -base.panelSize[base.pages][2]);
530
+ page = base.pages;
531
+ } else if (page > base.pages) {
532
+ // reset back to start position
533
+ base.$el.css( base.dir, -base.panelSize[1][2]);
534
+ page = 1;
535
+ }
536
+ base.exactPage = page;
537
+ base.setCurrentPage(page, false);
538
+ // Add active panel class
539
+ base.$items.removeClass('activePage').eq(page - base.adj).addClass('activePage');
540
+
541
+ if (!base.hovered) { base.slideControls(false); }
542
+
543
+ if (time >= 0) { base.$el.trigger('slide_complete', base); }
544
+ // callback from external slide control: $('#slider').anythingSlider(4, function(slider){ })
545
+ if (typeof callback === 'function') { callback(base); }
546
+
547
+ // Continue slideshow after a delay
548
+ if (o.autoPlayLocked && !base.playing) {
549
+ setTimeout(function(){
550
+ base.startStop(true);
551
+ // subtract out slide delay as the slideshow waits that additional time.
552
+ }, o.resumeDelay - (o.autoPlayDelayed ? o.delay : 0));
553
+ }
554
+ };
555
+
556
+ base.setCurrentPage = function(page, move) {
557
+ page = parseInt(page, 10);
558
+ if (base.pages < 1 || page === 0 || isNaN(page)) { return; }
559
+ if (page > base.pages + 1 - base.adj) { page = base.pages - base.adj; }
560
+ if (page < base.adj ) { page = 1; }
561
+
562
+ // Set visual
563
+ if (o.buildNavigation){
564
+ base.$nav
565
+ .find('.cur').removeClass('cur').end()
566
+ .find('a').eq(page - 1).addClass('cur');
567
+ }
568
+
569
+ // hide/show arrows based on infinite scroll mode
570
+ if (!o.infiniteSlides && o.stopAtEnd){
571
+ base.$wrapper
572
+ .find('span.forward')[ page === base.pages ? 'addClass' : 'removeClass']('disabled').end()
573
+ .find('span.back')[ page === 1 ? 'addClass' : 'removeClass']('disabled');
574
+ if (page === base.pages && base.playing) { base.startStop(); }
575
+ }
576
+
577
+ // Only change left if move does not equal false
578
+ if (!move) {
579
+ var d = base.getDim(page);
580
+ base.$wrapper
581
+ .css({ width: d[0], height: d[1] })
582
+ .add(base.$window).scrollLeft(0); // reset in case tabbing changed this scrollLeft - probably overly redundant
583
+ base.$el.css( base.dir, -base.panelSize[(o.infiniteSlides && base.pages > 1) ? page : page - 1][2] );
584
+ }
585
+ // Update local variable
586
+ base.currentPage = page;
587
+ base.$currentPage = base.$items.removeClass('activePage').eq(page - base.adj).addClass('activePage');
588
+
589
+ };
590
+
591
+ base.makeActive = function(){
592
+ // Set current slider as active so keyboard navigation works properly
593
+ if (!base.$wrapper.is('.activeSlider')){
594
+ $('.activeSlider').removeClass('activeSlider');
595
+ base.$wrapper.addClass('activeSlider');
596
+ }
597
+ };
598
+
599
+ // This method tries to find a hash that matches an ID and panel-X
600
+ // If either found, it tries to find a matching item
601
+ // If that is found as well, then it returns the page number
602
+ base.gotoHash = function(){
603
+ var h = base.win.location.hash,
604
+ i = h.indexOf('&'),
605
+ n = h.match(base.regex);
606
+ if (n === null && !/^#&/.test(h)) {
607
+ // #quote2&panel1-3&panel3-3
608
+ h = h.substring(0, (i >= 0 ? i : h.length));
609
+ // ensure the element is in the same slider
610
+ n = ($(h).closest('.anythingBase')[0] === base.el) ? $(h).closest('.panel').index() : null;
611
+ } else if (n !== null) {
612
+ // #&panel1-3&panel3-3
613
+ n = (o.hashTags) ? parseInt(n[1],10) : null;
614
+ }
615
+ return n;
616
+ };
617
+
618
+ base.setHash = function(n){
619
+ var s = 'panel' + base.runTimes + '-',
620
+ h = base.win.location.hash;
621
+ if ( typeof h !== 'undefined' ) {
622
+ base.win.location.hash = (h.indexOf(s) > 0) ? h.replace(base.regex, s + n) : h + "&" + s + n;
623
+ }
624
+ };
625
+
626
+ // Slide controls (nav and play/stop button up or down)
627
+ base.slideControls = function(toggle){
628
+ var dir = (toggle) ? 'slideDown' : 'slideUp',
629
+ t1 = (toggle) ? 0 : o.animationTime,
630
+ t2 = (toggle) ? o.animationTime: 0,
631
+ op = (toggle) ? 1 : 0,
632
+ sign = (toggle) ? 0 : 1; // 0 = visible, 1 = hidden
633
+ if (o.toggleControls) {
634
+ base.$controls.stop(true,true).delay(t1)[dir](o.animationTime/2).delay(t2);
635
+ }
636
+ if (o.buildArrows && o.toggleArrows) {
637
+ if (!base.hovered && base.playing) { sign = 1; op = 0; } // don't animate arrows during slideshow
638
+ base.$forward.stop(true,true).delay(t1).animate({ right: sign * base.$arrowWidth, opacity: op }, o.animationTime/2);
639
+ base.$back.stop(true,true).delay(t1).animate({ left: sign * base.$arrowWidth, opacity: op }, o.animationTime/2);
640
+ }
641
+ };
642
+
643
+ base.clearTimer = function(paused){
644
+ // Clear the timer only if it is set
645
+ if (base.timer) {
646
+ base.win.clearInterval(base.timer);
647
+ if (!paused && base.slideshow) {
648
+ base.$el.trigger('slideshow_stop', base);
649
+ base.slideshow = false;
650
+ }
651
+ }
652
+ };
653
+
654
+ // Pass startStop(false) to stop and startStop(true) to play
655
+ base.startStop = function(playing, paused) {
656
+ if (playing !== true) { playing = false; } // Default if not supplied is false
657
+ base.playing = playing;
658
+
659
+ if (playing && !paused) {
660
+ base.$el.trigger('slideshow_start', base);
661
+ base.slideshow = true;
662
+ }
663
+
664
+ // Toggle playing and text
665
+ if (o.buildStartStop) {
666
+ base.$startStop.toggleClass('playing', playing).find('span').html( playing ? o.stopText : o.startText );
667
+ // add button text to title attribute if it is hidden by text-indent
668
+ if (parseInt(base.$startStop.find('span').css('text-indent'),10) < 0) {
669
+ base.$startStop.addClass(o.tooltipClass).attr( 'title', playing ? o.stopText : o.startText );
670
+ }
671
+ }
672
+
673
+ // Pause slideshow while video is playing
674
+ if (playing){
675
+ base.clearTimer(true); // Just in case this was triggered twice in a row
676
+ base.timer = base.win.setInterval(function() {
677
+ // prevent autoplay if video is playing
678
+ if ( !o.isVideoPlaying(base) ) {
679
+ base.goForward(true);
680
+ // stop slideshow if resume if false
681
+ } else if (!o.resumeOnVideoEnd) {
682
+ base.startStop();
683
+ }
684
+ }, o.delay);
685
+ } else {
686
+ base.clearTimer();
687
+ }
688
+ };
689
+
690
+ // Trigger the initialization
691
+ base.init();
692
+ };
693
+
694
+ $.anythingSlider.defaults = {
695
+ // Appearance
696
+ theme : "default", // Theme name, add the css stylesheet manually
697
+ expand : false, // If true, the entire slider will expand to fit the parent element
698
+ resizeContents : true, // If true, solitary images/objects in the panel will expand to fit the viewport
699
+ vertical : false, // If true, all panels will slide vertically; they slide horizontally otherwise
700
+ showMultiple : false, // Set this value to a number and it will show that many slides at once
701
+ easing : "swing", // Anything other than "linear" or "swing" requires the easing plugin or jQuery UI
702
+
703
+ buildArrows : true, // If true, builds the forwards and backwards buttons
704
+ buildNavigation : true, // If true, builds a list of anchor links to link to each panel
705
+ buildStartStop : true, // ** If true, builds the start/stop button
706
+
707
+ appendForwardTo : null, // Append forward arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null
708
+ appendBackTo : null, // Append back arrow to a HTML element (jQuery Object, selector or HTMLNode), if not null
709
+ appendControlsTo : null, // Append controls (navigation + start-stop) to a HTML element (jQuery Object, selector or HTMLNode), if not null
710
+ appendNavigationTo : null, // Append navigation buttons to a HTML element (jQuery Object, selector or HTMLNode), if not null
711
+ appendStartStopTo : null, // Append start-stop button to a HTML element (jQuery Object, selector or HTMLNode), if not null
712
+
713
+ toggleArrows : false, // If true, side navigation arrows will slide out on hovering & hide @ other times
714
+ toggleControls : false, // if true, slide in controls (navigation + play/stop button) on hover and slide change, hide @ other times
715
+
716
+ startText : "Start", // Start button text
717
+ stopText : "Stop", // Stop button text
718
+ forwardText : "&raquo;", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image)
719
+ backText : "&laquo;", // Link text used to move the slider back (hidden by CSS, replace with arrow image)
720
+ tooltipClass : "tooltip", // Class added to navigation & start/stop button (text copied to title if it is hidden by a negative text indent)
721
+
722
+ // Function
723
+ enableArrows : true, // if false, arrows will be visible, but not clickable.
724
+ enableNavigation : true, // if false, navigation links will still be visible, but not clickable.
725
+ enableStartStop : true, // if false, the play/stop button will still be visible, but not clickable. Previously "enablePlay"
726
+ enableKeyboard : true, // if false, keyboard arrow keys will not work for this slider.
727
+
728
+ // Navigation
729
+ startPanel : 1, // This sets the initial panel
730
+ changeBy : 1, // Amount to go forward or back when changing panels.
731
+ hashTags : true, // Should links change the hashtag in the URL?
732
+ infiniteSlides : true, // if false, the slider will not wrap & not clone any panels
733
+ navigationFormatter : null, // Details at the top of the file on this use (advanced use)
734
+ navigationSize : false, // Set this to the maximum number of visible navigation tabs; false to disable
735
+
736
+ // Slideshow options
737
+ autoPlay : false, // If true, the slideshow will start running; replaces "startStopped" option
738
+ autoPlayLocked : false, // If true, user changing slides will not stop the slideshow
739
+ 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
740
+ pauseOnHover : true, // If true & the slideshow is active, the slideshow will pause on hover
741
+ 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.
742
+ playRtl : false, // If true, the slideshow will move right-to-left
743
+
744
+ // Times
745
+ delay : 3000, // How long between slideshow transitions in AutoPlay mode (in milliseconds)
746
+ resumeDelay : 15000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
747
+ animationTime : 600, // How long the slideshow transition takes (in milliseconds)
748
+ delayBeforeAnimate : 0, // How long to pause slide animation before going to the desired slide (used if you want your "out" FX to show).
749
+
750
+ // Callbacks - removed from options to reduce size - they still work
751
+
752
+ // Interactivity
753
+ clickForwardArrow : "click", // Event used to activate forward arrow functionality (e.g. add jQuery mobile's "swiperight")
754
+ clickBackArrow : "click", // Event used to activate back arrow functionality (e.g. add jQuery mobile's "swipeleft")
755
+ clickControls : "click focusin", // Events used to activate navigation control functionality
756
+ clickSlideshow : "click", // Event used to activate slideshow play/stop button
757
+
758
+ // Video
759
+ resumeOnVideoEnd : true, // If true & the slideshow is active & a supported video is playing, it will pause the autoplay until the video is complete
760
+ addWmodeToObject : "opaque", // If your slider has an embedded object, the script will automatically add a wmode parameter with this setting
761
+ isVideoPlaying : function(base){ return false; } // return true if video is playing or false if not - used by video extension
762
+
763
+ };
764
+
765
+ $.fn.anythingSlider = function(options, callback) {
766
+
767
+ return this.each(function(){
768
+ var page, anySlide = $(this).data('AnythingSlider');
769
+
770
+ // initialize the slider but prevent multiple initializations
771
+ if ((typeof(options)).match('object|undefined')){
772
+ if (!anySlide) {
773
+ (new $.anythingSlider(this, options));
774
+ } else {
775
+ anySlide.updateSlider();
776
+ }
777
+ // If options is a number, process as an external link to page #: $(element).anythingSlider(#)
778
+ } else if (/\d/.test(options) && !isNaN(options) && anySlide) {
779
+ page = (typeof(options) === "number") ? options : parseInt($.trim(options),10); // accepts " 2 "
780
+ // ignore out of bound pages
781
+ if ( page >= 1 && page <= anySlide.pages ) {
782
+ anySlide.gotoPage(page, false, callback); // page #, autoplay, one time callback
783
+ }
784
+ // Accept id or class name
785
+ } else if (/^[#|.]/.test(options) && $(options).length) {
786
+ anySlide.gotoPage(options, false, callback);
787
+ }
788
+ });
789
+ };
790
+
791
+ })(jQuery);