1 |
85ad3d82
|
Assos Assos
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
(function ($) {
|
10 |
|
|
Drupal.behaviors.viewsSlideshowCycle = {
|
11 |
|
|
attach: function (context) {
|
12 |
|
|
$('.views_slideshow_cycle_main:not(.viewsSlideshowCycle-processed)', context).addClass('viewsSlideshowCycle-processed').each(function() {
|
13 |
|
|
var fullId = '#' + $(this).attr('id');
|
14 |
|
|
var settings = Drupal.settings.viewsSlideshowCycle[fullId];
|
15 |
|
|
settings.targetId = '#' + $(fullId + " :first").attr('id');
|
16 |
|
|
|
17 |
|
|
settings.slideshowId = settings.targetId.replace('#views_slideshow_cycle_teaser_section_', '');
|
18 |
|
|
|
19 |
|
|
var pager_after_fn = function(curr, next, opts) {
|
20 |
|
|
|
21 |
|
|
var slideNum = opts.currSlide;
|
22 |
|
|
if (typeof settings.processedAfter == 'undefined' || !settings.processedAfter) {
|
23 |
|
|
settings.processedAfter = 1;
|
24 |
|
|
slideNum = (typeof settings.opts.startingSlide == 'undefined') ? 0 : settings.opts.startingSlide;
|
25 |
|
|
}
|
26 |
7547bb19
|
Assos Assos
|
if (settings.pause_after_slideshow) {
|
27 |
|
|
opts.counter += 1;
|
28 |
|
|
if (opts.counter == settings.num_divs + 1) {
|
29 |
|
|
opts.counter = 1;
|
30 |
|
|
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true });
|
31 |
|
|
}
|
32 |
|
|
}
|
33 |
85ad3d82
|
Assos Assos
|
Drupal.viewsSlideshow.action({ "action": 'transitionEnd', "slideshowID": settings.slideshowId, "slideNum": slideNum });
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
var pager_before_fn = function(curr, next, opts) {
|
37 |
7547bb19
|
Assos Assos
|
$(document).trigger('drupal:views_slideshow_cycle:before', {
|
38 |
|
|
curr: curr, next: next, opts: opts, settings: settings
|
39 |
|
|
});
|
40 |
|
|
|
41 |
85ad3d82
|
Assos Assos
|
var slideNum = opts.nextSlide;
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
if (settings.remember_slide) {
|
45 |
|
|
createCookie(settings.vss_id, slideNum, settings.remember_slide_days);
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
if (!settings.fixed_height) {
|
50 |
|
|
|
51 |
|
|
var $ht = $(next).height();
|
52 |
|
|
|
53 |
|
|
$(next).parent().animate({height: $ht});
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
if (typeof settings.processedBefore == 'undefined' || !settings.processedBefore) {
|
58 |
|
|
settings.processedBefore = 1;
|
59 |
|
|
slideNum = (typeof opts.startingSlide == 'undefined') ? 0 : opts.startingSlide;
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
Drupal.viewsSlideshow.action({ "action": 'transitionBegin', "slideshowID": settings.slideshowId, "slideNum": slideNum });
|
63 |
|
|
}
|
64 |
|
|
settings.loaded = false;
|
65 |
|
|
|
66 |
|
|
settings.opts = {
|
67 |
|
|
speed:settings.speed,
|
68 |
|
|
timeout:settings.timeout,
|
69 |
|
|
delay:settings.delay,
|
70 |
|
|
sync:settings.sync,
|
71 |
|
|
random:settings.random,
|
72 |
|
|
nowrap:settings.nowrap,
|
73 |
7547bb19
|
Assos Assos
|
pause_after_slideshow:settings.pause_after_slideshow,
|
74 |
|
|
counter:0,
|
75 |
85ad3d82
|
Assos Assos
|
after:pager_after_fn,
|
76 |
|
|
before:pager_before_fn,
|
77 |
|
|
cleartype:(settings.cleartype)? true : false,
|
78 |
|
|
cleartypeNoBg:(settings.cleartypenobg)? true : false
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
if (settings.remember_slide) {
|
83 |
|
|
var startSlide = readCookie(settings.vss_id);
|
84 |
|
|
if (startSlide == null) {
|
85 |
|
|
startSlide = 0;
|
86 |
|
|
}
|
87 |
|
|
settings.opts.startingSlide = parseInt(startSlide);
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
if (settings.effect == 'none') {
|
91 |
|
|
settings.opts.speed = 1;
|
92 |
|
|
}
|
93 |
|
|
else {
|
94 |
|
|
settings.opts.fx = settings.effect;
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
var hash = location.hash;
|
99 |
|
|
if (hash) {
|
100 |
|
|
var hash = hash.replace('#', '');
|
101 |
|
|
var aHash = hash.split(';');
|
102 |
|
|
var aHashLen = aHash.length;
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
for (var i = 0; i < aHashLen; i++) {
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
var initialInfo = aHash[i].split(':');
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
if (settings.slideshowId == initialInfo[0] && settings.num_divs > initialInfo[1]) {
|
113 |
|
|
settings.opts.startingSlide = parseInt(initialInfo[1]);
|
114 |
|
|
}
|
115 |
|
|
}
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
if (settings.pause) {
|
120 |
|
|
var mouseIn = function() {
|
121 |
|
|
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId });
|
122 |
|
|
}
|
123 |
|
|
|
124 |
|
|
var mouseOut = function() {
|
125 |
|
|
Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId });
|
126 |
|
|
}
|
127 |
|
|
|
128 |
|
|
if (jQuery.fn.hoverIntent) {
|
129 |
|
|
$('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hoverIntent(mouseIn, mouseOut);
|
130 |
|
|
}
|
131 |
|
|
else {
|
132 |
|
|
$('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hover(mouseIn, mouseOut);
|
133 |
|
|
}
|
134 |
|
|
}
|
135 |
7547bb19
|
Assos Assos
|
|
136 |
99781f3b
|
Assos Assos
|
|
137 |
|
|
if (settings.play_on_hover) {
|
138 |
|
|
var mouseIn = function() {
|
139 |
|
|
Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId, "force": true });
|
140 |
|
|
}
|
141 |
|
|
|
142 |
|
|
var mouseOut = function() {
|
143 |
|
|
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId });
|
144 |
|
|
}
|
145 |
|
|
|
146 |
|
|
if (jQuery.fn.hoverIntent) {
|
147 |
|
|
$('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hoverIntent(mouseIn, mouseOut);
|
148 |
|
|
}
|
149 |
|
|
else {
|
150 |
|
|
$('#views_slideshow_cycle_teaser_section_' + settings.vss_id).hover(mouseIn, mouseOut);
|
151 |
|
|
}
|
152 |
|
|
}
|
153 |
85ad3d82
|
Assos Assos
|
|
154 |
|
|
|
155 |
|
|
if (settings.pause_on_click) {
|
156 |
|
|
$('#views_slideshow_cycle_teaser_section_' + settings.vss_id).click(function() {
|
157 |
|
|
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true });
|
158 |
|
|
});
|
159 |
|
|
}
|
160 |
|
|
|
161 |
|
|
if (typeof JSON != 'undefined') {
|
162 |
|
|
var advancedOptions = JSON.parse(settings.advanced_options);
|
163 |
|
|
for (var option in advancedOptions) {
|
164 |
|
|
switch(option) {
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
case "activePagerClass":
|
168 |
|
|
case "allowPagerClickBubble":
|
169 |
|
|
case "autostop":
|
170 |
|
|
case "autostopCount":
|
171 |
|
|
case "backwards":
|
172 |
|
|
case "bounce":
|
173 |
|
|
case "cleartype":
|
174 |
|
|
case "cleartypeNoBg":
|
175 |
|
|
case "containerResize":
|
176 |
|
|
case "continuous":
|
177 |
|
|
case "delay":
|
178 |
|
|
case "easeIn":
|
179 |
|
|
case "easeOut":
|
180 |
|
|
case "easing":
|
181 |
|
|
case "fastOnEvent":
|
182 |
|
|
case "fit":
|
183 |
|
|
case "fx":
|
184 |
|
|
case "manualTrump":
|
185 |
|
|
case "metaAttr":
|
186 |
|
|
case "next":
|
187 |
|
|
case "nowrap":
|
188 |
|
|
case "pager":
|
189 |
|
|
case "pagerEvent":
|
190 |
|
|
case "pause":
|
191 |
|
|
case "pauseOnPagerHover":
|
192 |
|
|
case "prev":
|
193 |
|
|
case "prevNextEvent":
|
194 |
|
|
case "random":
|
195 |
|
|
case "randomizeEffects":
|
196 |
|
|
case "requeueOnImageNotLoaded":
|
197 |
|
|
case "requeueTimeout":
|
198 |
|
|
case "rev":
|
199 |
|
|
case "slideExpr":
|
200 |
|
|
case "slideResize":
|
201 |
|
|
case "speed":
|
202 |
|
|
case "speedIn":
|
203 |
|
|
case "speedOut":
|
204 |
|
|
case "startingSlide":
|
205 |
|
|
case "sync":
|
206 |
|
|
case "timeout":
|
207 |
|
|
var optionValue = advancedOptions[option];
|
208 |
|
|
optionValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(optionValue);
|
209 |
|
|
settings.opts[option] = optionValue;
|
210 |
|
|
break;
|
211 |
|
|
|
212 |
2181db6c
|
Assos Assos
|
|
213 |
|
|
case "width":
|
214 |
|
|
var optionValue = advancedOptions["width"];
|
215 |
|
|
optionValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(optionValue);
|
216 |
|
|
settings.opts["width"] = optionValue;
|
217 |
|
|
settings.opts["containerResize"] = 0;
|
218 |
|
|
break;
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
case "height":
|
222 |
|
|
var optionValue = advancedOptions["height"];
|
223 |
|
|
optionValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(optionValue);
|
224 |
|
|
settings.opts["height"] = optionValue;
|
225 |
|
|
settings.fixed_height = 1;
|
226 |
|
|
break;
|
227 |
|
|
|
228 |
85ad3d82
|
Assos Assos
|
|
229 |
|
|
case "animIn":
|
230 |
99781f3b
|
Assos Assos
|
case "animInDelay":
|
231 |
85ad3d82
|
Assos Assos
|
case "animOut":
|
232 |
99781f3b
|
Assos Assos
|
case "animOutDelay":
|
233 |
85ad3d82
|
Assos Assos
|
case "cssBefore":
|
234 |
|
|
case "cssAfter":
|
235 |
|
|
case "shuffle":
|
236 |
|
|
var cssValue = advancedOptions[option];
|
237 |
|
|
cssValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(cssValue);
|
238 |
|
|
settings.opts[option] = eval('(' + cssValue + ')');
|
239 |
|
|
break;
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
case "after":
|
243 |
|
|
var afterValue = advancedOptions[option];
|
244 |
|
|
afterValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(afterValue);
|
245 |
|
|
|
246 |
|
|
settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
|
247 |
|
|
pager_after_fn(currSlideElement, nextSlideElement, options);
|
248 |
|
|
eval(afterValue);
|
249 |
|
|
}
|
250 |
|
|
break;
|
251 |
|
|
|
252 |
|
|
case "before":
|
253 |
|
|
var beforeValue = advancedOptions[option];
|
254 |
|
|
beforeValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(beforeValue);
|
255 |
|
|
|
256 |
|
|
settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
|
257 |
|
|
pager_before_fn(currSlideElement, nextSlideElement, options);
|
258 |
|
|
eval(beforeValue);
|
259 |
|
|
}
|
260 |
|
|
break;
|
261 |
|
|
|
262 |
|
|
case "end":
|
263 |
|
|
var endValue = advancedOptions[option];
|
264 |
|
|
endValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(endValue);
|
265 |
|
|
|
266 |
|
|
settings.opts[option] = function(options) {
|
267 |
|
|
eval(endValue);
|
268 |
|
|
}
|
269 |
|
|
break;
|
270 |
|
|
|
271 |
|
|
case "fxFn":
|
272 |
|
|
var fxFnValue = advancedOptions[option];
|
273 |
|
|
fxFnValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(fxFnValue);
|
274 |
|
|
|
275 |
|
|
settings.opts[option] = function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag) {
|
276 |
|
|
eval(fxFnValue);
|
277 |
|
|
}
|
278 |
|
|
break;
|
279 |
|
|
|
280 |
|
|
case "onPagerEvent":
|
281 |
|
|
var onPagerEventValue = advancedOptions[option];
|
282 |
|
|
onPagerEventValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(onPagerEventValue);
|
283 |
|
|
settings.opts[option] = function(zeroBasedSlideIndex, slideElement) {
|
284 |
|
|
eval(onPagerEventValue);
|
285 |
|
|
}
|
286 |
|
|
break;
|
287 |
|
|
|
288 |
|
|
case "onPrevNextEvent":
|
289 |
|
|
var onPrevNextEventValue = advancedOptions[option];
|
290 |
|
|
onPrevNextEventValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(onPrevNextEventValue);
|
291 |
|
|
settings.opts[option] = function(isNext, zeroBasedSlideIndex, slideElement) {
|
292 |
|
|
eval(onPrevNextEventValue);
|
293 |
|
|
}
|
294 |
|
|
break;
|
295 |
|
|
|
296 |
|
|
case "pagerAnchorBuilder":
|
297 |
|
|
var pagerAnchorBuilderValue = advancedOptions[option];
|
298 |
|
|
pagerAnchorBuilderValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pagerAnchorBuilderValue);
|
299 |
|
|
|
300 |
|
|
settings.opts[option] = function(index, DOMelement) {
|
301 |
|
|
var returnVal = '';
|
302 |
|
|
eval(pagerAnchorBuilderValue);
|
303 |
|
|
return returnVal;
|
304 |
|
|
}
|
305 |
|
|
break;
|
306 |
|
|
|
307 |
|
|
case "pagerClick":
|
308 |
|
|
var pagerClickValue = advancedOptions[option];
|
309 |
|
|
pagerClickValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pagerClickValue);
|
310 |
|
|
|
311 |
|
|
settings.opts[option] = function(zeroBasedSlideIndex, slideElement) {
|
312 |
|
|
eval(pagerClickValue);
|
313 |
|
|
}
|
314 |
|
|
break;
|
315 |
|
|
|
316 |
|
|
case "paused":
|
317 |
|
|
var pausedValue = advancedOptions[option];
|
318 |
|
|
pausedValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(pausedValue);
|
319 |
|
|
|
320 |
|
|
settings.opts[option] = function(cont, opts, byHover) {
|
321 |
|
|
eval(pausedValue);
|
322 |
|
|
}
|
323 |
|
|
break;
|
324 |
|
|
|
325 |
|
|
case "resumed":
|
326 |
|
|
var resumedValue = advancedOptions[option];
|
327 |
|
|
resumedValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(resumedValue);
|
328 |
|
|
|
329 |
|
|
settings.opts[option] = function(cont, opts, byHover) {
|
330 |
|
|
eval(resumedValue);
|
331 |
|
|
}
|
332 |
|
|
break;
|
333 |
|
|
|
334 |
|
|
case "timeoutFn":
|
335 |
|
|
var timeoutFnValue = advancedOptions[option];
|
336 |
|
|
timeoutFnValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(timeoutFnValue);
|
337 |
|
|
settings.opts[option] = function(currSlideElement, nextSlideElement, options, forwardFlag) {
|
338 |
2181db6c
|
Assos Assos
|
|
339 |
|
|
var returnVal = settings.timeout;
|
340 |
85ad3d82
|
Assos Assos
|
eval(timeoutFnValue);
|
341 |
2181db6c
|
Assos Assos
|
return returnVal;
|
342 |
85ad3d82
|
Assos Assos
|
}
|
343 |
|
|
break;
|
344 |
|
|
|
345 |
|
|
case "updateActivePagerLink":
|
346 |
|
|
var updateActivePagerLinkValue = advancedOptions[option];
|
347 |
|
|
updateActivePagerLinkValue = Drupal.viewsSlideshowCycle.advancedOptionCleanup(updateActivePagerLinkValue);
|
348 |
|
|
|
349 |
|
|
settings.opts[option] = function(pager, currSlideIndex) {
|
350 |
|
|
eval(updateActivePagerLinkValue);
|
351 |
|
|
}
|
352 |
|
|
break;
|
353 |
|
|
}
|
354 |
|
|
}
|
355 |
|
|
}
|
356 |
|
|
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
if (settings.wait_for_image_load) {
|
360 |
|
|
|
361 |
|
|
|
362 |
|
|
settings.totalImages = $(settings.targetId + ' img').length;
|
363 |
|
|
if (settings.totalImages) {
|
364 |
|
|
settings.loadedImages = 0;
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
$(settings.targetId + ' img').each(function() {
|
368 |
|
|
var $imageElement = $(this);
|
369 |
|
|
$imageElement.bind('load', function () {
|
370 |
|
|
Drupal.viewsSlideshowCycle.imageWait(fullId);
|
371 |
|
|
});
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
var imgSrc = $imageElement.attr('src');
|
375 |
|
|
$imageElement.attr('src', '');
|
376 |
|
|
$imageElement.attr('src', imgSrc);
|
377 |
|
|
});
|
378 |
|
|
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
setTimeout("Drupal.viewsSlideshowCycle.load('" + fullId + "')", settings.wait_for_image_load_timeout);
|
382 |
|
|
}
|
383 |
|
|
else {
|
384 |
|
|
Drupal.viewsSlideshowCycle.load(fullId);
|
385 |
|
|
}
|
386 |
|
|
}
|
387 |
|
|
else {
|
388 |
|
|
Drupal.viewsSlideshowCycle.load(fullId);
|
389 |
|
|
}
|
390 |
|
|
});
|
391 |
|
|
}
|
392 |
|
|
};
|
393 |
|
|
|
394 |
7547bb19
|
Assos Assos
|
|
395 |
|
|
|
396 |
|
|
|
397 |
|
|
Drupal.behaviors.viewsSlideshowSwipe = {
|
398 |
|
|
attach: function (context) {
|
399 |
|
|
var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0));
|
400 |
|
|
if (isTouch === true && $('.views-slideshow-cycle-main-frame').length) {
|
401 |
|
|
var $slider = $('.views-slideshow-cycle-main-frame'),
|
402 |
|
|
opts = {
|
403 |
|
|
start: {x: 0, y: 0},
|
404 |
|
|
end: {x: 0, y: 0},
|
405 |
|
|
hdiff: 0,
|
406 |
|
|
vdiff: 0,
|
407 |
|
|
length: 0,
|
408 |
|
|
angle: null,
|
409 |
|
|
direction: null,
|
410 |
|
|
},
|
411 |
|
|
optsReset = $.extend(true, {}, opts),
|
412 |
|
|
H_THRESHOLD = 110,
|
413 |
|
|
V_THRESHOLD = 50;
|
414 |
|
|
$slider.data('bw', opts)
|
415 |
|
|
.bind('touchstart.cycle', function (e) {
|
416 |
|
|
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
|
417 |
|
|
if (e.originalEvent.touches.length == 1) {
|
418 |
|
|
var data = $(this).data('bw');
|
419 |
|
|
data.start.x = touch.pageX;
|
420 |
|
|
data.start.y = touch.pageY;
|
421 |
|
|
$(this).data('bw', data);
|
422 |
|
|
}
|
423 |
|
|
})
|
424 |
|
|
.bind('touchend.cycle', function (e) {
|
425 |
|
|
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
|
426 |
|
|
var data = $(this).data('bw');
|
427 |
|
|
data.end.x = touch.pageX;
|
428 |
|
|
data.end.y = touch.pageY;
|
429 |
|
|
$(this).data('bw', data);
|
430 |
|
|
if (data.start.x != 0 && data.start.y != 0) {
|
431 |
|
|
data.vdiff = data.start.x - data.end.x;
|
432 |
|
|
data.hdiff = data.end.y - data.start.y;
|
433 |
|
|
if (Math.abs(data.vdiff) == data.start.x && Math.abs(data.hdiff) == data.start.y) {
|
434 |
|
|
data.vdiff = 0;
|
435 |
|
|
data.hdiff = 0;
|
436 |
|
|
}
|
437 |
|
|
var length = Math.round(Math.sqrt(Math.pow(data.vdiff,2) + Math.pow(data.hdiff,2)));
|
438 |
|
|
var rads = Math.atan2(data.hdiff, data.vdiff);
|
439 |
|
|
var angle = Math.round(rads*180/Math.PI);
|
440 |
|
|
if (angle < 0) { angle = 360 - Math.abs(angle); }
|
441 |
|
|
if (length > H_THRESHOLD && V_THRESHOLD > data.hdiff) {
|
442 |
|
|
e.preventDefault();
|
443 |
|
|
if (angle > 135 && angle < 225) {
|
444 |
|
|
var cyopt = $slider.data('cycle.opts');
|
445 |
|
|
if (cyopt.currSlide > 0) {
|
446 |
|
|
$slider.cycle((cyopt.currSlide - 1), 'scrollRight');
|
447 |
|
|
}
|
448 |
|
|
else {
|
449 |
|
|
$slider.cycle((cyopt.slideCount - 1), 'scrollRight');
|
450 |
|
|
}
|
451 |
|
|
}
|
452 |
|
|
else if (angle > 315 || angle < 45) {
|
453 |
|
|
$slider.cycle('next');
|
454 |
|
|
}
|
455 |
|
|
}
|
456 |
|
|
}
|
457 |
|
|
data = $.extend(true, {}, optsReset);
|
458 |
|
|
});
|
459 |
|
|
}
|
460 |
|
|
}
|
461 |
|
|
};
|
462 |
|
|
|
463 |
85ad3d82
|
Assos Assos
|
Drupal.viewsSlideshowCycle = Drupal.viewsSlideshowCycle || {};
|
464 |
|
|
|
465 |
|
|
|
466 |
|
|
Drupal.viewsSlideshowCycle.advancedOptionCleanup = function(value) {
|
467 |
|
|
value = $.trim(value);
|
468 |
|
|
value = value.replace(/\n/g, '');
|
469 |
2181db6c
|
Assos Assos
|
if (value.match(/^[\d.]+%$/)) {
|
470 |
|
|
|
471 |
|
|
}
|
472 |
|
|
else if (!isNaN(parseInt(value))) {
|
473 |
85ad3d82
|
Assos Assos
|
value = parseInt(value);
|
474 |
|
|
}
|
475 |
|
|
else if (value.toLowerCase() == 'true') {
|
476 |
|
|
value = true;
|
477 |
|
|
}
|
478 |
|
|
else if (value.toLowerCase() == 'false') {
|
479 |
|
|
value = false;
|
480 |
|
|
}
|
481 |
|
|
|
482 |
|
|
return value;
|
483 |
|
|
}
|
484 |
|
|
|
485 |
|
|
|
486 |
|
|
|
487 |
|
|
Drupal.viewsSlideshowCycle.imageWait = function(fullId) {
|
488 |
|
|
if (++Drupal.settings.viewsSlideshowCycle[fullId].loadedImages == Drupal.settings.viewsSlideshowCycle[fullId].totalImages) {
|
489 |
|
|
Drupal.viewsSlideshowCycle.load(fullId);
|
490 |
|
|
}
|
491 |
|
|
};
|
492 |
|
|
|
493 |
|
|
|
494 |
|
|
Drupal.viewsSlideshowCycle.load = function (fullId) {
|
495 |
|
|
var settings = Drupal.settings.viewsSlideshowCycle[fullId];
|
496 |
|
|
|
497 |
|
|
|
498 |
|
|
if (!settings.loaded) {
|
499 |
|
|
$(settings.targetId).cycle(settings.opts);
|
500 |
|
|
settings.loaded = true;
|
501 |
|
|
|
502 |
|
|
|
503 |
|
|
if (settings.start_paused) {
|
504 |
|
|
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId, "force": true });
|
505 |
|
|
}
|
506 |
|
|
|
507 |
|
|
|
508 |
|
|
if (settings.pause_when_hidden) {
|
509 |
|
|
var checkPause = function(settings) {
|
510 |
|
|
|
511 |
|
|
|
512 |
|
|
|
513 |
|
|
var visible = viewsSlideshowCycleIsVisible(settings.targetId, settings.pause_when_hidden_type, settings.amount_allowed_visible);
|
514 |
|
|
if (visible) {
|
515 |
|
|
Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": settings.slideshowId });
|
516 |
|
|
}
|
517 |
|
|
else {
|
518 |
|
|
Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": settings.slideshowId });
|
519 |
|
|
}
|
520 |
|
|
}
|
521 |
|
|
|
522 |
|
|
|
523 |
|
|
$(window).scroll(function() {
|
524 |
|
|
checkPause(settings);
|
525 |
|
|
});
|
526 |
|
|
|
527 |
|
|
|
528 |
|
|
$(window).resize(function() {
|
529 |
|
|
checkPause(settings);
|
530 |
|
|
});
|
531 |
|
|
}
|
532 |
|
|
}
|
533 |
|
|
};
|
534 |
|
|
|
535 |
|
|
Drupal.viewsSlideshowCycle.pause = function (options) {
|
536 |
|
|
|
537 |
|
|
try{
|
538 |
|
|
if (options.pause_in_middle && $.fn.pause) {
|
539 |
|
|
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).pause();
|
540 |
|
|
}
|
541 |
|
|
else {
|
542 |
|
|
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('pause');
|
543 |
|
|
}
|
544 |
|
|
}
|
545 |
|
|
catch(e){
|
546 |
|
|
if(!e instanceof TypeError){
|
547 |
|
|
throw e;
|
548 |
|
|
}
|
549 |
|
|
}
|
550 |
|
|
};
|
551 |
|
|
|
552 |
|
|
Drupal.viewsSlideshowCycle.play = function (options) {
|
553 |
|
|
Drupal.settings.viewsSlideshowCycle['#views_slideshow_cycle_main_' + options.slideshowID].paused = false;
|
554 |
|
|
if (options.pause_in_middle && $.fn.resume) {
|
555 |
|
|
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).resume();
|
556 |
|
|
}
|
557 |
|
|
else {
|
558 |
|
|
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('resume');
|
559 |
|
|
}
|
560 |
|
|
};
|
561 |
|
|
|
562 |
|
|
Drupal.viewsSlideshowCycle.previousSlide = function (options) {
|
563 |
|
|
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('prev');
|
564 |
|
|
};
|
565 |
|
|
|
566 |
|
|
Drupal.viewsSlideshowCycle.nextSlide = function (options) {
|
567 |
|
|
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle('next');
|
568 |
|
|
};
|
569 |
|
|
|
570 |
|
|
Drupal.viewsSlideshowCycle.goToSlide = function (options) {
|
571 |
|
|
$('#views_slideshow_cycle_teaser_section_' + options.slideshowID).cycle(options.slideNum);
|
572 |
|
|
};
|
573 |
|
|
|
574 |
|
|
|
575 |
|
|
function IsNumeric(sText) {
|
576 |
|
|
var ValidChars = "0123456789";
|
577 |
|
|
var IsNumber=true;
|
578 |
|
|
var Char;
|
579 |
|
|
|
580 |
|
|
for (var i=0; i < sText.length && IsNumber == true; i++) {
|
581 |
|
|
Char = sText.charAt(i);
|
582 |
|
|
if (ValidChars.indexOf(Char) == -1) {
|
583 |
|
|
IsNumber = false;
|
584 |
|
|
}
|
585 |
|
|
}
|
586 |
|
|
return IsNumber;
|
587 |
|
|
}
|
588 |
|
|
|
589 |
|
|
|
590 |
|
|
|
591 |
|
|
|
592 |
|
|
function createCookie(name,value,days) {
|
593 |
|
|
if (days) {
|
594 |
|
|
var date = new Date();
|
595 |
|
|
date.setTime(date.getTime()+(days*24*60*60*1000));
|
596 |
|
|
var expires = "; expires="+date.toGMTString();
|
597 |
|
|
}
|
598 |
|
|
else {
|
599 |
|
|
var expires = "";
|
600 |
|
|
}
|
601 |
|
|
document.cookie = name+"="+value+expires+"; path=/";
|
602 |
|
|
}
|
603 |
|
|
|
604 |
|
|
function readCookie(name) {
|
605 |
|
|
var nameEQ = name + "=";
|
606 |
|
|
var ca = document.cookie.split(';');
|
607 |
|
|
for(var i=0;i < ca.length;i++) {
|
608 |
|
|
var c = ca[i];
|
609 |
|
|
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
610 |
|
|
if (c.indexOf(nameEQ) == 0) {
|
611 |
|
|
return c.substring(nameEQ.length,c.length);
|
612 |
|
|
}
|
613 |
|
|
}
|
614 |
|
|
return null;
|
615 |
|
|
}
|
616 |
|
|
|
617 |
|
|
function eraseCookie(name) {
|
618 |
|
|
createCookie(name,"",-1);
|
619 |
|
|
}
|
620 |
|
|
|
621 |
|
|
|
622 |
|
|
|
623 |
|
|
|
624 |
|
|
|
625 |
|
|
|
626 |
|
|
|
627 |
|
|
|
628 |
|
|
|
629 |
|
|
|
630 |
|
|
function viewsSlideshowCycleIsVisible(elem, type, amountVisible) {
|
631 |
|
|
|
632 |
|
|
var docViewTop = $(window).scrollTop();
|
633 |
|
|
var docViewBottom = docViewTop + $(window).height();
|
634 |
|
|
var docViewLeft = $(window).scrollLeft();
|
635 |
|
|
var docViewRight = docViewLeft + $(window).width();
|
636 |
|
|
|
637 |
|
|
|
638 |
|
|
var elemTop = $(elem).offset().top;
|
639 |
|
|
var elemHeight = $(elem).height();
|
640 |
|
|
var elemBottom = elemTop + elemHeight;
|
641 |
|
|
var elemLeft = $(elem).offset().left;
|
642 |
|
|
var elemWidth = $(elem).width();
|
643 |
|
|
var elemRight = elemLeft + elemWidth;
|
644 |
|
|
var elemArea = elemHeight * elemWidth;
|
645 |
|
|
|
646 |
|
|
|
647 |
|
|
var missingLeft = 0;
|
648 |
|
|
var missingRight = 0;
|
649 |
|
|
var missingTop = 0;
|
650 |
|
|
var missingBottom = 0;
|
651 |
|
|
|
652 |
|
|
|
653 |
|
|
if (elemLeft < docViewLeft) {
|
654 |
|
|
missingLeft = docViewLeft - elemLeft;
|
655 |
|
|
}
|
656 |
|
|
|
657 |
|
|
|
658 |
|
|
if (elemRight > docViewRight) {
|
659 |
|
|
missingRight = elemRight - docViewRight;
|
660 |
|
|
}
|
661 |
|
|
|
662 |
|
|
|
663 |
|
|
if (elemTop < docViewTop) {
|
664 |
|
|
missingTop = docViewTop - elemTop;
|
665 |
|
|
}
|
666 |
|
|
|
667 |
|
|
|
668 |
|
|
if (elemBottom > docViewBottom) {
|
669 |
|
|
missingBottom = elemBottom - docViewBottom;
|
670 |
|
|
}
|
671 |
|
|
|
672 |
|
|
|
673 |
|
|
|
674 |
|
|
if (type == 'full') {
|
675 |
|
|
return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom)
|
676 |
|
|
&& (elemBottom <= docViewBottom) && (elemTop >= docViewTop)
|
677 |
|
|
&& (elemLeft >= docViewLeft) && (elemRight <= docViewRight)
|
678 |
|
|
&& (elemLeft <= docViewRight) && (elemRight >= docViewLeft));
|
679 |
|
|
}
|
680 |
|
|
else if(type == 'vertical') {
|
681 |
|
|
var verticalShowing = elemHeight - missingTop - missingBottom;
|
682 |
|
|
|
683 |
|
|
|
684 |
|
|
|
685 |
|
|
|
686 |
|
|
|
687 |
a2bb1a14
|
Assos Assos
|
if (typeof amountVisible === 'string' && amountVisible.indexOf('%')) {
|
688 |
85ad3d82
|
Assos Assos
|
return (((verticalShowing/elemHeight)*100) >= parseInt(amountVisible));
|
689 |
|
|
}
|
690 |
|
|
else {
|
691 |
|
|
return (verticalShowing >= parseInt(amountVisible));
|
692 |
|
|
}
|
693 |
|
|
}
|
694 |
|
|
else if(type == 'horizontal') {
|
695 |
|
|
var horizontalShowing = elemWidth - missingLeft - missingRight;
|
696 |
|
|
|
697 |
|
|
|
698 |
|
|
|
699 |
|
|
|
700 |
|
|
|
701 |
a2bb1a14
|
Assos Assos
|
if (typeof amountVisible === 'string' && amountVisible.indexOf('%')) {
|
702 |
85ad3d82
|
Assos Assos
|
return (((horizontalShowing/elemWidth)*100) >= parseInt(amountVisible));
|
703 |
|
|
}
|
704 |
|
|
else {
|
705 |
|
|
return (horizontalShowing >= parseInt(amountVisible));
|
706 |
|
|
}
|
707 |
|
|
}
|
708 |
|
|
else if(type == 'area') {
|
709 |
|
|
var areaShowing = (elemWidth - missingLeft - missingRight) * (elemHeight - missingTop - missingBottom);
|
710 |
|
|
|
711 |
|
|
|
712 |
|
|
|
713 |
|
|
|
714 |
|
|
|
715 |
a2bb1a14
|
Assos Assos
|
if (typeof amountVisible === 'string' && amountVisible.indexOf('%')) {
|
716 |
85ad3d82
|
Assos Assos
|
return (((areaShowing/elemArea)*100) >= parseInt(amountVisible));
|
717 |
|
|
}
|
718 |
|
|
else {
|
719 |
|
|
return (areaShowing >= parseInt(amountVisible));
|
720 |
|
|
}
|
721 |
|
|
}
|
722 |
|
|
}
|
723 |
|
|
})(jQuery); |