PageSourceSearch

https://seawanhaka.org/CMSWebParts/CHO/Slider_Files/Camera.js?639245304038677308

js seawanhaka.org collected 2026-09-26 10:41:45 UTC 107,290 bytes, 2,293 lines download raw bytes

1// JavaScript source code
2// Camera slideshow v1.4.0 - a jQuery slideshow with many effects, transitions, easy to customize, using canvas and mobile ready, based on jQuery 1.9.1+
3// Copyright (c) 2012 by Manuel Masia - www.pixedelic.com
4// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
5; (function ($) {
6    $.fn.camera = function (opts, callback) {
7
8        var defaults = {
9            alignment: 'center', //topLeft, topCenter, topRight, centerLeft, center, centerRight, bottomLeft, bottomCenter, bottomRight
10
11            autoAdvance: true, //true, false
12
13            mobileAutoAdvance: true, //true, false. Auto-advancing for mobile devices
14
15            barDirection: 'leftToRight', //'leftToRight', 'rightToLeft', 'topToBottom', 'bottomToTop'
16
17            barPosition: 'bottom', //'bottom', 'left', 'top', 'right'
18
19            cols: 6,
20
21            easing: 'easeInOutExpo', //for the complete list http://jqueryui.com/demos/effect/easing.html
22
23            mobileEasing: '', //leave empty if you want to display the same easing on mobile devices and on desktop etc.
24
25            fx: 'random', //'random','simpleFade', 'curtainTopLeft', 'curtainTopRight', 'curtainBottomLeft', 'curtainBottomRight', 'curtainSliceLeft', 'curtainSliceRight', 'blindCurtainTopLeft', 'blindCurtainTopRight', 'blindCurtainBottomLeft', 'blindCurtainBottomRight', 'blindCurtainSliceBottom', 'blindCurtainSliceTop', 'stampede', 'mosaic', 'mosaicReverse', 'mosaicRandom', 'mosaicSpiral', 'mosaicSpiralReverse', 'topLeftBottomRight', 'bottomRightTopLeft', 'bottomLeftTopRight', 'bottomLeftTopRight'
26            //you can also use more than one effect, just separate them with commas: 'simpleFade, scrollRight, scrollBottom'
27
28            mobileFx: '', //leave empty if you want to display the same effect on mobile devices and on desktop etc.
29
30            gridDifference: 250, //to make the grid blocks slower than the slices, this value must be smaller than transPeriod
31
32            height: '50%', //here you can type pixels (for instance '300px'), a percentage (relative to the width of the slideshow, for instance '50%') or 'auto'
33
34            imagePath: 'images/', //he path to the image folder (it serves for the blank.gif, when you want to display videos)
35
36            hover: true, //true, false. Puase on state hover. Not available for mobile devices
37
38            loader: 'pie', //pie, bar, none (even if you choose "pie", old browsers like IE8- can't display it... they will display always a loading bar)
39
40            loaderColor: '#eeeeee',
41
42            loaderBgColor: '#222222',
43
44            loaderOpacity: .8, //0, .1, .2, .3, .4, .5, .6, .7, .8, .9, 1
45
46            loaderPadding: 2, //how many empty pixels you want to display between the loader and its background
47
48            loaderStroke: 7, //the thickness both of the pie loader and of the bar loader. Remember: for the pie, the loader thickness must be less than a half of the pie diameter
49            
50            minHeight: '200px', //you can also leave it blank
51
52            navigation: true, //true or false, to display or not the navigation buttons
53
54            navigationHover: true, //if true the navigation button (prev, next and play/stop buttons) will be visible on hover state only, if false they will be visible always
55
56            mobileNavHover: true, //same as above, but only for mobile devices
57
58            opacityOnGrid: false, //true, false. Decide to apply a fade effect to blocks and slices: if your slideshow is fullscreen or simply big, I recommend to set it false to have a smoother effect 
59
60            overlayer: true, //a layer on the images to prevent the users grab them simply by clicking the right button of their mouse (.camera_overlayer)
61
62            pagination: true,
63
64            playPause: true, //true or false, to display or not the play/pause buttons
65
66            pauseOnClick: true, //true, false. It stops the slideshow when you click the sliders.
67
68            pieDiameter: 38,
69
70            piePosition: 'rightTop', //'rightTop', 'leftTop', 'leftBottom', 'rightBottom'
71
72            portrait: false, //true, false. Select true if you don't want that your images are cropped
73
74            rows: 4,
75
76            slicedCols: 12, //if 0 the same value of cols
77
78            slicedRows: 8, //if 0 the same value of rows
79
80            slideOn: 'random', //next, prev, random: decide if the transition effect will be applied to the current (prev) or the next slide
81
82            thumbnails: false,
83
84            time: 7000, //milliseconds between the end of the sliding effect and the start of the nex one
85
86            transPeriod: 1500, //lenght of the sliding effect in milliseconds
87
88
89            ////////callbacks
90
91            onEndTransition: function () { },	//this callback is invoked when the transition effect ends
92
93            onLoaded: function () { },	//this callback is invoked when the image on a slide has completely loaded
94
95            onStartLoading: function () { },	//this callback is invoked when the image on a slide start loading
96
97            onStartTransition: function () { }	//this callback is invoked when the transition effect starts
98
99        };
100
101
102        function isMobile() {
103            if (navigator.userAgent.match(/Android/i) ||
104                navigator.userAgent.match(/webOS/i) ||
105                navigator.userAgent.match(/iPad/i) ||
106                navigator.userAgent.match(/iPhone/i) ||
107                navigator.userAgent.match(/iPod/i)
108                ) {
109                return true;
110            }
111        }
112
113        $.support.borderRadius = false;
114        $.each(['borderRadius', 'BorderRadius', 'MozBorderRadius', 'WebkitBorderRadius', 'OBorderRadius', 'KhtmlBorderRadius'], function () {
115            if (document.body.style[this] !== undefined) $.support.borderRadius = true;
116        });
117
118        var opts = $.extend({}, defaults, opts);
119
120        var wrap = $(this).addClass('camera_wrap');
121
122        setWidth();
123
124        // dealing with set width - width can be set in % or px. In pixedelic original application, it's always set to 100% for responsive purposes
125        function setWidth() {
126            if (opts.width.indexOf('%') > 0) {
127                var width = opts.width.replace('%', '');
128                if ((width < 100))
129                    wrap.width(wrap.width() * width / 100);
130                } else {
131                wrap.width(opts.width);
132            }
133        };
134
135       if (isMobile() && $(document).width() < 768) { // for Full Site, use original width & height. Otherwise, use these prms
136           wrap[0].style.width = '100%';
137           opts.portrait = opts.portraitMobile;
138           wrap[0].style.maxHeight = "400px";
139       }
140
141        wrap.wrapInner(
142            '<div class="camera_src" />'
143            ).wrapInner(
144            '<div class="camera_fakehover" />'
145            );
146
147        var fakeHover = $('.camera_fakehover', wrap);
148        var fakeHoverSelector = ('.camera_fakehover', wrap);
149
150        fakeHover.append(
151            '<div class="camera_target"></div>'
152            );
153        if (opts.overlayer == true) {
154            fakeHover.append(
155                '<div class="camera_overlayer"></div>'
156                )
157        }
158        fakeHover.append(
159        '<div class="camera_target_content"></div>'
160		);
161
162        var loader;
163
164        if (opts.loader == 'pie' && !$.support.borderRadius) {
165            loader = 'bar';
166        } else {
167            loader = opts.loader;
168        }
169
170        if (loader == 'pie') {
171            fakeHover.append(
172                '<div class="camera_pie"></div>'
173                )
174        } else if (loader == 'bar') {
175            fakeHover.append(
176                '<div class="camera_bar"></div>'
177                )
178        } else {
179            fakeHover.append(
180                '<div class="camera_bar" style="display:none"></div>'
181                )
182        }
183
184        if (opts.playPause == true) {
185            fakeHover.append(
186            '<div class="camera_commands"></div>'
187            )
188        }
189
190        if (opts.navigation == true) {
191            fakeHover.append(
192                '<div class="camera_prev"><span></span></div>'
193                ).append(
194                '<div class="camera_next"><span></span></div>'
195                );
196        }
197
198        if (opts.thumbnails == true) {
199            wrap.append(
200                '<div class="camera_thumbs_cont" />'
201                );
202        }
203
204        if (opts.thumbnails == true && opts.pagination != true) {
205            $('.camera_thumbs_cont', wrap).wrap(
206                '<div />'
207                ).wrap(
208                    '<div class="camera_thumbs" />'
209                ).wrap(
210                    '<div />'
211                ).wrap(
212                    '<div class="camera_command_wrap" />'
213                );
214        }
215
216        if (opts.pagination == true) {
217            wrap.append(
218                '<div class="camera_pag"></div>'
219                );
220        }
221
222        wrap.append(
223            '<div class="camera_loader"></div>'
224            );
225
226        $('.camera_caption', wrap).each(function () {
227            if ($(this)[0] && $(this).text().trim() !== '')
228                $(this).wrapInner('<div />');
229        });
230
231
232        var pieID = 'pie_' + wrap.index(),
233            elem = $('.camera_src', wrap),
234            target = $('.camera_target', wrap),
235            content = $('.camera_target_content', wrap),
236            pieContainer = $('.camera_pie', wrap),
237            barContainer = $('.camera_bar', wrap),
238            prevNav = $('.camera_prev', wrap),
239            nextNav = $('.camera_next', wrap),
240            commands = $('.camera_commands', wrap),
241            pagination = $('.camera_pag', wrap),
242            thumbs = $('.camera_thumbs_cont', wrap);
243
244
245        var w,
246            h;
247
248
249        var allImg = new Array();
250        $('> div', elem).each(function () {
251            allImg.push($(this).attr('data-src'));
252        });
253
254        var allLinks = new Array();
255        $('> div', elem).each(function () {
256            if ($(this).attr('data-link')) {
257                allLinks.push($(this).attr('data-link'));
258            } else {
259                allLinks.push('');
260            }
261        });
262
263        var allTargets = new Array();
264        $('> div', elem).each(function () {
265            if ($(this).attr('data-target')) {
266                allTargets.push($(this).attr('data-target'));
267            } else {
268                allTargets.push('');
269            }
270        });
271
272        var allPor = new Array();
273        $('> div', elem).each(function () {
274            if ($(this).attr('data-portrait')) {
275                allPor.push($(this).attr('data-portrait'));
276            } else {
277                allPor.push('');
278            }
279        });
280
281        var allAlign = new Array();
282        $('> div', elem).each(function () {
283            if ($(this).attr('data-alignment')) {
284                allAlign.push($(this).attr('data-alignment'));
285            } else {
286                allAlign.push('');
287            }
288        });
289
290
291        var allThumbs = new Array();
292        $('> div', elem).each(function () {
293            if ($(this).attr('data-thumb')) {
294                allThumbs.push($(this).attr('data-thumb'));
295            } else {
296                allThumbs.push('');
297            }
298        });
299        
300        var amountSlide = allImg.length;
301
302        $(content).append('<div class="cameraContents" />');
303        var loopMove;
304        for (loopMove = 0; loopMove < amountSlide; loopMove++) {
305            $('.cameraContents', content).append('<div class="cameraContent" />');
306            if (allLinks[loopMove] != '') {
307                //only for Wordpress plugin
308                var dataBox = $('> div ', elem).eq(loopMove).attr('data-box');
309                if (typeof dataBox !== 'undefined' && dataBox !== false && dataBox != '') {
310                    dataBox = 'data-box="' + $('> div ', elem).eq(loopMove).attr('data-box') + '"';
311                } else {
312                    dataBox = '';
313                }
314                //
315                $('.camera_target_content .cameraContent:eq(' + loopMove + ')', wrap).append('<a class="camera_link" href="' + allLinks[loopMove] + '" ' + dataBox + ' target="' + allTargets[loopMove] + '"></a>');
316            }
317
318        }
319        $('.camera_caption', wrap).each(function () {
320            var ind = $(this).parent().index(),
321                cont = wrap.find('.cameraContent').eq(ind);
322            $(this).appendTo(cont);
323        });
324
325        target.append('<div class="cameraCont" />');
326        var cameraCont = $('.cameraCont', wrap);
327
328
329
330        var loop;
331        for (loop = 0; loop < amountSlide; loop++) {
332            cameraCont.append('<div class="cameraSlide cameraSlide_' + loop + '" />');
333            var div = $('> div:eq(' + loop + ')', elem);
334            target.find('.cameraSlide_' + loop).clone(div);
335        }
336
337
338        function thumbnailVisible() {
339            var wTh = $(thumbs).width();
340            $('li', thumbs).removeClass('camera_visThumb');
341            $('li', thumbs).each(function () {
342                var pos = $(this).position(),
343                    ulW = $('ul', thumbs).outerWidth(),
344                    offUl = $('ul', thumbs).offset().left,
345                    offDiv = $('> div', thumbs).offset().left,
346                    ulLeft = offDiv - offUl;
347                if (ulLeft > 0) {
348                    $('.camera_prevThumbs', camera_thumbs_wrap).removeClass('hideNav');
349                } else {
350                    $('.camera_prevThumbs', camera_thumbs_wrap).addClass('hideNav');
351                }
352                if ((ulW - ulLeft) > wTh) {
353                    $('.camera_nextThumbs', camera_thumbs_wrap).removeClass('hideNav');
354                } else {
355                    $('.camera_nextThumbs', camera_thumbs_wrap).addClass('hideNav');
356                }
357                var left = pos.left,
358					right = pos.left + ($(this).width());
359                if (right - ulLeft <= wTh && left - ulLeft >= 0) {
360                    $(this).addClass('camera_visThumb');
361                }
362            });
363        }
364
365        $(window).bind('load resize pageshow', function () {
366            thumbnailPos();
367            thumbnailVisible();
368        });
369
370
371        cameraCont.append('<div class="cameraSlide cameraSlide_' + loop + '" />');
372
373
374        var started;
375
376        wrap.show();
377        var w = target.width();
378        var h = target.height();
379
380        var setPause;
381
382        $(window).bind('resize pageshow', function () {
383            if (started == true) {
384                resizeImage();
385            }
386            $('ul', thumbs).animate({ 'margin-top': 0 }, 0, thumbnailPos);
387            if (!elem.hasClass('paused')) {
388                elem.addClass('paused');
389                if ($('.camera_stop', camera_thumbs_wrap).length) {
390                    $('.camera_stop', camera_thumbs_wrap).hide();
391                    $('.camera_play', camera_thumbs_wrap).show();
392                    if (loader != 'none') {
393                        $('#' + pieID).hide();
394                    }
395                } else {
396                    if (loader != 'none') {
397                        $('#' + pieID).hide();
398                    }
399                }
400                clearTimeout(setPause);
401                setPause = setTimeout(function () {
402                    elem.removeClass('paused');
403                    if ($('.camera_play', camera_thumbs_wrap).length) {
404                        $('.camera_play', camera_thumbs_wrap).hide();
405                        $('.camera_stop', camera_thumbs_wrap).show();
406                        if (loader != 'none') {
407                            $('#' + pieID).fadeIn();
408                        }
409                    } else {
410                        if (loader != 'none') {
411                            $('#' + pieID).fadeIn();
412                        }
413                    }
414                }, 1500);
415            }
416        });
417
418        function resizeImage() {
419            var res;
420            function resizeImageWork() {
421                w = wrap.width();
422                if (opts.height.indexOf('%') != -1) {
423                    var startH = Math.round(w / (100 / parseFloat(opts.height)));
424                    if (opts.minHeight != '' && startH < parseFloat(opts.minHeight)) {
425                        h = parseFloat(opts.minHeight);
426                    } else {
427                        h = startH;
428                    }
429                    wrap.css({ height: h });
430                } else if (opts.height == 'auto') {
431                    h = wrap.height();
432                } else {
433                    h = parseFloat(opts.height);
434                    wrap.css({ height: h });
435                }
436                $('.camerarelative', target).css({ 'width': w, 'height': h });
437                $('.imgLoaded', target).each(function () {
438                    var t = $(this),
439                        wT = t.attr('width'),
440                        hT = t.attr('height'),
441                        imgLoadIn = t.index(),
442                        mTop,
443                        mLeft,
444                        alignment = t.attr('data-alignment'),
445                        portrait = t.attr('data-portrait');
446
447                    if (typeof alignment === 'undefined' || alignment === false || alignment === '') {
448                        alignment = opts.alignment;
449                    }
450
451                    if (typeof portrait === 'undefined' || portrait === false || portrait === '') {
452                        portrait = opts.portrait;
453                    }
454
455                    if (portrait == false || portrait == 'false') {
456                        if ((wT / hT) < (w / h)) {
457                            var r = w / wT;
458                            var d = (Math.abs(h - (hT * r))) * 0.5;
459                            switch (alignment) {
460                                case 'topLeft':
461                                    mTop = 0;
462                                    break;
463                                case 'topCenter':
464                                    mTop = 0;
465                                    break;
466                                case 'topRight':
467                                    mTop = 0;
468                                    break;
469                                case 'centerLeft':
470                                    mTop = '-' + d + 'px';
471                                    break;
472                                case 'center':
473                                    mTop = '-' + d + 'px';
474                                    break;
475                                case 'centerRight':
476                                    mTop = '-' + d + 'px';
477                                    break;
478                                case 'bottomLeft':
479                                    mTop = '-' + d * 2 + 'px';
480                                    break;
481                                case 'bottomCenter':
482                                    mTop = '-' + d * 2 + 'px';
483                                    break;
484                                case 'bottomRight':
485                                    mTop = '-' + d * 2 + 'px';
486                                    break;
487                            }
488                            if (isMobile())
489                            t.css("cssText", "height: " + (hT * r) + "px; width: " + w + "px !important; max-width: " + w + "px !important; visibility: visible;" +
490                                "position: absolute; margin-top: " + mTop + "; margin-right: 0px; margin-left: 0px");
491                            else
492                                t.css("cssText", "height: " + (hT * r) + "px; width: " + w + "px; max-width: " + w + "px; visibility: visible;" +
493                                    "position: absolute; margin-top: " + mTop + "; margin-right: 0px; margin-left: 0px");
494
495                        }
496                        else {
497                            var r = h / hT;
498                            var d = (Math.abs(w - (wT * r))) * 0.5;
499                            switch (alignment) {
500                                case 'topLeft':
501                                    mLeft = 0;
502                                    break;
503                                case 'topCenter':
504                                    mLeft = '-' + d + 'px';
505                                    break;
506                                case 'topRight':
507                                    mLeft = '-' + d * 2 + 'px';
508                                    break;
509                                case 'centerLeft':
510                                    mLeft = 0;
511                                    break;
512                                case 'center':
513                                    mLeft = '-' + d + 'px';
514                                    break;
515                                case 'centerRight':
516                                    mLeft = '-' + d * 2 + 'px';
517                                    break;
518                                case 'bottomLeft':
519                                    mLeft = 0;
520                                    break;
521                                case 'bottomCenter':
522                                    mLeft = '-' + d + 'px';
523                                    break;
524                                case 'bottomRight':
525                                    mLeft = '-' + d * 2 + 'px';
526                                    break;
527                            }
528                            if (isMobile())
529                                t.css("cssText", "height: " + h + "px; width: " + wT * r + "px !important; max-width: " + wT * r + "px !important; visibility: visible;" +
530                                "position: absolute; margin-top: 0px; margin-right: " + mLeft + "; margin-left: " + mLeft + ";");
531                            else
532                                t.css("cssText", "height: " + h + "px; width: " + wT * r + "px; max-width: " + wT * r + "px; visibility: visible;" +
533                                "position: absolute; margin-top: 0px; margin-right: " + mLeft + "; margin-left: " + mLeft + ";");
534                        }
535                    } else {
536                        if ((wT / hT) < (w / h)) {
537                            var r = h / hT;
538                            var d = (Math.abs(w - (wT * r))) * 0.5;
539                            switch (alignment) {
540                                case 'topLeft':
541                                    mLeft = 0;
542                                    break;
543                                case 'topCenter':
544                                    mLeft = d + 'px';
545                                    break;
546                                case 'topRight':
547                                    mLeft = d * 2 + 'px';
548                                    break;
549                                case 'centerLeft':
550                                    mLeft = 0;
551                                    break;
552                                case 'center':
553                                    mLeft = d + 'px';
554                                    break;
555                                case 'centerRight':
556                                    mLeft = d * 2 + 'px';
557                                    break;
558                                case 'bottomLeft':
559                                    mLeft = 0;
560                                    break;
561                                case 'bottomCenter':
562                                    mLeft = d + 'px';
563                                    break;
564                                case 'bottomRight':
565                                    mLeft = d * 2 + 'px';
566                                    break;
567                            }
568                            if (isMobile())
569                                t.css("cssText", "height: " + h + "px; width: " + wT * r + "px !important; max-width: " + wT * r + "px !important; visibility: visible;" +
570                                "position: absolute; margin-top: 0px; margin-right: " + mLeft + "; margin-left: " + mLeft + ";");
571                            else
572                                t.css("cssText", "height: " + h + "px; width: " + wT * r + "px; max-width: " + wT * r + "px; visibility: visible;" +
573                                "position: absolute; margin-top: 0px; margin-right: " + mLeft + "; margin-left: " + mLeft + ";");
574                        }
575                        else {
576                            var r = w / wT;
577                            var d = (Math.abs(h - (hT * r))) * 0.5;
578                            switch (alignment) {
579                                case 'topLeft':
580                                    mTop = 0;
581                                    break;
582                                case 'topCenter':
583                                    mTop = 0;
584                                    break;
585                                case 'topRight':
586                                    mTop = 0;
587                                    break;
588                                case 'centerLeft':
589                                    mTop = d + 'px';
590                                    break;
591                                case 'center':
592                                    mTop = d + 'px';
593                                    break;
594                                case 'centerRight':
595                                    mTop = d + 'px';
596                                    break;
597                                case 'bottomLeft':
598                                    mTop = d * 2 + 'px';
599                                    break;
600                                case 'bottomCenter':
601                                    mTop = d * 2 + 'px';
602                                    break;
603                                case 'bottomRight':
604                                    mTop = d * 2 + 'px';
605                                    break;
606                            }
607                            if (isMobile())
608                                t.css("cssText", "height: " + (hT * r) + "px; width: " + w + "px !important; max-width: " + w + "px !important; visibility: visible;" +
609                                "position: absolute; margin-top: " + mTop + "px; margin-right: 0px; margin-left: 0px;");
610                            else
611                                t.css("cssText", "height: " + (hT * r) + "px; width: " + w + "px; max-width: " + w + "px; visibility: visible;" +
612                                "position: absolute; margin-top: " + mTop + "px; margin-right: 0px; margin-left: 0px;");
613                        }
614                    }
615                });
616            }
617            if (started == true) {
618                clearTimeout(res);
619                res = setTimeout(resizeImageWork, 200);
620            } else {
621                resizeImageWork();
622            }
623
624            started = true;
625        }
626
627
628        var u,
629            setT;
630
631        var clickEv,
632            autoAdv,
633            navHover,
634            commands,
635            pagination;
636
637        var videoHover,
638            videoPresent;
639
640        if (isMobile() && opts.mobileAutoAdvance != '') {
641            autoAdv = opts.mobileAutoAdvance;
642        } else {
643            autoAdv = opts.autoAdvance;
644        }
645
646        if (autoAdv == false) {
647            elem.addClass('paused');
648        }
649
650        if (isMobile() && opts.mobileNavHover != '') {
651            navHover = opts.mobileNavHover;
652        } else {
653            navHover = opts.navigationHover;
654        }
655
656        if (elem.length != 0) {
657
658            var selector = $('.cameraSlide', target);
659            selector.wrapInner('<div class="camerarelative" />');
660
661            var navSlide;
662
663            var barDirection = opts.barDirection;
664
665            var camera_thumbs_wrap = wrap;
666
667
668            $('iframe', fakeHover).each(function () {
669                var t = $(this);
670                var src = t.attr('src');
671                t.attr('data-src', src);
672                var divInd = t.parent().index('.camera_src > div');
673                $('.camera_target_content .cameraContent:eq(' + divInd + ')', wrap).append(t);
674            });
675            function imgFake() {
676                $('iframe', fakeHover).each(function () {
677                    $('.camera_caption', fakeHover).show();
678                    var t = $(this);
679                    var cloneSrc = t.attr('data-src');
680                    t.attr('src', cloneSrc);
681                    var imgFakeUrl = opts.imagePath + 'blank.gif';
682                    var imgFake = new Image();
683                    imgFake.src = imgFakeUrl;
684                    if (opts.height.indexOf('%') != -1) {
685                        var startH = Math.round(w / (100 / parseFloat(opts.height)));
686                        if (opts.minHeight != '' && startH < parseFloat(opts.minHeight)) {
687                            h = parseFloat(opts.minHeight);
688                        } else {
689                            h = startH;
690                        }
691                    } else if (opts.height == 'auto') {
692                        h = wrap.height();
693                    } else {
694                        h = parseFloat(opts.height);
695                    }
696                    t.after($(imgFake).attr({ 'class': 'imgFake', 'width': w, 'height': h }));
697                    var clone = t.clone();
698                    t.remove();
699                    $(imgFake).bind('click', function () {
700                        if ($(this).css('position') == 'absolute') {
701                            $(this).remove();
702                            if (cloneSrc.indexOf('vimeo') != -1 || cloneSrc.indexOf('youtube') != -1) {
703                                if (cloneSrc.indexOf('?') != -1) {
704                                    autoplay = '&autoplay=1';
705                                } else {
706                                    autoplay = '?autoplay=1';
707                                }
708                            } else if (cloneSrc.indexOf('dailymotion') != -1) {
709                                if (cloneSrc.indexOf('?') != -1) {
710                                    autoplay = '&autoPlay=1';
711                                } else {
712                                    autoplay = '?autoPlay=1';
713                                }
714                            }
715                            clone.attr('src', cloneSrc + autoplay);
716                            videoPresent = true;
717                        } else {
718                            $(this).css({ position: 'absolute', top: 0, left: 0, zIndex: 10 }).after(clone);
719                            clone.css({ position: 'absolute', top: 0, left: 0, zIndex: 9 });
720                        }
721                    });
722                });
723            }
724
725            imgFake();
726
727
728            if (opts.hover == true) {
729                if (!isMobile()) {
730                    fakeHover.hover(function () {
731                        elem.addClass('hovered');
732                    }, function () {
733                        elem.removeClass('hovered');
734                    });
735                }
736            }
737
738            if (navHover == true) {
739                $(prevNav, wrap).animate({ opacity: 0 }, 0);
740                $(nextNav, wrap).animate({ opacity: 0 }, 0);
741                $(commands, wrap).animate({ opacity: 0 }, 0);
742                if (isMobile()) {
743                    $(document).on('vmouseover', fakeHoverSelector, function () {
744                        $(prevNav, wrap).animate({ opacity: 1 }, 200);
745                        $(nextNav, wrap).animate({ opacity: 1 }, 200);
746                        $(commands, wrap).animate({ opacity: 1 }, 200);
747                    });
748                    $(document).on('vmouseout', fakeHoverSelector, function () {
749                        $(prevNav, wrap).delay(500).animate({ opacity: 0 }, 200);
750                        $(nextNav, wrap).delay(500).animate({ opacity: 0 }, 200);
751                        $(commands, wrap).delay(500).animate({ opacity: 0 }, 200);
752                    });
753                } else {
754                    fakeHover.hover(function () {
755                        $(prevNav, wrap).animate({ opacity: 1 }, 200);
756                        $(nextNav, wrap).animate({ opacity: 1 }, 200);
757                        $(commands, wrap).animate({ opacity: 1 }, 200);
758                    }, function () {
759                        $(prevNav, wrap).animate({ opacity: 0 }, 200);
760                        $(nextNav, wrap).animate({ opacity: 0 }, 200);
761                        $(commands, wrap).animate({ opacity: 0 }, 200);
762                    });
763                }
764            }
765
766
767            camera_thumbs_wrap.on('click', '.camera_stop', function () {
768                autoAdv = false;
769                elem.addClass('paused');
770                if ($('.camera_stop', camera_thumbs_wrap).length) {
771                    $('.camera_stop', camera_thumbs_wrap).hide()
772                    $('.camera_play', camera_thumbs_wrap).show();
773                    if (loader != 'none') {
774                        $('#' + pieID).hide();
775                    }
776                } else {
777                    if (loader != 'none') {
778                        $('#' + pieID).hide();
779                    }
780                }
781            });
782
783            camera_thumbs_wrap.on('click', '.camera_play', function () {
784                autoAdv = true;
785                elem.removeClass('paused');
786                if ($('.camera_play', camera_thumbs_wrap).length) {
787                    $('.camera_play', camera_thumbs_wrap).hide();
788                    $('.camera_stop', camera_thumbs_wrap).show();
789                    if (loader != 'none') {
790                        $('#' + pieID).show();
791                    }
792                } else {
793                    if (loader != 'none') {
794                        $('#' + pieID).show();
795                    }
796                }
797            });
798
799            if (opts.pauseOnClick == true) {
800                $('.camera_target_content', fakeHover).mouseup(function () {
801                    autoAdv = false;
802                    elem.addClass('paused');
803                    $('.camera_stop', camera_thumbs_wrap).hide()
804                    $('.camera_play', camera_thumbs_wrap).show();
805                    $('#' + pieID).hide();
806                });
807            }
808            $('.cameraContent, .imgFake', fakeHover).hover(function () {
809                videoHover = true;
810            }, function () {
811                videoHover = false;
812            });
813
814            $('.cameraContent, .imgFake', fakeHover).bind('click', function () {
815                if (videoPresent == true && videoHover == true) {
816                    autoAdv = false;
817                    $('.camera_caption', fakeHover).hide();
818                    elem.addClass('paused');
819                    $('.camera_stop', camera_thumbs_wrap).hide()
820                    $('.camera_play', camera_thumbs_wrap).show();
821                    $('#' + pieID).hide();
822                }
823            });
824
825
826        }
827
828
829        function shuffle(arr) {
830            for (
831			  var j, x, i = arr.length; i;
832			  j = parseInt(Math.random() * i),
833			  x = arr[--i], arr[i] = arr[j], arr[j] = x
834			);
835            return arr;
836        }
837
838        function isInteger(s) {
839            return Math.ceil(s) == Math.floor(s);
840        }
841
842        if (loader != 'pie') {
843            barContainer.append('<span class="camera_bar_cont" />');
844            $('.camera_bar_cont', barContainer)
845				.animate({ opacity: opts.loaderOpacity }, 0)
846				.css({ 'position': 'absolute', 'left': 0, 'right': 0, 'top': 0, 'bottom': 0, 'background-color': opts.loaderBgColor })
847				.append('<span id="' + pieID + '" />');
848            $('#' + pieID).animate({ opacity: 0 }, 0);
849            var canvas = $('#' + pieID);
850            canvas.css({ 'position': 'absolute', 'background-color': opts.loaderColor });
851            switch (opts.barPosition) {
852                case 'left':
853                    barContainer.css({ right: 'auto', width: opts.loaderStroke });
854                    break;
855                case 'right':
856                    barContainer.css({ left: 'auto', width: opts.loaderStroke });
857                    break;
858                case 'top':
859                    barContainer.css({ bottom: 'auto', height: opts.loaderStroke });
860                    break;
861                case 'bottom':
862                    barContainer.css({ top: 'auto', height: opts.loaderStroke });
863                    break;
864            }
865            switch (barDirection) {
866                case 'leftToRight':
867                    canvas.css({ 'left': 0, 'right': 0, 'top': opts.loaderPadding, 'bottom': opts.loaderPadding });
868                    break;
869                case 'rightToLeft':
870                    canvas.css({ 'left': 0, 'right': 0, 'top': opts.loaderPadding, 'bottom': opts.loaderPadding });
871                    break;
872                case 'topToBottom':
873                    canvas.css({ 'left': opts.loaderPadding, 'right': opts.loaderPadding, 'top': 0, 'bottom': 0 });
874                    break;
875                case 'bottomToTop':
876                    canvas.css({ 'left': opts.loaderPadding, 'right': opts.loaderPadding, 'top': 0, 'bottom': 0 });
877                    break;
878            }
879        } else {
880            pieContainer.append('<canvas id="' + pieID + '"></canvas>');
881            var G_vmlCanvasManager;
882            var canvas = document.getElementById(pieID);
883            canvas.setAttribute("width", opts.pieDiameter);
884            canvas.setAttribute("height", opts.pieDiameter);
885            var piePosition;
886            switch (opts.piePosition) {
887                case 'leftTop':
888                    piePosition = 'left:0; top:0;';
889                    break;
890                case 'rightTop':
891                    piePosition = 'right:0; top:0;';
892                    break;
893                case 'leftBottom':
894                    piePosition = 'left:0; bottom:0;';
895                    break;
896                case 'rightBottom':
897                    piePosition = 'right:0; bottom:0;';
898                    break;
899            }
900            canvas.setAttribute("style", "position:absolute; z-index:1002; " + piePosition);
901            var rad;
902            var radNew;
903
904            if (canvas && canvas.getContext) {
905                var ctx = canvas.getContext("2d");
906                ctx.rotate(Math.PI * (3 / 2));
907                ctx.translate(-opts.pieDiameter, 0);
908            }
909
910        }
911        if (loader == 'none' || autoAdv == false) {
912            $('#' + pieID).hide();
913            $('.camera_canvas_wrap', camera_thumbs_wrap).hide();
914        }
915
916        if ($(pagination).length) {
917            $(pagination).append('<ul class="camera_pag_ul" />');
918            var li;
919            for (li = 0; li < amountSlide; li++) {
920                $('.camera_pag_ul', wrap).append('<li class="pag_nav_' + li + '" style="position:relative; z-index:1002"><span><span>' + li + '</span></span></li>');
921            }
922            $('.camera_pag_ul li', wrap).hover(function () {
923                $(this).addClass('camera_hover');
924                if ($('.camera_thumb', this).length) {
925                    var wTh = $('.camera_thumb', this).outerWidth(),
926                    hTh = $('.camera_thumb', this).outerHeight(),
927					wTt = $(this).outerWidth();
928                    $('.camera_thumb', this).show().css({ 'top': '-' + hTh + 'px', 'left': '-' + (wTh - wTt) / 2 + 'px' }).animate({ 'opacity': 1, 'margin-top': '-3px' }, 200);
929                    $('.thumb_arrow', this).show().animate({ 'opacity': 1, 'margin-top': '-3px' }, 200);
930                }
931            }, function () {
932                $(this).removeClass('camera_hover');
933                $('.camera_thumb', this).animate({ 'margin-top': '-20px', 'opacity': 0 }, 200, function () {
934                    $(this).css({ marginTop: '5px' }).hide();
935                });
936                $('.thumb_arrow', this).animate({ 'margin-top': '-20px', 'opacity': 0 }, 200, function () {
937                    $(this).css({ marginTop: '5px' }).hide();
938                });
939            });
940        }
941
942
943        if ($(thumbs).length) {
944            var thumbUrl;
945            if (!$(pagination).length) {
946                $(thumbs).append('<div />');
947                $(thumbs).before('<div class="camera_prevThumbs hideNav"><div></div></div>').before('<div class="camera_nextThumbs hideNav"><div></div></div>');
948                $('> div', thumbs).append('<ul />');
949                $.each(allThumbs, function (i, val) {
950                    if ($('> div', elem).eq(i).attr('data-thumb') != '') {
951                        var thumbUrl = $('> div', elem).eq(i).attr('data-thumb'),
952							newImg = new Image();
953                        newImg.src = thumbUrl;
954                        $('ul', thumbs).append('<li class="pix_thumb pix_thumb_' + i + '" />');
955                            $('li.pix_thumb_' + i, thumbs).append($(newImg).attr('class', 'camera_thumb'));
956                    }
957                });
958            } else {
959                $.each(allThumbs, function (i, val) {
960                    if ($('> div', elem).eq(i).attr('data-thumb') != '') {
961                        var thumbUrl = $('> div', elem).eq(i).attr('data-thumb'),
962							newImg = new Image();
963                        newImg.src = thumbUrl;
964                        $('li.pag_nav_' + i, pagination).append($(newImg).attr('class', 'camera_thumb').css({ 'position': 'absolute' }).animate({ opacity: 0 }, 0));
965                        $('li.pag_nav_' + i + ' > img', pagination).after('<div class="thumb_arrow" />');
966                        $('li.pag_nav_' + i + ' > .thumb_arrow', pagination).animate({ opacity: 0 }, 0);
967                    }
968                });
969                wrap.css({ marginBottom: $(pagination).outerHeight() });
970            }
971        } else if (!$(thumbs).length && $(pagination).length) {
972            wrap.css({ marginBottom: $(pagination).outerHeight() });
973        }
974
975
976        var firstPos = true;
977
978        function thumbnailPos() {
979            if ($(thumbs).length && !$(pagination).length) {
980                $('.camera_prevThumbs', camera_thumbs_wrap).css('visibility', opts.thumbnailNav ? 'visible' : 'hidden');
981                $('.camera_nextThumbs', camera_thumbs_wrap).css('visibility', opts.thumbnailNav ? 'visible' : 'hidden');
982
983                var wTh = $(thumbs).outerWidth(),
984					owTh = $('ul > li', thumbs).outerWidth(),
985					pos = $('li.cameracurrent', thumbs).length ? $('li.cameracurrent', thumbs).position() : '',
986					ulW = ($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth()),
987					offUl = $('ul', thumbs).offset().left,
988					offDiv = $('> div', thumbs).offset().left,
989					ulLeft;
990
991                if (offUl < 0) {
992                    ulLeft = '-' + (offDiv - offUl);
993                } else {
994                    ulLeft = offDiv - offUl;
995                }
996
997
998
999                if (firstPos == true) {
1000                    $('ul', thumbs).width($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth());
1001                    if ($(thumbs).length && !$(pagination).lenght) {
1002                        wrap.css({ marginBottom: $(thumbs).outerHeight() });
1003                    }
1004                    thumbnailVisible();
1005                    /*I repeat this two lines because of a problem with iPhones*/
1006                    $('ul', thumbs).width($('ul > li', thumbs).length * $('ul > li', thumbs).outerWidth());
1007                    if ($(thumbs).length && !$(pagination).lenght) {
1008                        wrap.css({ marginBottom: $(thumbs).outerHeight() });
1009                    }
1010                    /*...*/
1011                }
1012                firstPos = false;
1013
1014                var left = $('li.cameracurrent', thumbs).length ? pos.left : '',
1015                    right = $('li.cameracurrent', thumbs).length ? pos.left + ($('li.cameracurrent', thumbs).outerWidth()) : '';
1016                if (left < $('li.cameracurrent', thumbs).outerWidth()) {
1017                    left = 0;
1018                }
1019                if (right - ulLeft > wTh) {
1020                    if ((left + wTh) < ulW) {
1021                        $('ul', thumbs).animate({ 'margin-left': '-' + (left) + 'px' }, 500, thumbnailVisible);
1022                    } else {
1023                        $('ul', thumbs).animate({ 'margin-left': '-' + ($('ul', thumbs).outerWidth() - wTh) + 'px' }, 500, thumbnailVisible);
1024                    }
1025                } else if (left - ulLeft < 0) {
1026                    $('ul', thumbs).animate({ 'margin-left': '-' + (left) + 'px' }, 500, thumbnailVisible);
1027                } else {
1028                    $('ul', thumbs).css({ 'margin-left': 'auto', 'margin-right': 'auto' });
1029                    setTimeout(thumbnailVisible, 100);
1030                }
1031
1032            }
1033        }
1034
1035        if ($(commands).length) {
1036            $(commands).append('<div class="camera_play"></div>').append('<div class="camera_stop"></div>');
1037            if (autoAdv == true) {
1038                $('.camera_play', camera_thumbs_wrap).hide();
1039                $('.camera_stop', camera_thumbs_wrap).show();
1040            } else {
1041                $('.camera_stop', camera_thumbs_wrap).hide();
1042                $('.camera_play', camera_thumbs_wrap).show();
1043            }
1044
1045        }
1046
1047
1048        function canvasLoader() {
1049            rad = 0;
1050            var barWidth = $('.camera_bar_cont', camera_thumbs_wrap).width(),
1051				barHeight = $('.camera_bar_cont', camera_thumbs_wrap).height();
1052
1053            if (loader != 'pie') {
1054                switch (barDirection) {
1055                    case 'leftToRight':
1056                        $('#' + pieID).css({ 'right': barWidth });
1057                        break;
1058                    case 'rightToLeft':
1059                        $('#' + pieID).css({ 'left': barWidth });
1060                        break;
1061                    case 'topToBottom':
1062                        $('#' + pieID).css({ 'bottom': barHeight });
1063                        break;
1064                    case 'bottomToTop':
1065                        $('#' + pieID).css({ 'top': barHeight });
1066                        break;
1067                }
1068            } else {
1069                ctx.clearRect(0, 0, opts.pieDiameter, opts.pieDiameter);
1070            }
1071        }
1072
1073
1074        canvasLoader();
1075
1076
1077        $('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom', fakeHover).each(function () {
1078            $(this).css('visibility', 'hidden');
1079        });
1080
1081        opts.onStartLoading.call(this);
1082
1083        nextSlide();
1084
1085
1086        /*************************** FUNCTION nextSlide() ***************************/
1087
1088        function nextSlide(navSlide) {
1089            elem.addClass('camerasliding');
1090
1091            videoPresent = false;
1092            var vis = parseFloat($('div.cameraSlide.cameracurrent', target).index());
1093
1094            if (navSlide > 0) {
1095                var slideI = navSlide - 1;
1096            } else if (vis == amountSlide - 1) {
1097                var slideI = 0;
1098            } else {
1099                var slideI = vis + 1;
1100            }
1101
1102
1103            var slide = $('.cameraSlide:eq(' + slideI + ')', target);
1104            var slideNext = $('.cameraSlide:eq(' + (slideI + 1) + ')', target).addClass('cameranext');
1105            if (vis != slideI + 1) {
1106                slideNext.hide();
1107            }
1108            $('.cameraContent', fakeHover).fadeOut(600);
1109            $('.camera_caption', fakeHover).show();
1110
1111            $('.camerarelative', slide).append($('> div ', elem).eq(slideI).find('> div.camera_effected'));
1112
1113            $('.camera_target_content .cameraContent:eq(' + slideI + ')', wrap).append($('> div ', elem).eq(slideI).find('> div'));
1114
1115            if (!$('.imgLoaded', slide).length) {
1116                var imgUrl = allImg[slideI];
1117                var imgLoaded = new Image();
1118                imgLoaded.src = imgUrl + "?" + new Date().getTime();
1119                slide.css('visibility', 'hidden');
1120                slide.prepend($(imgLoaded).attr('class', 'imgLoaded').css('visibility', 'hidden'));
1121                var wT, hT;
1122                if (!$(imgLoaded).get(0).complete || wT == '0' || hT == '0' || typeof wT === 'undefined' || wT === false || typeof hT === 'undefined' || hT === false) {
1123                    $('.camera_loader', wrap).delay(500).fadeIn(400);
1124                    imgLoaded.onload = function () {
1125                        wT = imgLoaded.naturalWidth;
1126                        hT = imgLoaded.naturalHeight;
1127                        $(imgLoaded).attr('data-alignment', allAlign[slideI]).attr('data-portrait', allPor[slideI]);
1128                        $(imgLoaded).attr('width', wT);
1129                        $(imgLoaded).attr('height', hT);
1130                        target.find('.cameraSlide_' + slideI).hide().css('visibility', 'visible');
1131                        resizeImage();
1132                        nextSlide(slideI + 1);
1133                    };
1134                }
1135            } else {
1136                if (allImg.length > (slideI + 1) && !$('.imgLoaded', slideNext).length) {
1137                    var imgUrl2 = allImg[(slideI + 1)];
1138                    var imgLoaded2 = new Image();
1139                    imgLoaded2.src = imgUrl2 + "?" + new Date().getTime();
1140                    slideNext.prepend($(imgLoaded2).attr('class', 'imgLoaded').css('visibility', 'hidden'));
1141                    imgLoaded2.onload = function () {
1142                        wT = imgLoaded2.naturalWidth;
1143                        hT = imgLoaded2.naturalHeight;
1144                        $(imgLoaded2).attr('data-alignment', allAlign[slideI + 1]).attr('data-portrait', allPor[slideI + 1]);
1145                        $(imgLoaded2).attr('width', wT);
1146                        $(imgLoaded2).attr('height', hT);
1147                        resizeImage();
1148                    };
1149                }
1150                opts.onLoaded.call(this);
1151                if ($('.camera_loader', wrap).is(':visible')) {
1152                    $('.camera_loader', wrap).fadeOut(400);
1153                } else {
1154                    $('.camera_loader', wrap).css({ 'visibility': 'hidden' });
1155                    $('.camera_loader', wrap).fadeOut(400, function () {
1156                        $('.camera_loader', wrap).css({ 'visibility': 'visible' });
1157                    });
1158                }
1159                var rows = opts.rows,
1160                    cols = opts.cols,
1161                    couples = 1,
1162                    difference = 0,
1163                    dataSlideOn,
1164                    time,
1165                    transPeriod,
1166                    fx,
1167                    easing,
1168                    randomFx = new Array('simpleFade', 'curtainTopLeft', 'curtainTopRight', 'curtainBottomLeft', 'curtainBottomRight', 'curtainSliceLeft', 'curtainSliceRight', 'blindCurtainTopLeft', 'blindCurtainTopRight', 'blindCurtainBottomLeft', 'blindCurtainBottomRight', 'blindCurtainSliceBottom', 'blindCurtainSliceTop', 'stampede', 'mosaic', 'mosaicReverse', 'mosaicRandom', 'mosaicSpiral', 'mosaicSpiralReverse', 'topLeftBottomRight', 'bottomRightTopLeft', 'bottomLeftTopRight', 'topRightBottomLeft', 'scrollLeft', 'scrollRight', 'scrollTop', 'scrollBottom', 'scrollHorz');
1169                marginLeft = 0,
1170				marginTop = 0,
1171				opacityOnGrid = 0;
1172
1173                if (opts.opacityOnGrid == true) {
1174                    opacityOnGrid = 0;
1175                } else {
1176                    opacityOnGrid = 1;
1177                }
1178
1179
1180
1181                var dataFx = $(' > div', elem).eq(slideI).attr('data-fx');
1182
1183                if (isMobile() && opts.mobileFx != '' && opts.mobileFx != 'default') {
1184                    fx = opts.mobileFx;
1185                } else {
1186                    if (typeof dataFx !== 'undefined' && dataFx !== false && dataFx !== 'default') {
1187                        fx = dataFx;
1188                    } else {
1189                        fx = opts.fx;
1190                    }
1191                }
1192
1193                if (fx == 'random') {
1194                    fx = shuffle(randomFx);
1195                    fx = fx[0];
1196                } else {
1197                    fx = fx;
1198                    if (fx.indexOf(',') > 0) {
1199                        fx = fx.replace(/ /g, '');
1200                        fx = fx.split(',');
1201                        fx = shuffle(fx);
1202                        fx = fx[0];
1203                    }
1204                }
1205
1206                dataEasing = $(' > div', elem).eq(slideI).attr('data-easing');
1207                mobileEasing = $(' > div', elem).eq(slideI).attr('data-mobileEasing');
1208
1209                if (isMobile() && opts.mobileEasing != '' && opts.mobileEasing != 'default') {
1210                    if (typeof mobileEasing !== 'undefined' && mobileEasing !== false && mobileEasing !== 'default') {
1211                        easing = mobileEasing;
1212                    } else {
1213                        easing = opts.mobileEasing;
1214                    }
1215                } else {
1216                    if (typeof dataEasing !== 'undefined' && dataEasing !== false && dataEasing !== 'default') {
1217                        easing = dataEasing;
1218                    } else {
1219                        easing = opts.easing;
1220                    }
1221                }
1222
1223                dataSlideOn = $(' > div', elem).eq(slideI).attr('data-slideOn');
1224                if (typeof dataSlideOn !== 'undefined' && dataSlideOn !== false) {
1225                    slideOn = dataSlideOn;
1226                } else {
1227                    if (opts.slideOn == 'random') {
1228                        var slideOn = new Array('next', 'prev');
1229                        slideOn = shuffle(slideOn);
1230                        slideOn = slideOn[0];
1231                    } else {
1232                        slideOn = opts.slideOn;
1233                    }
1234                }
1235
1236                var dataTime = $(' > div', elem).eq(slideI).attr('data-time');
1237                if (typeof dataTime !== 'undefined' && dataTime !== false && dataTime !== '') {
1238                    time = parseFloat(dataTime);
1239                } else {
1240                    time = opts.time;
1241                }
1242
1243                var dataTransPeriod = $(' > div', elem).eq(slideI).attr('data-transPeriod');
1244                if (typeof dataTransPeriod !== 'undefined' && dataTransPeriod !== false && dataTransPeriod !== '') {
1245                    transPeriod = parseFloat(dataTransPeriod);
1246                } else {
1247                    transPeriod = opts.transPeriod;
1248                }
1249
1250                if (!$(elem).hasClass('camerastarted')) {
1251                    fx = 'simpleFade';
1252                    slideOn = 'next';
1253                    easing = '';
1254                    transPeriod = 400;
1255                    $(elem).addClass('camerastarted')
1256                }
1257
1258                switch (fx) {
1259                    case 'simpleFade':
1260                        cols = 1;
1261                        rows = 1;
1262                        break;
1263                    case 'curtainTopLeft':
1264                        if (opts.slicedCols == 0) {
1265                            cols = opts.cols;
1266                        } else {
1267                            cols = opts.slicedCols;
1268                        }
1269                        rows = 1;
1270                        break;
1271                    case 'curtainTopRight':
1272                        if (opts.slicedCols == 0) {
1273                            cols = opts.cols;
1274                        } else {
1275                            cols = opts.slicedCols;
1276                        }
1277                        rows = 1;
1278                        break;
1279                    case 'curtainBottomLeft':
1280                        if (opts.slicedCols == 0) {
1281                            cols = opts.cols;
1282                        } else {
1283                            cols = opts.slicedCols;
1284                        }
1285                        rows = 1;
1286                        break;
1287                    case 'curtainBottomRight':
1288                        if (opts.slicedCols == 0) {
1289                            cols = opts.cols;
1290                        } else {
1291                            cols = opts.slicedCols;
1292                        }
1293                        rows = 1;
1294                        break;
1295                    case 'curtainSliceLeft':
1296                        if (opts.slicedCols == 0) {
1297                            cols = opts.cols;
1298                        } else {
1299                            cols = opts.slicedCols;
1300                        }
1301                        rows = 1;
1302                        break;
1303                    case 'curtainSliceRight':
1304                        if (opts.slicedCols == 0) {
1305                            cols = opts.cols;
1306                        } else {
1307                            cols = opts.slicedCols;
1308                        }
1309                        rows = 1;
1310                        break;
1311                    case 'blindCurtainTopLeft':
1312                        if (opts.slicedRows == 0) {
1313                            rows = opts.rows;
1314                        } else {
1315                            rows = opts.slicedRows;
1316                        }
1317                        cols = 1;
1318                        break;
1319                    case 'blindCurtainTopRight':
1320                        if (opts.slicedRows == 0) {
1321                            rows = opts.rows;
1322                        } else {
1323                            rows = opts.slicedRows;
1324                        }
1325                        cols = 1;
1326                        break;
1327                    case 'blindCurtainBottomLeft':
1328                        if (opts.slicedRows == 0) {
1329                            rows = opts.rows;
1330                        } else {
1331                            rows = opts.slicedRows;
1332                        }
1333                        cols = 1;
1334                        break;
1335                    case 'blindCurtainBottomRight':
1336                        if (opts.slicedRows == 0) {
1337                            rows = opts.rows;
1338                        } else {
1339                            rows = opts.slicedRows;
1340                        }
1341                        cols = 1;
1342                        break;
1343                    case 'blindCurtainSliceTop':
1344                        if (opts.slicedRows == 0) {
1345                            rows = opts.rows;
1346                        } else {
1347                            rows = opts.slicedRows;
1348                        }
1349                        cols = 1;
1350                        break;
1351                    case 'blindCurtainSliceBottom':
1352                        if (opts.slicedRows == 0) {
1353                            rows = opts.rows;
1354                        } else {
1355                            rows = opts.slicedRows;
1356                        }
1357                        cols = 1;
1358                        break;
1359                    case 'stampede':
1360                        difference = '-' + transPeriod;
1361                        break;
1362                    case 'mosaic':
1363                        difference = opts.gridDifference;
1364                        break;
1365                    case 'mosaicReverse':
1366                        difference = opts.gridDifference;
1367                        break;
1368                    case 'mosaicRandom':
1369                        break;
1370                    case 'mosaicSpiral':
1371                        difference = opts.gridDifference;
1372                        couples = 1.7;
1373                        break;
1374                    case 'mosaicSpiralReverse':
1375                        difference = opts.gridDifference;
1376                        couples = 1.7;
1377                        break;
1378                    case 'topLeftBottomRight':
1379                        difference = opts.gridDifference;
1380                        couples = 6;
1381                        break;
1382                    case 'bottomRightTopLeft':
1383                        difference = opts.gridDifference;
1384                        couples = 6;
1385                        break;
1386                    case 'bottomLeftTopRight':
1387                        difference = opts.gridDifference;
1388                        couples = 6;
1389                        break;
1390                    case 'topRightBottomLeft':
1391                        difference = opts.gridDifference;
1392                        couples = 6;
1393                        break;
1394                    case 'scrollLeft':
1395                        cols = 1;
1396                        rows = 1;
1397                        break;
1398                    case 'scrollRight':
1399                        cols = 1;
1400                        rows = 1;
1401                        break;
1402                    case 'scrollTop':
1403                        cols = 1;
1404                        rows = 1;
1405                        break;
1406                    case 'scrollBottom':
1407                        cols = 1;
1408                        rows = 1;
1409                        break;
1410                    case 'scrollHorz':
1411                        cols = 1;
1412                        rows = 1;
1413                        break;
1414                }
1415
1416                var cycle = 0;
1417                var blocks = rows * cols;
1418                var leftScrap = w - (Math.floor(w / cols) * cols);
1419                var topScrap = h - (Math.floor(h / rows) * rows);
1420                var addLeft;
1421                var addTop;
1422                var tAppW = 0;
1423                var tAppH = 0;
1424                var arr = new Array();
1425                var delay = new Array();
1426                var order = new Array();
1427                while (cycle < blocks) {
1428                    arr.push(cycle);
1429                    delay.push(cycle);
1430                    cameraCont.append('<div class="cameraappended" style="display:none; overflow:hidden; position:absolute; z-index:1000" />');
1431                    var tApp = $('.cameraappended:eq(' + cycle + ')', target);
1432                    if (fx == 'scrollLeft' || fx == 'scrollRight' || fx == 'scrollTop' || fx == 'scrollBottom' || fx == 'scrollHorz') {
1433                        selector.eq(slideI).clone().show().appendTo(tApp);
1434                    } else {
1435                        if (slideOn == 'next') {
1436                            selector.eq(slideI).clone().show().appendTo(tApp);
1437                        } else {
1438                            selector.eq(vis).clone().show().appendTo(tApp);
1439                        }
1440                    }
1441
1442                    if (cycle % cols < leftScrap) {
1443                        addLeft = 1;
1444                    } else {
1445                        addLeft = 0;
1446                    }
1447                    if (cycle % cols == 0) {
1448                        tAppW = 0;
1449                    }
1450                    if (Math.floor(cycle / cols) < topScrap) {
1451                        addTop = 1;
1452                    } else {
1453                        addTop = 0;
1454                    }
1455                    tApp.css({
1456                        'height': Math.floor((h / rows) + addTop + 1),
1457                        'left': tAppW,
1458                        'top': tAppH,
1459                        'width': Math.floor((w / cols) + addLeft + 1)
1460                    });
1461                    $('> .cameraSlide', tApp).css({
1462                        'height': h,
1463                        'margin-left': '-' + tAppW + 'px',
1464                        'margin-top': '-' + tAppH + 'px',
1465                        'width': w
1466                    });
1467                    tAppW = tAppW + tApp.width() - 1;
1468                    if (cycle % cols == cols - 1) {
1469                        tAppH = tAppH + tApp.height() - 1;
1470                    }
1471                    cycle++;
1472                }
1473
1474
1475
1476                switch (fx) {
1477                    case 'curtainTopLeft':
1478                        break;
1479                    case 'curtainBottomLeft':
1480                        break;
1481                    case 'curtainSliceLeft':
1482                        break;
1483                    case 'curtainTopRight':
1484                        arr = arr.reverse();
1485                        break;
1486                    case 'curtainBottomRight':
1487                        arr = arr.reverse();
1488                        break;
1489                    case 'curtainSliceRight':
1490                        arr = arr.reverse();
1491                        break;
1492                    case 'blindCurtainTopLeft':
1493                        break;
1494                    case 'blindCurtainBottomLeft':
1495                        arr = arr.reverse();
1496                        break;
1497                    case 'blindCurtainSliceTop':
1498                        break;
1499                    case 'blindCurtainTopRight':
1500                        break;
1501                    case 'blindCurtainBottomRight':
1502                        arr = arr.reverse();
1503                        break;
1504                    case 'blindCurtainSliceBottom':
1505                        arr = arr.reverse();
1506                        break;
1507                    case 'stampede':
1508                        arr = shuffle(arr);
1509                        break;
1510                    case 'mosaic':
1511                        break;
1512                    case 'mosaicReverse':
1513                        arr = arr.reverse();
1514                        break;
1515                    case 'mosaicRandom':
1516                        arr = shuffle(arr);
1517                        break;
1518                    case 'mosaicSpiral':
1519                        var rows2 = rows / 2, x, y, z, n = 0;
1520                        for (z = 0; z < rows2; z++) {
1521                            y = z;
1522                            for (x = z; x < cols - z - 1; x++) {
1523                                order[n++] = y * cols + x;
1524                            }
1525                            x = cols - z - 1;
1526                            for (y = z; y < rows - z - 1; y++) {
1527                                order[n++] = y * cols + x;
1528                            }
1529                            y = rows - z - 1;
1530                            for (x = cols - z - 1; x > z; x--) {
1531                                order[n++] = y * cols + x;
1532                            }
1533                            x = z;
1534                            for (y = rows - z - 1; y > z; y--) {
1535                                order[n++] = y * cols + x;
1536                            }
1537                        }
1538
1539                        arr = order;
1540
1541                        break;
1542                    case 'mosaicSpiralReverse':
1543                        var rows2 = rows / 2, x, y, z, n = blocks - 1;
1544                        for (z = 0; z < rows2; z++) {
1545                            y = z;
1546                            for (x = z; x < cols - z - 1; x++) {
1547                                order[n--] = y * cols + x;
1548                            }
1549                            x = cols - z - 1;
1550                            for (y = z; y < rows - z - 1; y++) {
1551                                order[n--] = y * cols + x;
1552                            }
1553                            y = rows - z - 1;
1554                            for (x = cols - z - 1; x > z; x--) {
1555                                order[n--] = y * cols + x;
1556                            }
1557                            x = z;
1558                            for (y = rows - z - 1; y > z; y--) {
1559                                order[n--] = y * cols + x;
1560                            }
1561                        }
1562
1563                        arr = order;
1564
1565                        break;
1566                    case 'topLeftBottomRight':
1567                        for (var y = 0; y < rows; y++)
1568                            for (var x = 0; x < cols; x++) {
1569                                order.push(x + y);
1570                            }
1571                        delay = order;
1572                        break;
1573                    case 'bottomRightTopLeft':
1574                        for (var y = 0; y < rows; y++)
1575                            for (var x = 0; x < cols; x++) {
1576                                order.push(x + y);
1577                            }
1578                        delay = order.reverse();
1579                        break;
1580                    case 'bottomLeftTopRight':
1581                        for (var y = rows; y > 0; y--)
1582                            for (var x = 0; x < cols; x++) {
1583                                order.push(x + y);
1584                            }
1585                        delay = order;
1586                        break;
1587                    case 'topRightBottomLeft':
1588                        for (var y = 0; y < rows; y++)
1589                            for (var x = cols; x > 0; x--) {
1590                                order.push(x + y);
1591                            }
1592                        delay = order;
1593                        break;
1594                }
1595
1596
1597
1598                $.each(arr, function (index, value) {
1599
1600                    if (value % cols < leftScrap) {
1601                        addLeft = 1;
1602                    } else {
1603                        addLeft = 0;
1604                    }
1605                    if (value % cols == 0) {
1606                        tAppW = 0;
1607                    }
1608                    if (Math.floor(value / cols) < topScrap) {
1609                        addTop = 1;
1610                    } else {
1611                        addTop = 0;
1612                    }
1613
1614                    switch (fx) {
1615                        case 'simpleFade':
1616                            height = h;
1617                            width = w;
1618                            opacityOnGrid = 0;
1619                            break;
1620                        case 'curtainTopLeft':
1621                            height = 0,
1622                            width = Math.floor((w / cols) + addLeft + 1),
1623                            marginTop = '-' + Math.floor((h / rows) + addTop + 1) + 'px';
1624                            break;
1625                        case 'curtainTopRight':
1626                            height = 0,
1627                            width = Math.floor((w / cols) + addLeft + 1),
1628                            marginTop = '-' + Math.floor((h / rows) + addTop + 1) + 'px';
1629                            break;
1630                        case 'curtainBottomLeft':
1631                            height = 0,
1632                            width = Math.floor((w / cols) + addLeft + 1),
1633                            marginTop = Math.floor((h / rows) + addTop + 1) + 'px';
1634                            break;
1635                        case 'curtainBottomRight':
1636                            height = 0,
1637                            width = Math.floor((w / cols) + addLeft + 1),
1638                            marginTop = Math.floor((h / rows) + addTop + 1) + 'px';
1639                            break;
1640                        case 'curtainSliceLeft':
1641                            height = 0,
1642                            width = Math.floor((w / cols) + addLeft + 1);
1643                            if (value % 2 == 0) {
1644                                marginTop = Math.floor((h / rows) + addTop + 1) + 'px';
1645                            } else {
1646                                marginTop = '-' + Math.floor((h / rows) + addTop + 1) + 'px';
1647                            }
1648                            break;
1649                        case 'curtainSliceRight':
1650                            height = 0,
1651                            width = Math.floor((w / cols) + addLeft + 1);
1652                            if (value % 2 == 0) {
1653                                marginTop = Math.floor((h / rows) + addTop + 1) + 'px';
1654                            } else {
1655                                marginTop = '-' + Math.floor((h / rows) + addTop + 1) + 'px';
1656                            }
1657                            break;
1658                        case 'blindCurtainTopLeft':
1659                            height = Math.floor((h / rows) + addTop + 1),
1660                            width = 0,
1661                            marginLeft = '-' + Math.floor((w / cols
1661) + addLeft + 1) + 'px';
1662                            break;
1663                        case 'blindCurtainTopRight':
1664                            height = Math.floor((h / rows) + addTop + 1),
1665                            width = 0,
1666                            marginLeft = Math.floor((w / cols) + addLeft + 1) + 'px';
1667                            break;
1668                        case 'blindCurtainBottomLeft':
1669                            height = Math.floor((h / rows) + addTop + 1),
1670                            width = 0,
1671                            marginLeft = '-' + Math.floor((w / cols) + addLeft + 1) + 'px';
1672                            break;
1673                        case 'blindCurtainBottomRight':
1674                            height = Math.floor((h / rows) + addTop + 1),
1675                            width = 0,
1676                            marginLeft = Math.floor((w / cols) + addLeft + 1) + 'px';
1677                            break;
1678                        case 'blindCurtainSliceBottom':
1679                            height = Math.floor((h / rows) + addTop + 1),
1680                            width = 0;
1681                            if (value % 2 == 0) {
1682                                marginLeft = '-' + Math.floor((w / cols) + addLeft + 1) + 'px';
1683                            } else {
1684                                marginLeft = Math.floor((w / cols) + addLeft + 1) + 'px';
1685                            }
1686                            break;
1687                        case 'blindCurtainSliceTop':
1688                            height = Math.floor((h / rows) + addTop + 1),
1689                            width = 0;
1690                            if (value % 2 == 0) {
1691                                marginLeft = '-' + Math.floor((w / cols) + addLeft + 1) + 'px';
1692                            } else {
1693                                marginLeft = Math.floor((w / cols) + addLeft + 1) + 'px';
1694                            }
1695                            break;
1696                        case 'stampede':
1697                            height = 0;
1698                            width = 0;
1699                            marginLeft = (w * 0.2) * (((index) % cols) - (cols - (Math.floor(cols / 2)))) + 'px';
1700                            marginTop = (h * 0.2) * ((Math.floor(index / cols) + 1) - (rows - (Math.floor(rows / 2)))) + 'px';
1701                            break;
1702                        case 'mosaic':
1703                            height = 0;
1704                            width = 0;
1705                            break;
1706                        case 'mosaicReverse':
1707                            height = 0;
1708                            width = 0;
1709                            marginLeft = Math.floor((w / cols) + addLeft + 1) + 'px';
1710                            marginTop = Math.floor((h / rows) + addTop + 1) + 'px';
1711                            break;
1712                        case 'mosaicRandom':
1713                            height = 0;
1714                            width = 0;
1715                            marginLeft = Math.floor((w / cols) + addLeft + 1) * 0.5 + 'px';
1716                            marginTop = Math.floor((h / rows) + addTop + 1) * 0.5 + 'px';
1717                            break;
1718                        case 'mosaicSpiral':
1719                            height = 0;
1720                            width = 0;
1721                            marginLeft = Math.floor((w / cols) + addLeft + 1) * 0.5 + 'px';
1722                            marginTop = Math.floor((h / rows) + addTop + 1) * 0.5 + 'px';
1723                            break;
1724                        case 'mosaicSpiralReverse':
1725                            height = 0;
1726                            width = 0;
1727                            marginLeft = Math.floor((w / cols) + addLeft + 1) * 0.5 + 'px';
1728                            marginTop = Math.floor((h / rows) + addTop + 1) * 0.5 + 'px';
1729                            break;
1730                        case 'topLeftBottomRight':
1731                            height = 0;
1732                            width = 0;
1733                            break;
1734                        case 'bottomRightTopLeft':
1735                            height = 0;
1736                            width = 0;
1737                            marginLeft = Math.floor((w / cols) + addLeft + 1) + 'px';
1738                            marginTop = Math.floor((h / rows) + addTop + 1) + 'px';
1739                            break;
1740                        case 'bottomLeftTopRight':
1741                            height = 0;
1742                            width = 0;
1743                            marginLeft = 0;
1744                            marginTop = Math.floor((h / rows) + addTop + 1) + 'px';
1745                            break;
1746                        case 'topRightBottomLeft':
1747                            height = 0;
1748                            width = 0;
1749                            marginLeft = Math.floor((w / cols) + addLeft + 1) + 'px';
1750                            marginTop = 0;
1751                            break;
1752                        case 'scrollRight':
1753                            height = h;
1754                            width = w;
1755                            marginLeft = -w;
1756                            break;
1757                        case 'scrollLeft':
1758                            height = h;
1759                            width = w;
1760                            marginLeft = w;
1761                            break;
1762                        case 'scrollTop':
1763                            height = h;
1764                            width = w;
1765                            marginTop = h;
1766                            break;
1767                        case 'scrollBottom':
1768                            height = h;
1769                            width = w;
1770                            marginTop = -h;
1771                            break;
1772                        case 'scrollHorz':
1773                            height = h;
1774                            width = w;
1775                            if (vis == 0 && slideI == amountSlide - 1) {
1776                                marginLeft = -w;
1777                            } else if (vis < slideI || (vis == amountSlide - 1 && slideI == 0)) {
1778                                marginLeft = w;
1779                            } else {
1780                                marginLeft = -w;
1781                            }
1782                            break;
1783                    }
1784
1785
1786                    var tApp = $('.cameraappended:eq(' + value + ')', target);
1787
1788                    if (typeof u !== 'undefined') {
1789                        clearInterval(u);
1790                        clearTimeout(setT);
1791                        setT = setTimeout(canvasLoader, transPeriod + difference);
1792                    }
1793
1794
1795                    if ($(pagination).length) {
1796                        $('.camera_pag li', wrap).removeClass('cameracurrent');
1797                        $('.camera_pag li', wrap).eq(slideI).addClass('cameracurrent');
1798                    }
1799
1800                    if ($(thumbs).length) {
1801                        $('li', thumbs).removeClass('cameracurrent');
1802                        $('li', thumbs).eq(slideI).addClass('cameracurrent');
1803                        $('li', thumbs).not('.cameracurrent').find('img').animate({ opacity: .5 }, 0);
1804                        $('li.cameracurrent img', thumbs).animate({ opacity: 1 }, 0);
1805                        $('li', thumbs).hover(function () {
1806                            $('img', this).stop(true, false).animate({ opacity: 1 }, 150);
1807                        }, function () {
1808                            if (!$(this).hasClass('cameracurrent')) {
1809                                $('img', this).stop(true, false).animate({ opacity: .5 }, 150);
1810                            }
1811                        });
1812                    }
1813
1814
1815                    var easedTime = parseFloat(transPeriod) + parseFloat(difference);
1816
1817                    function cameraeased() {
1818
1819                        $(this).addClass('cameraeased');
1820                        if ($('.cameraeased', target).length >= 0) {
1821                            $(thumbs).css({ visibility: 'visible' });
1822                        }
1823                        if ($('.cameraeased', target).length == blocks) {
1824
1825                            // thumbnailPos(); // removing thumbnail scroll on focus
1826
1827                            $('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom', fakeHover).each(function () {
1828                                $(this).css('visibility', 'hidden');
1829                            });
1830
1831                            selector.eq(slideI).show().css('z-index', '999').removeClass('cameranext').addClass('cameracurrent');
1832                            selector.eq(vis).css('z-index', '1').removeClass('cameracurrent');
1833                            $('.cameraContent', fakeHover).eq(slideI).addClass('cameracurrent');
1834                            if (vis >= 0) {
1835                                $('.cameraContent', fakeHover).eq(vis).removeClass('cameracurrent');
1836                            }
1837
1838                            opts.onEndTransition.call(this);
1839
1840                            if ($('> div', elem).eq(slideI).attr('data-video') != 'hide' && $('.cameraContent.cameracurrent .imgFake', fakeHover).length) {
1841                                $('.cameraContent.cameracurrent .imgFake', fakeHover).click();
1842                            }
1843
1844
1845                            var lMoveIn = selector.eq(slideI).find('.fadeIn').length;
1846                            var lMoveInContent = $('.cameraContent', fakeHover).eq(slideI).find('.moveFromLeft, .moveFromRight, .moveFromTop, .moveFromBottom, .fadeIn, .fadeFromLeft, .fadeFromRight, .fadeFromTop, .fadeFromBottom').length;
1847
1848                            if (lMoveIn != 0) {
1849                                $('.cameraSlide.cameracurrent .fadeIn', fakeHover).each(function () {
1850                                    if ($(this).attr('data-easing') != '') {
1851                                        var easeMove = $(this).attr('data-easing');
1852                                    } else {
1853                                        var easeMove = easing;
1854                                    }
1855                                    var t = $(this);
1856                                    if (typeof t.attr('data-outerWidth') === 'undefined' || t.attr('data-outerWidth') === false || t.attr('data-outerWidth') === '') {
1857                                        var wMoveIn = t.outerWidth();
1858                                        t.attr('data-outerWidth', wMoveIn);
1859                                    } else {
1860                                        var wMoveIn = t.attr('data-outerWidth');
1861                                    }
1862                                    if (typeof t.attr('data-outerHeight') === 'undefined' || t.attr('data-outerHeight') === false || t.attr('data-outerHeight') === '') {
1863                                        var hMoveIn = t.outerHeight();
1864                                        t.attr('data-outerHeight', hMoveIn);
1865                                    } else {
1866                                        var hMoveIn = t.attr('data-outerHeight');
1867                                    }
1868                                    //t.css('width',wMoveIn);
1869                                    var pos = t.position();
1870                                    var left = pos.left;
1871                                    var top = pos.top;
1872                                    var tClass = t.attr('class');
1873                                    var ind = t.index();
1874                                    var hRel = t.parents('.camerarelative').outerHeight();
1875                                    var wRel = t.parents('.camerarelative').outerWidth();
1876                                    if (tClass.indexOf("fadeIn") != -1) {
1877                                        t.animate({ opacity: 0 }, 0).css('visibility', 'visible').delay((time / lMoveIn) * (0.1 * (ind - 1))).animate({ opacity: 1 }, (time / lMoveIn) * 0.15, easeMove);
1878                                    } else {
1879                                        t.css('visibility', 'visible');
1880                                    }
1881                                });
1882                            }
1883
1884                            $('.cameraContent.cameracurrent', fakeHover).show();
1885                            if (lMoveInContent != 0) {
1886
1887                                $('.cameraContent.cameracurrent .moveFromLeft, .cameraContent.cameracurrent .moveFromRight, .cameraContent.cameracurrent .moveFromTop, .cameraContent.cameracurrent .moveFromBottom, .cameraContent.cameracurrent .fadeIn, .cameraContent.cameracurrent .fadeFromLeft, .cameraContent.cameracurrent .fadeFromRight, .cameraContent.cameracurrent .fadeFromTop, .cameraContent.cameracurrent .fadeFromBottom', fakeHover).each(function () {
1888                                    if ($(this).attr('data-easing') != '') {
1889                                        var easeMove = $(this).attr('data-easing');
1890                                    } else {
1891                                        var easeMove = easing;
1892                                    }
1893                                    var t = $(this);
1894                                    var pos = t.position();
1895                                    var left = pos.left;
1896                                    var top = pos.top;
1897                                    var tClass = t.attr('class');
1898                                    var ind = t.index();
1899                                    var thisH = t.outerHeight();
1900                                    if (tClass.indexOf("moveFromLeft") != -1) {
1901                                        t.css({ 'left': '-' + (w) + 'px', 'right': 'auto' });
1902                                        t.css('visibility', 'visible').delay((time / lMoveInContent) * (0.1 * (ind - 1))).animate({ 'left': pos.left }, (time / lMoveInContent) * 0.15, easeMove);
1903                                    } else if (tClass.indexOf("moveFromRight") != -1) {
1904                                        t.css({ 'left': w + 'px', 'right': 'auto' });
1905                                        t.css('visibility', 'visible').delay((time / lMoveInContent) * (0.1 * (ind - 1))).animate({ 'left': pos.left }, (time / lMoveInContent) * 0.15, easeMove);
1906                                    } else if (tClass.indexOf("moveFromTop") != -1) {
1907                                        t.css({ 'top': '-' + h + 'px', 'bottom': 'auto' });
1908                                        t.css('visibility', 'visible').delay((time / lMoveInContent) * (0.1 * (ind - 1))).animate({ 'top': pos.top }, (time / lMoveInContent) * 0.15, easeMove, function () {
1909                                            t.css({ top: 'auto', bottom: 0 });
1910                                        });
1911                                    } else if (tClass.indexOf("moveFromBottom") != -1) {
1912                                        t.css({ 'top': h + 'px', 'bottom': 'auto' });
1913                                        t.css('visibility', 'visible').delay((time / lMoveInContent) * (0.1 * (ind - 1))).animate({ 'top': pos.top }, (time / lMoveInContent) * 0.15, easeMove);
1914                                    } else if (tClass.indexOf("fadeFromLeft") != -1) {
1915                                        t.animate({ opacity: 0 }, 0).css({ 'left': '-' + (w) + 'px', 'right': 'auto' });
1916                                        t.css('visibility', 'visible').delay((time / lMoveInContent) * (0.1 * (ind - 1))).animate({ 'left': pos.left, opacity: 1 }, (time / lMoveInContent) * 0.15, easeMove);
1917                                    } else if (tClass.indexOf("fadeFromRight") != -1) {
1918                                        t.animate({ opacity: 0 }, 0).css({ 'left': (w) + 'px', 'right': 'auto' });
1919                                        t.css('visibility', 'visible').delay((time / lMoveInContent) * (0.1 * (ind - 1))).animate({ 'left': pos.left, opacity: 1 }, (time / lMoveInContent) * 0.15, easeMove);
1920                                    } else if (tClass.indexOf("fadeFromTop") != -1) {
1921                                        t.animate({ opacity: 0 }, 0).css({ 'top': '-' + (h) + 'px', 'bottom': 'auto' });
1922                                        t.css('visibility', 'visible').delay((time / lMoveInContent) * (0.1 * (ind - 1))).animate({ 'top': pos.top, opacity: 1 }, (time / lMoveInContent) * 0.15, easeMove, function () {
1923                                            t.css({ top: 'auto', bottom: 0 });
1924                                        });
1925                                    } else if (tClass.indexOf("fadeFromBottom") != -1) {
1926                                        t.animate({ opacity: 0 }, 0).css({ 'bottom': '-' + thisH + 'px' });
1927                                        t.css('visibility', 'visible').delay((time / lMoveInContent) * (0.1 * (ind - 1))).animate({ 'bottom': '0', opacity: 1 }, (time / lMoveInContent) * 0.15, easeMove);
1928                                    } else if (tClass.indexOf("fadeIn") != -1) {
1929                                        t.animate({ opacity: 0 }, 0).css('visibility', 'visible').delay((time / lMoveInContent) * (0.1 * (ind - 1))).animate({ opacity: 1 }, (time / lMoveInContent) * 0.15, easeMove);
1930                                    } else {
1931                                        t.css('visibility', 'visible');
1932                                    }
1933                                });
1934                            }
1935
1936
1937                            $('.cameraappended', target).remove();
1938                            elem.removeClass('camerasliding');
1939                            selector.eq(vis).hide();
1940                            var barWidth = $('.camera_bar_cont', camera_thumbs_wrap).width(),
1941								barHeight = $('.camera_bar_cont', camera_thumbs_wrap).height(),
1942								radSum;
1943                            if (loader != 'pie') {
1944                                radSum = 0.05;
1945                            } else {
1946                                radSum = 0.005;
1947                            }
1948                            $('#' + pieID).animate({ opacity: opts.loaderOpacity }, 200);
1949                            u = setInterval(
1950								function () {
1951								    if (elem.hasClass('stopped')) {
1952								        clearInterval(u);
1953								    }
1954								    if (loader != 'pie') {
1955								        if (rad <= 1.002 && !elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')) {
1956								            rad = (rad + radSum);
1957								        } else if (rad <= 1 && (elem.hasClass('stopped') || elem.hasClass('paused') || elem.hasClass('stopped') || elem.hasClass('hovered'))) {
1958								            rad = rad;
1959								        } else {
1960								            if (!elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')) {
1961								                clearInterval(u);
1962								                imgFake();
1963								                $('#' + pieID).animate({ opacity: 0 }, 200, function () {
1964								                    clearTimeout(setT);
1965								                    setT = setTimeout(canvasLoader, easedTime);
1966								                    nextSlide();
1967								                    opts.onStartLoading.call(this);
1968								                });
1969								            }
1970								        }
1971								        switch (barDirection) {
1972								            case 'leftToRight':
1973								                $('#' + pieID).animate({ 'right': barWidth - (barWidth * rad) }, (time * radSum), 'linear');
1974								                break;
1975								            case 'rightToLeft':
1976								                $('#' + pieID).animate({ 'left': barWidth - (barWidth * rad) }, (time * radSum), 'linear');
1977								                break;
1978								            case 'topToBottom':
1979								                $('#' + pieID).animate({ 'bottom': barHeight - (barHeight * rad) }, (time * radSum), 'linear');
1980								                break;
1981								            case 'bottomToTop':
1982								                $('#' + pieID).animate({ 'bottom': barHeight - (barHeight * rad) }, (time * radSum), 'linear');
1983								                break;
1984								        }
1985
1986								    } else {
1987								        radNew = rad;
1988								        ctx.clearRect(0, 0, opts.pieDiameter, opts.pieDiameter);
1989								        ctx.globalCompositeOperation = 'destination-over';
1990								        ctx.beginPath();
1991								        ctx.arc((opts.pieDiameter) / 2, (opts.pieDiameter) / 2, (opts.pieDiameter) / 2 - opts.loaderStroke, 0, Math.PI * 2, false);
1992								        ctx.lineWidth = opts.loaderStroke;
1993								        ctx.strokeStyle = opts.loaderBgColor;
1994								        ctx.stroke();
1995								        ctx.closePath();
1996								        ctx.globalCompositeOperation = 'source-over';
1997								        ctx.beginPath();
1998								        ctx.arc((opts.pieDiameter) / 2, (opts.pieDiameter) / 2, (opts.pieDiameter) / 2 - opts.loaderStroke, 0, Math.PI * 2 * radNew, false);
1999								        ctx.lineWidth = opts.loaderStroke - (opts.loaderPadding * 2);
2000								        ctx.strokeStyle = opts.loaderColor;
2001								        ctx.stroke();
2002								        ctx.closePath();
2003
2004								        if (rad <= 1.002 && !elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')) {
2005								            rad = (rad + radSum);
2006								        } else if (rad <= 1 && (elem.hasClass('stopped') || elem.hasClass('paused') || elem.hasClass('hovered'))) {
2007								            rad = rad;
2008								        } else {
2009								            if (!elem.hasClass('stopped') && !elem.hasClass('paused') && !elem.hasClass('hovered')) {
2010								                clearInterval(u);
2011								                imgFake();
2012								                $('#' + pieID + ', .camera_canvas_wrap', camera_thumbs_wrap).animate({ opacity: 0 }, 200, function () {
2013								                    clearTimeout(setT);
2014								                    setT = setTimeout(canvasLoader, easedTime);
2015								                    nextSlide();
2016								                    opts.onStartLoading.call(this);
2017								                });
2018								            }
2019								        }
2020								    }
2021								}, time * radSum
2022							);
2023                        }
2024
2025                    }
2026
2027
2028
2029                    if (fx == 'scrollLeft' || fx == 'scrollRight' || fx == 'scrollTop' || fx == 'scrollBottom' || fx == 'scrollHorz') {
2030                        opts.onStartTransition.call(this);
2031                        easedTime = 0;
2032                        tApp.delay((((transPeriod + difference) / blocks) * delay[index] * couples) * 0.5).css({
2033                            'display': 'block',
2034                            'height': height,
2035                            'margin-left': marginLeft,
2036                            'margin-top': marginTop,
2037                            'width': width
2038                        }).animate({
2039                            'height': Math.floor((h / rows) + addTop + 1),
2040                            'margin-top': 0,
2041                            'margin-left': 0,
2042                            'width': Math.floor((w / cols) + addLeft + 1)
2043                        }, (transPeriod - difference), easing, cameraeased);
2044                        selector.eq(vis).delay((((transPeriod + difference) / blocks) * delay[index] * couples) * 0.5).animate({
2045                            'margin-left': marginLeft * (-1),
2046                            'margin-top': marginTop * (-1)
2047                        }, (transPeriod - difference), easing, function () {
2048                            $(this).css({ 'margin-top': 0, 'margin-left': 0 });
2049                        });
2050                    } else {
2051                        opts.onStartTransition.call(this);
2052                        easedTime = parseFloat(transPeriod) + parseFloat(difference);
2053                        if (slideOn == 'next') {
2054                            tApp.delay((((transPeriod + difference) / blocks) * delay[index] * couples) * 0.5).css({
2055                                'display': 'block',
2056                                'height': height,
2057                                'margin-left': marginLeft,
2058                                'margin-top': marginTop,
2059                                'width': width,
2060                                'opacity': opacityOnGrid
2061                            }).animate({
2062                                'height': Math.floor((h / rows) + addTop + 1),
2063                                'margin-top': 0,
2064                                'margin-left': 0,
2065                                'opacity': 1,
2066                                'width': Math.floor((w / cols) + addLeft + 1)
2067                            }, (transPeriod - difference), easing, cameraeased);
2068                        } else {
2069                            selector.eq(slideI).show().css('z-index', '999').addClass('cameracurrent');
2070                            selector.eq(vis).css('z-index', '1').removeClass('cameracurrent');
2071                            $('.cameraContent', fakeHover).eq(slideI).addClass('cameracurrent');
2072                            $('.cameraContent', fakeHover).eq(vis).removeClass('cameracurrent');
2073                            tApp.delay((((transPeriod + difference) / blocks) * delay[index] * couples) * 0.5).css({
2074                                'display': 'block',
2075                                'height': Math.floor((h / rows) + addTop + 1),
2076                                'margin-top': 0,
2077                                'margin-left': 0,
2078                                'opacity': 1,
2079                                'width': Math.floor((w / cols) + addLeft + 1)
2080                            }).animate({
2081                                'height': height,
2082                                'margin-left': marginLeft,
2083                                'margin-top': marginTop,
2084                                'width': width,
2085                                'opacity': opacityOnGrid
2086                            }, (transPeriod - difference), easing, cameraeased);
2087                        }
2088                    }
2089
2090
2091
2092
2093
2094                });
2095
2096
2097
2098
2099            }
2100        }
2101
2102
2103        if ($(prevNav).length) {
2104            $(prevNav).click(function () {
2105                if (!elem.hasClass('camerasliding')) {
2106                    var idNum = parseFloat($('.cameraSlide.cameracurrent', target).index());
2107                    clearInterval(u);
2108                    imgFake();
2109                    $('#' + pieID + ', .camera_canvas_wrap', wrap).animate({ opacity: 0 }, 0);
2110                    canvasLoader();
2111                    if (idNum != 0) {
2112                        nextSlide(idNum);
2113                    } else {
2114                        nextSlide(amountSlide);
2115                    }
2116                    opts.onStartLoading.call(this);
2117                }
2118            });
2119        }
2120
2121        if ($(nextNav).length) {
2122            $(nextNav).click(function () {
2123                if (!elem.hasClass('camerasliding')) {
2124                    var idNum = parseFloat($('.cameraSlide.cameracurrent', target).index());
2125                    clearInterval(u);
2126                    imgFake();
2127                    $('#' + pieID + ', .camera_canvas_wrap', camera_thumbs_wrap).animate({ opacity: 0 }, 0);
2128                    canvasLoader();
2129                    if (idNum == amountSlide - 1) {
2130                        nextSlide(1);
2131                    } else {
2132                        nextSlide(idNum + 2);
2133                    }
2134                    opts.onStartLoading.call(this);
2135                }
2136            });
2137        }
2138
2139
2140        if (isMobile()) {
2141            fakeHover.bind('swipeleft', function (event) {
2142                if (!elem.hasClass('camerasliding')) {
2143                    var idNum = parseFloat($('.cameraSlide.cameracurrent', target).index());
2144                    clearInterval(u);
2145                    imgFake();
2146                    $('#' + pieID + ', .camera_canvas_wrap', camera_thumbs_wrap).animate({ opacity: 0 }, 0);
2147                    canvasLoader();
2148                    if (idNum == amountSlide - 1) {
2149                        nextSlide(1);
2150                    } else {
2151                        nextSlide(idNum + 2);
2152                    }
2153                    opts.onStartLoading.call(this);
2154                }
2155            });
2156            fakeHover.bind('swiperight', function (event) {
2157                if (!elem.hasClass('camerasliding')) {
2158                    var idNum = parseFloat($('.cameraSlide.cameracurrent', target).index());
2159                    clearInterval(u);
2160                    imgFake();
2161                    $('#' + pieID + ', .camera_canvas_wrap', camera_thumbs_wrap).animate({ opacity: 0 }, 0);
2162                    canvasLoader();
2163                    if (idNum != 0) {
2164                        nextSlide(idNum);
2165                    } else {
2166                        nextSlide(amountSlide);
2167                    }
2168                    opts.onStartLoading.call(this);
2169                }
2170            });
2171        }
2172
2173        if ($(pagination).length) {
2174            $('.camera_pag li', wrap).click(function () {
2175                if (!elem.hasClass('camerasliding')) {
2176                    var idNum = parseFloat($(this).index());
2177                    var curNum = parseFloat($('.cameraSlide.cameracurrent', target).index());
2178                    if (idNum != curNum) {
2179                        clearInterval(u);
2180                        imgFake();
2181                        $('#' + pieID + ', .camera_canvas_wrap', camera_thumbs_wrap).animate({ opacity: 0 }, 0);
2182                        canvasLoader();
2183                        nextSlide(idNum + 1);
2184                        opts.onStartLoading.call(this);
2185                    }
2186                }
2187            });
2188        }
2189
2190        if ($(thumbs).length) {
2191
2192            $('.pix_thumb img', thumbs).click(function () {
2193                if (!elem.hasClass('camerasliding')) {
2194                    var idNum = parseFloat($(this).parents('li').index());
2195                    var curNum = parseFloat($('.cameracurrent', target).index());
2196                    if (idNum != curNum) {
2197                        clearInterval(u);
2198                        imgFake();
2199                        $('#' + pieID + ', .camera_canvas_wrap', camera_thumbs_wrap).animate({ opacity: 0 }, 0);
2200                        $('.pix_thumb', thumbs).removeClass('cameracurrent');
2201                        $(this).parents('li').addClass('cameracurrent');
2202                        canvasLoader();
2203                        nextSlide(idNum + 1);
2204                        thumbnailPos();
2205                        opts.onStartLoading.call(this);
2206                    }
2207                }
2208            });
2209
2210            $('.camera_thumbs_cont .camera_prevThumbs', camera_thumbs_wrap).hover(function () {
2211                $(this).stop(true, false).animate({ opacity: 1 }, 250);
2212            }, function () {
2213                $(this).stop(true, false).animate({ opacity: .7 }, 250);
2214            });
2215            $('.camera_prevThumbs', camera_thumbs_wrap).click(function () {
2216                var sum = 0,
2217                    wTh = $(thumbs).outerWidth(),
2218                    offUl = $('ul', thumbs).offset().left,
2219                    offDiv = $('> div', thumbs).offset().left,
2220                    ulLeft = offDiv - offUl;
2221                $('.camera_visThumb', thumbs).each(function () {
2222                    var tW = $(this).outerWidth();
2223                    sum = sum + tW;
2224                });
2225                if (ulLeft - sum > 0) {
2226                    $('ul', thumbs).animate({ 'margin-left': '-' + (ulLeft - sum) + 'px' }, 500, thumbnailVisible);
2227                } else {
2228                    $('ul', thumbs).animate({ 'margin-left': 0 }, 500, thumbnailVisible);
2229                }
2230            });
2231
2232            $('.camera_thumbs_cont .camera_nextThumbs', camera_thumbs_wrap).hover(function () {
2233                $(this).stop(true, false).animate({ opacity: 1 }, 250);
2234            }, function () {
2235                $(this).stop(true, false).animate({ opacity: .7 }, 250);
2236            });
2237            $('.camera_nextThumbs', camera_thumbs_wrap).click(function () {
2238                var sum = 0,
2239                    wTh = $(thumbs).outerWidth(),
2240                    ulW = $('ul', thumbs).outerWidth(),
2241                    offUl = $('ul', thumbs).offset().left,
2242                    offDiv = $('> div', thumbs).offset().left,
2243                    ulLeft = offDiv - offUl;
2244                $('.camera_visThumb', thumbs).each(function () {
2245                    var tW = $(this).outerWidth();
2246                    sum = sum + tW;
2247                });
2248                if (ulLeft + sum + sum < ulW) {
2249                    $('ul', thumbs).animate({ 'margin-left': '-' + (ulLeft + sum) + 'px' }, 500, thumbnailVisible);
2250                } else {
2251                    $('ul', thumbs).animate({ 'margin-left': '-' + (ulW - wTh) + 'px' }, 500, thumbnailVisible);
2252                }
2253            });
2254
2255        }
2256
2257
2258
2259    }
2260
2261})(jQuery);
2262
2263; (function ($) {
2264    $.fn.cameraStop = function () {
2265        var wrap = $(this),
2266            elem = $('.camera_src', wrap),
2267            pieID = 'pie_' + wrap.index();
2268        elem.addClass('stopped');
2269        if ($('.camera_showcommands').length) {
2270            var camera_thumbs_wrap = $('.camera_thumbs_wrap', wrap);
2271        } else {
2272            var camera_thumbs_wrap = wrap;
2273        }
2274    }
2275})(jQuery);
2276
2277; (function ($) {
2278    $.fn.cameraPause = function () {
2279        var wrap = $(this);
2280        var elem = $('.camera_src', wrap);
2281        elem.addClass('paused');
2282    }
2283})(jQuery);
2284
2285; (function ($) {
2286    $.fn.cameraResume = function () {
2287        var wrap = $(this);
2288        var elem = $('.camera_src', wrap);
2289        if (typeof autoAdv === 'undefined' || autoAdv !== true) {
2290            elem.removeClass('paused');
2291        }
2292    }
2293})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.