1
|
(function ($) {
|
2
|
Drupal.viewsSlideshow = Drupal.viewsSlideshow || {};
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
Drupal.viewsSlideshowControls = Drupal.viewsSlideshowControls || {};
|
8
|
|
9
|
|
10
|
|
11
|
|
12
|
Drupal.viewsSlideshowControls.play = function (options) {
|
13
|
|
14
|
|
15
|
|
16
|
try {
|
17
|
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play == 'function') {
|
18
|
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play(options);
|
19
|
}
|
20
|
}
|
21
|
catch(err) {
|
22
|
|
23
|
}
|
24
|
|
25
|
try {
|
26
|
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play == 'function') {
|
27
|
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play(options);
|
28
|
}
|
29
|
}
|
30
|
catch(err) {
|
31
|
|
32
|
}
|
33
|
};
|
34
|
|
35
|
|
36
|
|
37
|
|
38
|
Drupal.viewsSlideshowControls.pause = function (options) {
|
39
|
|
40
|
|
41
|
|
42
|
try {
|
43
|
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause == 'function') {
|
44
|
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause(options);
|
45
|
}
|
46
|
}
|
47
|
catch(err) {
|
48
|
|
49
|
}
|
50
|
|
51
|
try {
|
52
|
if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause == 'function') {
|
53
|
Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause(options);
|
54
|
}
|
55
|
}
|
56
|
catch(err) {
|
57
|
|
58
|
}
|
59
|
};
|
60
|
|
61
|
|
62
|
|
63
|
|
64
|
|
65
|
|
66
|
|
67
|
Drupal.behaviors.viewsSlideshowControlsText = {
|
68
|
attach: function (context) {
|
69
|
|
70
|
|
71
|
$('.views_slideshow_controls_text_previous:not(.views-slideshow-controls-text-previous-processed)', context).addClass('views-slideshow-controls-text-previous-processed').each(function() {
|
72
|
var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_previous_', '');
|
73
|
$(this).click(function() {
|
74
|
Drupal.viewsSlideshow.action({ "action": 'previousSlide', "slideshowID": uniqueID });
|
75
|
return false;
|
76
|
});
|
77
|
});
|
78
|
|
79
|
|
80
|
$('.views_slideshow_controls_text_next:not(.views-slideshow-controls-text-next-processed)', context).addClass('views-slideshow-controls-text-next-processed').each(function() {
|
81
|
var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_next_', '');
|
82
|
$(this).click(function() {
|
83
|
Drupal.viewsSlideshow.action({ "action": 'nextSlide', "slideshowID": uniqueID });
|
84
|
return false;
|
85
|
});
|
86
|
});
|
87
|
|
88
|
|
89
|
$('.views_slideshow_controls_text_pause:not(.views-slideshow-controls-text-pause-processed)', context).addClass('views-slideshow-controls-text-pause-processed').each(function() {
|
90
|
var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', '');
|
91
|
$(this).click(function() {
|
92
|
if (Drupal.settings.viewsSlideshow[uniqueID].paused) {
|
93
|
Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID, "force": true });
|
94
|
}
|
95
|
else {
|
96
|
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID, "force": true });
|
97
|
}
|
98
|
return false;
|
99
|
});
|
100
|
});
|
101
|
}
|
102
|
};
|
103
|
|
104
|
Drupal.viewsSlideshowControlsText = Drupal.viewsSlideshowControlsText || {};
|
105
|
|
106
|
|
107
|
|
108
|
|
109
|
Drupal.viewsSlideshowControlsText.pause = function (options) {
|
110
|
var pauseText = Drupal.theme.prototype['viewsSlideshowControlsPause'] ? Drupal.theme('viewsSlideshowControlsPause') : '';
|
111
|
$('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(pauseText);
|
112
|
$('#views_slideshow_controls_text_pause_' + options.slideshowID).removeClass('views-slideshow-controls-text-status-play');
|
113
|
$('#views_slideshow_controls_text_pause_' + options.slideshowID).addClass('views-slideshow-controls-text-status-pause');
|
114
|
};
|
115
|
|
116
|
|
117
|
|
118
|
|
119
|
Drupal.viewsSlideshowControlsText.play = function (options) {
|
120
|
var playText = Drupal.theme.prototype['viewsSlideshowControlsPlay'] ? Drupal.theme('viewsSlideshowControlsPlay') : '';
|
121
|
$('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(playText);
|
122
|
$('#views_slideshow_controls_text_pause_' + options.slideshowID).removeClass('views-slideshow-controls-text-status-pause');
|
123
|
$('#views_slideshow_controls_text_pause_' + options.slideshowID).addClass('views-slideshow-controls-text-status-play');
|
124
|
};
|
125
|
|
126
|
|
127
|
Drupal.theme.prototype.viewsSlideshowControlsPause = function () {
|
128
|
return Drupal.t('Resume');
|
129
|
};
|
130
|
|
131
|
|
132
|
Drupal.theme.prototype.viewsSlideshowControlsPlay = function () {
|
133
|
return Drupal.t('Pause');
|
134
|
};
|
135
|
|
136
|
|
137
|
|
138
|
|
139
|
Drupal.viewsSlideshowPager = Drupal.viewsSlideshowPager || {};
|
140
|
|
141
|
|
142
|
|
143
|
|
144
|
Drupal.viewsSlideshowPager.transitionBegin = function (options) {
|
145
|
|
146
|
|
147
|
|
148
|
try {
|
149
|
if (typeof Drupal.settings.viewsSlideshowPager != "undefined" && typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin == 'function') {
|
150
|
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin(options);
|
151
|
if (Drupal.settings.viewsSlideshowPager[options.slideshowID].top.master_pager) {
|
152
|
$.each(Drupal.settings.viewsSlideshow, function(i, obj) {
|
153
|
if (i != options.slideshowID) {
|
154
|
options.slideshowID = i;
|
155
|
options.action = 'goToSlide';
|
156
|
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options);
|
157
|
}
|
158
|
});
|
159
|
}
|
160
|
}
|
161
|
}
|
162
|
catch(err) {
|
163
|
|
164
|
}
|
165
|
|
166
|
try {
|
167
|
if (typeof Drupal.settings.viewsSlideshowPager != "undefined" && typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin == 'function') {
|
168
|
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin(options);
|
169
|
if (Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.master_pager) {
|
170
|
$.each(Drupal.settings.viewsSlideshow, function(i, obj) {
|
171
|
if (i != options.slideshowID) {
|
172
|
options.slideshowID = i;
|
173
|
options.action = 'goToSlide';
|
174
|
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options);
|
175
|
}
|
176
|
});
|
177
|
}
|
178
|
}
|
179
|
}
|
180
|
catch(err) {
|
181
|
|
182
|
}
|
183
|
};
|
184
|
|
185
|
|
186
|
|
187
|
|
188
|
Drupal.viewsSlideshowPager.goToSlide = function (options) {
|
189
|
|
190
|
|
191
|
|
192
|
try {
|
193
|
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide == 'function') {
|
194
|
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options);
|
195
|
}
|
196
|
}
|
197
|
catch(err) {
|
198
|
|
199
|
}
|
200
|
|
201
|
try {
|
202
|
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide == 'function') {
|
203
|
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options);
|
204
|
}
|
205
|
}
|
206
|
catch(err) {
|
207
|
|
208
|
}
|
209
|
};
|
210
|
|
211
|
|
212
|
|
213
|
|
214
|
Drupal.viewsSlideshowPager.previousSlide = function (options) {
|
215
|
|
216
|
|
217
|
|
218
|
try {
|
219
|
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide == 'function') {
|
220
|
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide(options);
|
221
|
}
|
222
|
}
|
223
|
catch(err) {
|
224
|
|
225
|
}
|
226
|
|
227
|
try {
|
228
|
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide == 'function') {
|
229
|
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide(options);
|
230
|
}
|
231
|
}
|
232
|
catch(err) {
|
233
|
|
234
|
}
|
235
|
};
|
236
|
|
237
|
|
238
|
|
239
|
|
240
|
Drupal.viewsSlideshowPager.nextSlide = function (options) {
|
241
|
|
242
|
|
243
|
|
244
|
try {
|
245
|
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide == 'function') {
|
246
|
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide(options);
|
247
|
}
|
248
|
}
|
249
|
catch(err) {
|
250
|
|
251
|
}
|
252
|
|
253
|
try {
|
254
|
if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide == 'function') {
|
255
|
Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide(options);
|
256
|
}
|
257
|
}
|
258
|
catch(err) {
|
259
|
|
260
|
}
|
261
|
};
|
262
|
|
263
|
|
264
|
|
265
|
|
266
|
|
267
|
|
268
|
|
269
|
Drupal.behaviors.viewsSlideshowPagerFields = {
|
270
|
attach: function (context) {
|
271
|
|
272
|
$('.views_slideshow_pager_field:not(.views-slideshow-pager-field-processed)', context).addClass('views-slideshow-pager-field-processed').each(function() {
|
273
|
|
274
|
var pagerInfo = $(this).attr('id').split('_');
|
275
|
var location = pagerInfo[2];
|
276
|
pagerInfo.splice(0, 3);
|
277
|
var uniqueID = pagerInfo.join('_');
|
278
|
|
279
|
|
280
|
if (Drupal.settings.viewsSlideshowPagerFields[uniqueID][location].activatePauseOnHover) {
|
281
|
$(this).children().each(function(index, pagerItem) {
|
282
|
var mouseIn = function() {
|
283
|
Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index });
|
284
|
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID });
|
285
|
};
|
286
|
|
287
|
var mouseOut = function() {
|
288
|
Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID });
|
289
|
};
|
290
|
|
291
|
if (jQuery.fn.hoverIntent) {
|
292
|
$(pagerItem).hoverIntent(mouseIn, mouseOut);
|
293
|
}
|
294
|
else {
|
295
|
$(pagerItem).hover(mouseIn, mouseOut);
|
296
|
}
|
297
|
});
|
298
|
}
|
299
|
else {
|
300
|
$(this).children().each(function(index, pagerItem) {
|
301
|
$(pagerItem).click(function() {
|
302
|
Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index });
|
303
|
});
|
304
|
});
|
305
|
}
|
306
|
});
|
307
|
}
|
308
|
};
|
309
|
|
310
|
Drupal.viewsSlideshowPagerFields = Drupal.viewsSlideshowPagerFields || {};
|
311
|
|
312
|
|
313
|
|
314
|
|
315
|
Drupal.viewsSlideshowPagerFields.transitionBegin = function (options) {
|
316
|
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
|
317
|
|
318
|
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
|
319
|
|
320
|
|
321
|
$('#views_slideshow_pager_field_item_'+ pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active');
|
322
|
}
|
323
|
};
|
324
|
|
325
|
|
326
|
|
327
|
|
328
|
Drupal.viewsSlideshowPagerFields.goToSlide = function (options) {
|
329
|
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
|
330
|
|
331
|
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
|
332
|
|
333
|
|
334
|
$('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active');
|
335
|
}
|
336
|
};
|
337
|
|
338
|
|
339
|
|
340
|
|
341
|
Drupal.viewsSlideshowPagerFields.previousSlide = function (options) {
|
342
|
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
|
343
|
|
344
|
var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', '');
|
345
|
|
346
|
|
347
|
|
348
|
if (pagerNum == 0) {
|
349
|
pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length() - 1;
|
350
|
}
|
351
|
else {
|
352
|
pagerNum--;
|
353
|
}
|
354
|
|
355
|
|
356
|
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
|
357
|
|
358
|
|
359
|
$('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + pagerNum).addClass('active');
|
360
|
}
|
361
|
};
|
362
|
|
363
|
|
364
|
|
365
|
|
366
|
Drupal.viewsSlideshowPagerFields.nextSlide = function (options) {
|
367
|
for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) {
|
368
|
|
369
|
var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', '');
|
370
|
var totalPagers = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length();
|
371
|
|
372
|
|
373
|
|
374
|
pagerNum++;
|
375
|
if (pagerNum == totalPagers) {
|
376
|
pagerNum = 0;
|
377
|
}
|
378
|
|
379
|
|
380
|
$('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active');
|
381
|
|
382
|
|
383
|
$('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + slideNum).addClass('active');
|
384
|
}
|
385
|
};
|
386
|
|
387
|
|
388
|
|
389
|
|
390
|
|
391
|
|
392
|
Drupal.viewsSlideshowSlideCounter = Drupal.viewsSlideshowSlideCounter || {};
|
393
|
|
394
|
|
395
|
|
396
|
|
397
|
Drupal.viewsSlideshowSlideCounter.transitionBegin = function (options) {
|
398
|
$('#views_slideshow_slide_counter_' + options.slideshowID + ' .num').text(options.slideNum + 1);
|
399
|
};
|
400
|
|
401
|
|
402
|
|
403
|
|
404
|
Drupal.viewsSlideshow.action = function (options) {
|
405
|
|
406
|
var status = {
|
407
|
'value': true,
|
408
|
'text': ''
|
409
|
};
|
410
|
|
411
|
|
412
|
if (typeof options.action == 'undefined' || options.action == '') {
|
413
|
status.value = false;
|
414
|
status.text = Drupal.t('There was no action specified.');
|
415
|
return error;
|
416
|
}
|
417
|
|
418
|
|
419
|
if (options.action == 'pause') {
|
420
|
Drupal.settings.viewsSlideshow[options.slideshowID].paused = 1;
|
421
|
|
422
|
if (options.force) {
|
423
|
Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 1;
|
424
|
}
|
425
|
}
|
426
|
else if (options.action == 'play') {
|
427
|
|
428
|
|
429
|
|
430
|
if (!Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce || options.force) {
|
431
|
Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0;
|
432
|
Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 0;
|
433
|
}
|
434
|
else {
|
435
|
status.value = false;
|
436
|
status.text += ' ' + Drupal.t('This slideshow is forced paused.');
|
437
|
return status;
|
438
|
}
|
439
|
}
|
440
|
|
441
|
|
442
|
|
443
|
switch (options.action) {
|
444
|
case "goToSlide":
|
445
|
case "transitionBegin":
|
446
|
case "transitionEnd":
|
447
|
|
448
|
|
449
|
if (typeof options.slideNum == 'undefined' || typeof options.slideNum !== 'number' || parseInt(options.slideNum) != (options.slideNum - 0)) {
|
450
|
status.value = false;
|
451
|
status.text = Drupal.t('An invalid integer was specified for slideNum.');
|
452
|
}
|
453
|
case "pause":
|
454
|
case "play":
|
455
|
case "nextSlide":
|
456
|
case "previousSlide":
|
457
|
|
458
|
var methods = Drupal.settings.viewsSlideshow[options.slideshowID]['methods'];
|
459
|
|
460
|
|
461
|
|
462
|
var excludeMethodsObj = {};
|
463
|
if (typeof options.excludeMethods !== 'undefined') {
|
464
|
|
465
|
|
466
|
for (var i=0; i < excludeMethods.length; i++) {
|
467
|
excludeMethodsObj[excludeMethods[i]] = '';
|
468
|
}
|
469
|
}
|
470
|
|
471
|
|
472
|
for (i = 0; i < methods[options.action].length; i++) {
|
473
|
if (Drupal[methods[options.action][i]] != undefined && typeof Drupal[methods[options.action][i]][options.action] == 'function' && !(methods[options.action][i] in excludeMethodsObj)) {
|
474
|
Drupal[methods[options.action][i]][options.action](options);
|
475
|
}
|
476
|
}
|
477
|
break;
|
478
|
|
479
|
|
480
|
default:
|
481
|
status.value = false;
|
482
|
status.text = Drupal.t('An invalid action "!action" was specified.', { "!action": options.action });
|
483
|
}
|
484
|
return status;
|
485
|
};
|
486
|
})(jQuery);
|