spree_multi_slideshow 1.1.8 → 1.2.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.
- data/README.md +3 -3
- data/app/assets/images/store/slides/bg-gallery.png +0 -0
- data/app/assets/images/store/slides/bg-text02.png +0 -0
- data/app/assets/javascripts/admin/slides/index.js +1 -1
- data/app/assets/javascripts/admin/slides/new.js +1 -1
- data/app/assets/javascripts/admin/spree_multi_slideshow.js +1 -1
- data/app/assets/javascripts/store/spree_multi_slideshow.js +211 -537
- data/app/assets/stylesheets/admin/spree_multi_slideshow.css +16 -0
- data/app/assets/stylesheets/store/carousel_slideshow.css.scss +73 -0
- data/app/assets/stylesheets/store/spree_multi_slideshow.css +3 -47
- data/app/controllers/spree/admin/slides_controller.rb +5 -3
- data/app/controllers/spree/admin/slideshow_types_controller.rb +1 -5
- data/app/controllers/spree/slides_controller.rb +5 -0
- data/app/controllers/spree/slideshow_types_controller.rb +5 -0
- data/app/helpers/spree/slides_helper.rb +4 -0
- data/app/helpers/spree/slideshow_types_helper.rb +46 -44
- data/app/models/spree/slide.rb +27 -39
- data/app/models/spree/slideshow_type.rb +10 -4
- data/app/overrides/slideshow_type_admin_tab.rb +1 -6
- data/app/views/spree/admin/shared/_slideshow_type_tabs.html.erb +6 -8
- data/app/views/spree/admin/slides/_form.html.erb +9 -22
- data/app/views/spree/admin/slides/edit.html.erb +7 -7
- data/app/views/spree/admin/slides/index.html.erb +31 -30
- data/app/views/spree/admin/slides/new.html.erb +2 -2
- data/app/views/spree/admin/slideshow_types/_form.html.erb +8 -30
- data/app/views/spree/admin/slideshow_types/edit.html.erb +7 -6
- data/app/views/spree/admin/slideshow_types/index.html.erb +29 -30
- data/app/views/spree/admin/slideshow_types/new.html.erb +5 -33
- data/config/locales/en.yml +0 -1
- data/config/locales/it.yml +0 -1
- data/config/routes.rb +0 -1
- data/db/migrate/20120116081431_create_slideshow_types.rb +4 -1
- data/db/migrate/20120116083546_create_slides.rb +1 -0
- data/lib/generators/spree_multi_slideshow/install/install_generator.rb +22 -2
- data/lib/spree_multi_slideshow.rb +2 -0
- metadata +110 -81
- data/app/assets/images/store/slides/pagination.png +0 -0
- data/app/assets/javascripts/admin/slide_settings.js +0 -31
- data/app/controllers/spree/admin/slide_settings_controller.rb +0 -51
- data/app/models/spree/app_configuration_decorator.rb +0 -8
- data/app/views/spree/admin/shared/_slide_setting_configurations_menu.html.erb +0 -4
- data/app/views/spree/admin/slide_settings/edit.html.erb +0 -48
- data/app/views/spree/admin/slide_settings/show.html.erb +0 -10
- data/app/views/spree/admin/slideshow_types/new.js.erb +0 -2
- data/db/migrate/20130114150224_add_enable_pagination.rb +0 -5
- data/db/migrate/20130226082756_add_enable_to_slide.rb +0 -8
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Basic Installation
|
|
9
9
|
|
10
10
|
1. Add the following to your Gemfile
|
11
11
|
<pre>
|
12
|
-
gem 'spree_multi_slideshow', '~> 1.
|
12
|
+
gem 'spree_multi_slideshow', '~> 1.2.0'
|
13
13
|
</pre>
|
14
14
|
2. Run `bundle install`
|
15
15
|
3. To copy and apply migrations run:
|
@@ -35,8 +35,8 @@ displays slides for which the category column, dafault is "home"
|
|
35
35
|
</pre>
|
36
36
|
style layout for slideshow: [small, medium, slide, default => custom]
|
37
37
|
<pre>
|
38
|
-
<%= insert_slideshow(:
|
38
|
+
<%= insert_slideshow(:enable_content => true/false :style => "custom", :category => "custom") %>
|
39
39
|
</pre>
|
40
|
-
added
|
40
|
+
added a content_tag for display title and description of slide
|
41
41
|
|
42
42
|
Copyright (c) 2012 [Damiano Giacomello], released under the New BSD License
|
Binary file
|
Binary file
|
@@ -1 +1 @@
|
|
1
|
-
//= require
|
1
|
+
//= require ckeditor/init
|
@@ -1,555 +1,229 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
* Version: 1.1.9
|
6
|
-
* Updated: September 5th, 2011
|
7
|
-
*
|
8
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
* you may not use this file except in compliance with the License.
|
10
|
-
* You may obtain a copy of the License at
|
11
|
-
*
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
*
|
14
|
-
* Unless required by applicable law or agreed to in writing, software
|
15
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
-
* See the License for the specific language governing permissions and
|
18
|
-
* limitations under the License.
|
19
|
-
*/
|
20
|
-
(function($){
|
21
|
-
$.fn.slides = function( option ) {
|
22
|
-
// override defaults with specified option
|
23
|
-
option = $.extend( {}, $.fn.slides.option, option );
|
1
|
+
// page init
|
2
|
+
jQuery(function($) {
|
3
|
+
initGalleries();
|
4
|
+
});
|
24
5
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
start = option.start - 1,
|
35
|
-
effect = option.effect.indexOf(',') < 0 ? option.effect : option.effect.replace(' ', '').split(',')[0],
|
36
|
-
paginationEffect = option.effect.indexOf(',') < 0 ? effect : option.effect.replace(' ', '').split(',')[1],
|
37
|
-
next = 0, prev = 0, number = 0, current = 0, loaded, active, clicked, position, direction, imageParent, pauseTimeout, playInterval;
|
38
|
-
|
39
|
-
// is there only one slide?
|
40
|
-
if (total < 2) {
|
41
|
-
// Fade in .slides_container
|
42
|
-
$('.' + option.container, $(this)).fadeIn(option.fadeSpeed, option.fadeEasing, function(){
|
43
|
-
// let the script know everything is loaded
|
44
|
-
loaded = true;
|
45
|
-
// call the loaded funciton
|
46
|
-
option.slidesLoaded();
|
47
|
-
});
|
48
|
-
// Hide the next/previous buttons
|
49
|
-
$('.' + option.next + ', .' + option.prev).fadeOut(0);
|
50
|
-
return false;
|
51
|
-
}
|
6
|
+
// galleries init
|
7
|
+
function initGalleries(){
|
8
|
+
// main banner slideshow
|
9
|
+
jQuery('div.gallery').fadeGallery({
|
10
|
+
autoRotation: true,
|
11
|
+
switchTime: 5000, //ms
|
12
|
+
duration: 800 //ms
|
13
|
+
});
|
14
|
+
};
|
52
15
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
position = 0;
|
83
|
-
// distance to slide based on width of slides
|
84
|
-
direction = 0;
|
85
|
-
// store new current slide
|
86
|
-
current = next;
|
87
|
-
break;
|
88
|
-
case 'pagination':
|
89
|
-
// get next from pagination item clicked, convert to number
|
90
|
-
next = parseInt(clicked,10);
|
91
|
-
// get previous from pagination item with class of current
|
92
|
-
prev = $('.' + option.paginationClass + ' li.'+ option.currentClass +' a', elem).attr('href').match('[^#/]+$');
|
93
|
-
// if next is greater then previous set position of next slide to right of previous
|
94
|
-
if (next > prev) {
|
95
|
-
position = width*2;
|
96
|
-
direction = -width*2;
|
97
|
-
} else {
|
98
|
-
// if next is less then previous set position of next slide to left of previous
|
99
|
-
position = 0;
|
100
|
-
direction = 0;
|
101
|
-
}
|
102
|
-
// store new current slide
|
103
|
-
current = next;
|
104
|
-
break;
|
105
|
-
}
|
16
|
+
// slideshow plugin
|
17
|
+
jQuery.fn.fadeGallery = function(_options){
|
18
|
+
var _options = jQuery.extend({
|
19
|
+
slideElements:'div.gallery-inner > ul > li',
|
20
|
+
pagerGener: false,
|
21
|
+
pagerHold: false,
|
22
|
+
pagerLinks:'ul.nav-list li',
|
23
|
+
btnNext:'a.gallery-control.right',
|
24
|
+
btnPrev:'a.gallery-control.left',
|
25
|
+
btnPlayPause:'a.play-pause',
|
26
|
+
btnPlay:'a.play',
|
27
|
+
btnPause:'a.pause',
|
28
|
+
pausedClass:'paused',
|
29
|
+
disabledClass: 'disabled',
|
30
|
+
playClass:'playing',
|
31
|
+
activeClass:'active',
|
32
|
+
currentNum:false,
|
33
|
+
allNum:false,
|
34
|
+
startSlide:null,
|
35
|
+
noCircle:false,
|
36
|
+
caption:'ul.caption > li',
|
37
|
+
pauseOnHover:false,
|
38
|
+
autoRotation:false,
|
39
|
+
autoHeight:false,
|
40
|
+
onChange:false,
|
41
|
+
switchTime:3000,
|
42
|
+
duration:650,
|
43
|
+
event:'click'
|
44
|
+
},_options);
|
106
45
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
} else {
|
150
|
-
// fade animation with no crossfade
|
151
|
-
control.children(':eq('+ prev +')', elem).fadeOut(option.fadeSpeed, option.fadeEasing, function(){
|
152
|
-
// animate to new height
|
153
|
-
if (option.autoHeight) {
|
154
|
-
control.animate({
|
155
|
-
// animate container to height of next
|
156
|
-
height: control.children(':eq('+ next +')', elem).outerHeight()
|
157
|
-
}, option.autoHeightSpeed,
|
158
|
-
// fade in next slide
|
159
|
-
function(){
|
160
|
-
control.children(':eq('+ next +')', elem).fadeIn(option.fadeSpeed, option.fadeEasing);
|
161
|
-
});
|
162
|
-
} else {
|
163
|
-
// if fixed height
|
164
|
-
control.children(':eq('+ next +')', elem).fadeIn(option.fadeSpeed, option.fadeEasing, function(){
|
165
|
-
// fix font rendering in ie, lame
|
166
|
-
if($.browser.msie) {
|
167
|
-
$(this).get(0).style.removeAttribute('filter');
|
168
|
-
}
|
169
|
-
});
|
170
|
-
}
|
171
|
-
// end of animation
|
172
|
-
option.animationComplete(next + 1);
|
173
|
-
active = false;
|
174
|
-
});
|
175
|
-
}
|
176
|
-
// slide animation
|
177
|
-
} else {
|
178
|
-
// move next slide to right of previous
|
179
|
-
control.children(':eq('+ next +')').css({
|
180
|
-
left: position,
|
181
|
-
display: 'block'
|
182
|
-
});
|
183
|
-
// animate to new height
|
184
|
-
if (option.autoHeight) {
|
185
|
-
control.animate({
|
186
|
-
left: direction,
|
187
|
-
height: control.children(':eq('+ next +')').outerHeight()
|
188
|
-
},option.slideSpeed, option.slideEasing, function(){
|
189
|
-
control.css({
|
190
|
-
left: -width
|
191
|
-
});
|
192
|
-
control.children(':eq('+ next +')').css({
|
193
|
-
left: width,
|
194
|
-
zIndex: 0
|
195
|
-
});
|
196
|
-
// reset previous slide
|
197
|
-
control.children(':eq('+ prev +')').css({
|
198
|
-
left: width,
|
199
|
-
display: 'none',
|
200
|
-
zIndex: 0
|
201
|
-
});
|
202
|
-
// end of animation
|
203
|
-
option.animationComplete(next + 1);
|
204
|
-
active = false;
|
205
|
-
});
|
206
|
-
// if fixed height
|
207
|
-
} else {
|
208
|
-
// animate control
|
209
|
-
control.animate({
|
210
|
-
left: direction
|
211
|
-
},option.slideSpeed, option.slideEasing, function(){
|
212
|
-
// after animation reset control position
|
213
|
-
control.css({
|
214
|
-
left: -width
|
215
|
-
});
|
216
|
-
// reset and show next
|
217
|
-
control.children(':eq('+ next +')').css({
|
218
|
-
left: width,
|
219
|
-
zIndex: 0
|
220
|
-
});
|
221
|
-
// reset previous slide
|
222
|
-
control.children(':eq('+ prev +')').css({
|
223
|
-
left: width,
|
224
|
-
display: 'none',
|
225
|
-
zIndex: 0
|
226
|
-
});
|
227
|
-
// end of animation
|
228
|
-
option.animationComplete(next + 1);
|
229
|
-
active = false;
|
230
|
-
});
|
231
|
-
}
|
232
|
-
}
|
233
|
-
// set current state for pagination
|
234
|
-
if (option.pagination) {
|
235
|
-
// remove current class from all
|
236
|
-
$('.'+ option.paginationClass +' li.' + option.currentClass, elem).removeClass(option.currentClass);
|
237
|
-
// add current class to next
|
238
|
-
$('.' + option.paginationClass + ' li:eq('+ next +')', elem).addClass(option.currentClass);
|
239
|
-
}
|
240
|
-
}
|
241
|
-
} // end animate function
|
242
|
-
|
243
|
-
function stop() {
|
244
|
-
// clear interval from stored id
|
245
|
-
clearInterval(elem.data('interval'));
|
246
|
-
}
|
46
|
+
return this.each(function(){
|
47
|
+
// gallery options
|
48
|
+
var _this = jQuery(this);
|
49
|
+
var _slides = jQuery(_options.slideElements, _this);
|
50
|
+
var _btnPrev = jQuery(_options.btnPrev, _this);
|
51
|
+
var _btnNext = jQuery(_options.btnNext, _this);
|
52
|
+
var _btnPlayPause = jQuery(_options.btnPlayPause, _this);
|
53
|
+
var _btnPause = jQuery(_options.btnPause, _this);
|
54
|
+
var _btnPlay = jQuery(_options.btnPlay, _this);
|
55
|
+
var _pauseOnHover = _options.pauseOnHover;
|
56
|
+
var _autoRotation = _options.autoRotation;
|
57
|
+
var _activeClass = _options.activeClass;
|
58
|
+
var _disabledClass = _options.disabledClass;
|
59
|
+
var _pausedClass = _options.pausedClass;
|
60
|
+
var _playClass = _options.playClass;
|
61
|
+
var _autoHeight = _options.autoHeight;
|
62
|
+
var _duration = _options.duration;
|
63
|
+
var _switchTime = _options.switchTime;
|
64
|
+
var _controlEvent = _options.event;
|
65
|
+
var _currentNum = (_options.currentNum ? jQuery(_options.currentNum, _this) : false);
|
66
|
+
var _allNum = (_options.allNum ? jQuery(_options.allNum, _this) : false);
|
67
|
+
var _startSlide = _options.startSlide;
|
68
|
+
var _noCycle = _options.noCircle;
|
69
|
+
var _onChange = _options.onChange;
|
70
|
+
var _pagerGener = _options.pagerGener;
|
71
|
+
var _pagerHold = jQuery(_options.pagerHold,_this);
|
72
|
+
var _caption = jQuery(_options.caption,_this);
|
73
|
+
var _paging = '';
|
74
|
+
if(_pagerGener){
|
75
|
+
for(var i=0; i< _slides.length; i++){
|
76
|
+
_paging += '<li><a href="#">'+(i+1)+'</a></li>';
|
77
|
+
}
|
78
|
+
_pagerHold.html('<ul>'+_paging+'</ul>');
|
79
|
+
}
|
80
|
+
var _pagerLinks = jQuery(_options.pagerLinks, _this);
|
81
|
+
// gallery init
|
82
|
+
var _hover = false;
|
83
|
+
var _prevIndex = 0;
|
84
|
+
var _currentIndex = 0;
|
85
|
+
var _slideCount = _slides.length;
|
86
|
+
var _timer;
|
87
|
+
if(_slideCount < 2) return;
|
247
88
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
elem.data('pause',pauseTimeout);
|
266
|
-
} else {
|
267
|
-
// if no pause, just stop
|
268
|
-
stop();
|
269
|
-
}
|
270
|
-
}
|
271
|
-
|
272
|
-
// 2 or more slides required
|
273
|
-
if (total < 2) {
|
274
|
-
return;
|
275
|
-
}
|
276
|
-
|
277
|
-
// error corection for start slide
|
278
|
-
if (start < 0) {
|
279
|
-
start = 0;
|
280
|
-
}
|
281
|
-
|
282
|
-
if (start > total) {
|
283
|
-
start = total - 1;
|
284
|
-
}
|
285
|
-
|
286
|
-
// change current based on start option number
|
287
|
-
if (option.start) {
|
288
|
-
current = start;
|
289
|
-
}
|
290
|
-
|
291
|
-
// randomizes slide order
|
292
|
-
if (option.randomize) {
|
293
|
-
control.randomize();
|
294
|
-
}
|
295
|
-
|
296
|
-
// make sure overflow is hidden, width is set
|
297
|
-
$('.' + option.container, elem).css({
|
298
|
-
overflow: 'hidden',
|
299
|
-
// fix for ie
|
300
|
-
position: 'relative'
|
89
|
+
_prevIndex = _slides.index(_slides.filter('.'+_activeClass));
|
90
|
+
if(_prevIndex < 0) _prevIndex = _currentIndex = 0;
|
91
|
+
else _currentIndex = _prevIndex;
|
92
|
+
if(_startSlide != null) {
|
93
|
+
if(_startSlide == 'random') _prevIndex = _currentIndex = Math.floor(Math.random()*_slideCount);
|
94
|
+
else _prevIndex = _currentIndex = parseInt(_startSlide);
|
95
|
+
}
|
96
|
+
_slides.hide().eq(_currentIndex).show();
|
97
|
+
_caption.hide().eq(_currentIndex).show();
|
98
|
+
if(_autoRotation) _this.removeClass(_pausedClass).addClass(_playClass);
|
99
|
+
else _this.removeClass(_playClass).addClass(_pausedClass);
|
100
|
+
|
101
|
+
// gallery control
|
102
|
+
if(_btnPrev.length) {
|
103
|
+
_btnPrev.bind(_controlEvent,function(){
|
104
|
+
prevSlide();
|
105
|
+
return false;
|
301
106
|
});
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
left: control.children().outerWidth(),
|
308
|
-
zIndex: 0,
|
309
|
-
display: 'none'
|
310
|
-
});
|
311
|
-
|
312
|
-
// set css for control div
|
313
|
-
control.css({
|
314
|
-
position: 'relative',
|
315
|
-
// size of control 3 x slide width
|
316
|
-
width: (width * 3),
|
317
|
-
// set height to slide height
|
318
|
-
height: height,
|
319
|
-
// center control to slide
|
320
|
-
left: -width
|
107
|
+
}
|
108
|
+
if(_btnNext.length) {
|
109
|
+
_btnNext.bind(_controlEvent,function(){
|
110
|
+
nextSlide();
|
111
|
+
return false;
|
321
112
|
});
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
113
|
+
}
|
114
|
+
if(_pagerLinks.length) {
|
115
|
+
_pagerLinks.each(function(_ind){
|
116
|
+
jQuery(this).bind(_controlEvent,function(){
|
117
|
+
if(_currentIndex != _ind) {
|
118
|
+
_prevIndex = _currentIndex;
|
119
|
+
_currentIndex = _ind;
|
120
|
+
switchSlide();
|
121
|
+
}
|
122
|
+
return false;
|
123
|
+
});
|
326
124
|
});
|
125
|
+
}
|
327
126
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
},option.autoHeightSpeed);
|
336
|
-
}
|
337
|
-
|
338
|
-
// checks if image is loaded
|
339
|
-
if (option.preload && control.find('img:eq(' + start + ')').length) {
|
340
|
-
// adds preload image
|
341
|
-
$('.' + option.container, elem).css({
|
342
|
-
background: 'url(' + option.preloadImage + ') no-repeat 50% 50%'
|
343
|
-
});
|
344
|
-
|
345
|
-
// gets image src, with cache buster
|
346
|
-
var img = control.find('img:eq(' + start + ')').attr('src') + '?' + (new Date()).getTime();
|
347
|
-
|
348
|
-
// check if the image has a parent
|
349
|
-
if ($('img', elem).parent().attr('class') != 'slides_control') {
|
350
|
-
// If image has parent, get tag name
|
351
|
-
imageParent = control.children(':eq(0)')[0].tagName.toLowerCase();
|
127
|
+
// play pause section
|
128
|
+
if(_btnPlayPause.length) {
|
129
|
+
_btnPlayPause.bind(_controlEvent,function(){
|
130
|
+
if(_this.hasClass(_pausedClass)) {
|
131
|
+
_this.removeClass(_pausedClass).addClass(_playClass);
|
132
|
+
_autoRotation = true;
|
133
|
+
autoSlide();
|
352
134
|
} else {
|
353
|
-
|
354
|
-
|
135
|
+
_autoRotation = false;
|
136
|
+
if(_timer) clearTimeout(_timer);
|
137
|
+
_this.removeClass(_playClass).addClass(_pausedClass);
|
355
138
|
}
|
356
|
-
|
357
|
-
// checks if image is loaded
|
358
|
-
control.find('img:eq(' + start + ')').attr('src', img).load(function() {
|
359
|
-
// once image is fully loaded, fade in
|
360
|
-
control.find(imageParent + ':eq(' + start + ')').fadeIn(option.fadeSpeed, option.fadeEasing, function(){
|
361
|
-
$(this).css({
|
362
|
-
zIndex: 0
|
363
|
-
});
|
364
|
-
// removes preload image
|
365
|
-
$('.' + option.container, elem).css({
|
366
|
-
background: ''
|
367
|
-
});
|
368
|
-
// let the script know everything is loaded
|
369
|
-
loaded = true;
|
370
|
-
// call the loaded funciton
|
371
|
-
option.slidesLoaded();
|
372
|
-
});
|
373
|
-
});
|
374
|
-
} else {
|
375
|
-
// if no preloader fade in start slide
|
376
|
-
control.children(':eq(' + start + ')').fadeIn(option.fadeSpeed, option.fadeEasing, function(){
|
377
|
-
// let the script know everything is loaded
|
378
|
-
loaded = true;
|
379
|
-
// call the loaded funciton
|
380
|
-
option.slidesLoaded();
|
381
|
-
});
|
382
|
-
}
|
383
|
-
|
384
|
-
// click slide for next
|
385
|
-
if (option.bigTarget) {
|
386
|
-
// set cursor to pointer
|
387
|
-
control.children().css({
|
388
|
-
cursor: 'pointer'
|
389
|
-
});
|
390
|
-
// click handler
|
391
|
-
control.children().click(function(){
|
392
|
-
// animate to next on slide click
|
393
|
-
animate('next', effect);
|
394
|
-
return false;
|
395
|
-
});
|
396
|
-
}
|
397
|
-
|
398
|
-
// pause on mouseover
|
399
|
-
if (option.hoverPause && option.play) {
|
400
|
-
control.bind('mouseover',function(){
|
401
|
-
// on mouse over stop
|
402
|
-
stop();
|
403
|
-
});
|
404
|
-
control.bind('mouseleave',function(){
|
405
|
-
// on mouse leave start pause timeout
|
406
|
-
pause();
|
407
|
-
});
|
408
|
-
}
|
409
|
-
|
410
|
-
// generate next/prev buttons
|
411
|
-
if (option.generateNextPrev) {
|
412
|
-
$('.' + option.container, elem).after('<a href="#" class="'+ option.prev +'">Prev</a>');
|
413
|
-
$('.' + option.prev, elem).after('<a href="#" class="'+ option.next +'">Next</a>');
|
414
|
-
}
|
415
|
-
|
416
|
-
// next button
|
417
|
-
$('.' + option.next ,elem).click(function(e){
|
418
|
-
e.preventDefault();
|
419
|
-
if (option.play) {
|
420
|
-
pause();
|
421
|
-
}
|
422
|
-
animate('next', effect);
|
139
|
+
return false;
|
423
140
|
});
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
animate('prev', effect);
|
141
|
+
}
|
142
|
+
if(_btnPlay.length) {
|
143
|
+
_btnPlay.bind(_controlEvent,function(){
|
144
|
+
_this.removeClass(_pausedClass).addClass(_playClass);
|
145
|
+
_autoRotation = true;
|
146
|
+
autoSlide();
|
147
|
+
return false;
|
432
148
|
});
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
if (
|
438
|
-
|
439
|
-
} else {
|
440
|
-
elem.append('<ul class='+ option.paginationClass +'></ul>');
|
441
|
-
}
|
442
|
-
// for each slide create a list item and link
|
443
|
-
control.children().each(function(){
|
444
|
-
$('.' + option.paginationClass, elem).append('<li><a href="#'+ number +'">'+ (number+1) +'</a></li>');
|
445
|
-
number++;
|
446
|
-
});
|
447
|
-
} else {
|
448
|
-
// if pagination exists, add href w/ value of item number to links
|
449
|
-
$('.' + option.paginationClass + ' li a', elem).each(function(){
|
450
|
-
$(this).attr('href', '#' + number);
|
451
|
-
number++;
|
452
|
-
});
|
453
|
-
}
|
454
|
-
|
455
|
-
// add current class to start slide pagination
|
456
|
-
$('.' + option.paginationClass + ' li:eq('+ start +')', elem).addClass(option.currentClass);
|
457
|
-
|
458
|
-
// click handling
|
459
|
-
$('.' + option.paginationClass + ' li a', elem ).click(function(){
|
460
|
-
// pause slideshow
|
461
|
-
if (option.play) {
|
462
|
-
pause();
|
463
|
-
}
|
464
|
-
// get clicked, pass to animate function
|
465
|
-
clicked = $(this).attr('href').match('[^#/]+$');
|
466
|
-
// if current slide equals clicked, don't do anything
|
467
|
-
if (current != clicked) {
|
468
|
-
animate('pagination', paginationEffect, clicked);
|
469
|
-
}
|
149
|
+
}
|
150
|
+
if(_btnPause.length) {
|
151
|
+
_btnPause.bind(_controlEvent,function(){
|
152
|
+
_autoRotation = false;
|
153
|
+
if(_timer) clearTimeout(_timer);
|
154
|
+
_this.removeClass(_playClass).addClass(_pausedClass);
|
470
155
|
return false;
|
471
156
|
});
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
157
|
+
}
|
158
|
+
// gallery animation
|
159
|
+
function prevSlide() {
|
160
|
+
_prevIndex = _currentIndex;
|
161
|
+
if(_currentIndex > 0) _currentIndex--;
|
162
|
+
else {
|
163
|
+
if(_noCycle) return;
|
164
|
+
else _currentIndex = _slideCount-1;
|
165
|
+
}
|
166
|
+
switchSlide();
|
167
|
+
}
|
168
|
+
function nextSlide() {
|
169
|
+
_prevIndex = _currentIndex;
|
170
|
+
if(_currentIndex < _slideCount-1) _currentIndex++;
|
171
|
+
else {
|
172
|
+
if(_noCycle) return;
|
173
|
+
else _currentIndex = 0;
|
174
|
+
}
|
175
|
+
switchSlide();
|
176
|
+
}
|
177
|
+
function refreshStatus() {
|
178
|
+
if(_pagerLinks.length) _pagerLinks.removeClass(_activeClass).eq(_currentIndex).addClass(_activeClass);
|
179
|
+
if(_currentNum) _currentNum.text(_currentIndex+1);
|
180
|
+
if(_allNum) _allNum.text(_slideCount);
|
181
|
+
_slides.eq(_prevIndex).removeClass(_activeClass);
|
182
|
+
_slides.eq(_currentIndex).addClass(_activeClass);
|
183
|
+
if(_noCycle) {
|
184
|
+
if(_btnPrev.length) {
|
185
|
+
if(_currentIndex == 0) _btnPrev.addClass(_disabledClass);
|
186
|
+
else _btnPrev.removeClass(_disabledClass);
|
478
187
|
}
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
if (current != clicked) {
|
483
|
-
animate('pagination', paginationEffect, clicked);
|
188
|
+
if(_btnNext.length) {
|
189
|
+
if(_currentIndex == _slideCount-1) _btnNext.addClass(_disabledClass);
|
190
|
+
else _btnNext.removeClass(_disabledClass);
|
484
191
|
}
|
485
|
-
return false;
|
486
|
-
});
|
487
|
-
|
488
|
-
if (option.play) {
|
489
|
-
// set interval
|
490
|
-
playInterval = setInterval(function() {
|
491
|
-
animate('next', effect);
|
492
|
-
}, option.play);
|
493
|
-
// store interval id
|
494
|
-
elem.data('interval',playInterval);
|
495
192
|
}
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
animationComplete: function(){}, // Function called at the completion of animation
|
528
|
-
slidesLoaded: function() {} // Function is called when slides is fully loaded
|
529
|
-
};
|
530
|
-
|
531
|
-
// Randomize slide order on load
|
532
|
-
$.fn.randomize = function(callback) {
|
533
|
-
function randomizeOrder() { return(Math.round(Math.random())-0.5); }
|
534
|
-
return($(this).each(function() {
|
535
|
-
var $this = $(this);
|
536
|
-
var $children = $this.children();
|
537
|
-
var childCount = $children.length;
|
538
|
-
if (childCount > 1) {
|
539
|
-
$children.hide();
|
540
|
-
var indices = [];
|
541
|
-
for (i=0;i<childCount;i++) { indices[indices.length] = i; }
|
542
|
-
indices = indices.sort(randomizeOrder);
|
543
|
-
$.each(indices,function(j,k) {
|
544
|
-
var $child = $children.eq(k);
|
545
|
-
var $clone = $child.clone(true);
|
546
|
-
$clone.show().appendTo($this);
|
547
|
-
if (callback !== undefined) {
|
548
|
-
callback($child, $clone);
|
549
|
-
}
|
550
|
-
$child.remove();
|
193
|
+
if(typeof _onChange === 'function') {
|
194
|
+
_onChange(_this, _currentIndex);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
function switchSlide() {
|
198
|
+
_slides.eq(_prevIndex).stop().animate({opacity:0},{duration: _duration, queue: false,complete:function(){
|
199
|
+
jQuery(this).css({display:'none'});
|
200
|
+
}})
|
201
|
+
_slides.eq(_currentIndex).stop().css({display:'block',opacity:0}).animate({opacity:1},{duration: _duration, queue: false,complete:function(){
|
202
|
+
jQuery(this).css({opacity:''});
|
203
|
+
}})
|
204
|
+
_caption.eq(_prevIndex).fadeOut();
|
205
|
+
_caption.eq(_currentIndex).fadeIn();
|
206
|
+
if(_autoHeight) _slides.eq(_currentIndex).parent().animate({height:_slides.eq(_currentIndex).outerHeight(true)},{duration:_duration,queue:false});
|
207
|
+
refreshStatus();
|
208
|
+
autoSlide();
|
209
|
+
}
|
210
|
+
|
211
|
+
// autoslide function
|
212
|
+
function autoSlide() {
|
213
|
+
if(!_autoRotation || _hover) return;
|
214
|
+
if(_timer) clearTimeout(_timer);
|
215
|
+
_timer = setTimeout(nextSlide,_switchTime+_duration);
|
216
|
+
}
|
217
|
+
if(_pauseOnHover) {
|
218
|
+
_this.hover(function(){
|
219
|
+
_hover = true;
|
220
|
+
if(_timer) clearTimeout(_timer);
|
221
|
+
},function(){
|
222
|
+
_hover = false;
|
223
|
+
autoSlide();
|
551
224
|
});
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
})
|
225
|
+
}
|
226
|
+
refreshStatus();
|
227
|
+
autoSlide();
|
228
|
+
});
|
229
|
+
};
|