PageSourceSearch

https://wisniowa.malopolska.pl/asp/js/jssor.slider.js

js wisniowa.malopolska.pl collected 2026-10-10 00:32:39 UTC 165,438 bytes, 4,184 lines download raw bytes

1/// <reference path="Jssor.js" />
2
3/*
4* Jssor.Slider 19.0
5* http://www.jssor.com/
6*
7* Licensed under the MIT license:
8* http://www.opensource.org/licenses/MIT
9* 
10* TERMS OF USE - Jssor.Slider
11* 
12* Copyright 2014 Jssor
13*
14* Permission is hereby granted, free of charge, to any person obtaining
15* a copy of this software and associated documentation files (the
16* "Software"), to deal in the Software without restriction, including
17* without limitation the rights to use, copy, modify, merge, publish,
18* distribute, sublicense, and/or sell copies of the Software, and to
19* permit persons to whom the Software is furnished to do so, subject to
20* the following conditions:
21* 
22* The above copyright notice and this permission notice shall be
23* included in all copies or substantial portions of the Software.
24* 
25* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32*/
33
34
35var $JssorSlideshowFormations$ = window.$JssorSlideshowFormations$ = new function () {
36    var _This = this;
37
38    //Constants +++++++
39
40    var COLUMN_INCREASE = 0;
41    var COLUMN_DECREASE = 1;
42    var ROW_INCREASE = 2;
43    var ROW_DECREASE = 3;
44
45    var DIRECTION_HORIZONTAL = 0x0003;
46    var DIRECTION_VERTICAL = 0x000C;
47
48    var TO_LEFT = 0x0001;
49    var TO_RIGHT = 0x0002;
50    var TO_TOP = 0x0004;
51    var TO_BOTTOM = 0x0008;
52
53    var FROM_LEFT = 0x0100;
54    var FROM_TOP = 0x0200;
55    var FROM_RIGHT = 0x0400;
56    var FROM_BOTTOM = 0x0800;
57
58    var ASSEMBLY_BOTTOM_LEFT = FROM_BOTTOM + TO_LEFT;
59    var ASSEMBLY_BOTTOM_RIGHT = FROM_BOTTOM + TO_RIGHT;
60    var ASSEMBLY_TOP_LEFT = FROM_TOP + TO_LEFT;
61    var ASSEMBLY_TOP_RIGHT = FROM_TOP + TO_RIGHT;
62    var ASSEMBLY_LEFT_TOP = FROM_LEFT + TO_TOP;
63    var ASSEMBLY_LEFT_BOTTOM = FROM_LEFT + TO_BOTTOM;
64    var ASSEMBLY_RIGHT_TOP = FROM_RIGHT + TO_TOP;
65    var ASSEMBLY_RIGHT_BOTTOM = FROM_RIGHT + TO_BOTTOM;
66
67    //Constants -------
68
69    //Formation Definition +++++++
70    function isToLeft(roadValue) {
71        return (roadValue & TO_LEFT) == TO_LEFT;
72    }
73
74    function isToRight(roadValue) {
75        return (roadValue & TO_RIGHT) == TO_RIGHT;
76    }
77
78    function isToTop(roadValue) {
79        return (roadValue & TO_TOP) == TO_TOP;
80    }
81
82    function isToBottom(roadValue) {
83        return (roadValue & TO_BOTTOM) == TO_BOTTOM;
84    }
85
86    function PushFormationOrder(arr, order, formationItem) {
87        formationItem.push(order);
88        arr[order] = arr[order] || [];
89        arr[order].push(formationItem);
90    }
91
92    _This.$FormationStraight = function (transition) {
93        var cols = transition.$Cols;
94        var rows = transition.$Rows;
95        var formationDirection = transition.$Assembly;
96        var count = transition.$Count;
97        var a = [];
98        var i = 0;
99        var col = 0;
100        var r = 0;
101        var cl = cols - 1;
102        var rl = rows - 1;
103        var il = count - 1;
104        var cr;
105        var order;
106        for (r = 0; r < rows; r++) {
107            for (col = 0; col < cols; col++) {
108                cr = r + ',' + col;
109                switch (formationDirection) {
110                    case ASSEMBLY_BOTTOM_LEFT:
111                        order = il - (col * rows + (rl - r));
112                        break;
113                    case ASSEMBLY_RIGHT_TOP:
114                        order = il - (r * cols + (cl - col));
115                        break;
116                    case ASSEMBLY_TOP_LEFT:
117                        order = il - (col * rows + r);
118                    case ASSEMBLY_LEFT_TOP:
119                        order = il - (r * cols + col);
120                        break;
121                    case ASSEMBLY_BOTTOM_RIGHT:
122                        order = col * rows + r;
123                        break;
124                    case ASSEMBLY_LEFT_BOTTOM:
125                        order = r * cols + (cl - col);
126                        break;
127                    case ASSEMBLY_TOP_RIGHT:
128                        order = col * rows + (rl - r);
129                        break;
130                    default:
131                        order = r * cols + col;
132                        break; //ASSEMBLY_RIGHT_BOTTOM
133                }
134                PushFormationOrder(a, order, [r, col]);
135            }
136        }
137
138        return a;
139    };
140
141    _This.$FormationSwirl = function (transition) {
142        var cols = transition.$Cols;
143        var rows = transition.$Rows;
144        var formationDirection = transition.$Assembly;
145        var count = transition.$Count;
146        var a = [];
147        var hit = [];
148        var i = 0;
149        var col = 0;
150        var r = 0;
151        var cl = cols - 1;
152        var rl = rows - 1;
153        var il = count - 1;
154        var cr;
155        var courses;
156        var course = 0;
157        switch (formationDirection) {
158            case ASSEMBLY_BOTTOM_LEFT:
159                col = cl;
160                r = 0;
161                courses = [ROW_INCREASE, COLUMN_DECREASE, ROW_DECREASE, COLUMN_INCREASE];
162                break;
163            case ASSEMBLY_RIGHT_TOP:
164                col = 0;
165                r = rl;
166                courses = [COLUMN_INCREASE, ROW_DECREASE, COLUMN_DECREASE, ROW_INCREASE];
167                break;
168            case ASSEMBLY_TOP_LEFT:
169                col = cl;
170                r = rl;
171                courses = [ROW_DECREASE, COLUMN_DECREASE, ROW_INCREASE, COLUMN_INCREASE];
172                break;
173            case ASSEMBLY_LEFT_TOP:
174                col = cl;
175                r = rl;
176                courses = [COLUMN_DECREASE, ROW_DECREASE, COLUMN_INCREASE, ROW_INCREASE];
177                break;
178            case ASSEMBLY_BOTTOM_RIGHT:
179                col = 0;
180                r = 0;
181                courses = [ROW_INCREASE, COLUMN_INCREASE, ROW_DECREASE, COLUMN_DECREASE];
182                break;
183            case ASSEMBLY_LEFT_BOTTOM:
184                col = cl;
185                r = 0;
186                courses = [COLUMN_DECREASE, ROW_INCREASE, COLUMN_INCREASE, ROW_DECREASE];
187                break;
188            case ASSEMBLY_TOP_RIGHT:
189                col = 0;
190                r = rl;
191                courses = [ROW_DECREASE, COLUMN_INCREASE, ROW_INCREASE, COLUMN_DECREASE];
192                break;
193            default:
194                col = 0;
195                r = 0;
196                courses = [COLUMN_INCREASE, ROW_INCREASE, COLUMN_DECREASE, ROW_DECREASE];
197                break; //ASSEMBLY_RIGHT_BOTTOM
198        }
199        i = 0;
200        while (i < count) {
201            cr = r + ',' + col;
202            if (col >= 0 && col < cols && r >= 0 && r < rows && !hit[cr]) {
203                //a[cr] = i++;
204                hit[cr] = true;
205                PushFormationOrder(a, i++, [r, col]);
206            }
207            else {
208                switch (courses[course++ % courses.length]) {
209                    case COLUMN_INCREASE:
210                        col--;
211                        break;
212                    case ROW_INCREASE:
213                        r--;
214                        break;
215                    case COLUMN_DECREASE:
216                        col++;
217                        break;
218                    case ROW_DECREASE:
219                        r++;
220                        break;
221                }
222            }
223
224            switch (courses[course % courses.length]) {
225                case COLUMN_INCREASE:
226                    col++;
227                    break;
228                case ROW_INCREASE:
229                    r++;
230                    break;
231                case COLUMN_DECREASE:
232                    col--;
233                    break;
234                case ROW_DECREASE:
235                    r--;
236                    break;
237            }
238        }
239        return a;
240    };
241
242    _This.$FormationZigZag = function (transition) {
243        var cols = transition.$Cols;
244        var rows = transition.$Rows;
245        var formationDirection = transition.$Assembly;
246        var count = transition.$Count;
247        var a = [];
248        var i = 0;
249        var col = 0;
250        var r = 0;
251        var cl = cols - 1;
252        var rl = rows - 1;
253        var il = count - 1;
254        var cr;
255        var courses;
256        var course = 0;
257        switch (formationDirection) {
258            case ASSEMBLY_BOTTOM_LEFT:
259                col = cl;
260                r = 0;
261                courses = [ROW_INCREASE, COLUMN_DECREASE, ROW_DECREASE, COLUMN_DECREASE];
262                break;
263            case ASSEMBLY_RIGHT_TOP:
264                col = 0;
265                r = rl;
266                courses = [COLUMN_INCREASE, ROW_DECREASE, COLUMN_DECREASE, ROW_DECREASE];
267                break;
268            case ASSEMBLY_TOP_LEFT:
269                col = cl;
270                r = rl;
271                courses = [ROW_DECREASE, COLUMN_DECREASE, ROW_INCREASE, COLUMN_DECREASE];
272                break;
273            case ASSEMBLY_LEFT_TOP:
274                col = cl;
275                r = rl;
276                courses = [COLUMN_DECREASE, ROW_DECREASE, COLUMN_INCREASE, ROW_DECREASE];
277                break;
278            case ASSEMBLY_BOTTOM_RIGHT:
279                col = 0;
280                r = 0;
281                courses = [ROW_INCREASE, COLUMN_INCREASE, ROW_DECREASE, COLUMN_INCREASE];
282                break;
283            case ASSEMBLY_LEFT_BOTTOM:
284                col = cl;
285                r = 0;
286                courses = [COLUMN_DECREASE, ROW_INCREASE, COLUMN_INCREASE, ROW_INCREASE];
287                break;
288            case ASSEMBLY_TOP_RIGHT:
289                col = 0;
290                r = rl;
291                courses = [ROW_DECREASE, COLUMN_INCREASE, ROW_INCREASE, COLUMN_INCREASE];
292                break;
293            default:
294                col = 0;
295                r = 0;
296                courses = [COLUMN_INCREASE, ROW_INCREASE, COLUMN_DECREASE, ROW_INCREASE];
297                break; //ASSEMBLY_RIGHT_BOTTOM
298        }
299        i = 0;
300        while (i < count) {
301            cr = r + ',' + col;
302            if (col >= 0 && col < cols && r >= 0 && r < rows && typeof (a[cr]) == 'undefined') {
303                PushFormationOrder(a, i++, [r, col]);
304                //a[cr] = i++;
305                switch (courses[course % courses.length]) {
306                    case COLUMN_INCREASE:
307                        col++;
308                        break;
309                    case ROW_INCREASE:
310                        r++;
311                        break;
312                    case COLUMN_DECREASE:
313                        col--;
314                        break;
315                    case ROW_DECREASE:
316                        r--;
317                        break;
318                }
319            }
320            else {
321                switch (courses[course++ % courses.length]) {
322                    case COLUMN_INCREASE:
323                        col--;
324                        break;
325                    case ROW_INCREASE:
326                        r--;
327                        break;
328                    case COLUMN_DECREASE:
329                        col++;
330                        break;
331                    case ROW_DECREASE:
332                        r++;
333                        break;
334                }
335                switch (courses[course++ % courses.length]) {
336                    case COLUMN_INCREASE:
337                        col++;
338                        break;
339                    case ROW_INCREASE:
340                        r++;
341                        break;
342                    case COLUMN_DECREASE:
343                        col--;
344                        break;
345                    case ROW_DECREASE:
346                        r--;
347                        break;
348                }
349            }
350        }
351        return a;
352    };
353
354    _This.$FormationStraightStairs = function (transition) {
355        var cols = transition.$Cols;
356        var rows = transition.$Rows;
357        var formationDirection = transition.$Assembly;
358        var count = transition.$Count;
359        var a = [];
360        var i = 0;
361        var col = 0;
362        var r = 0;
363        var cl = cols - 1;
364        var rl = rows - 1;
365        var il = count - 1;
366        var cr;
367        switch (formationDirection) {
368            case ASSEMBLY_BOTTOM_LEFT:
369            case ASSEMBLY_TOP_RIGHT:
370            case ASSEMBLY_TOP_LEFT:
371            case ASSEMBLY_BOTTOM_RIGHT:
372                var C = 0;
373                var R = 0;
374                break;
375            case ASSEMBLY_LEFT_BOTTOM:
376            case ASSEMBLY_RIGHT_TOP:
377            case ASSEMBLY_LEFT_TOP:
378            case ASSEMBLY_RIGHT_BOTTOM:
379                var C = cl;
380                var R = 0;
381                break;
382            default:
383                formationDirection = ASSEMBLY_RIGHT_BOTTOM;
384                var C = cl;
385                var R = 0;
386                break;
387        }
388        col = C;
389        r = R;
390        while (i < count) {
391            cr = r + ',' + col;
392            if (isToTop(formationDirection) || isToRight(formationDirection)) {
393                PushFormationOrder(a, il - i++, [r, col]);
394                //a[cr] = il - i++;
395            }
396            else {
397                PushFormationOrder(a, i++, [r, col]);
398                //a[cr] = i++;
399            }
400            switch (formationDirection) {
401                case ASSEMBLY_BOTTOM_LEFT:
402                case ASSEMBLY_TOP_RIGHT:
403                    col--;
404                    r++;
405                    break;
406                case ASSEMBLY_TOP_LEFT:
407                case ASSEMBLY_BOTTOM_RIGHT:
408                    col++;
409                    r--;
410                    break;
411                case ASSEMBLY_LEFT_BOTTOM:
412                case ASSEMBLY_RIGHT_TOP:
413                    col--;
414                    r--;
415                    break;
416                case ASSEMBLY_RIGHT_BOTTOM:
417                case ASSEMBLY_LEFT_TOP:
418                default:
419                    col++;
420                    r++;
421                    break;
422            }
423            if (col < 0 || r < 0 || col > cl || r > rl) {
424                switch (formationDirection) {
425                    case ASSEMBLY_BOTTOM_LEFT:
426                    case ASSEMBLY_TOP_RIGHT:
427                        C++;
428                        break;
429                    case ASSEMBLY_LEFT_BOTTOM:
430                    case ASSEMBLY_RIGHT_TOP:
431                    case ASSEMBLY_TOP_LEFT:
432                    case ASSEMBLY_BOTTOM_RIGHT:
433                        R++;
434                        break;
435                    case ASSEMBLY_RIGHT_BOTTOM:
436                    case ASSEMBLY_LEFT_TOP:
437                    default:
438                        C--;
439                        break;
440                }
441                if (C < 0 || R < 0 || C > cl || R > rl) {
442                    switch (formationDirection) {
443                        case ASSEMBLY_BOTTOM_LEFT:
444                        case ASSEMBLY_TOP_RIGHT:
445                            C = cl;
446                            R++;
447                            break;
448                        case ASSEMBLY_TOP_LEFT:
449                        case ASSEMBLY_BOTTOM_RIGHT:
450                            R = rl;
451                            C++;
452                            break;
453                        case ASSEMBLY_LEFT_BOTTOM:
454                        case ASSEMBLY_RIGHT_TOP: R = rl; C--;
455                            break;
456                        case ASSEMBLY_RIGHT_BOTTOM:
457                        case ASSEMBLY_LEFT_TOP:
458                        default:
459                            C = 0;
460                            R++;
461                            break;
462                    }
463                    if (R > rl)
464                        R = rl;
465                    else if (R < 0)
466                        R = 0;
467                    else if (C > cl)
468                        C = cl;
469                    else if (C < 0)
470                        C = 0;
471                }
472                r = R;
473                col = C;
474            }
475        }
476        return a;
477    };
478
479    _This.$FormationSquare = function (transition) {
480        var cols = transition.$Cols || 1;
481        var rows = transition.$Rows || 1;
482        var arr = [];
483        var i = 0;
484        var col;
485        var r;
486        var dc;
487        var dr;
488        var cr;
489        dc = cols < rows ? (rows - cols) / 2 : 0;
490        dr = cols > rows ? (cols - rows) / 2 : 0;
491        cr = Math.round(Math.max(cols / 2, rows / 2)) + 1;
492        for (col = 0; col < cols; col++) {
493            for (r = 0; r < rows; r++)
494                PushFormationOrder(arr, cr - Math.min(col + 1 + dc, r + 1 + dr, cols - col + dc, rows - r + dr), [r, col]);
495        }
496        return arr;
497    };
498
499    _This.$FormationRectangle = function (transition) {
500        var cols = transition.$Cols || 1;
501        var rows = transition.$Rows || 1;
502        var arr = [];
503        var i = 0;
504        var col;
505        var r;
506        var cr;
507        cr = Math.round(Math.min(cols / 2, rows / 2)) + 1;
508        for (col = 0; col < cols; col++) {
509            for (r = 0; r < rows; r++)
510                PushFormationOrder(arr, cr - Math.min(col + 1, r + 1, cols - col, rows - r), [r, col]);
511        }
512        return arr;
513    };
514
515    _This.$FormationRandom = function (transition) {
516        var a = [];
517        var r, col, i;
518        for (r = 0; r < transition.$Rows; r++) {
519            for (col = 0; col < transition.$Cols; col++)
520                PushFormationOrder(a, Math.ceil(100000 * Math.random()) % 13, [r, col]);
521        }
522
523        return a;
524    };
525
526    _This.$FormationCircle = function (transition) {
527        var cols = transition.$Cols || 1;
528        var rows = transition.$Rows || 1;
529        var arr = [];
530        var i = 0;
531        var col;
532        var r;
533        var hc = cols / 2 - 0.5;
534        var hr = rows / 2 - 0.5;
535        for (col = 0; col < cols; col++) {
536            for (r = 0; r < rows; r++)
537                PushFormationOrder(arr, Math.round(Math.sqrt(Math.pow(col - hc, 2) + Math.pow(r - hr, 2))), [r, col]);
538        }
539        return arr;
540    };
541
542    _This.$FormationCross = function (transition) {
543        var cols = transition.$Cols || 1;
544        var rows = transition.$Rows || 1;
545        var arr = [];
546        var i = 0;
547        var col;
548        var r;
549        var hc = cols / 2 - 0.5;
550        var hr = rows / 2 - 0.5;
551        for (col = 0; col < cols; col++) {
552            for (r = 0; r < rows; r++)
553                PushFormationOrder(arr, Math.round(Math.min(Math.abs(col - hc), Math.abs(r - hr))), [r, col]);
554        }
555        return arr;
556    };
557
558    _This.$FormationRectangleCross = function (transition) {
559        var cols = transition.$Cols || 1;
560        var rows = transition.$Rows || 1;
561        var arr = [];
562        var i = 0;
563        var col;
564        var r;
565        var hc = cols / 2 - 0.5;
566        var hr = rows / 2 - 0.5;
567        var cr = Math.max(hc, hr) + 1;
568        for (col = 0; col < cols; col++) {
569            for (r = 0; r < rows; r++)
570                PushFormationOrder(arr, Math.round(cr - Math.max(hc - Math.abs(col - hc), hr - Math.abs(r - hr))) - 1, [r, col]);
571        }
572        return arr;
573    };
574};
575
576var $JssorSlideshowRunner$ = window.$JssorSlideshowRunner$ = function (slideContainer, slideContainerWidth, slideContainerHeight, slideshowOptions, isTouchDevice) {
577
578    var _SelfSlideshowRunner = this;
579
580    //var _State = 0; //-1 fullfill, 0 clean, 1 initializing, 2 stay, 3 playing
581    var _EndTime;
582
583    var _SliderFrameCount;
584
585    var _SlideshowPlayerBelow;
586    var _SlideshowPlayerAbove;
587
588    var _PrevItem;
589    var _SlideItem;
590
591    var _TransitionIndex = 0;
592    var _TransitionsOrder = slideshowOptions.$TransitionsOrder;
593
594    var _SlideshowTransition;
595
596    var _SlideshowPerformance = 8;
597
598    //#region Private Methods
599    function EnsureTransitionInstance(options, slideshowInterval) {
600
601        var slideshowTransition = {
602            $Interval: slideshowInterval,  //Delay to play next frame
603            $Duration: 1, //Duration to finish the entire transition
604            $Delay: 0,  //Delay to assembly blocks
605            $Cols: 1,   //Number of columns
606            $Rows: 1,   //Number of rows
607            $Opacity: 0,   //Fade block or not
608            $Zoom: 0,   //Zoom block or not
609            $Clip: 0,   //Clip block or not
610            $Move: false,   //Move block or not
611            $SlideOut: false,   //Slide the previous slide out to display next slide instead
612            //$FlyDirection: 0,   //Specify fly transform with direction
613            $Reverse: false,    //Reverse the assembly or not
614            $Formation: $JssorSlideshowFormations$.$FormationRandom,    //Shape that assembly blocks as
615            $Assembly: 0x0408,   //The way to assembly blocks ASSEMBLY_RIGHT_BOTTOM
616            $ChessMode: { $Column: 0, $Row: 0 },    //Chess move or fly direction
617            $Easing: $JssorEasing$.$EaseSwing,  //Specify variation of speed during transition
618            $Round: {},
619            $Blocks: [],
620            $During: {}
621        };
622
623        $Jssor$.$Extend(slideshowTransition, options);
624
625        slideshowTransition.$Count = slideshowTransition.$Cols * slideshowTransition.$Rows;
626        if ($Jssor$.$IsFunction(slideshowTransition.$Easing))
627            slideshowTransition.$Easing = { $Default: slideshowTransition.$Easing };
628
629        slideshowTransition.$FramesCount = Math.ceil(slideshowTransition.$Duration / slideshowTransition.$Interval);
630
631        slideshowTransition.$GetBlocks = function (width, height) {
632            width /= slideshowTransition.$Cols;
633            height /= slideshowTransition.$Rows;
634            var wh = width + 'x' + height;
635            if (!slideshowTransition.$Blocks[wh]) {
636                slideshowTransition.$Blocks[wh] = { $Width: width, $Height: height };
637                for (var col = 0; col < slideshowTransition.$Cols; col++) {
638                    for (var r = 0; r < slideshowTransition.$Rows; r++)
639                        slideshowTransition.$Blocks[wh][r + ',' + col] = { $Top: r * height, $Right: col * width + width, $Bottom: r * height + height, $Left: col * width };
640                }
641            }
642
643            return slideshowTransition.$Blocks[wh];
644        };
645
646        if (slideshowTransition.$Brother) {
647            slideshowTransition.$Brother = EnsureTransitionInstance(slideshowTransition.$Brother, slideshowInterval);
648            slideshowTransition.$SlideOut = true;
649        }
650
651        return slideshowTransition;
652    }
653    //#endregion
654
655    //#region Private Classes
656    function JssorSlideshowPlayer(slideContainer, slideElement, slideTransition, beginTime, slideContainerWidth, slideContainerHeight) {
657        var _Self = this;
658
659        var _Block;
660        var _StartStylesArr = {};
661        var _AnimationStylesArrs = {};
662        var _AnimationBlockItems = [];
663        var _StyleStart;
664        var _StyleEnd;
665        var _StyleDif;
666        var _ChessModeColumn = slideTransition.$ChessMode.$Column || 0;
667        var _ChessModeRow = slideTransition.$ChessMode.$Row || 0;
668
669        var _Blocks = slideTransition.$GetBlocks(slideContainerWidth, slideContainerHeight);
670        var _FormationInstance = GetFormation(slideTransition);
671        var _MaxOrder = _FormationInstance.length - 1;
672        var _Period = slideTransition.$Duration + slideTransition.$Delay * _MaxOrder;
673        var _EndTime = beginTime + _Period;
674
675        var _SlideOut = slideTransition.$SlideOut;
676        var _IsIn;
677
678        //_EndTime += $Jssor$.$IsBrowserChrome() ? 260 : 50;
679        _EndTime += 50;
680
681        //#region Private Methods
682
683        function GetFormation(transition) {
684
685            var formationInstance = transition.$Formation(transition);
686
687            return transition.$Reverse ? formationInstance.reverse() : formationInstance;
688
689        }
690        //#endregion
691
692        _Self.$EndTime = _EndTime;
693
694        _Self.$ShowFrame = function (time) {
695            time -= beginTime;
696
697            var isIn = time < _Period;
698
699            if (isIn || _IsIn) {
700                _IsIn = isIn;
701
702                if (!_SlideOut)
703                    time = _Period - time;
704
705                var frameIndex = Math.ceil(time / slideTransition.$Interval);
706
707                $Jssor$.$Each(_AnimationStylesArrs, function (value, index) {
708
709                    var itemFrameIndex = Math.max(frameIndex, value.$Min);
710                    itemFrameIndex = Math.min(itemFrameIndex, value.length - 1);
711
712                    if (value.$LastFrameIndex != itemFrameIndex) {
713                        if (!value.$LastFrameIndex && !_SlideOut) {
714                            $Jssor$.$ShowElement(_AnimationBlockItems[index]);
715                        }
716                        else if (itemFrameIndex == value.$Max && _SlideOut) {
717                            $Jssor$.$HideElement(_AnimationBlockItems[index]);
718                        }
719                        value.$LastFrameIndex = itemFrameIndex;
720                        $Jssor$.$SetStylesEx(_AnimationBlockItems[index], value[itemFrameIndex]);
721                    }
722                });
723            }
724        };
725
726        function DisableHWA(elmt) {
727            $Jssor$.$DisableHWA(elmt);
728
729            var children = $Jssor$.$Children(elmt);
730
731            $Jssor$.$Each(children, function (child) {
732                DisableHWA(child);
733            });
734        }
735
736        //constructor
737        {
738            slideElement = $Jssor$.$CloneNode(slideElement);
739            //$Jssor$.$RemoveAttribute(slideElement, "id");
740            DisableHWA(slideElement);
741            if ($Jssor$.$IsBrowserIe9Earlier()) {
742                var hasImage = !slideElement["no-image"];
743                var slideChildElements = $Jssor$.$FindChildrenByTag(slideElement);
744                $Jssor$.$Each(slideChildElements, function (slideChildElement) {
745                    if (hasImage || slideChildElement["jssor-slider"])
746                        $Jssor$.$CssOpacity(slideChildElement, $Jssor$.$CssOpacity(slideChildElement), true);
747                });
748            }
749
750            $Jssor$.$Each(_FormationInstance, function (formationItems, order) {
751                $Jssor$.$Each(formationItems, function (formationItem) {
752                    var row = formationItem[0];
753                    var col = formationItem[1];
754                    {
755                        var columnRow = row + ',' + col;
756
757                        var chessHorizontal = false;
758                        var chessVertical = false;
759                        var chessRotate = false;
760
761                        if (_ChessModeColumn && col % 2) {
762                            if (_ChessModeColumn & 3/*$JssorDirection$.$IsHorizontal(_ChessModeColumn)*/) {
763                                chessHorizontal = !chessHorizontal;
764                            }
765                            if (_ChessModeColumn & 12/*$JssorDirection$.$IsVertical(_ChessModeColumn)*/) {
766                                chessVertical = !chessVertical;
767                            }
768
769                            if (_ChessModeColumn & 16)
770                                chessRotate = !chessRotate;
771                        }
772
773                        if (_ChessModeRow && row % 2) {
774                            if (_ChessModeRow & 3/*$JssorDirection$.$IsHorizontal(_ChessModeRow)*/) {
775                                chessHorizontal = !chessHorizontal;
776                            }
777                            if (_ChessModeRow & 12/*$JssorDirection$.$IsVertical(_ChessModeRow)*/) {
778                                chessVertical = !chessVertical;
779                            }
780                            if (_ChessModeRow & 16)
781                                chessRotate = !chessRotate;
782                        }
783
784                        slideTransition.$Top = slideTransition.$Top || (slideTransition.$Clip & 4);
785                        slideTransition.$Bottom = slideTransition.$Bottom || (slideTransition.$Clip & 8);
786                        slideTransition.$Left = slideTransition.$Left || (slideTransition.$Clip & 1);
787                        slideTransition.$Right = slideTransition.$Right || (slideTransition.$Clip & 2);
788
789                        var topBenchmark = chessVertical ? slideTransition.$Bottom : slideTransition.$Top;
790                        var bottomBenchmark = chessVertical ? slideTransition.$Top : slideTransition.$Bottom;
791                        var leftBenchmark = chessHorizontal ? slideTransition.$Right : slideTransition.$Left;
792                        var rightBenchmark = chessHorizontal ? slideTransition.$Left : slideTransition.$Right;
793
794                        slideTransition.$Clip = topBenchmark || bottomBenchmark || leftBenchmark || rightBenchmark;
795
796                        _StyleDif = {};
797                        _StyleEnd = { $Top: 0, $Left: 0, $Opacity: 1, $Width: slideContainerWidth, $He
797ight: slideContainerHeight };
798                        _StyleStart = $Jssor$.$Extend({}, _StyleEnd);
799                        _Block = $Jssor$.$Extend({}, _Blocks[columnRow]);
800
801                        if (slideTransition.$Opacity) {
802                            _StyleEnd.$Opacity = 2 - slideTransition.$Opacity;
803                        }
804
805                        if (slideTransition.$ZIndex) {
806                            _StyleEnd.$ZIndex = slideTransition.$ZIndex;
807                            _StyleStart.$ZIndex = 0;
808                        }
809
810                        var allowClip = slideTransition.$Cols * slideTransition.$Rows > 1 || slideTransition.$Clip;
811
812                        if (slideTransition.$Zoom || slideTransition.$Rotate) {
813                            var allowRotate = true;
814                            if ($Jssor$.$IsBrowserIe9Earlier()) {
815                                if (slideTransition.$Cols * slideTransition.$Rows > 1)
816                                    allowRotate = false;
817                                else
818                                    allowClip = false;
819                            }
820
821                            if (allowRotate) {
822                                _StyleEnd.$Zoom = slideTransition.$Zoom ? slideTransition.$Zoom - 1 : 1;
823                                _StyleStart.$Zoom = 1;
824
825                                if ($Jssor$.$IsBrowserIe9Earlier() || $Jssor$.$IsBrowserOpera())
826                                    _StyleEnd.$Zoom = Math.min(_StyleEnd.$Zoom, 2);
827
828                                var rotate = slideTransition.$Rotate;
829
830                                _StyleEnd.$Rotate = rotate * 360 * ((chessRotate) ? -1 : 1);
831                                _StyleStart.$Rotate = 0;
832                            }
833                        }
834
835                        if (allowClip) {
836                            if (slideTransition.$Clip) {
837                                var clipScale = slideTransition.$ScaleClip || 1;
838                                var blockOffset = _Block.$Offset = {};
839                                if (topBenchmark && bottomBenchmark) {
840                                    blockOffset.$Top = _Blocks.$Height / 2 * clipScale;
841                                    blockOffset.$Bottom = -blockOffset.$Top;
842                                }
843                                else if (topBenchmark) {
844                                    blockOffset.$Bottom = -_Blocks.$Height * clipScale;
845                                }
846                                else if (bottomBenchmark) {
847                                    blockOffset.$Top = _Blocks.$Height * clipScale;
848                                }
849
850                                if (leftBenchmark && rightBenchmark) {
851                                    blockOffset.$Left = _Blocks.$Width / 2 * clipScale;
852                                    blockOffset.$Right = -blockOffset.$Left;
853                                }
854                                else if (leftBenchmark) {
855                                    blockOffset.$Right = -_Blocks.$Width * clipScale;
856                                }
857                                else if (rightBenchmark) {
858                                    blockOffset.$Left = _Blocks.$Width * clipScale;
859                                }
860                            }
861
862                            _StyleDif.$Clip = _Block;
863                            _StyleStart.$Clip = _Blocks[columnRow];
864                        }
865
866                        //fly
867                        {
868                            var chessHor = chessHorizontal ? 1 : -1;
869                            var chessVer = chessVertical ? 1 : -1;
870
871                            if (slideTransition.x)
872                                _StyleEnd.$Left += slideContainerWidth * slideTransition.x * chessHor;
873
874                            if (slideTransition.y)
875                                _StyleEnd.$Top += slideContainerHeight * slideTransition.y * chessVer;
876                        }
877
878                        $Jssor$.$Each(_StyleEnd, function (propertyEnd, property) {
879                            if ($Jssor$.$IsNumeric(propertyEnd)) {
880                                if (propertyEnd != _StyleStart[property]) {
881                                    _StyleDif[property] = propertyEnd - _StyleStart[property];
882                                }
883                            }
884                        });
885
886                        _StartStylesArr[columnRow] = _SlideOut ? _StyleStart : _StyleEnd;
887
888                        var animationStylesArr = [];
889                        var framesCount = slideTransition.$FramesCount;
890                        var virtualFrameCount = Math.round(order * slideTransition.$Delay / slideTransition.$Interval);
891                        _AnimationStylesArrs[columnRow] = new Array(virtualFrameCount);
892                        _AnimationStylesArrs[columnRow].$Min = virtualFrameCount;
893                        _AnimationStylesArrs[columnRow].$Max = virtualFrameCount + framesCount - 1;
894
895                        for (var frameN = 0; frameN <= framesCount; frameN++) {
896                            var styleFrameN = $Jssor$.$Cast(_StyleStart, _StyleDif, frameN / framesCount, slideTransition.$Easing, slideTransition.$During, slideTransition.$Round, { $Move: slideTransition.$Move, $OriginalWidth: slideContainerWidth, $OriginalHeight: slideContainerHeight })
897
898                            styleFrameN.$ZIndex = styleFrameN.$ZIndex || 1;
899
900                            _AnimationStylesArrs[columnRow].push(styleFrameN);
901                        }
902
903                    } //for
904                });
905            });
906
907            _FormationInstance.reverse();
908            $Jssor$.$Each(_FormationInstance, function (formationItems) {
909                $Jssor$.$Each(formationItems, function (formationItem) {
910                    var row = formationItem[0];
911                    var col = formationItem[1];
912
913                    var columnRow = row + ',' + col;
914
915                    var image = slideElement;
916                    if (col || row)
917                        image = $Jssor$.$CloneNode(slideElement);
918
919                    $Jssor$.$SetStyles(image, _StartStylesArr[columnRow]);
920                    $Jssor$.$CssOverflow(image, "hidden");
921
922                    $Jssor$.$CssPosition(image, "absolute");
923                    slideContainer.$AddClipElement(image);
924                    _AnimationBlockItems[columnRow] = image;
925                    $Jssor$.$ShowElement(image, !_SlideOut);
926                });
927            });
928        }
929    }
930
931    function SlideshowProcessor() {
932        var _SelfSlideshowProcessor = this;
933        var _CurrentTime = 0;
934
935        $JssorAnimator$.call(_SelfSlideshowProcessor, 0, _EndTime);
936
937        _SelfSlideshowProcessor.$OnPositionChange = function (oldPosition, newPosition) {
938            if ((newPosition - _CurrentTime) > _SlideshowPerformance) {
939                _CurrentTime = newPosition;
940
941                _SlideshowPlayerAbove && _SlideshowPlayerAbove.$ShowFrame(newPosition);
942                _SlideshowPlayerBelow && _SlideshowPlayerBelow.$ShowFrame(newPosition);
943            }
944        };
945
946        _SelfSlideshowProcessor.$Transition = _SlideshowTransition;
947    }
948    //#endregion
949
950    //member functions
951    _SelfSlideshowRunner.$GetTransition = function (slideCount) {
952        var n = 0;
953
954        var transitions = slideshowOptions.$Transitions;
955
956        var transitionCount = transitions.length;
957
958        if (_TransitionsOrder) { /*Sequence*/
959            //if (transitionCount > slideCount && ($Jssor$.$IsBrowserChrome() || $Jssor$.$IsBrowserSafari() || $Jssor$.$IsBrowserFireFox())) {
960            //    transitionCount -= transitionCount % slideCount;
961            //}
962            n = _TransitionIndex++ % transitionCount;
963        }
964        else { /*Random*/
965            n = Math.floor(Math.random() * transitionCount);
966        }
967
968        transitions[n] && (transitions[n].$Index = n);
969
970        return transitions[n];
971    };
972
973    _SelfSlideshowRunner.$Initialize = function (slideIndex, prevIndex, slideItem, prevItem, slideshowTransition) {
974        $JssorDebug$.$Execute(function () {
975            if (_SlideshowPlayerBelow) {
976                $JssorDebug$.$Fail("slideshow runner has not been cleared.");
977            }
978        });
979
980        _SlideshowTransition = slideshowTransition;
981
982        slideshowTransition = EnsureTransitionInstance(slideshowTransition, _SlideshowPerformance);
983
984        _SlideItem = slideItem;
985        _PrevItem = prevItem;
986
987        var prevSlideElement = prevItem.$Item;
988        var currentSlideElement = slideItem.$Item;
989        prevSlideElement["no-image"] = !prevItem.$Image;
990        currentSlideElement["no-image"] = !slideItem.$Image;
991
992        var slideElementAbove = prevSlideElement;
993        var slideElementBelow = currentSlideElement;
994
995        var slideTransitionAbove = slideshowTransition;
996        var slideTransitionBelow = slideshowTransition.$Brother || EnsureTransitionInstance({}, _SlideshowPerformance);
997
998        if (!slideshowTransition.$SlideOut) {
999            slideElementAbove = currentSlideElement;
1000            slideElementBelow = prevSlideElement;
1001        }
1002
1003        var shift = slideTransitionBelow.$Shift || 0;
1004
1005        _SlideshowPlayerBelow = new JssorSlideshowPlayer(slideContainer, slideElementBelow, slideTransitionBelow, Math.max(shift - slideTransitionBelow.$Interval, 0), slideContainerWidth, slideContainerHeight);
1006        _SlideshowPlayerAbove = new JssorSlideshowPlayer(slideContainer, slideElementAbove, slideTransitionAbove, Math.max(slideTransitionBelow.$Interval - shift, 0), slideContainerWidth, slideContainerHeight);
1007
1008        _SlideshowPlayerBelow.$ShowFrame(0);
1009        _SlideshowPlayerAbove.$ShowFrame(0);
1010
1011        _EndTime = Math.max(_SlideshowPlayerBelow.$EndTime, _SlideshowPlayerAbove.$EndTime);
1012
1013        _SelfSlideshowRunner.$Index = slideIndex;
1014    };
1015
1016    _SelfSlideshowRunner.$Clear = function () {
1017        slideContainer.$Clear();
1018        _SlideshowPlayerBelow = null;
1019        _SlideshowPlayerAbove = null;
1020    };
1021
1022    _SelfSlideshowRunner.$GetProcessor = function () {
1023        var slideshowProcessor = null;
1024
1025        if (_SlideshowPlayerAbove)
1026            slideshowProcessor = new SlideshowProcessor();
1027
1028        return slideshowProcessor;
1029    };
1030
1031    //Constructor
1032    {
1033        if ($Jssor$.$IsBrowserIe9Earlier() || $Jssor$.$IsBrowserOpera() || (isTouchDevice && $Jssor$.$WebKitVersion() < 537)) {
1034            _SlideshowPerformance = 16;
1035        }
1036
1037        $JssorObject$.call(_SelfSlideshowRunner);
1038        $JssorAnimator$.call(_SelfSlideshowRunner, -10000000, 10000000);
1039    }
1040};
1041
1042var $JssorSlider$ = window.$JssorSlider$ = function (elmt, options) {
1043    var _SelfSlider = this;
1044
1045    //#region Private Classes
1046    //Conveyor
1047    function Conveyor() {
1048        var _SelfConveyor = this;
1049        $JssorAnimator$.call(_SelfConveyor, -100000000, 200000000);
1050
1051        _SelfConveyor.$GetCurrentSlideInfo = function () {
1052            var positionDisplay = _SelfConveyor.$GetPosition_Display();
1053            var virtualIndex = Math.floor(positionDisplay);
1054            var slideIndex = GetRealIndex(virtualIndex);
1055            var slidePosition = positionDisplay - Math.floor(positionDisplay);
1056
1057            return { $Index: slideIndex, $VirtualIndex: virtualIndex, $Position: slidePosition };
1058        };
1059
1060        _SelfConveyor.$OnPositionChange = function (oldPosition, newPosition) {
1061
1062            var index = Math.floor(newPosition);
1063            if (index != newPosition && newPosition > oldPosition)
1064                index++;
1065
1066            ResetNavigator(index, true);
1067
1068            _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_POSITION_CHANGE, GetRealIndex(newPosition), GetRealIndex(oldPosition), newPosition, oldPosition);
1069        };
1070    }
1071    //Conveyor
1072
1073    //Carousel
1074    function Carousel() {
1075        var _SelfCarousel = this;
1076
1077        $JssorAnimator$.call(_SelfCarousel, 0, 0, { $LoopLength: _SlideCount });
1078
1079        //Carousel Constructor
1080        {
1081            $Jssor$.$Each(_SlideItems, function (slideItem) {
1082                (_Loop & 1) && slideItem.$SetLoopLength(_SlideCount);
1083                _SelfCarousel.$Chain(slideItem);
1084                slideItem.$Shift(_ParkingPosition / _StepLength);
1085            });
1086        }
1087    }
1088    //Carousel
1089
1090    //Slideshow
1091    function Slideshow() {
1092        var _SelfSlideshow = this;
1093        var _Wrapper = _SlideContainer.$Elmt;
1094
1095        $JssorAnimator$.call(_SelfSlideshow, -1, 2, { $Easing: $JssorEasing$.$EaseLinear, $Setter: { $Position: SetPosition }, $LoopLength: _SlideCount }, _Wrapper, { $Position: 1 }, { $Position: -2 });
1096
1097        _SelfSlideshow.$Wrapper = _Wrapper;
1098
1099        //Slideshow Constructor
1100        {
1101            $JssorDebug$.$Execute(function () {
1102                $Jssor$.$Attribute(_SlideContainer.$Elmt, "debug
1102-id", "slide_container");
1103            });
1104        }
1105    }
1106    //Slideshow
1107
1108    //CarouselPlayer
1109    function CarouselPlayer(carousel, slideshow) {
1110        var _SelfCarouselPlayer = this;
1111        var _FromPosition;
1112        var _ToPosition;
1113        var _Duration;
1114        var _StandBy;
1115        var _StandByPosition;
1116
1117        $JssorAnimator$.call(_SelfCarouselPlayer, -100000000, 200000000, { $IntervalMax: 100 });
1118
1119        _SelfCarouselPlayer.$OnStart = function () {
1120            _IsSliding = true;
1121            _LoadingTicket = null;
1122
1123            //EVT_SWIPE_START
1124            _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_SWIPE_START, GetRealIndex(_Conveyor.$GetPosition()), _Conveyor.$GetPosition());
1125        };
1126
1127        _SelfCarouselPlayer.$OnStop = function () {
1128
1129            _IsSliding = false;
1130            _StandBy = false;
1131
1132            var currentSlideInfo = _Conveyor.$GetCurrentSlideInfo();
1133
1134            //EVT_SWIPE_END
1135            _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_SWIPE_END, GetRealIndex(_Conveyor.$GetPosition()), _Conveyor.$GetPosition());
1136
1137            if (!currentSlideInfo.$Position) {
1138                OnPark(currentSlideInfo.$VirtualIndex, _CurrentSlideIndex);
1139            }
1140        };
1141
1142        _SelfCarouselPlayer.$OnPositionChange = function (oldPosition, newPosition) {
1143
1144            var toPosition;
1145
1146            if (_StandBy)
1147                toPosition = _StandByPosition;
1148            else {
1149                toPosition = _ToPosition;
1150
1151                if (_Duration) {
1152                    var interPosition = newPosition / _Duration;
1153                    toPosition = _Options.$SlideEasing(interPosition) * (_ToPosition - _FromPosition) + _FromPosition;
1154                }
1155            }
1156
1157            _Conveyor.$GoToPosition(toPosition);
1158        };
1159
1160        _SelfCarouselPlayer.$PlayCarousel = function (fromPosition, toPosition, duration, callback) {
1161            $JssorDebug$.$Execute(function () {
1162                if (_SelfCarouselPlayer.$IsPlaying())
1163                    $JssorDebug$.$Fail("The carousel is already playing.");
1164            });
1165
1166            _FromPosition = fromPosition;
1167            _ToPosition = toPosition;
1168            _Duration = duration;
1169
1170            _Conveyor.$GoToPosition(fromPosition);
1171            _SelfCarouselPlayer.$GoToPosition(0);
1172
1173            _SelfCarouselPlayer.$PlayToPosition(duration, callback);
1174        };
1175
1176        _SelfCarouselPlayer.$StandBy = function (standByPosition) {
1177            _StandBy = true;
1178            _StandByPosition = standByPosition;
1179            _SelfCarouselPlayer.$Play(standByPosition, null, true);
1180        };
1181
1182        _SelfCarouselPlayer.$SetStandByPosition = function (standByPosition) {
1183            _StandByPosition = standByPosition;
1184        };
1185
1186        _SelfCarouselPlayer.$MoveCarouselTo = function (position) {
1187            _Conveyor.$GoToPosition(position);
1188        };
1189
1190        //CarouselPlayer Constructor
1191        {
1192            _Conveyor = new Conveyor();
1193
1194            _Conveyor.$Combine(carousel);
1195            _Conveyor.$Combine(slideshow);
1196        }
1197    }
1198    //CarouselPlayer
1199
1200    //SlideContainer
1201    function SlideContainer() {
1202        var _Self = this;
1203        var elmt = CreatePanel();
1204
1205        $Jssor$.$CssZIndex(elmt, 0);
1206        $Jssor$.$Css(elmt, "pointerEvents", "none");
1207
1208        _Self.$Elmt = elmt;
1209
1210        _Self.$AddClipElement = function (clipElement) {
1211            $Jssor$.$AppendChild(elmt, clipElement);
1212            $Jssor$.$ShowElement(elmt);
1213        };
1214
1215        _Self.$Clear = function () {
1216            $Jssor$.$HideElement(elmt);
1217            $Jssor$.$Empty(elmt);
1218        };
1219    }
1220    //SlideContainer
1221
1222    //SlideItem
1223    function SlideItem(slideElmt, slideIndex) {
1224
1225        var _SelfSlideItem = this;
1226
1227        var _CaptionSliderIn;
1228        var _CaptionSliderOut;
1229        var _CaptionSliderCurrent;
1230        var _IsCaptionSliderPlayingWhenDragStart;
1231
1232        var _Wrapper;
1233        var _BaseElement = slideElmt;
1234
1235        var _LoadingScreen;
1236
1237        var _ImageItem;
1238        var _ImageElmts = [];
1239        var _LinkItemOrigin;
1240        var _LinkItem;
1241        var _ImageLoading;
1242        var _ImageLoaded;
1243        var _ImageLazyLoading;
1244        var _ContentRefreshed;
1245
1246        var _Processor;
1247
1248        var _PlayerInstanceElement;
1249        var _PlayerInstance;
1250
1251        var _SequenceNumber;    //for debug only
1252
1253        $JssorAnimator$.call(_SelfSlideItem, -_DisplayPieces, _DisplayPieces + 1, { $SlideItemAnimator: true });
1254
1255        function ResetCaptionSlider(fresh) {
1256            _CaptionSliderOut && _CaptionSliderOut.$Revert();
1257            _CaptionSliderIn && _CaptionSliderIn.$Revert();
1258
1259            RefreshContent(slideElmt, fresh);
1260            _ContentRefreshed = true;
1261
1262            _CaptionSliderIn = new _CaptionSliderOptions.$Class(slideElmt, _CaptionSliderOptions, 1);
1263            $JssorDebug$.$LiveStamp(_CaptionSliderIn, "caption_slider_" + _CaptionSliderCount + "_in");
1264            _CaptionSliderOut = new _CaptionSliderOptions.$Class(slideElmt, _CaptionSliderOptions);
1265            $JssorDebug$.$LiveStamp(_CaptionSliderOut, "caption_slider_" + _CaptionSliderCount + "_out");
1266
1267            $JssorDebug$.$Execute(function () {
1268                _CaptionSliderCount++;
1269            });
1270
1271            _CaptionSliderOut.$GoToBegin();
1272            _CaptionSliderIn.$GoToBegin();
1273        }
1274
1275        function EnsureCaptionSliderVersion() {
1276            if (_CaptionSliderIn.$Version < _CaptionSliderOptions.$Version) {
1277                ResetCaptionSlider();
1278            }
1279        }
1280
1281        //event handling begin
1282        function LoadImageCompleteEventHandler(completeCallback, loadingScreen, image) {
1283            if (!_ImageLoaded) {
1284                _ImageLoaded = true;
1285
1286                if (_ImageItem && image) {
1287                    var imageWidth = image.width;
1288                    var imageHeight = image.height;
1289                    var fillWidth = imageWidth;
1290                    var fillHeight = imageHeight;
1291
1292                    if (imageWidth && imageHeight && _Options.$FillMode) {
1293
1294                        //0 stretch, 1 contain (keep aspect ratio and put all inside slide), 2 cover (keep aspect ratio and cover whole slide), 4 actual size, 5 contain for large image, actual size for small image, default value is 0
1295                        if (_Options.$FillMode & 3 && (!(_Options.$FillMode & 4) || imageWidth > _SlideWidth || imageHeight > _SlideHeight)) {
1296                            var fitHeight = false;
1297                            var ratio = _SlideWidth / _SlideHeight * imageHeight / imageWidth;
1298
1299                            if (_Options.$FillMode & 1) {
1300                                fitHeight = (ratio > 1);
1301                            }
1302                            else if (_Options.$FillMode & 2) {
1303                                fitHeight = (ratio < 1);
1304                            }
1305                            fillWidth = fitHeight ? imageWidth * _SlideHeight / imageHeight : _SlideWidth;
1306                            fillHeight = fitHeight ? _SlideHeight : imageHeight * _SlideWidth / imageWidth;
1307                        }
1308
1309                        $Jssor$.$CssWidth(_ImageItem, fillWidth);
1310                        $Jssor$.$CssHeight(_ImageItem, fillHeight);
1311                        $Jssor$.$CssTop(_ImageItem, (_SlideHeight - fillHeight) / 2);
1312                        $Jssor$.$CssLeft(_ImageItem, (_SlideWidth - fillWidth) / 2);
1313                    }
1314
1315                    $Jssor$.$CssPosition(_ImageItem, "absolute");
1316
1317                    _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_LOAD_END, slideIndex);
1318                }
1319            }
1320
1321            $Jssor$.$HideElement(loadingScreen);
1322            completeCallback && completeCallback(_SelfSlideItem);
1323        }
1324
1325        function LoadSlideshowImageCompleteEventHandler(nextIndex, nextItem, slideshowTransition, loadingTicket) {
1326            if (loadingTicket == _LoadingTicket && _CurrentSlideIndex == slideIndex && _AutoPlay) {
1327                if (!_Frozen) {
1328                    var nextRealIndex = GetRealIndex(nextIndex);
1329                    _SlideshowRunner.$Initialize(nextRealIndex, slideIndex, nextItem, _SelfSlideItem, slideshowTransition);
1330                    nextItem.$HideContentForSlideshow();
1331                    _Slideshow.$Locate(nextRealIndex, 1);
1332                    _Slideshow.$GoToPosition(nextRealIndex);
1333                    _CarouselPlayer.$PlayCarousel(nextIndex, nextIndex, 0);
1334                }
1335            }
1336        }
1337
1338        function SlideReadyEventHandler(loadingTicket) {
1339            if (loadingTicket == _LoadingTicket && _CurrentSlideIndex == slideIndex) {
1340
1341                if (!_Processor) {
1342                    var slideshowProcessor = null;
1343                    if (_SlideshowRunner) {
1344                        if (_SlideshowRunner.$Index == slideIndex)
1345                            slideshowProcessor = _SlideshowRunner.$GetProcessor();
1346                        else
1347                            _SlideshowRunner.$Clear();
1348                    }
1349
1350                    EnsureCaptionSliderVersion();
1351
1352                    _Processor = new Processor(slideElmt, slideIndex, slideshowProcessor, _SelfSlideItem.$GetCaptionSliderIn(), _SelfSlideItem.$GetCaptionSliderOut());
1353                    _Processor.$SetPlayer(_PlayerInstance);
1354                }
1355
1356                !_Processor.$IsPlaying() && _Processor.$Replay();
1357            }
1358        }
1359
1360        function ParkEventHandler(currentIndex, previousIndex, manualActivate) {
1361            if (currentIndex == slideIndex) {
1362
1363                if (currentIndex != previousIndex)
1364                    _SlideItems[previousIndex] && _SlideItems[previousIndex].$ParkOut();
1365                else
1366                    !manualActivate && _Processor && _Processor.$AdjustIdleOnPark();
1367
1368                _PlayerInstance && _PlayerInstance.$Enable();
1369
1370                //park in
1371                var loadingTicket = _LoadingTicket = $Jssor$.$GetNow();
1372                _SelfSlideItem.$LoadImage($Jssor$.$CreateCallback(null, SlideReadyEventHandler, loadingTicket));
1373            }
1374            else {
1375                var distance = Math.abs(slideIndex - currentIndex);
1376                var loadRange = _DisplayPieces + _Options.$LazyLoading - 1;
1377                if (!_ImageLazyLoading || distance <= loadRange) {
1378                    _SelfSlideItem.$LoadImage();
1379                }
1380            }
1381        }
1382
1383        function SwipeStartEventHandler() {
1384            if (_CurrentSlideIndex == slideIndex && _Processor) {
1385                _Processor.$Stop();
1386                _PlayerInstance && _PlayerInstance.$Quit();
1387                _PlayerInstance && _PlayerInstance.$Disable();
1388                _Processor.$OpenSlideshowPanel();
1389            }
1390        }
1391
1392        function FreezeEventHandler() {
1393            if (_CurrentSlideIndex == slideIndex && _Processor) {
1394                _Processor.$Stop();
1395            }
1396        }
1397
1398        function ContentClickEventHandler(event) {
1399            if (_LastDragSucceded) {
1400                $Jssor$.$StopEvent(event);
1401
1402                var checkElement = $Jssor$.$EvtSrc(event);
1403                while (checkElement && slideElmt !== checkElement) {
1404                    if (checkElement.tagName == "A") {
1405                        $Jssor$.$CancelEvent(event);
1406                    }
1407                    try {
1408                        checkElement = checkElement.parentNode;
1409                    } catch (e) {
1410                        // Firefox sometimes fires events for XUL elements, which throws
1411                        // a "permission denied" error. so this is not a child.
1412                        break;
1413                    }
1414                }
1415            }
1416        }
1417
1418        function SlideClickEventHandler(event) {
1419            if (!_LastDragSucceded) {
1420                _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_CLICK, slideIndex, event);
1421            }
1422        }
1423
1424        function PlayerAvailableEventHandler() {
1425            _PlayerInstance = _PlayerInstanceElement.pInstance;
1426            _Processor && _Processor.$SetPlayer(_PlayerInstance);
1427        }
1428
1429        _SelfSlideItem.$LoadImage = function (completeCallback, loadingScreen) {
1430            loadingScreen = loadingScreen || _LoadingScreen;
1431
1432            if (_ImageElmts.length && !_ImageLoaded) {
1433
1434                $Jssor$.$ShowElement(loadingScreen);
1435
1436                if (!_ImageLoading) {
1437                    _ImageLoading = true;
1438                    _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_LOAD_START, slideIndex);
1439
1440                    $Jssor$.$Each(_ImageElmts, function (imageElmt) {
1441
1442                        if (!$Jssor$.$Attribute(imageElmt, "src")) {
1443                            imageElmt.src = $Jssor$.$AttributeEx(imageElmt, "src2");
1444                            $Jssor$.$CssDisplay(imageElmt, imageElmt["display-origin"]);
1445                        }
1446                    });
1447                }
1448                $Jssor$.$LoadImages(_ImageElmts, _ImageItem, $Jssor$.$CreateCallback(null, LoadImageCompleteEventHandler, completeCallback, loadingScreen));
1449            }
1450            else {
1451                LoadImageCompleteEventHandler(completeCallback, loadingScreen);
1452            }
1453        };
1454
1455        _SelfSlideItem.$GoForNextSlide = function () {
1456            if (_SlideshowRunner) {
1457                var slideshowTransition = _SlideshowRunner.$GetTransition(_SlideCount);
1458
1459                if (slideshowTransition) {
1460                    var loadingTicket = _LoadingTicket = $Jssor$.$GetNow();
1461
1462                    var nextIndex = slideIndex + _PlayReverse;
1463                    var nextItem = _SlideItems[GetRealIndex(nextIndex)];
1464                    return nextItem.$LoadImage($Jssor$.$CreateCallback(null, LoadSlideshowImageCompleteEventHandler, nextIndex, nextItem, slideshowTransition, loadingTicket), _LoadingScreen);
1465                }
1466            }
1467
1468            PlayTo(_CurrentSlideIndex + _Options.$AutoPlaySteps * _PlayReverse);
1469        };
1470
1471        _SelfSlideItem.$TryActivate = function () {
1472            ParkEventHandler(slideIndex, slideIndex, true);
1473        };
1474
1475        _SelfSlideItem.$ParkOut = function () {
1476            //park out
1477            _PlayerInstance && _PlayerInstance.$Quit();
1478            _PlayerInstance && _PlayerInstance.$Disable();
1479            _SelfSlideItem.$UnhideContentForSlideshow();
1480            _Processor && _Processor.$Abort();
1481            _Processor = null;
1482            ResetCaptionSlider();
1483        };
1484
1485        //for debug only
1486        _SelfSlideItem.$StampSlideItemElements = function (stamp) {
1487            stamp = _SequenceNumber + "_" + stamp;
1488
1489            $JssorDebug$.$Execute(function () {
1490                if (_ImageItem)
1491                    $Jssor$.$Attribute(_ImageItem, "debug-id", stamp + "_slide_item_image_id");
1492
1493                $Jssor$.$Attribute(slideElmt, "debug-id", stamp + "_slide_item_item_id");
1494            });
1495
1496            $JssorDebug$.$Execute(function () {
1497                $Jssor$.$Attribute(_Wrapper, "debug-id", stamp + "_slide_item_wrapper_id");
1498            });
1499
1500            $JssorDebug$.$Execute(function () {
1501                $Jssor$.$Attribute(_LoadingScreen, "debug-id", stamp + "_loading_container_id");
1502            });
1503        };
1504
1505        _SelfSlideItem.$HideContentForSlideshow = function () {
1506            $Jssor$.$HideElement(slideElmt);
1507        };
1508
1509        _SelfSlideItem.$UnhideContentForSlideshow = function () {
1510            $Jssor$.$ShowElement(slideElmt);
1511        };
1512
1513        _SelfSlideItem.$EnablePlayer = function () {
1514            _PlayerInstance && _PlayerInstance.$Enable();
1515        };
1516
1517        function RefreshContent(elmt, fresh, level) {
1518            $JssorDebug$.$Execute(function () {
1519                if ($Jssor$.$Attribute(elmt, "jssor-slider"))
1520                    $JssorDebug$.$Log("Child slider found.");
1521            });
1522
1523            if ($Jssor$.$Attribute(elmt, "jssor-slider"))
1524                return;
1525
1526            level = level || 0;
1527
1528            if (!_ContentRefreshed) {
1529                if (elmt.tagName == "IMG") {
1530                    _ImageElmts.push(elmt);
1531
1532                    if (!$Jssor$.$Attribute(elmt, "src")) {
1533                        _ImageLazyLoading = true;
1534                        elmt["display-origin"] = $Jssor$.$CssDisplay(elmt);
1535                        $Jssor$.$HideElement(elmt);
1536                    }
1537                }
1538                if ($Jssor$.$IsBrowserIe9Earlier()) {
1539                    $Jssor$.$CssZIndex(elmt, ($Jssor$.$CssZIndex(elmt) || 0) + 1);
1540                }
1541                if (_Options.$HWA && $Jssor$.$WebKitVersion()) {
1542                    if (!_IsTouchDevice || $Jssor$.$WebKitVersion() < 534 || (!_SlideshowEnabled && !$Jssor$.$IsBrowserChrome())) {
1543                        $Jssor$.$EnableHWA(elmt);
1544                    }
1545                }
1546            }
1547
1548            var childElements = $Jssor$.$Children(elmt);
1549
1550            $Jssor$.$Each(childElements, function (childElement, i) {
1551
1552                var childTagName = childElement.tagName;
1553                var uAttribute = $Jssor$.$AttributeEx(childElement, "u");
1554                if (uAttribute == "player" && !_PlayerInstanceElement) {
1555                    _PlayerInstanceElement = childElement;
1556                    if (_PlayerInstanceElement.pInstance) {
1557                        PlayerAvailableEventHandler();
1558                    }
1559                    else {
1560                        $Jssor$.$AddEvent(_PlayerInstanceElement, "dataavailable", PlayerAvailableEventHandler);
1561                    }
1562                }
1563
1564                if (uAttribute == "caption") {
1565                    if (!$Jssor$.$IsBrowserIE() && !fresh) {
1566
1567                        //if (childTagName == "A") {
1568                        //    $Jssor$.$RemoveEvent(childElement, "click", ContentClickEventHandler);
1569                        //    $Jssor$.$Attribute(childElement, "jssor-content", null);
1570                        //}
1571
1572                        var captionElement = $Jssor$.$CloneNode(childElement, false, true);
1573                        $Jssor$.$InsertBefore(captionElement, childElement, elmt);
1574                        $Jssor$.$RemoveElement(childElement, elmt);
1575                        childElement = captionElement;
1576
1577                        fresh = true;
1578                    }
1579                }
1580                else if (!_ContentRefreshed && !level && !_ImageItem) {
1581
1582                    if (childTagName == "A") {
1583                        if ($Jssor$.$AttributeEx(childElement, "u") == "image") {
1584                            _ImageItem = $Jssor$.$FindChildByTag(childElement, "IMG");
1585
1586                            $JssorDebug$.$Execute(function () {
1587                                if (!_ImageItem) {
1588                                    $JssorDebug$.$Error("slide html code definition error, no 'IMG' found in a 'image with link' slide.\r\n" + elmt.outerHTML);
1589                                }
1590                            });
1591                        }
1592                        else {
1593                            _ImageItem = $Jssor$.$FindChild(childElement, "image", true);
1594                        }
1595
1596                        if (_ImageItem) {
1597                            _LinkItemOrigin = childElement;
1598                            $Jssor$.$SetStyles(_LinkItemOrigin, _StyleDef);
1599
1600                            _LinkItem = $Jssor$.$CloneNode(_LinkItemOrigin, true);
1601                            //$Jssor$.$AddEvent(_LinkItem, "click", ContentClickEventHandler);
1602
1603                            $Jssor$.$CssDisplay(_LinkItem, "block");
1604                            $Jssor$.$SetStyles(_LinkItem, _StyleDef);
1605                            $Jssor$.$CssOpacity(_LinkItem, 0);
1606                            $Jssor$.$Css(_LinkItem, "backgroundColor", "#000");
1607                        }
1608                    }
1609                    else if (childTagName == "IMG" && $Jssor$.$AttributeEx(childElement, "u") == "image") {
1610                        _ImageItem = childElement;
1611                    }
1612
1613                    if (_ImageItem) {
1614                        _ImageItem.border = 0;
1615                        $Jssor$.$SetStyles(_ImageItem, _StyleDef);
1616                    }
1617                }
1618
1619                //if (!$Jssor$.$Attribute(childElement, "jssor-content")) {
1620                //    //cancel click event on <A> element when a drag of slide succeeded
1621                //    $Jssor$.$AddEvent(childElement, "click", ContentClickEventHandler);
1622                //    $Jssor$.$Attribute(childElement, "jssor-content", true);
1623                //}
1624
1625                RefreshContent(childElement, fresh, level +1);
1626            });
1627        }
1628
1629        _SelfSlideItem.$OnInnerOffsetChange = function (oldOffset, newOffset) {
1630            var slidePosition = _DisplayPieces - newOffset;
1631
1632            SetPosition(_Wrapper, slidePosition);
1633
1634            //following lines are for future usage, not ready yet
1635            //if (!_IsDragging || !_IsCaptionSliderPlayingWhenDragStart) {
1636            //    var _DealWithParallax;
1637            //    if (IsCurrentSlideIndex(slideIndex)) {
1638            //        if (_CaptionSliderOptions.$PlayOutMode == 2)
1639            //            _DealWithParallax = true;
1640            //    }
1641            //    else {
1642            //        if (!_CaptionSliderOptions.$PlayInMode) {
1643            //            //PlayInMode: 0 none
1644            //            _CaptionSliderIn.$GoToEnd();
1645            //        }
1646            //        //else if (_CaptionSliderOptions.$PlayInMode == 1) {
1647            //        //    //PlayInMode: 1 chain
1648            //        //    _CaptionSliderIn.$GoToBegin();
1649            //        //}
1650            //        else if (_CaptionSliderOptions.$PlayInMode == 2) {
1651            //            //PlayInMode: 2 parallel
1652            //            _DealWithParallax = true;
1653            //        }
1654            //    }
1655
1656            //    if (_DealWithParallax) {
1657            //        _CaptionSliderIn.$GoToPosition((_CaptionSliderIn.$GetPosition_OuterEnd() - _CaptionSliderIn.$GetPosition_OuterBegin()) * Math.abs(newOffset - 1) * .8 + _CaptionSliderIn.$GetPosition_OuterBegin());
1658            //    }
1659            //}
1660        };
1661
1662        _SelfSlideItem.$GetCaptionSliderIn = function () {
1663            return _CaptionSliderIn;
1664        };
1665
1666        _SelfSlideItem.$GetCaptionSliderOut = function () {
1667            return _CaptionSliderOut;
1668        };
1669
1670        _SelfSlideItem.$Index = slideIndex;
1671
1672        $JssorObject$.call(_SelfSlideItem);
1673
1674        //SlideItem Constructor
1675        {
1676
1677            var thumb = $Jssor$.$FindChild(slideElmt, "thumb", true);
1678            if (thumb) {
1679                _SelfSlideItem.$Thumb = $Jssor$.$CloneNode(thumb);
1680                $Jssor$.$RemoveAttribute(thumb, "id");
1681                $Jssor$.$HideElement(thumb);
1682            }
1683            $Jssor$.$ShowElement(slideElmt);
1684
1685            _LoadingScreen = $Jssor$.$CloneNode(_LoadingContainer);
1686            $Jssor$.$CssZIndex(_LoadingScreen, 1000);
1687
1688            //cancel click event on <A> element when a drag of slide succeeded
1689            $Jssor$.$AddEvent(slideElmt, "click", SlideClickEventHandler);
1690
1691            ResetCaptionSlider(true);
1692
1693            _SelfSlideItem.$Image = _ImageItem;
1694            _SelfSlideItem.$Link = _LinkItem;
1695
1696            _SelfSlideItem.$Item = slideElmt;
1697
1698            _SelfSlideItem.$Wrapper = _Wrapper = slideElmt;
1699            $Jssor$.$AppendChild(_Wrapper, _LoadingScreen);
1700
1701            _SelfSlider.$On(203, ParkEventHandler);
1702            _SelfSlider.$On(28, FreezeEventHandler);
1703            _SelfSlider.$On(24, SwipeStartEventHandler);
1704
1705            $JssorDebug$.$Execute(function () {
1706                _SequenceNumber = _SlideItemCreatedCount++;
1707            });
1708
1709            $JssorDebug$.$Execute(function () {
1710                $Jssor$.$Attribute(_Wrapper, "debug-id", "slide-" + slideIndex);
1711            });
1712        }
1713    }
1714    //SlideItem
1715
1716    //Processor
1717    function Processor(slideElmt, slideIndex, slideshowProcessor, captionSliderIn, captionSliderOut) {
1718
1719        var _SelfProcessor = this;
1720
1721        var _ProgressBegin = 0;
1722        var _SlideshowBegin = 0;
1723        var _SlideshowEnd;
1724        var _CaptionInBegin;
1725        var _IdleBegin;
1726        var _IdleEnd;
1727        var _ProgressEnd;
1728
1729        var _IsSlideshowRunning;
1730        var _IsRollingBack;
1731
1732        var _PlayerInstance;
1733        var _IsPlayerOnService;
1734
1735        var slideItem = _SlideItems[slideIndex];
1736
1737        $JssorAnimator$.call(_SelfProcessor, 0, 0);
1738
1739        function UpdateLink() {
1740
1741            $Jssor$.$Empty(_LinkContainer);
1742
1743            if (_ShowLink && _IsSlideshowRunning && slideItem.$Link) {
1744                $Jssor$.$AppendChild(_LinkContainer, slideItem.$Link);
1745            }
1746
1747            $Jssor$.$ShowElement(_LinkContainer, !_IsSlideshowRunning && slideItem.$Image);
1748        }
1749
1750        function ProcessCompleteEventHandler() {
1751
1752            if (_IsRollingBack) {
1753                _IsRollingBack = false;
1754                _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_ROLLBACK_END, slideIndex, _IdleEnd, _ProgressBeg
1754in, _IdleBegin, _IdleEnd, _ProgressEnd);
1755                _SelfProcessor.$GoToPosition(_IdleBegin);
1756            }
1757
1758            _SelfProcessor.$Replay();
1759        }
1760
1761        function PlayerSwitchEventHandler(isOnService) {
1762            _IsPlayerOnService = isOnService;
1763
1764            _SelfProcessor.$Stop();
1765            _SelfProcessor.$Replay();
1766        }
1767
1768        _SelfProcessor.$Replay = function () {
1769
1770            var currentPosition = _SelfProcessor.$GetPosition_Display();
1771
1772            if (!_IsDragging && !_IsSliding && !_IsPlayerOnService && _CurrentSlideIndex == slideIndex) {
1773
1774                if (!currentPosition) {
1775                    if (_SlideshowEnd && !_IsSlideshowRunning) {
1776                        _IsSlideshowRunning = true;
1777
1778                        _SelfProcessor.$OpenSlideshowPanel(true);
1779
1780                        _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_SLIDESHOW_START, slideIndex, _ProgressBegin, _SlideshowBegin, _SlideshowEnd, _ProgressEnd);
1781                    }
1782
1783                    UpdateLink();
1784                }
1785
1786                var toPosition;
1787                var stateEvent = $JssorSlider$.$EVT_STATE_CHANGE;
1788
1789                if (currentPosition != _ProgressEnd) {
1790                    if (currentPosition == _IdleEnd) {
1791                        toPosition = _ProgressEnd;
1792                    }
1793                    else if (currentPosition == _IdleBegin) {
1794                        toPosition = _IdleEnd;
1795                    }
1796                    else if (!currentPosition) {
1797                        toPosition = _IdleBegin;
1798                    }
1799                    else if (currentPosition > _IdleEnd) {
1800                        _IsRollingBack = true;
1801                        toPosition = _IdleEnd;
1802                        stateEvent = $JssorSlider$.$EVT_ROLLBACK_START;
1803                    }
1804                    else {
1805                        //continue from break (by drag or lock)
1806                        toPosition = _SelfProcessor.$GetPlayToPosition();
1807                    }
1808                }
1809
1810                _SelfSlider.$TriggerEvent(stateEvent, slideIndex, currentPosition, _ProgressBegin, _IdleBegin, _IdleEnd, _ProgressEnd);
1811
1812                var allowAutoPlay = _AutoPlay && (!_HoverToPause || _NotOnHover);
1813
1814                if (currentPosition == _ProgressEnd) {
1815                    (_IdleEnd != _ProgressEnd && !(_HoverToPause & 12) || allowAutoPlay) && slideItem.$GoForNextSlide();
1816                }
1817                else if (allowAutoPlay || currentPosition != _IdleEnd) {
1818                    _SelfProcessor.$PlayToPosition(toPosition, ProcessCompleteEventHandler);
1819                }
1820            }
1821        };
1822
1823        _SelfProcessor.$AdjustIdleOnPark = function () {
1824            if (_IdleEnd == _ProgressEnd && _IdleEnd == _SelfProcessor.$GetPosition_Display())
1825                _SelfProcessor.$GoToPosition(_IdleBegin);
1826        };
1827
1828        _SelfProcessor.$Abort = function () {
1829            _SlideshowRunner && _SlideshowRunner.$Index == slideIndex && _SlideshowRunner.$Clear();
1830
1831            var currentPosition = _SelfProcessor.$GetPosition_Display();
1832            if (currentPosition < _ProgressEnd) {
1833                _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_STATE_CHANGE, slideIndex, -currentPosition - 1, _ProgressBegin, _IdleBegin, _IdleEnd, _ProgressEnd);
1834            }
1835        };
1836
1837        _SelfProcessor.$OpenSlideshowPanel = function (open) {
1838            if (slideshowProcessor) {
1839                $Jssor$.$CssOverflow(_SlideshowPanel, open && slideshowProcessor.$Transition.$Outside ? "" : "hidden");
1840            }
1841        };
1842
1843        _SelfProcessor.$OnInnerOffsetChange = function (oldPosition, newPosition) {
1844
1845            if (_IsSlideshowRunning && newPosition >= _SlideshowEnd) {
1846                _IsSlideshowRunning = false;
1847                UpdateLink();
1848                slideItem.$UnhideContentForSlideshow();
1849                _SlideshowRunner.$Clear();
1850
1851                _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_SLIDESHOW_END, slideIndex, _ProgressBegin, _SlideshowBegin, _SlideshowEnd, _ProgressEnd);
1852            }
1853
1854            _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_PROGRESS_CHANGE, slideIndex, newPosition, _ProgressBegin, _IdleBegin, _IdleEnd, _ProgressEnd);
1855        };
1856
1857        _SelfProcessor.$SetPlayer = function (playerInstance) {
1858            if (playerInstance && !_PlayerInstance) {
1859                _PlayerInstance = playerInstance;
1860
1861                playerInstance.$On($JssorPlayer$.$EVT_SWITCH, PlayerSwitchEventHandler);
1862            }
1863        };
1864
1865        //Processor Constructor
1866        {
1867            if (slideshowProcessor) {
1868                _SelfProcessor.$Chain(slideshowProcessor);
1869            }
1870
1871            _SlideshowEnd = _SelfProcessor.$GetPosition_OuterEnd();
1872            _CaptionInBegin = _SelfProcessor.$GetPosition_OuterEnd();
1873            _SelfProcessor.$Chain(captionSliderIn);
1874            _IdleBegin = captionSliderIn.$GetPosition_OuterEnd();
1875            _IdleEnd = _IdleBegin + ($Jssor$.$ParseFloat($Jssor$.$AttributeEx(slideElmt, "idle")) || _AutoPlayInterval);
1876
1877            captionSliderOut.$Shift(_IdleEnd);
1878            _SelfProcessor.$Combine(captionSliderOut);
1879            _ProgressEnd = _SelfProcessor.$GetPosition_OuterEnd();
1880        }
1881    }
1882    //Processor
1883    //#endregion
1884
1885    function SetPosition(elmt, position) {
1886        var orientation = _DragOrientation > 0 ? _DragOrientation : _PlayOrientation;
1887        var x = _StepLengthX * position * (orientation & 1);
1888        var y = _StepLengthY * position * ((orientation >> 1) & 1);
1889
1890        x = Math.round(x);
1891        y = Math.round(y);
1892
1893        $Jssor$.$CssLeft(elmt, x);
1894        $Jssor$.$CssTop(elmt, y);
1895    }
1896
1897    //#region Event handling begin
1898
1899    function RecordFreezePoint() {
1900        _CarouselPlaying_OnFreeze = _IsSliding;
1901        _PlayToPosition_OnFreeze = _CarouselPlayer.$GetPlayToPosition();
1902        _Position_OnFreeze = _Conveyor.$GetPosition();
1903    }
1904
1905    function Freeze() {
1906        RecordFreezePoint();
1907
1908        if (_IsDragging || !_NotOnHover && (_HoverToPause & 12)) {
1909            _CarouselPlayer.$Stop();
1910
1911            _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_FREEZE);
1912        }
1913    }
1914
1915    function Unfreeze(byDrag) {
1916
1917        if (!_IsDragging && (_NotOnHover || !(_HoverToPause & 12)) && !_CarouselPlayer.$IsPlaying()) {
1918
1919            var currentPosition = _Conveyor.$GetPosition();
1920            var toPosition = Math.ceil(_Position_OnFreeze);
1921
1922            if (byDrag && Math.abs(_DragOffsetTotal) >= _Options.$MinDragOffsetToSlide) {
1923                toPosition = Math.ceil(currentPosition);
1924                toPosition += _DragIndexAdjust;
1925            }
1926
1927            if (!(_Loop & 1)) {
1928                toPosition = Math.min(_SlideCount - _DisplayPieces, Math.max(toPosition, 0));
1929            }
1930
1931            var t = Math.abs(toPosition - currentPosition);
1932            t = 1 - Math.pow(1 - t, 5);
1933
1934            if (!_LastDragSucceded && _CarouselPlaying_OnFreeze) {
1935                _CarouselPlayer.$Continue(_PlayToPosition_OnFreeze);
1936            }
1937            else if (currentPosition == toPosition) {
1938                _CurrentSlideItem.$EnablePlayer();
1939                _CurrentSlideItem.$TryActivate();
1940            }
1941            else {
1942
1943                _CarouselPlayer.$PlayCarousel(currentPosition, toPosition, t * _SlideDuration);
1944            }
1945        }
1946    }
1947
1948    function PreventDragSelectionEvent(event) {
1949        if (!$Jssor$.$AttributeEx($Jssor$.$EvtSrc(event), "nodrag")) {
1950            $Jssor$.$CancelEvent(event);
1951        }
1952    }
1953
1954    function OnTouchStart(event) {
1955        OnDragStart(event, 1);
1956    }
1957
1958    function OnDragStart(event, touch) {
1959        event = $Jssor$.$GetEvent(event);
1960        var eventSrc = $Jssor$.$EvtSrc(event);
1961
1962        if (!_DragOrientationRegistered && !$Jssor$.$AttributeEx(eventSrc, "nodrag") && RegisterDrag() && (!touch || event.touches.length == 1)) {
1963            _IsDragging = true;
1964            _DragInvalid = false;
1965            _LoadingTicket = null;
1966
1967            $Jssor$.$AddEvent(document, touch ? "touchmove" : "mousemove", OnDragMove);
1968
1969            _LastTimeMoveByDrag = $Jssor$.$GetNow() - 50;
1970
1971            _LastDragSucceded = 0;
1972            Freeze();
1973
1974            if (!_CarouselPlaying_OnFreeze)
1975                _DragOrientation = 0;
1976
1977            if (touch) {
1978                var touchPoint = event.touches[0];
1979                _DragStartMouseX = touchPoint.clientX;
1980                _DragStartMouseY = touchPoint.clientY;
1981            }
1982            else {
1983                var mousePoint = $Jssor$.$MousePosition(event);
1984
1985                _DragStartMouseX = mousePoint.x;
1986                _DragStartMouseY = mousePoint.y;
1987            }
1988
1989            _DragOffsetTotal = 0;
1990            _DragOffsetLastTime = 0;
1991            _DragIndexAdjust = 0;
1992
1993            //Trigger EVT_DRAGSTART
1994            _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_DRAG_START, GetRealIndex(_Position_OnFreeze), _Position_OnFreeze, event);
1995        }
1996    }
1997
1998    function OnDragMove(event) {
1999        if (_IsDragging) {
2000            event = $Jssor$.$GetEvent(event);
2001
2002            var actionPoint;
2003
2004            if (event.type != "mousemove") {
2005                var touch = event.touches[0];
2006                actionPoint = { x: touch.clientX, y: touch.clientY };
2007            }
2008            else {
2009                actionPoint = $Jssor$.$MousePosition(event);
2010            }
2011
2012            if (actionPoint) {
2013                var distanceX = actionPoint.x - _DragStartMouseX;
2014                var distanceY = actionPoint.y - _DragStartMouseY;
2015
2016
2017                if (Math.floor(_Position_OnFreeze) != _Position_OnFreeze)
2018                    _DragOrientation = _DragOrientation || (_PlayOrientation & _DragOrientationRegistered);
2019
2020                if ((distanceX || distanceY) && !_DragOrientation) {
2021                    if (_DragOrientationRegistered == 3) {
2022                        if (Math.abs(distanceY) > Math.abs(distanceX)) {
2023                            _DragOrientation = 2;
2024                        }
2025                        else
2026                            _DragOrientation = 1;
2027                    }
2028                    else {
2029                        _DragOrientation = _DragOrientationRegistered;
2030                    }
2031
2032                    if (_IsTouchDevice && _DragOrientation == 1 && Math.abs(distanceY) - Math.abs(distanceX) > 3) {
2033                        _DragInvalid = true;
2034                    }
2035                }
2036
2037                if (_DragOrientation) {
2038                    var distance = distanceY;
2039                    var stepLength = _StepLengthY;
2040
2041                    if (_DragOrientation == 1) {
2042                        distance = distanceX;
2043                        stepLength = _StepLengthX;
2044                    }
2045
2046                    if (!(_Loop & 1)) {
2047                        if (distance > 0) {
2048                            var normalDistance = stepLength * _CurrentSlideIndex;
2049                            var sqrtDistance = distance - normalDistance;
2050                            if (sqrtDistance > 0) {
2051                                distance = normalDistance + Math.sqrt(sqrtDistance) * 5;
2052                            }
2053                        }
2054
2055                        if (distance < 0) {
2056                            var normalDistance = stepLength * (_SlideCount - _DisplayPieces - _CurrentSlideIndex);
2057                            var sqrtDistance = -distance - normalDistance;
2058
2059                            if (sqrtDistance > 0) {
2060                                distance = -normalDistance - Math.sqrt(sqrtDistance) * 5;
2061                            }
2062                        }
2063                    }
2064
2065                    if (_DragOffsetTotal - _DragOffsetLastTime < -2) {
2066                        _DragIndexAdjust = 0;
2067                    }
2068                    else if (_DragOffsetTotal - _DragOffsetLastTime > 2) {
2069                        _DragIndexAdjust = -1;
2070                    }
2071
2072                    _DragOffsetLastTime = _DragOffsetTotal;
2073                    _DragOffsetTotal = distance;
2074                    _PositionToGoByDrag = _Position_OnFreeze - _DragOffsetTotal / stepLength / (_ScaleRatio || 1);
2075
2076                    if (_DragOffsetTotal && _DragOrientation && !_DragInvalid) {
2077                        $Jssor$.$CancelEvent(event);
2078                        if (!_IsSliding) {
2079                            _CarouselPlayer.$StandBy(_PositionToGoByDrag);
2080                        }
2081                        else
2082                            _CarouselPlayer.$SetStandByPosition(_PositionToGoByDrag);
2083                    }
2084                }
2085            }
2086        }
2087    }
2088
2089    function OnDragEnd() {
2090        UnregisterDrag();
2091
2092        if (_IsDragging) {
2093
2094            _IsDragging = false;
2095
2096            _LastTimeMoveByDrag = $Jssor$.$GetNow();
2097
2098            $Jssor$.$RemoveEvent(document, "mousemove", OnDragMove);
2099            $Jssor$.$RemoveEvent(document, "touchmove", OnDragMove);
2100
2101            _LastDragSucceded = _DragOffsetTotal;
2102
2103            _CarouselPlayer.$Stop();
2104
2105            var currentPosition = _Conveyor.$GetPosition();
2106
2107            //Trigger EVT_DRAG_END
2108            _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_DRAG_END, GetRealIndex(currentPosition), currentPosition, GetRealIndex(_Position_OnFreeze), _Position_OnFreeze);
2109
2110            (_HoverToPause & 12) && RecordFreezePoint();
2111
2112            Unfreeze(true);
2113        }
2114    }
2115
2116    function SlidesClickEventHandler(event) {
2117        if (_LastDragSucceded) {
2118            $Jssor$.$StopEvent(event);
2119
2120            var checkElement = $Jssor$.$EvtSrc(event);
2121            while (checkElement && _SlidesContainer !== checkElement) {
2122                if (checkElement.tagName == "A") {
2123                    $Jssor$.$CancelEvent(event);
2124                }
2125                try {
2126                    checkElement = checkElement.parentNode;
2127                } catch (e) {
2128                    // Firefox sometimes fires events for XUL elements, which throws
2129                    // a "permission denied" error. so this is not a child.
2130                    break;
2131                }
2132            }
2133        }
2134    }
2135    //#endregion
2136
2137    function SetCurrentSlideIndex(index) {
2138        _PrevSlideItem = _SlideItems[_CurrentSlideIndex];
2139        _PreviousSlideIndex = _CurrentSlideIndex;
2140        _CurrentSlideIndex = GetRealIndex(index);
2141        _CurrentSlideItem = _SlideItems[_CurrentSlideIndex];
2142        ResetNavigator(index);
2143        return _CurrentSlideIndex;
2144    }
2145
2146    function OnPark(slideIndex, prevIndex) {
2147        _DragOrientation = 0;
2148
2149        SetCurrentSlideIndex(slideIndex);
2150
2151        //Trigger EVT_PARK
2152        _SelfSlider.$TriggerEvent($JssorSlider$.$EVT_PARK, GetRealIndex(slideIndex), prevIndex);
2153    }
2154
2155    function ResetNavigator(index, temp) {
2156        _TempSlideIndex = index;
2157        $Jssor$.$Each(_Navigators, function (navigator) {
2158            navigator.$SetCurrentIndex(GetRealIndex(index), index, temp);
2159        });
2160    }
2161
2162    function RegisterDrag() {
2163        var dragRegistry = $JssorSlider$.$DragRegistry || 0;
2164        var dragOrientation = _DragEnabled;
2165        if (_IsTouchDevice)
2166            (dragOrientation & 1) && (dragOrientation &= 1);
2167        $JssorSlider$.$DragRegistry |= dragOrientation;
2168
2169        return (_DragOrientationRegistered = dragOrientation & ~dragRegistry);
2170    }
2171
2172    function UnregisterDrag() {
2173        if (_DragOrientationRegistered) {
2174            $JssorSlider$.$DragRegistry &= ~_DragEnabled;
2175            _DragOrientationRegistered = 0;
2176        }
2177    }
2178
2179    function CreatePanel() {
2180        var div = $Jssor$.$CreateDiv();
2181
2182        $Jssor$.$SetStyles(div, _StyleDef);
2183        $Jssor$.$CssPosition(div, "absolute");
2184
2185        return div;
2186    }
2187
2188    function GetRealIndex(index) {
2189        return (index % _SlideCount + _SlideCount) % _SlideCount;
2190    }
2191
2192    function IsCurrentSlideIndex(index) {
2193        return GetRealIndex(index) == _CurrentSlideIndex;
2194    }
2195
2196    function IsPreviousSlideIndex(index) {
2197        return GetRealIndex(index) == _PreviousSlideIndex;
2198    }
2199
2200    //Navigation Request Handler
2201    function NavigationClickHandler(index, relative) {
2202        if (relative) {
2203            if (!_Loop) {
2204                //Stop at threshold
2205                index = Math.min(Math.max(index + _TempSlideIndex, 0), _SlideCount - _DisplayPieces);
2206                relative = false;
2207            }
2208            else if (_Loop & 2) {
2209                //Rewind
2210                index = GetRealIndex(index + _TempSlideIndex);
2211                relative = false;
2212            }
2213        }
2214        PlayTo(index, _Options.$SlideDuration, relative);
2215    }
2216
2217    function ShowNavigators() {
2218        $Jssor$.$Each(_Navigators, function (navigator) {
2219            navigator.$Show(navigator.$Options.$ChanceToShow <= _NotOnHover);
2220        });
2221    }
2222
2223    function MainContainerMouseLeaveEventHandler() {
2224        if (!_NotOnHover) {
2225
2226            //$JssorDebug$.$Log("mouseleave");
2227
2228            _NotOnHover = 1;
2229
2230            ShowNavigators();
2231
2232            if (!_IsDragging) {
2233                (_HoverToPause & 12) && Unfreeze();
2234                (_HoverToPause & 3) && _SlideItems[_CurrentSlideIndex].$TryActivate();
2235            }
2236        }
2237    }
2238
2239    function MainContainerMouseEnterEventHandler() {
2240
2241        if (_NotOnHover) {
2242
2243            //$JssorDebug$.$Log("mouseenter");
2244
2245            _NotOnHover = 0;
2246
2247            ShowNavigators();
2248
2249            _IsDragging || !(_HoverToPause & 12) || Freeze();
2250        }
2251    }
2252
2253    function AdjustSlidesContainerSize() {
2254        _StyleDef = { $Width: _SlideWidth, $Height: _SlideHeight, $Top: 0, $Left: 0 };
2255
2256        $Jssor$.$Each(_SlideElmts, function (slideElmt, i) {
2257
2258            $Jssor$.$SetStyles(slideElmt, _StyleDef);
2259            $Jssor$.$CssPosition(slideElmt, "absolute");
2260            $Jssor$.$CssOverflow(slideElmt, "hidden");
2261
2262            $Jssor$.$HideElement(slideElmt);
2263        });
2264
2265        $Jssor$.$SetStyles(_LoadingContainer, _StyleDef);
2266    }
2267
2268    function PlayToOffset(offset, slideDuration) {
2269        PlayTo(offset, slideDuration, true);
2270    }
2271
2272    function PlayTo(slideIndex, slideDuration, relative) {
2273        ///	<summary>
2274        ///		PlayTo( slideIndex [, slideDuration] ); //Play slider to position 'slideIndex' within a period calculated base on 'slideDuration'.
2275        ///	</summary>
2276        ///	<param name="slideIndex" type="Number">
2277        ///		slide slideIndex or position will be playing to
2278        ///	</param>
2279        ///	<param name="slideDuration" type="Number" optional="true">
2280        ///		base slide duration in milliseconds to calculate the whole duration to complete this play request.
2281        ///	    default value is '$SlideDuration' value which is specified when initialize the slider.
2282        ///	</param>
2283        /// http://msdn.microsoft.com/en-us/library/vstudio/bb385682.aspx
2284        /// http://msdn.microsoft.com/en-us/library/vstudio/hh542720.aspx
2285        if (_CarouselEnabled && (!_IsDragging || _Options.$NaviQuitDrag)) {
2286            _IsSliding = true;
2287            _IsDragging = false;
2288            _CarouselPlayer.$Stop();
2289
2290            {
2291                //Slide Duration
2292                if (slideDuration == undefined)
2293                    slideDuration = _SlideDuration;
2294
2295                var positionDisplay = _Carousel.$GetPosition_Display();
2296                var positionTo = slideIndex;
2297                if (relative) {
2298                    positionTo = positionDisplay + slideIndex;
2299                    if (slideIndex > 0)
2300                        positionTo = Math.ceil(positionTo);
2301                    else
2302                        positionTo = Math.floor(positionTo);
2303                }
2304
2305                if (_Loop & 2) {
2306                    //Rewind
2307                    positionTo = GetRealIndex(positionTo);
2308                }
2309                if (!(_Loop & 1)) {
2310                    //Stop at threshold
2311                    positionTo = Math.max(0, Math.min(positionTo, _SlideCount - _DisplayPieces));
2312                }
2313
2314                var positionOffset = (positionTo - positionDisplay) % _SlideCount;
2315                positionTo = positionDisplay + positionOffset;
2316
2317                var duration = positionDisplay == positionTo ? 0 : slideDuration * Math.abs(positionOffset);
2318                duration = Math.min(duration, slideDuration * _DisplayPieces * 1.5);
2319
2320                _CarouselPlayer.$PlayCarousel(positionDisplay, positionTo, duration || 1);
2321            }
2322        }
2323    }
2324
2325    //private functions
2326
2327    //member functions
2328
2329    _SelfSlider.$PlayTo = PlayTo;
2330
2331    _SelfSlider.$GoTo = function (slideIndex) {
2332        ///	<summary>
2333        ///		instance.$GoTo( slideIndex );   //Go to the specifed slide immediately with no play.
2334        ///	</summary>
2335        PlayTo(slideIndex, 1);
2336    };
2337
2338    _SelfSlider.$Next = function () {
2339        ///	<summary>
2340        ///		instance.$Next();   //Play the slider to next slide.
2341        ///	</summary>
2342        PlayToOffset(1);
2343    };
2344
2345    _SelfSlider.$Prev = function () {
2346        ///	<summary>
2347        ///		instance.$Prev();   //Play the slider to previous slide.
2348        ///	</summary>
2349        PlayToOffset(-1);
2350    };
2351
2352    _SelfSlider.$Pause = function () {
2353        ///	<summary>
2354        ///		instance.$Pause();   //Pause the slider, prevent it from auto playing.
2355        ///	</summary>
2356        _AutoPlay = false;
2357    };
2358
2359    _SelfSlider.$Play = function () {
2360        ///	<summary>
2361        ///		instance.$Play();   //Start auto play if the slider is currently paused.
2362        ///	</summary>
2363        if (!_AutoPlay) {
2364            _AutoPlay = true;
2365            _SlideItems[_CurrentSlideIndex] && _SlideItems[_CurrentSlideIndex].$TryActivate();
2366        }
2367    };
2368
2369    _SelfSlider.$SetSlideshowTransitions = function (transitions) {
2370        ///	<summary>
2371        ///		instance.$SetSlideshowTransitions( transitions );   //Reset slideshow transitions for the slider.
2372        ///	</summary>
2373        $JssorDebug$.$Execute(function () {
2374            if (!transitions || !transitions.length) {
2375                $JssorDebug$.$Error("Can not set slideshow transitions, no transitions specified.");
2376            }
2377        });
2378
2379        //$Jssor$.$TranslateTransitions(transitions);    //for old transition compatibility
2380        _Options.$SlideshowOptions.$Transitions = transitions;
2381    };
2382
2383    _SelfSlider.$SetCaptionTransitions = function (transitions) {
2384        ///	<summary>
2385        ///		instance.$SetCaptionTransitions( transitions );   //Reset caption transitions for the slider.
2386        ///	</summary>
2387        $JssorDebug$.$Execute(function () {
2388            if (!transitions || !transitions.length) {
2389                $JssorDebug$.$Error("Can not set caption transitions, no transitions specified");
2390            }
2391        });
2392
2393        //$Jssor$.$TranslateTransitions(transitions);    //for old transition compatibility
2394        _CaptionSliderOptions.$CaptionTransitions = transitions;
2395        _CaptionSliderOptions.$Version = $Jssor$.$GetNow();
2396    };
2397
2398    _SelfSlider.$SlidesCount = function () {
2399        ///	<summary>
2400        ///		instance.$SlidesCount();   //Retrieve slides count of the slider.
2401        ///	</summary>
2402        return _SlideElmts.length;
2403    };
2404
2405    _SelfSlider.$CurrentIndex = function () {
2406        ///	<summary>
2407        ///		instance.$CurrentIndex();   //Retrieve current slide index of the slider.
2408        ///	</summary>
2409        return _CurrentSlideIndex;
2410    };
2411
2412    _SelfSlider.$IsAutoPlaying = function () {
2413        ///	<summary>
2414        ///		instance.$IsAutoPlaying();   //Retrieve auto play status of the slider.
2415        ///	</summary>
2416        return _AutoPlay;
2417    };
2418
2419    _SelfSlider.$IsDragging = function () {
2420        ///	<summary>
2421        ///		instance.$IsDragging();   //Retrieve drag status of the slider.
2422        ///	</summary>
2423        return _IsDragging;
2424    };
2425
2426    _SelfSlider.$IsSliding = function () {
2427        ///	<summary>
2428        ///		instance.$IsSliding();   //Retrieve right<-->left sliding status of the slider.
2429        ///	</summary>
2430        return _IsSliding;
2431    };
2432
2433    _SelfSlider.$IsMouseOver = function () {
2434        ///	<summary>
2435        ///		instance.$IsMouseOver();   //Retrieve mouse over status of the slider.
2436        ///	</summary>
2437        return !_NotOnHover;
2438    };
2439
2440    _SelfSlider.$LastDragSucceded = function () {
2441        ///	<summary>
2442        ///		instance.$IsLastDragSucceded();   //Retrieve last drag succeded status, returns 0 if failed, returns drag offset if succeded
2443        ///	</summary>
2444        return _LastDragSucceded;
2445    };
2446
2447    function OriginalWidth() {
2448        ///	<summary>
2449        ///		instance.$OriginalWidth();   //Retrieve original width of the slider.
2450        ///	</summary>
2451        return $Jssor$.$CssWidth(_ScaleWrapper || elmt);
2452    }
2453
2454    function OriginalHeight() {
2455        ///	<summary>
2456        ///		instance.$OriginalHeight();   //Retrieve original height of the slider.
2457        ///	</summary>
2458        return $Jssor$.$CssHeight(_ScaleWrapper || elmt);
2459    }
2460
2461    _SelfSlider.$OriginalWidth = _SelfSlider.$GetOriginalWidth = OriginalWidth;
2462
2463    _SelfSlider.$OriginalHeight = _SelfSlider.$GetOriginalHeight = OriginalHeight;
2464
2465    function Scale(dimension, isHeight) {
2466        ///	<summary>
2467        ///		instance.$ScaleWidth();   //Retrieve scaled dimension the slider currently displays.
2468        ///		instance.$ScaleWidth( dimension );   //Scale the slider to new width and keep aspect ratio.
2469        ///	</summary>
2470
2471        if (dimension == undefined)
2472            return $Jssor$.$CssWidth(elmt);
2473
2474        if (!_ScaleWrapper) {
2475            $JssorDebug$.$Execute(function () {
2476                var originalWidthStr = $Jssor$.$Css(elmt, "width");
2477                var originalHeightStr = $Jssor$.$Css(elmt, "height");
2478                var originalWidth = $Jssor$.$CssP(elmt, "width");
2479                var originalHeight = $Jssor$.$CssP(elmt, "height");
2480
2481                if (!originalWidthStr || originalWidthStr.indexOf("px") == -1) {
2482                    $JssorDebug$.$Fail("Cannot scale jssor slider, 'width' of 'outer container' not specified. Please specify 'width' in pixel. e.g. 'width: 600px;'");
2483                }
2484
2485                if (!originalHeightStr || originalHeightStr.indexOf("px") == -1) {
2486                    $JssorDebug$.$Fail("Cannot scale jssor slider, 'he
2486ight' of 'outer container' not specified. Please specify 'height' in pixel. e.g. 'height: 300px;'");
2487                }
2488
2489                if (originalWidthStr.indexOf('%') != -1) {
2490                    $JssorDebug$.$Fail("Cannot scale jssor slider, 'width' of 'outer container' not valid. Please specify 'width' in pixel. e.g. 'width: 600px;'");
2491                }
2492
2493                if (originalHeightStr.indexOf('%') != -1) {
2494                    $JssorDebug$.$Fail("Cannot scale jssor slider, 'height' of 'outer container' not valid. Please specify 'height' in pixel. e.g. 'height: 300px;'");
2495                }
2496
2497                if (!originalWidth) {
2498                    $JssorDebug$.$Fail("Cannot scale jssor slider, 'width' of 'outer container' not valid. 'width' of 'outer container' should be positive number. e.g. 'width: 600px;'");
2499                }
2500
2501                if (!originalHeight) {
2502                    $JssorDebug$.$Fail("Cannot scale jssor slider, 'height' of 'outer container' not valid. 'height' of 'outer container' should be positive number. e.g. 'height: 300px;'");
2503                }
2504            });
2505
2506            var innerWrapper = $Jssor$.$CreateDiv(document);
2507            $Jssor$.$ClassName(innerWrapper, $Jssor$.$ClassName(elmt));
2508            $Jssor$.$CssCssText(innerWrapper, $Jssor$.$CssCssText(elmt));
2509            $Jssor$.$CssDisplay(innerWrapper, "block");
2510
2511            $Jssor$.$CssPosition(innerWrapper, "relative");
2512            $Jssor$.$CssTop(innerWrapper, 0);
2513            $Jssor$.$CssLeft(innerWrapper, 0);
2514            $Jssor$.$CssOverflow(innerWrapper, "visible");
2515
2516            _ScaleWrapper = $Jssor$.$CreateDiv(document);
2517
2518            $Jssor$.$CssPosition(_ScaleWrapper, "absolute");
2519            $Jssor$.$CssTop(_ScaleWrapper, 0);
2520            $Jssor$.$CssLeft(_ScaleWrapper, 0);
2521            $Jssor$.$CssWidth(_ScaleWrapper, $Jssor$.$CssWidth(elmt));
2522            $Jssor$.$CssHeight(_ScaleWrapper, $Jssor$.$CssHeight(elmt));
2523            $Jssor$.$SetStyleTransformOrigin(_ScaleWrapper, "0 0");
2524
2525            $Jssor$.$AppendChild(_ScaleWrapper, innerWrapper);
2526
2527            var children = $Jssor$.$Children(elmt);
2528            $Jssor$.$AppendChild(elmt, _ScaleWrapper);
2529
2530            $Jssor$.$Css(elmt, "backgroundImage", "");
2531
2532            var noMoveElmts = {
2533                "navigator": _BulletNavigatorOptions && _BulletNavigatorOptions.$Scale == false,
2534                "arrowleft": _ArrowNavigatorOptions && _ArrowNavigatorOptions.$Scale == false,
2535                "arrowright": _ArrowNavigatorOptions && _ArrowNavigatorOptions.$Scale == false,
2536                "thumbnavigator": _ThumbnailNavigatorOptions && _ThumbnailNavigatorOptions.$Scale == false,
2537                "thumbwrapper": _ThumbnailNavigatorOptions && _ThumbnailNavigatorOptions.$Scale == false
2538            };
2539
2540            $Jssor$.$Each(children, function (child) {
2541                $Jssor$.$AppendChild(noMoveElmts[$Jssor$.$AttributeEx(child, "u")] ? elmt : innerWrapper, child);
2542            });
2543        }
2544
2545        $JssorDebug$.$Execute(function () {
2546            if (!dimension || dimension < 0) {
2547                $JssorDebug$.$Fail("'$ScaleWidth' error, 'dimension' should be positive value.");
2548            }
2549        });
2550
2551        $JssorDebug$.$Execute(function () {
2552            if (!_InitialScrollWidth) {
2553                _InitialScrollWidth = _SelfSlider.$Elmt.scrollWidth;
2554            }
2555        });
2556
2557        _ScaleRatio = dimension / (isHeight ? $Jssor$.$CssHeight : $Jssor$.$CssWidth)(_ScaleWrapper);
2558        $Jssor$.$CssScale(_ScaleWrapper, _ScaleRatio);
2559
2560        var scaleWidth = isHeight ? (_ScaleRatio * OriginalWidth()) : dimension;
2561        var scaleHeight = isHeight ? dimension : (_ScaleRatio * OriginalHeight());
2562
2563        $Jssor$.$CssWidth(elmt, scaleWidth);
2564        $Jssor$.$CssHeight(elmt, scaleHeight);
2565
2566        $Jssor$.$Each(_Navigators, function (navigator) {
2567            navigator.$Relocate(scaleWidth, scaleHeight);
2568        });
2569    }
2570
2571    _SelfSlider.$ScaleHeight = _SelfSlider.$GetScaleHeight = function (height) {
2572        ///	<summary>
2573        ///		instance.$ScaleHeight();   //Retrieve scaled height the slider currently displays.
2574        ///		instance.$ScaleHeight( dimension );   //Scale the slider to new height and keep aspect ratio.
2575        ///	</summary>
2576
2577        if (height == undefined)
2578            return $Jssor$.$CssHeight(elmt);
2579
2580        Scale(height, true);
2581    };
2582
2583    _SelfSlider.$ScaleWidth = _SelfSlider.$SetScaleWidth = _SelfSlider.$GetScaleWidth = Scale;
2584
2585    _SelfSlider.$GetVirtualIndex = function (index) {
2586        var parkingIndex = Math.ceil(GetRealIndex(_ParkingPosition / _StepLength));
2587        var displayIndex = GetRealIndex(index - _CurrentSlideIndex + parkingIndex);
2588
2589        if (displayIndex > _DisplayPieces) {
2590            if (index - _CurrentSlideIndex > _SlideCount / 2)
2591                index -= _SlideCount;
2592            else if (index - _CurrentSlideIndex <= -_SlideCount / 2)
2593                index += _SlideCount;
2594        }
2595        else {
2596            index = _CurrentSlideIndex + displayIndex - parkingIndex;
2597        }
2598
2599        return index;
2600    };
2601
2602    //member functions
2603
2604    $JssorObject$.call(_SelfSlider);
2605
2606    $JssorDebug$.$Execute(function () {
2607        var outerContainerElmt = $Jssor$.$GetElement(elmt);
2608        if (!outerContainerElmt)
2609            $JssorDebug$.$Fail("Outer container '" + elmt + "' not found.");
2610    });
2611
2612    //initialize member variables
2613    _SelfSlider.$Elmt = elmt = $Jssor$.$GetElement(elmt);
2614    //initialize member variables
2615
2616    var _InitialScrollWidth;    //for debug only
2617    var _CaptionSliderCount = 1;    //for debug only
2618
2619    var _Options = $Jssor$.$Extend({
2620        $FillMode: 0,                   //[Optional] The way to fill image in slide, 0 stretch, 1 contain (keep aspect ratio and put all inside slide), 2 cover (keep aspect ratio and cover whole slide), 4 actual size, 5 contain for large image, actual size for small image, default value is 0
2621        $LazyLoading: 1,                //[Optional] For image with  lazy loading format (<IMG src2="url" .../>), by default it will be loaded only when the slide comes.
2622        //But an integer value (maybe 0, 1, 2 or 3) indicates that how far of nearby slides should be loaded immediately as well, default value is 1.
2623        $StartIndex: 0,                 //[Optional] Index of slide to display when initialize, default value is 0
2624        $AutoPlay: false,               //[Optional] Whether to auto play, default value is false
2625        $Loop: 1,                       //[Optional] Enable loop(circular) of carousel or not, 0: stop, 1: loop, 2 rewind, default value is 1
2626        $HWA: true,                     //[Optional] Enable hardware acceleration or not, default value is true
2627        $NaviQuitDrag: true,
2628        $AutoPlaySteps: 1,              //[Optional] Steps to go of every play (this options applys only when slideshow disabled), default value is 1
2629        $AutoPlayInterval: 3000,        //[Optional] Interval to play next slide since the previous stopped if a slideshow is auto playing, default value is 3000
2630        $PauseOnHover: 1,               //[Optional] Whether to pause when mouse over if a slider is auto playing, 0 no pause, 1 pause for desktop, 2 pause for touch device, 3 pause for desktop and touch device, 4 freeze for desktop, 8 freeze for touch device, 12 freeze for desktop and touch device, default value is 1
2631
2632        $SlideDuration: 500,            //[Optional] Specifies default duration (swipe) for slide in milliseconds, default value is 400
2633        $SlideEasing: $JssorEasing$.$EaseOutQuad,   //[Optional] Specifies easing for right to left animation, default value is $JssorEasing$.$EaseOutQuad
2634        $MinDragOffsetToSlide: 20,      //[Optional] Minimum drag offset that trigger slide, default value is 20
2635        $SlideSpacing: 0, 				//[Optional] Space between each slide in pixels, default value is 0
2636        $DisplayPieces: 1,              //[Optional] Number of pieces to display (the slideshow would be disabled if the value is set to greater than 1), default value is 1
2637        $ParkingPosition: 0,            //[Optional] The offset position to park slide (this options applys only when slideshow disabled), default value is 0.
2638        $UISearchMode: 1,               //[Optional] The way (0 parellel, 1 recursive, default value is recursive) to search UI components (slides container, loading screen, navigator container, arrow navigator container, thumbnail navigator container etc.
2639        $PlayOrientation: 1,            //[Optional] Orientation to play slide (for auto play, navigation), 1 horizental, 2 vertical, 5 horizental reverse, 6 vertical reverse, default value is 1
2640        $DragOrientation: 1             //[Optional] Orientation to drag slide, 0 no drag, 1 horizental, 2 vertical, 3 both, default value is 1 (Note that the $DragOrientation should be the same as $PlayOrientation when $DisplayPieces is greater than 1, or parking position is not 0)
2641
2642    }, options);
2643
2644    //going to use $Idle instead of $AutoPlayInterval
2645    if (_Options.$Idle != undefined)
2646        _Options.$AutoPlayInterval = _Options.$Idle;
2647
2648    //going to use $Cols instead of $DisplayPieces
2649    if (_Options.$Cols != undefined)
2650        _Options.$DisplayPieces = _Options.$Cols;
2651
2652    //Sodo statement for development time intellisence only
2653    $JssorDebug$.$Execute(function () {
2654        _Options = $Jssor$.$Extend({
2655            $ArrowKeyNavigation: undefined,
2656            $SlideWidth: undefined,
2657            $SlideHeight: undefined,
2658            $SlideshowOptions: undefined,
2659            $CaptionSliderOptions: undefined,
2660            $BulletNavigatorOptions: undefined,
2661            $ArrowNavigatorOptions: undefined,
2662            $ThumbnailNavigatorOptions: undefined
2663        },
2664        _Options);
2665    });
2666
2667    var _PlayOrientation = _Options.$PlayOrientation & 3;
2668    var _PlayReverse = (_Options.$PlayOrientation & 4) / -4 || 1;
2669
2670    var _SlideshowOptions = _Options.$SlideshowOptions;
2671    var _CaptionSliderOptions = $Jssor$.$Extend({ $Class: $JssorCaptionSliderBase$, $PlayInMode: 1, $PlayOutMode: 1 }, _Options.$CaptionSliderOptions);
2672    //$Jssor$.$TranslateTransitions(_CaptionSliderOptions.$CaptionTransitions); //for old transition compatibility
2673    var _BulletNavigatorOptions = _Options.$BulletNavigatorOptions;
2674    var _ArrowNavigatorOptions = _Options.$ArrowNavigatorOptions;
2675    var _ThumbnailNavigatorOptions = _Options.$ThumbnailNavigatorOptions;
2676
2677    $JssorDebug$.$Execute(function () {
2678        if (_SlideshowOptions && !_SlideshowOptions.$Class) {
2679            $JssorDebug$.$Fail("Option $SlideshowOptions error, class not specified.");
2680        }
2681    });
2682
2683    $JssorDebug$.$Execute(function () {
2684        if (_Options.$CaptionSliderOptions && !_Options.$CaptionSliderOptions.$Class) {
2685            $JssorDebug$.$Fail("Option $CaptionSliderOptions error, class not specified.");
2686        }
2687    });
2688
2689    $JssorDebug$.$Execute(function () {
2690        if (_BulletNavigatorOptions && !_BulletNavigatorOptions.$Class) {
2691            $JssorDebug$.$Fail("Option $BulletNavigatorOptions error, class not specified.");
2692        }
2693    });
2694
2695    $JssorDebug$.$Execute(function () {
2696        if (_ArrowNavigatorOptions && !_ArrowNavigatorOptions.$Class) {
2697            $JssorDebug$.$Fail("Option $ArrowNavigatorOptions error, class not specified.");
2698        }
2699    });
2700
2701    $JssorDebug$.$Execute(function () {
2702        if (_ThumbnailNavigatorOptions && !_ThumbnailNavigatorOptions.$Class) {
2703            $JssorDebug$.$Fail("Option $ThumbnailNavigatorOptions error, class not specified.");
2704        }
2705    });
2706
2707    var _UISearchNoDeep = !_Options.$UISearchMode;
2708    var _ScaleWrapper;
2709    var _SlidesContainer = $Jssor$.$FindChild(elmt, "slides", _UISearchNoDeep);
2710    var _LoadingContainer = $Jssor$.$FindChild(elmt, "loading", _UISearchNoDeep) || $Jssor$.$CreateDiv(document);
2711
2712    var _BulletNavigatorContainer = $Jssor$.$FindChild(elmt, "navigator", _UISearchNoDeep);
2713
2714    var _ArrowLeft = $Jssor$.$FindChild(elmt, "arrowleft", _UISearchNoDeep);
2715    var _ArrowRight = $Jssor$.$FindChild(elmt, "arrowright", _UISearchNoDeep);
2716
2717    var _ThumbnailNavigatorContainer = $Jssor$.$FindChild(elmt, "thumbnavigator", _UISearchNoDeep);
2718
2719    $JssorDebug$.$Execute(function () {
2720        //if (_BulletNavigatorOptions && !_BulletNavigatorContainer) {
2721        //    throw new Error("$BulletNavigatorOptions specified but bullet navigator container (<div u=\"navigator\" ...) not defined.");
2722        //}
2723        if (_BulletNavigatorContainer && !_BulletNavigatorOptions) {
2724            throw new Error("Bullet navigator container defined but $BulletNavigatorOptions not specified.");
2725        }
2726
2727        //if (_ArrowNavigatorOptions) {
2728        //    if (!_ArrowLeft) {
2729        //        throw new Error("$ArrowNavigatorOptions specified, but arrowleft (<span u=\"arrowleft\" ...) not defined.");
2730        //    }
2731
2732        //    if (!_ArrowRight) {
2733        //        throw new Error("$ArrowNavigatorOptions specified, but arrowright (<span u=\"arrowright\" ...) not defined.");
2734        //    }
2735        //}
2736
2737        if ((_ArrowLeft || _ArrowRight) && !_ArrowNavigatorOptions) {
2738            throw new Error("arrowleft or arrowright defined, but $ArrowNavigatorOptions not specified.");
2739        }
2740
2741        //if (_ThumbnailNavigatorOptions && !_ThumbnailNavigatorContainer) {
2742        //    throw new Error("$ThumbnailNavigatorOptions specified, but thumbnail navigator container (<div u=\"thumbnavigator\" ...) not defined.");
2743        //}
2744
2745        if (_ThumbnailNavigatorContainer && !_ThumbnailNavigatorOptions) {
2746            throw new Error("Thumbnail navigator container defined, but $ThumbnailNavigatorOptions not specified.");
2747        }
2748    });
2749
2750    var _SlidesContainerWidth = $Jssor$.$CssWidth(_SlidesContainer);
2751    var _SlidesContainerHeight = $Jssor$.$CssHeight(_SlidesContainer);
2752
2753    $JssorDebug$.$Execute(function () {
2754        if (isNaN(_SlidesContainerWidth))
2755            $JssorDebug$.$Fail("Width of slides container wrong specification, it should be specified in pixel (like style='width: 600px;').");
2756
2757        if (_SlidesContainerWidth == undefined)
2758            $JssorDebug$.$Fail("Width of slides container not specified, it should be specified in pixel (like style='width: 600px;').");
2759
2760        if (isNaN(_SlidesContainerHeight))
2761            $JssorDebug$.$Fail("Height of slides container wrong specification, it should be specified in pixel (like style='height: 300px;').");
2762
2763        if (_SlidesContainerHeight == undefined)
2764            $JssorDebug$.$Fail("Height of slides container not specified, it should be specified in pixel (like style='height: 300px;').");
2765
2766        var slidesContainerOverflow = $Jssor$.$CssOverflow(_SlidesContainer);
2767        var slidesContainerOverflowX = $Jssor$.$Css(_SlidesContainer, "overflowX");
2768        var slidesContainerOverflowY = $Jssor$.$Css(_SlidesContainer, "overflowY");
2769        if (slidesContainerOverflow != "hidden" && (slidesContainerOverflowX != "hidden" || slidesContainerOverflowY != "hidden"))
2770            $JssorDebug$.$Fail("Overflow of slides container wrong specification, it should be specified as 'hidden' (style='overflow:hidden;').");
2771    });
2772
2773    $JssorDebug$.$Execute(function () {
2774        if (!$Jssor$.$IsNumeric(_Options.$DisplayPieces))
2775            $JssorDebug$.$Fail("Option $DisplayPieces error, it should be a numeric value and greater than or equal to 1.");
2776
2777        if (_Options.$DisplayPieces < 1)
2778            $JssorDebug$.$Fail("Option $DisplayPieces error, it should be greater than or equal to 1.");
2779
2780        if (_Options.$DisplayPieces > 1 && _Options.$DragOrientation && _Options.$DragOrientation != _PlayOrientation)
2781            $JssorDebug$.$Fail("Option $DragOrientation error, it should be 0 or the same of $PlayOrientation when $DisplayPieces is greater than 1.");
2782
2783        if (!$Jssor$.$IsNumeric(_Options.$ParkingPosition))
2784            $JssorDebug$.$Fail("Option $ParkingPosition error, it should be a numeric value.");
2785
2786        if (_Options.$ParkingPosition && _Options.$DragOrientation && _Options.$DragOrientation != _PlayOrientation)
2787            $JssorDebug$.$Fail("Option $DragOrientation error, it should be 0 or the same of $PlayOrientation when $ParkingPosition is not equal to 0.");
2788    });
2789
2790    var _StyleDef;
2791
2792    var _SlideElmts = [];
2793
2794    {
2795        var slideElmts = $Jssor$.$Children(_SlidesContainer);
2796        $Jssor$.$Each(slideElmts, function (slideElmt) {
2797            if (slideElmt.tagName == "DIV" && !$Jssor$.$AttributeEx(slideElmt, "u")) {
2798                _SlideElmts.push(slideElmt);
2799            }
2800            else if ($Jssor$.$IsBrowserIe9Earlier()) {
2801                $Jssor$.$CssZIndex(slideElmt, ($Jssor$.$CssZIndex(slideElmt) || 0) + 1);
2802            }
2803        });
2804    }
2805
2806    $JssorDebug$.$Execute(function () {
2807        if (_SlideElmts.length < 1) {
2808            $JssorDebug$.$Error("Slides html code definition error, there must be at least 1 slide to initialize a slider.");
2809        }
2810    });
2811
2812    var _SlideItemCreatedCount = 0; //for debug only
2813    var _SlideItemReleasedCount = 0;    //for debug only
2814
2815    var _PreviousSlideIndex;
2816    var _CurrentSlideIndex = -1;
2817    var _TempSlideIndex;
2818    var _PrevSlideItem;
2819    var _CurrentSlideItem;
2820    var _SlideCount = _SlideElmts.length;
2821
2822    var _SlideWidth = _Options.$SlideWidth || _SlidesContainerWidth;
2823    var _SlideHeight = _Options.$SlideHeight || _SlidesContainerHeight;
2824
2825    var _SlideSpacing = _Options.$SlideSpacing;
2826    var _StepLengthX = _SlideWidth + _SlideSpacing;
2827    var _StepLengthY = _SlideHeight + _SlideSpacing;
2828    var _StepLength = (_PlayOrientation & 1) ? _StepLengthX : _StepLengthY;
2829    var _DisplayPieces = Math.min(_Options.$DisplayPieces, _SlideCount);
2830
2831    var _SlideshowPanel;
2832    var _CurrentBoardIndex = 0;
2833    var _DragOrientation;
2834    var _DragOrientationRegistered;
2835    var _DragInvalid;
2836
2837    var _Navigators = [];
2838    var _BulletNavigator;
2839    var _ArrowNavigator;
2840    var _ThumbnailNavigator;
2841
2842    var _ShowLink;
2843
2844    var _Frozen;
2845    var _AutoPlay;
2846    var _AutoPlaySteps = _Options.$AutoPlaySteps;
2847    var _HoverToPause = _Options.$PauseOnHover;
2848    var _AutoPlayInterval = _Options.$AutoPlayInterval;
2849    var _SlideDuration = _Options.$SlideDuration;
2850
2851    var _SlideshowRunnerClass;
2852    var _TransitionsOrder;
2853
2854    var _SlideshowEnabled;
2855    var _ParkingPosition;
2856    var _CarouselEnabled = _DisplayPieces < _SlideCount;
2857    var _Loop = _CarouselEnabled ? _Options.$Loop : 0;
2858
2859    var _DragEnabled;
2860    var _LastDragSucceded;
2861
2862    var _NotOnHover = 1;   //0 Hovering, 1 Not hovering
2863
2864    //Variable Definition
2865    var _IsSliding;
2866    var _IsDragging;
2867    var _LoadingTicket;
2868
2869    //The X position of mouse/touch when a drag start
2870    var _DragStartMouseX = 0;
2871    //The Y position of mouse/touch when a drag start
2872    var _DragStartMouseY = 0;
2873    var _DragOffsetTotal;
2874    var _DragOffsetLastTime;
2875    var _DragIndexAdjust;
2876
2877    var _Carousel;
2878    var _Conveyor;
2879    var _Slideshow;
2880    var _CarouselPlayer;
2881    var _SlideContainer = new SlideContainer();
2882    var _ScaleRatio;
2883
2884    //$JssorSlider$ Constructor
2885    {
2886        _AutoPlay = _Options.$AutoPlay;
2887        _SelfSlider.$Options = options;
2888
2889        AdjustSlidesContainerSize();
2890
2891        $Jssor$.$Attribute(elmt, "jssor-slider", true);
2892
2893        $Jssor$.$CssZIndex(_SlidesContainer, $Jssor$.$CssZIndex(_SlidesContainer) || 0);
2894        $Jssor$.$CssPosition(_SlidesContainer, "absolute");
2895        _SlideshowPanel = $Jssor$.$CloneNode(_SlidesContainer, true);
2896        $Jssor$.$InsertBefore(_SlideshowPanel, _SlidesContainer);
2897
2898        if (_SlideshowOptions) {
2899            _ShowLink = _SlideshowOptions.$ShowLink;
2900            _SlideshowRunnerClass = _SlideshowOptions.$Class;
2901
2902            $JssorDebug$.$Execute(function () {
2903                if (!_SlideshowOptions.$Transitions || !_SlideshowOptions.$Transitions.length) {
2904                    $JssorDebug$.$Error("Invalid '$SlideshowOptions', no '$Transitions' specified.");
2905                }
2906            });
2907
2908            _SlideshowEnabled = _DisplayPieces == 1 && _SlideCount > 1 && _SlideshowRunnerClass && (!$Jssor$.$IsBrowserIE() || $Jssor$.$BrowserVersion() >= 8);
2909        }
2910
2911        _ParkingPosition = (_SlideshowEnabled || _DisplayPieces >= _SlideCount || !(_Loop & 1)) ? 0 : _Options.$ParkingPosition;
2912
2913        _DragEnabled = ((_DisplayPieces > 1 || _ParkingPosition) ? _PlayOrientation : -1) & _Options.$DragOrientation;
2914
2915        //SlideBoard
2916        var _SlideboardElmt = _SlidesContainer;
2917        var _SlideItems = [];
2918
2919        var _SlideshowRunner;
2920        var _LinkContainer;
2921
2922        var _IsTouchDevice = $Jssor$.$Device().$Touchable;
2923
2924        var _LastTimeMoveByDrag;
2925        var _Position_OnFreeze;
2926        var _CarouselPlaying_OnFreeze;
2927        var _PlayToPosition_OnFreeze;
2928        var _PositionToGoByDrag;
2929
2930        //SlideBoard Constructor
2931        {
2932            //if (_Device.$TouchActionAttr) {
2933            //    if (_DragEnabled) {
2934            //        var touchAction = "auto";
2935            //        if (_DragEnabled == 2) {
2936            //            touchAction = "pan-x";
2937            //        }
2938            //        else if (_DragEnabled) {
2939            //            touchAction = "pan-y";
2940            //        }
2941
2942            //        $Jssor$.$Css(_SlideboardElmt, _Device.$TouchActionAttr, touchAction);
2943            //    }
2944            //}
2945
2946            _Slideshow = new Slideshow();
2947
2948            if (_SlideshowEnabled)
2949                _SlideshowRunner = new _SlideshowRunnerClass(_SlideContainer, _SlideWidth, _SlideHeight, _SlideshowOptions, _IsTouchDevice);
2950
2951            $Jssor$.$AppendChild(_SlideshowPanel, _Slideshow.$Wrapper);
2952            $Jssor$.$CssOverflow(_SlidesContainer, "hidden");
2953
2954            //link container
2955            {
2956                _LinkContainer = CreatePanel();
2957                $Jssor$.$Css(_LinkContainer, "backgroundColor", "#000");
2958                $Jssor$.$CssOpacity(_LinkContainer, 0);
2959                $Jssor$.$InsertBefore(_LinkContainer, _SlideboardElmt.firstChild, _SlideboardElmt);
2960            }
2961
2962            for (var i = 0; i < _SlideElmts.length; i++) {
2963                var slideElmt = _SlideElmts[i];
2964                var slideItem = new SlideItem(slideElmt, i);
2965                _SlideItems.push(slideItem);
2966            }
2967
2968            $Jssor$.$HideElement(_LoadingContainer);
2969
2970            $JssorDebug$.$Execute(function () {
2971                $Jssor$.$Attribute(_LoadingContainer, "debug-id", "loading-container");
2972            });
2973
2974            _Carousel = new Carousel();
2975            _CarouselPlayer = new CarouselPlayer(_Carousel, _Slideshow);
2976
2977            $JssorDebug$.$Execute(function () {
2978                $Jssor$.$Attribute(_SlideboardElmt, "debug-id", "slide-board");
2979            });
2980
2981            if (_DragEnabled) {
2982                $Jssor$.$AddEvent(_SlidesContainer, "mousedown", OnDragStart);
2983                $Jssor$.$AddEvent(_SlidesContainer, "touchstart", OnTouchStart);
2984                $Jssor$.$AddEvent(_SlidesContainer, "dragstart", PreventDragSelectionEvent);
2985                $Jssor$.$AddEvent(_SlidesContainer, "selectstart", PreventDragSelectionEvent);
2986                $Jssor$.$AddEvent(document, "mouseup", OnDragEnd);
2987                $Jssor$.$AddEvent(document, "touchend", OnDragEnd);
2988                $Jssor$.$AddEvent(document, "touchcancel", OnDragEnd);
2989                $Jssor$.$AddEvent(window, "blur", OnDragEnd);
2990            }
2991        }
2992        //SlideBoard
2993
2994        _HoverToPause &= (_IsTouchDevice ? 10 : 5);
2995
2996        //Bullet Navigator
2997        if (_BulletNavigatorContainer && _BulletNavigatorOptions) {
2998            _BulletNavigator = new _BulletNavigatorOptions.$Class(_BulletNavigatorContainer, _BulletNavigatorOptions, OriginalWidth(), OriginalHeight());
2999            _Navigators.push(_BulletNavigator);
3000        }
3001
3002        //Arrow Navigator
3003        if (_ArrowNavigatorOptions && _ArrowLeft && _ArrowRight) {
3004            _ArrowNavigatorOptions.$Loop = _Loop;
3005            _ArrowNavigatorOptions.$DisplayPieces = _DisplayPieces;
3006            _ArrowNavigator = new _ArrowNavigatorOptions.$Class(_ArrowLeft, _ArrowRight, _ArrowNavigatorOptions, OriginalWidth(), OriginalHeight());
3007            _Navigators.push(_ArrowNavigator);
3008        }
3009
3010        //Thumbnail Navigator
3011        if (_ThumbnailNavigatorContainer && _ThumbnailNavigatorOptions) {
3012            _ThumbnailNavigatorOptions.$StartIndex = _Options.$StartIndex;
3013            _ThumbnailNavigator = new _ThumbnailNavigatorOptions.$Class(_ThumbnailNavigatorContainer, _ThumbnailNavigatorOptions);
3014            _Navigators.push(_ThumbnailNavigator);
3015        }
3016
3017        $Jssor$.$Each(_Navigators, function (navigator) {
3018            navigator.$Reset(_SlideCount, _SlideItems, _LoadingContainer);
3019            navigator.$On($JssorNavigatorEvents$.$NAVIGATIONREQUEST, NavigationClickHandler);
3020        });
3021
3022        Scale(OriginalWidth());
3023
3024        $Jssor$.$AddEvent(_SlidesContainer, "click", SlidesClickEventHandler);
3025        $Jssor$.$AddEvent(elmt, "mouseout", $Jssor$.$MouseOverOutFilter(MainContainerMouseLeaveEventHandler, elmt));
3026        $Jssor$.$AddEvent(elmt, "mouseover", $Jssor$.$MouseOverOutFilter(MainContainerMouseEnterEventHandler, elmt));
3027
3028        ShowNavigators();
3029
3030        //Keyboard Navigation
3031        if (_Options.$ArrowKeyNavigation) {
3032            $Jssor$.$AddEvent(document, "keydown", function (e) {
3033                if (e.keyCode == 37/*$JssorKeyCode$.$LEFT*/) {
3034                    //Arrow Left
3035                    PlayToOffset(-1);
3036                }
3037                else if (e.keyCode == 39/*$JssorKeyCode$.$RIGHT*/) {
3038                    //Arrow Right
3039                    PlayToOffset(1);
3040                }
3041            });
3042        }
3043
3044        var startPosition = _Options.$StartIndex;
3045        if (!(_Loop & 1)) {
3046            startPosition = Math.max(0, Math.min(startPosition, _SlideCount - _DisplayPieces));
3047        }
3048        _CarouselPlayer.$PlayCarousel(startPosition, startPosition, 0);
3049    }
3050};
3051var $JssorSlideo$ = window.$JssorSlideo$ = $JssorSlider$;
3052
3053$JssorSlider$.$EVT_CLICK = 21;
3054$JssorSlider$.$EVT_DRAG_START = 22;
3055$JssorSlider$.$EVT_DRAG_END = 23;
3056$JssorSlider$.$EVT_SWIPE_START = 24;
3057$JssorSlider$.$EVT_SWIPE_END = 25;
3058
3059$JssorSlider$.$EVT_LOAD_START = 26;
3060$JssorSlider$.$EVT_LOAD_END = 27;
3061$JssorSlider$.$EVT_FREEZE = 28;
3062
3063$JssorSlider$.$EVT_POSITION_CHANGE = 202;
3064$JssorSlider$.$EVT_PARK = 203;
3065
3066$JssorSlider$.$EVT_SLIDESHOW_START = 206;
3067$JssorSlider$.$EVT_SLIDESHOW_END = 207;
3068
3069$JssorSlider$.$EVT_PROGRESS_CHANGE = 208;
3070$JssorSlider$.$EVT_STATE_CHANGE = 209;
3071$JssorSlider$.$EVT_ROLLBACK_START = 210;
3072$JssorSlider$.$EVT_ROLLBACK_END = 211;
3073
3074//(function ($) {
3075//    jQuery.fn.jssorSlider = function (options) {
3076//        return this.each(function () {
3077//            return $(this).data('jssorSlider') || $(this).data('jssorSlider', new $JssorSlider$(this, options));
3078//        });
3079//    };
3080//})(jQuery);
3081
3082//window.jQuery && (jQuery.fn.jssorSlider = function (options) {
3083//    return this.each(function () {
3084//        return jQuery(this).data('jssorSlider') || jQuery(this).data('jssorSlider', new $JssorSlider$(this, options));
3085//    });
3086//});
3087
3088//$JssorBulletNavigator$
3089var $JssorNavigatorEvents$ = {
3090    $NAVIGATIONREQUEST: 1,
3091    $INDEXCHANGE: 2,
3092    $RESET: 3
3093};
3094
3095var $JssorBulletNavigator$ = window.$JssorBulletNavigator$ = function (elmt, options, containerWidth, containerHeight) {
3096    var self = this;
3097    $JssorObject$.call(self);
3098
3099    elmt = $Jssor$.$GetElement(elmt);
3100
3101    var _Count;
3102    var _Length;
3103    var _Width;
3104    var _Height;
3105    var _CurrentIndex;
3106    var _CurrentInnerIndex = 0;
3107    var _Options;
3108    var _Steps;
3109    var _Lanes;
3110    var _SpacingX;
3111    var _SpacingY;
3112    var _Orientation;
3113    var _ItemPrototype;
3114    var _PrototypeWidth;
3115    var _PrototypeHeight;
3116
3117    var _ButtonElements = [];
3118    var _Buttons = [];
3119
3120    function Highlight(index) {
3121        if (index != -1)
3122            _Buttons[index].$Selected(index == _CurrentInnerIndex);
3123    }
3124
3125    function OnNavigationRequest(index) {
3126        self.$TriggerEvent($JssorNavigatorEvents$.$NAVIGATIONREQUEST, index * _Steps);
3127    }
3128
3129    self.$Elmt = elmt;
3130    self.$GetCurrentIndex = function () {
3131        return _CurrentIndex;
3132    };
3133
3134    self.$SetCurrentIndex = function (index) {
3135        if (index != _CurrentIndex) {
3136            var lastInnerIndex = _CurrentInnerIndex;
3137            var innerIndex = Math.floor(index / _Steps);
3138            _CurrentInnerIndex = innerIndex;
3139            _CurrentIndex = index;
3140
3141            Highlight(lastInnerIndex);
3142            Highlight(innerIndex);
3143
3144            //self.$TriggerEvent($JssorNavigatorEvents$.$INDEXCHANGE, index);
3145        }
3146    };
3147
3148    self.$Show = function (hide) {
3149        $Jssor$.$ShowElement(elmt, hide);
3150    };
3151
3152    var _Located;
3153    self.$Relocate = function (containerWidth, containerHeight) {
3154        if (!_Located || _Options.$Scale == false) {
3155            if (_Options.$AutoCenter & 1) {
3156                $Jssor$.$CssLeft(elmt, (containerWidth - _Width) / 2);
3157            }
3158            if (_Options.$AutoCenter & 2) {
3159                $Jssor$.$CssTop(elmt, (containerHeight - _Height) / 2);
3160            }
3161
3162            _Located = true;
3163        }
3164    };
3165
3166    var _Initialized;
3167    self.$Reset = function (length) {
3168        if (!_Initialized) {
3169            _Length = length;
3170            _Count = Math.ceil(length / _Steps);
3171            _CurrentInnerIndex = 0;
3172
3173            var itemOffsetX = _PrototypeWidth + _SpacingX;
3174            var itemOffsetY = _PrototypeHeight + _SpacingY;
3175
3176            var maxIndex = Math.ceil(_Count / _Lanes) - 1;
3177
3178            _Width = _PrototypeWidth + itemOffsetX * (!_Orientation ? maxIndex : _Lanes - 1);
3179            _Height = _PrototypeHeight + itemOffsetY * (_Orientation ? maxIndex : _Lanes - 1);
3180
3181            $Jssor$.$CssWidth(elmt, _Width);
3182            $Jssor$.$CssHeight(elmt, _Height);
3183
3184            for (var buttonIndex = 0; buttonIndex < _Count; buttonIndex++) {
3185
3186                var numberDiv = $Jssor$.$CreateSpan();
3187                $Jssor$.$InnerText(numberDiv, buttonIndex + 1);
3188
3189                var div = $Jssor$.$BuildElement(_ItemPrototype, "numbertemplate", numberDiv, true);
3190                $Jssor$.$CssPosition(div, "absolute");
3191
3192                var columnIndex = buttonIndex % (maxIndex + 1);
3193                $Jssor$.$CssLeft(div, !_Orientation ? itemOffsetX * columnIndex : buttonIndex % _Lanes * itemOffsetX);
3194                $Jssor$.$CssTop(div, _Orientation ? itemOffsetY * columnIndex : Math.floor(buttonIndex / (maxIndex + 1)) * itemOffsetY);
3195
3196                $Jssor$.$AppendChild(elmt, div);
3197                _ButtonElements[buttonIndex] = div;
3198
3199                if (_Options.$ActionMode & 1)
3200                    $Jssor$.$AddEvent(div, "click", $Jssor$.$CreateCallback(null, OnNavigationRequest, buttonIndex));
3201
3202                if (_Options.$ActionMode & 2)
3203                    $Jssor$.$AddEvent(div, "mouseover", $Jssor$.$MouseOverOutFilter($Jssor$.$CreateCallback(null, OnNavigationRequest, buttonIndex), div));
3204
3205                _Buttons[buttonIndex] = $Jssor$.$Buttonize(div);
3206            }
3207
3208            //self.$TriggerEvent($JssorNavigatorEvents$.$RESET);
3209            _Initialized = true;
3210        }
3211    };
3212
3213    //JssorBulletNavigator Constructor
3214    {
3215        self.$Options = _Options = $Jssor$.$Extend({
3216            $SpacingX: 0,
3217            $SpacingY: 0,
3218            $Orientation: 1,
3219            $ActionMode: 1
3220        }, options);
3221
3222        //Sodo statement for development time intellisence only
3223        $JssorDebug$.$Execute(function () {
3224            _Options = $Jssor$.$Extend({
3225                $Steps: undefined,
3226                $Lanes: undefined
3227            }, _Options);
3228        });
3229
3230        _ItemPrototype = $Jssor$.$FindChild(elmt, "prototype");
3231
3232        $JssorDebug$.$Execute(function () {
3233            if (!_ItemPrototype)
3234                $JssorDebug$.$Fail("Navigator item prototype not defined.");
3235
3236            if (isNaN($Jssor$.$CssWidth(_ItemPrototype))) {
3237                $JssorDebug$.$Fail("Width of 'navigator item prototype' not specified.");
3238            }
3239
3240            if (isNaN($Jssor$.$CssHeight(_ItemPrototype))) {
3241                $JssorDebug$.$Fail("Height of 'navigator item prototype' not specified.");
3242            }
3243        });
3244
3245        _PrototypeWidth = $Jssor$.$CssWidth(_ItemPrototype);
3246        _PrototypeHeight = $Jssor$.$CssHeight(_ItemPrototype);
3247
3248        $Jssor$.$RemoveElement(_ItemPrototype, elmt);
3249
3250        _Steps = _Options.$Steps || 1;
3251        _Lanes = _Options.$Lanes || 1;
3252        _SpacingX = _Options.$SpacingX;
3253        _SpacingY = _Options.$SpacingY;
3254        _Orientation = _Options.$Orientation - 1;
3255    }
3256};
3257
3258var $JssorArrowNavigator$ = window.$JssorArrowNavigator$ = function (arrowLeft, arrowRight, options, containerWidth, containerHeight) {
3259    var self = this;
3260    $JssorObject$.call(self);
3261
3262    $JssorDebug$.$Execute(function () {
3263
3264        if (!arrowLeft)
3265            $JssorDebug$.$Fail("Option '$ArrowNavigatorOptions' spepcified, but UI 'arrowleft' not defined. Define 'arrowleft' to enable direct navigation, or remove option '$ArrowNavigatorOptions' to disable direct navigation.");
3266
3267        if (!arrowRight)
3268            $JssorDebug$.$Fail("Option '$ArrowNavigatorOptions' spepcified, but UI 'arrowright' not defined. Define 'arrowright' to enable direct navigation, or remove option '$ArrowNavigatorOptions' to disable direct navigation.");
3269
3270        if (isNaN($Jssor$.$CssWidth(arrowLeft))) {
3271            $JssorDebug$.$Fail("Width of 'arrow left' not specified.");
3272        }
3273
3274        if (isNaN($Jssor$.$CssWidth(arrowRight))) {
3275            $JssorDebug$.$Fail("Width of 'arrow right' not specified.");
3276        }
3277
3278        if (isNaN($Jssor$.$CssHeight(arrowLeft))) {
3279            $JssorDebug$.$Fail("Height of 'arrow left' not specified.");
3280        }
3281
3282        if (isNaN($Jssor$.$CssHeight(arrowRight))) {
3283            $JssorDebug$.$Fail("Height of 'arrow right' not specified.");
3284        }
3285    });
3286
3287    var _Hide;
3288    var _Length;
3289    var _CurrentIndex;
3290    var _Options;
3291    var _Steps;
3292    var _ArrowWidth = $Jssor$.$CssWidth(arrowLeft);
3293    var _ArrowHeight = $Jssor$.$CssHeight(arrowLeft);
3294
3295    function OnNavigationRequest(steps) {
3296        self.$TriggerEvent($JssorNavigatorEvents$.$NAVIGATIONREQUEST, steps, true);
3297    }
3298
3299    function ShowArrows(hide) {
3300        $Jssor$.$ShowElement(arrowLeft, hide || !options.$Loop && _CurrentIndex == 0);
3301        $Jssor$.$ShowElement(arrowRight, hide || !options.$Loop && _CurrentIndex >= _Length - options.$DisplayPieces);
3302
3303        _Hide = hide;
3304    }
3305
3306    self.$GetCurrentIndex = function () {
3307        return _CurrentIndex;
3308    };
3309
3310    self.$SetCurrentIndex = function (index, virtualIndex, temp) {
3311        if (temp) {
3312            _CurrentIndex = virtualIndex;
3313        }
3314        else {
3315            _CurrentIndex = index;
3316
3317            ShowArrows(_Hide);
3318        }
3319        //self.$TriggerEvent($JssorNavigatorEvents$.$INDEXCHANGE, index);
3320    };
3321
3322    self.$Show = ShowArrows;
3323
3324    var _Located;
3325    self.$Relocate = function (conainerWidth, containerHeight) {
3326        if (!_Located || _Options.$Scale == false) {
3327
3328            if (_Options.$AutoCenter & 1) {
3329                $Jssor$.$CssLeft(arrowLeft, (containerWidth - _ArrowWidth) / 2);
3330                $Jssor$.$CssLeft(arrowRight, (containerWidth - _ArrowWidth) / 2);
3331            }
3332
3333            if (_Options.$AutoCenter & 2) {
3334                $Jssor$.$CssTop(arrowLeft, (containerHeight - _ArrowHeight) / 2);
3335                $Jssor$.$CssTop(arrowRight, (containerHeight - _ArrowHeight) / 2);
3336            }
3337
3338            _Located = true;
3339        }
3340    };
3341
3342    var _Initialized;
3343    self.$Reset = function (length) {
3344        _Length = length;
3345        _CurrentIndex = 0;
3346
3347        if (!_Initialized) {
3348
3349            $Jssor$.$AddEvent(arrowLeft, "click", $Jssor$.$CreateCallback(null, OnNavigationRequest, -_Steps));
3350            $Jssor$.$AddEvent(arrowRight, "click", $Jssor$.$CreateCallback(null, OnNavigationRequest, _Steps));
3351
3352            $Jssor$.$Buttonize(arrowLeft);
3353            $Jssor$.$Buttonize(arrowRight);
3354
3355            _Initialized = true;
3356        }
3357
3358        //self.$TriggerEvent($JssorNavigatorEvents$.$RESET);
3359    };
3360
3361    //JssorArrowNavigator Constructor
3362    {
3363        self.$Options = _Options = $Jssor$.$Extend({
3364            $Steps: 1
3365        }, options);
3366
3367        _Steps = _Options.$Steps;
3368    }
3369};
3370
3371//$JssorThumbnailNavigator$
3372var $JssorThumbnailNavigator$ = window.$JssorThumbnailNavigator$ = function (elmt, options) {
3373    var _Self = this;
3374    var _Length;
3375    var _Count;
3376    var _CurrentIndex;
3377    var _Options;
3378    var _NavigationItems = [];
3379
3380    var _Width;
3381    var _Height;
3382    var _Lanes;
3383    var _SpacingX;
3384    var _SpacingY;
3385    var _PrototypeWidth;
3386    var _PrototypeHeight;
3387    var _DisplayPieces;
3388
3389    var _Slider;
3390    var _CurrentMouseOverIndex = -1;
3391
3392    var _SlidesContainer;
3393    var _ThumbnailPrototype;
3394
3395    $JssorObject$.call(_Self);
3396    elmt = $Jssor$.$GetElement(elmt);
3397
3398    function NavigationItem(item, index) {
3399        var self = this;
3400        var _Wrapper;
3401        var _Button;
3402        var _Thumbnail;
3403
3404        function Highlight(mouseStatus) {
3405            _Button.$Selected(_CurrentIndex == index);
3406        }
3407
3408        function OnNavigationRequest(event) {
3409            if (!_Slider.$LastDragSucceded()) {
3410                var tail = _Lanes - index % _Lanes;
3411                var slideVirtualIndex = _Slider.$GetVirtualIndex((index + tail) / _Lanes - 1);
3412                var itemVirtualIndex = slideVirtualIndex * _Lanes + _Lanes - tail;
3413                _Self.$TriggerEvent($JssorNavigatorEvents$.$NAVIGATIONREQUEST, itemVirtualIndex);
3414            }
3415
3416            //$JssorDebug$.$Log("navigation request");
3417        }
3418
3419        $JssorDebug$.$Execute(function () {
3420            self.$Wrapper = undefined;
3421        });
3422
3423        self.$Index = index;
3424
3425        self.$Highlight = Highlight;
3426
3427        //NavigationItem Constructor
3428        {
3429            _Thumbnail = item.$Thumb || item.$Image || $Jssor$.$CreateDiv();
3430            self.$Wrapper = _Wrapper = $Jssor$.$BuildElement(_ThumbnailPrototype, "thumbnailtemplate", _Thumbnail, true);
3431
3432            _Button = $Jssor$.$Buttonize(_Wrapper);
3433            if (_Options.$ActionMode & 1)
3434                $Jssor$.$AddEvent(_Wrapper, "click", OnNavigationRequest);
3435            if (_Options.$ActionMode & 2)
3436                $Jssor$.$AddEvent(_Wrapper, "mouseover", $Jssor$.$MouseOverOutFilter(OnNavigationRequest, _Wrapper));
3437        }
3438    }
3439
3440    _Self.$GetCurrentIndex = function () {
3441        return _CurrentIndex;
3442    };
3443
3444    _Self.$SetCurrentIndex = function (index, virtualIndex, temp) {
3445        var oldIndex = _CurrentIndex;
3446        _CurrentIndex = index;
3447        if (oldIndex != -1)
3448            _NavigationItems[oldIndex].$Highlight();
3449        _NavigationItems[index].$Highlight();
3450
3451        if (!temp) {
3452            _Slider.$PlayTo(_Slider.$GetVirtualIndex(Math.floor(virtualIndex / _Lanes)));
3453        }
3454    };
3455
3456    _Self.$Show = function (hide) {
3457        $Jssor$.$ShowElement(elmt, hide);
3458    };
3459
3460    _Self.$Relocate = $Jssor$.$EmptyFunction;
3461
3462    var _Initialized;
3463    _Self.$Reset = function (length, items, loadingContainer) {
3464        if (!_Initialized) {
3465            _Length = length;
3466            _Count = Math.ceil(_Length / _Lanes);
3467            _CurrentIndex = -1;
3468            _DisplayPieces = Math.min(_DisplayPieces, items.length);
3469
3470            var horizontal = _Options.$Orientation & 1;
3471
3472            var slideWidth = _PrototypeWidth + (_PrototypeWidth + _SpacingX) * (_Lanes - 1) * (1 - horizontal);
3473            var slideHeight = _PrototypeHeight + (_PrototypeHeight + _SpacingY) * (_Lanes - 1) * horizontal;
3474
3475            var slidesContainerWidth = slideWidth + (slideWidth + _SpacingX) * (_DisplayPieces - 1) * horizontal;
3476            var slidesContainerHeight = slideHeight + (slideHeight + _SpacingY) * (_DisplayPieces - 1) * (1 - horizontal);
3477
3478            $Jssor$.$CssPosition(_SlidesContainer, "absolute");
3479            $Jssor$.$CssOverflow(_SlidesContainer, "hidden");
3480            if (_Options.$AutoCenter & 1) {
3481                $Jssor$.$CssLeft(_SlidesContainer, (_Width - slidesContainerWidth) / 2);
3482            }
3483            if (_Options.$AutoCenter & 2) {
3484                $Jssor$.$CssTop(_SlidesContainer, (_Height - slidesContainerHeight) / 2);
3485            }
3486            //$JssorDebug$.$Execute(function () {
3487            //    if (!_Options.$AutoCenter) {
3488            //        var slidesContainerTop = $Jssor$.$CssTop(_SlidesContainer);
3489            //        var slidesContainerLeft = $Jssor$.$CssLeft(_SlidesContainer);
3490
3491            //        if (isNaN(slidesContainerTop)) {
3492            //            $JssorDebug$.$Fail("Position 'top' wrong specification of thumbnail navigator slides container (<div u=\"thumbnavigator\">...<div u=\"slides\">), \r\nwhen option $ThumbnailNavigatorOptions.$AutoCenter set to 0, it should be specified in pixel (like <div u=\"slides\" style=\"top: 0px;\">)");
3493            //        }
3494
3495            //        if (isNaN(slidesContainerLeft)) {
3496            //            $JssorDebug$.$Fail("Position 'left' wrong specification of thumbnail navigator slides container (<div u=\"thumbnavigator\">...<div u=\"slides\">), \r\nwhen option $ThumbnailNavigatorOptions.$AutoCenter set to 0, it should be specified in pixel (like <div u=\"slides\" style=\"left: 0px;\">)");
3497            //        }
3498            //    }
3499            //});
3500            $Jssor$.$CssWidth(_SlidesContainer, slidesContainerWidth);
3501            $Jssor$.$CssHeight(_SlidesContainer, slidesContainerHeight);
3502
3503            var slideItemElmts = [];
3504            $Jssor$.$Each(items, function (item, index) {
3505                var navigationItem = new NavigationItem(item, index);
3506                var navigationItemWrapper = navigationItem.$Wrapper;
3507
3508                var columnIndex = Math.floor(index / _Lanes);
3509                var laneIndex = index % _Lanes;
3510
3511                $Jssor$.$CssLeft(navigationItemWrapper, (_PrototypeWidth + _SpacingX) * laneIndex * (1 - horizontal));
3512                $Jssor$.$CssTop(navigationItemWrapper, (_PrototypeHeight + _SpacingY) * laneIndex * horizontal);
3513
3514                if (!slideItemElmts[columnIndex]) {
3515                    slideItemElmts[columnIndex] = $Jssor$.$CreateDiv();
3516                    $Jssor$.$AppendChild(_SlidesContainer, slideItemElmts[columnIndex]);
3517                }
3518
3519                $Jssor$.$AppendChild(slideItemElmts[columnIndex], navigationItemWrapper);
3520
3521                _NavigationItems.push(navigationItem);
3522            });
3523
3524            var thumbnailSliderOptions = $Jssor$.$Extend({
3525                $HWA: false,
3526                $AutoPlay: false,
3527                $NaviQuitDrag: false,
3528                $SlideWidth: slideWidth,
3529                $SlideHeight: slideHeight,
3530                $SlideSpacing: _SpacingX * horizontal + _SpacingY * (1 - horizontal),
3531                $MinDragOffsetToSlide: 12,
3532                $SlideDuration: 200,
3533                $PauseOnHover: 1,
3534                $PlayOrientation: _Options.$Orientation,
3535                $DragOrientation: _Options.$DisableDrag ? 0 : _Options.$Orientation
3536            }, _Options);
3537
3538            _Slider = new $JssorSlider$(elmt, thumbnailSliderOptions);
3539
3540            _Initialized = true;
3541        }
3542
3543        //_Self.$TriggerEvent($JssorNavigatorEvents$.$RESET);
3544    };
3545
3546    //JssorThumbnailNavigator Constructor
3547    {
3548        _Self.$Options = _Options = $Jssor$.$Extend({
3549            $SpacingX: 3,
3550            $SpacingY: 3,
3551            $DisplayPieces: 1,
3552            $Orientation: 1,
3553            $AutoCenter: 3,
3554            $ActionMode: 1
3555        }, options);
3556
3557        //going to use $Rows instead of $Lanes
3558        if (_Options.$Rows != undefined)
3559            _Options.$Lanes = _Options.$Rows;
3560
3561        //Sodo statement for development time intellisence only
3562        $JssorDebug$.$Execute(function () {
3563            _Options = $Jssor$.$Extend({
3564                $Lanes: undefined,
3565                $Width: undefined,
3566                $Height: undefined
3567            }, _Options);
3568        });
3569
3570        _Width = $Jssor$.$CssWidth(elmt);
3571        _Height = $Jssor$.$CssHeight(elmt);
3572
3573        $JssorDebug$.$Execute(function () {
3574            if (!_Width)
3575                $JssorDebug$.$Fail("width of 'thumbnavigator' container not specified.");
3576            if (!_Height)
3577                $JssorDebug$.$Fail("height of 'thumbnavigator' container not specified.");
3578        });
3579
3580        _SlidesContainer = $Jssor$.$FindChild(elmt, "slides", true);
3581        _ThumbnailPrototype = $Jssor$.$FindChild(_SlidesContainer, "prototype");
3582
3583        $JssorDebug$.$Execute(function () {
3584            if (!_ThumbnailPrototype)
3585                $JssorDebug$.$Fail("prototype of 'thumbnavigator' not defined.");
3586        });
3587
3588        _PrototypeWidth = $Jssor$.$CssWidth(_ThumbnailPrototype);
3589        _PrototypeHeight = $Jssor$.$CssHeight(_ThumbnailPrototype);
3590
3591        $Jssor$.$RemoveElement(_ThumbnailPrototype, _SlidesContainer);
3592
3593        _Lanes = _Options.$Lanes || 1;
3594        _SpacingX = _Options.$SpacingX;
3595        _SpacingY = _Options.$SpacingY;
3596        _DisplayPieces = _Options.$DisplayPieces;
3597    }
3598};
3599
3600//$JssorCaptionSliderBase$
3601function $JssorCaptionSliderBase$() {
3602    $JssorAnimator$.call(this, 0, 0);
3603    this.$Revert = $Jssor$.$EmptyFunction;
3604}
3605
3606var $JssorCaptionSlider$ = window.$JssorCaptionSlider$ = function (container, captionSlideOptions, playIn) {
3607    $JssorDebug$.$Execute(function () {
3608        if (!captionSlideOptions.$CaptionTransitions) {
3609            $JssorDebug$.$Error("'$CaptionSliderOptions' option error, '$CaptionSliderOptions.$CaptionTransitions' not specified.");
3610        }
3611    });
3612
3613    var _Self = this;
3614    var _ImmediateOutCaptionHanger;
3615    var _PlayMode = playIn ? captionSlideOptions.$PlayInMode : captionSlideOptions.$PlayOutMode;
3616
3617    var _CaptionTransitions = captionSlideOptions.$CaptionTransitions;
3618    var _CaptionTuningFetcher = { $Transition: "t", $Delay: "d", $Duration: "du", x: "x", y: "y", $Rotate: "r", $Zoom: "z", $Opacity: "f", $BeginTime: "b" };
3619    var _CaptionTuningTransfer = {
3620        $Default: function (value, tuningValue) {
3621            if (!isNaN(tuningValue.$Value))
3622                value = tuningValue.$Value;
3623            else
3624                value *= tuningValue.$Percent;
3625
3626            return value;
3627        },
3628        $Opacity: function (value, tuningValue) {
3629            return this.$Default(value - 1, tuningValue);
3630        }
3631    };
3632    _CaptionTuningTransfer.$Zoom = _CaptionTuningTransfer.$Opacity;
3633
3634    $JssorAnimator$.call(_Self, 0, 0);
3635
3636    function GetCaptionItems(element, level) {
3637
3638        var itemsToPlay = [];
3639        var lastTransitionName;
3640        var namedTransitions = [];
3641        var namedTransitionOrders = [];
3642
3643        function FetchRawTransition(captionElmt, index) {
3644            var rawTransition = {};
3645
3646            $Jssor$.$Each(_CaptionTuningFetcher, function (fetchAttribute, fetchProperty) {
3647                var attributeValue = $Jssor$.$AttributeEx(captionElmt, fetchAttribute + (index || ""));
3648                if (attributeValue) {
3649                    var propertyValue = {};
3650
3651                    if (fetchAttribute == "t") {
3652                        propertyValue.$Value = attributeValue;
3653                    }
3654                    else if (attributeValue.indexOf("%") + 1)
3655                        propertyValue.$Percent = $Jssor$.$ParseFloat(attributeValue) / 100;
3656                    else
3657                        propertyValue.$Value = $Jssor$.$ParseFloat(attributeValue);
3658
3659                    rawTransition[fetchProperty] = propertyValue;
3660                }
3661            });
3662
3663            return rawTransition;
3664        }
3665
3666        function GetRandomTransition() {
3667            return _CaptionTransitions[Math.floor(Math.random() * _CaptionTransitions.length)];
3668        }
3669
3670        function EvaluateCaptionTransition(transitionName) {
3671
3672            var transition;
3673
3674            if (transitionName == "*") {
3675                transition = GetRandomTransition();
3676            }
3677            else if (transitionName) {
3678
3679                //indexed transition allowed, just the same as named transition
3680                var tempTransition = _CaptionTransitions[$Jssor$.$ParseInt(transitionName)] || _CaptionTransitions[transitionName];
3681
3682                if ($Jssor$.$IsArray(tempTransition)) {
3683                    if (transitionName != lastTransitionName) {
3684                        lastTransitionName = transitionName;
3685                        namedTransitionOrders[transitionName] = 0;
3686
3687                        namedTransitions[transitionName] = tempTransition[Math.floor(Math.random() * tempTransition.length)];
3688                    }
3689                    else {
3690                        namedTransitionOrders[transitionName]++;
3691                    }
3692
3693                    tempTransition = namedTransitions[transitionName];
3694
3695                    if ($Jssor$.$IsArray(tempTransition)) {
3696                        tempTransition = tempTransition.length && tempTransition[namedTransitionOrders[transitionName] % tempTransition.length];
3697
3698                        if ($Jssor$.$IsArray(tempTransition)) {
3699                            //got transition from array level 3, random for all captions
3700                            tempTransition = tempTransition[Math.floor(Math.random() * tempTransition.length)];
3701                        }
3702                        //else {
3703                        //    //got transition from array level 2, in sequence for all adjacent captions with same name specified
3704                        //    transition = tempTransition;
3705                        //}
3706                    }
3707                    //else {
3708                    //    //got transition from array level 1, random but same for all adjacent captions with same name specified
3709                    //    transition = tempTransition;
3710                    //}
3711                }
3712                //else {
3713                //    //got transition directly from a simple transition object
3714                //    transition = tempTransition;
3715                //}
3716
3717                transition = tempTransition;
3718
3719                if ($Jssor$.$IsString(transition))
3720                    transition = EvaluateCaptionTransition(transition);
3721            }
3722
3723            return transition;
3724        }
3725
3726        var captionElmts = $Jssor$.$Children(element);
3727        $Jssor$.$Each(captionElmts, function (captionElmt, i) {
3728
3729            var transitionsWithTuning = [];
3730            transitionsWithTuning.$Elmt = captionElmt;
3731            var isCaption = $Jssor$.$AttributeEx(captionElmt, "u") == "caption";
3732
3733            $Jssor$.$Each(playIn ? [0, 3] : [2], function (j, k) {
3734
3735                if (isCaption) {
3736                    var transition;
3737                    var rawTransition;
3738
3739                    if (j != 2 || !$Jssor$.$AttributeEx(captionElmt, "t3")) {
3740                        rawTransition = FetchRawTransition(captionElmt, j);
3741
3742                        if (j == 2 && !rawTransition.$Transition) {
3743                            rawTransition.$Delay = rawTransition.$Delay || { $Value: 0 };
3744                            rawTransition = $Jssor$.$Extend(FetchRawTransition(captionElmt, 0), rawTransition);
3745                        }
3746                    }
3747
3748                    if (rawTransition && rawTransition.$Transition) {
3749
3750                        transition = EvaluateCaptionTransition(rawTransition.$Transition.$Value);
3751
3752                        if (transition) {
3753
3754                            //var transitionWithTuning = $Jssor$.$Extend({ $Delay: 0, $ScaleHorizontal: 1, $ScaleVertical: 1 }, transition);
3755                            var transitionWithTuning = $Jssor$.$Extend({ $Delay: 0 }, transition);
3756
3757                            $Jssor$.$Each(rawTransition, function (rawPropertyValue, propertyName) {
3758                                var tuningPropertyValue = (_CaptionTuningTransfer[propertyName] || _CaptionTuningTransfer.$Default).apply(_CaptionTuningTransfer, [transitionWithTuning[propertyName], rawTransition[propertyName]]);
3759                                if (!isNaN(tuningPropertyValue))
3760                                    transitionWithTuning[propertyName] = tuningPropertyValue;
3761                            });
3762
3763                            if (!k) {
3764                                if (rawTransition.$BeginTime)
3765                                    transitionWithTuning.$BeginTime = rawTransition.$BeginTime.$Value || 0;
3766                                else if ((_PlayMode) & 2)
3767                                    transitionWithTuning.$BeginTime = 0;
3768                            }
3769                        }
3770                    }
3771
3772                    transitionsWithTuning.push(transitionWithTuning);
3773                }
3774
3775                if ((level % 2) && !k) {
3776                    transitionsWithTuning.$Children = GetCaptionItems(captionElmt, level + 1);
3777                }
3778            });
3779
3780            itemsToPlay.push(transitionsWithTuning);
3781        });
3782
3783        return itemsToPlay;
3784    }
3785
3786    function CreateAnimator(item, transition, immediateOut) {
3787
3788        var animatorOptions = {
3789            $Easing: transition.$Easing,
3790            $Round: transition.$Round,
3791            $During: transition.$During,
3792            $Reverse: playIn && !immediateOut
3793        };
3794
3795        $JssorDebug$.$Execute(function () {
3796            animatorOptions.$CaptionAnimator = true;
3797        });
3798
3799        var captionItem = item;
3800        var captionParent = $Jssor$.$ParentNode(item);
3801
3802        var captionItemWidth = $Jssor$.$CssWidth(captionItem);
3803        var captionItemHeight = $Jssor$.$CssHeight(captionItem);
3804        var captionParentWidth = $Jssor$.$CssWidth(captionParent);
3805        var captionParentHeight = $Jssor$.$CssHeight(captionParent);
3806
3807        var fromStyles = {};
3808        var difStyles = {};
3809        var scaleClip = transition.$ScaleClip || 1;
3810
3811        //Opacity
3812        if (transition.$Opacity) {
3813            difStyles.$Opacity = 1 - transition.$Opacity;
3814        }
3815
3816        animatorOptions.$OriginalWidth = captionItemWidth;
3817        animatorOptions.$OriginalHeight = captionItemHeight;
3818
3819        //Transform
3820        if (transition.$Zoom || transition.$Rotate) {
3821            difStyles.$Zoom = (transition.$Zoom || 2) - 2;
3822
3823            if ($Jssor$.$IsBrowserIe9Earlier() || $Jssor$.$IsBrowserOpera()) {
3824                difStyles.$Zoom = Math.min(difStyles.$Zoom, 1);
3825            }
3826
3827            fromStyles.$Zoom = 1;
3828
3829            var rotate = transition.$Rotate || 0;
3830
3831            difStyles.$Rotate = rotate * 360;
3832            fromStyles.$Rotate = 0;
3833        }
3834            //Clip
3835        else if (transition.$Clip) {
3836            var fromStyleClip = { $Top: 0, $Right: captionItemWidth, $Bottom: captionItemHeight, $Left: 0 };
3837            var toStyleClip = $Jssor$.$Extend({}, fromStyleClip);
3838
3839            var blockOffset = toStyleClip.$Offset = {};
3840
3841            var topBenchmark = transition.$Clip & 4;
3842            var bottomBenchmark = transition.$Clip & 8;
3843            var leftBenchmark = transition.$Clip & 1;
3844            var rightBenchmark = transition.$Clip & 2;
3845
3846            if (topBenchmark && bottomBenchmark) {
3847                blockOffset.$Top = captionItemHeight / 2 * scaleClip;
3848                blockOffset.$Bottom = -blockOffset.$Top;
3849            }
3850            else if (topBenchmark)
3851                blockOffset.$Bottom = -captionItemHeight * scaleClip;
3852            else if (bottomBenchmark)
3853                blockOffset.$Top = captionItemHeight * scaleClip;
3854
3855            if (leftBenchmark && rightBenchmark) {
3856                blockOffset.$Left = captionItemWidth / 2 * scaleClip;
3857                blockOffset.$Right = -blockOffset.$Left;
3858            }
3859            else if (leftBenchmark)
3860                blockOffset.$Right = -captionItemWidth * scaleClip;
3861            else if (rightBenchmark)
3862                blockOffset.$Left = captionItemWidth * scaleClip;
3863
3864            animatorOptions.$Move = transition.$Move;
3865            difStyles.$Clip = toStyleClip;
3866            fromStyles.$Clip = fromStyleClip;
3867        }
3868
3869        //Fly
3870        {
3871            var toLeft = 0;
3872            var toTop = 0;
3873
3874            if (transition.x)
3875                toLeft -= captionParentWidth * transition.x;
3876
3877            if (transition.y)
3878                toTop -= captionParentHeight * transition.y;
3879
3880            if (toLeft || toTop || animatorOptions.$Move) {
3881                difStyles.$Left = toLeft;
3882                difStyles.$Top = toTop;
3883            }
3884        }
3885
3886        //duration
3887        var duration = transition.$Duration;
3888
3889        fromStyles = $Jssor$.$Extend(fromStyles, $Jssor$.$GetStyles(captionItem, difStyles));
3890
3891        animatorOptions.$Setter = $Jssor$.$StyleSetterEx();
3892
3893        return new $JssorAnimator$(transition.$Delay, duration, animatorOptions, captionItem, fromStyles, difStyles);
3894    }
3895
3896    function CreateAnimators(streamLineLength, captionItems) {
3897
3898        $Jssor$.$Each(captionItems, function (captionItem, i) {
3899
3900            $JssorDebug$.$Execute(function () {
3901                if (captionItem.length) {
3902                    var top = $Jssor$.$CssTop(captionItem.$Elmt);
3903                    var left = $Jssor$.$CssLeft(captionItem.$Elmt);
3904                    var width = $Jssor$.$CssWidth(captionItem.$Elmt);
3905                    var height = $Jssor$.$CssHeight(captionItem.$Elmt);
3906
3907                    var error = null;
3908
3909                    if (isNaN(top))
3910                        error = "Style 'top' for caption not specified. Please always specify caption like 'position: absolute; top: ...px; left: ...px; width: ...px; height: ...px;'.";
3911                    else if (isNaN(left))
3912                        error = "Style 'left' not specified. Please always specify caption like 'position: absolute; top: ...px; left: ...px; width: ...px; height: ...px;'.";
3913                    else if (isNaN(width))
3914                        error = "Style 'width' not specified. Please always specify caption like 'position: absolute; top: ...px; left: ...px; width: ...px; height: ...px;'.";
3915                    else if (isNaN(height))
3916                        error = "Style 'height' not specified. Please always specify caption like 'position: absolute; top: ...px; left: ...px; width: ...px; height: ...px;'.";
3917
3918                    if (error)
3919                        $JssorDebug$.$Error("Caption " + (i + 1) + " definition error, \r\n" + error + "\r\n" + captionItem.$Elmt.outerHTML);
3920                }
3921            });
3922
3923            var animator;
3924            var captionElmt = captionItem.$Elmt;
3925            var transition = captionItem[0];
3926            var transition3 = captionItem[1];
3927
3928            if (transition) {
3929
3930                animator = CreateAnimator(captionElmt, transition);
3931                streamLineLength = animator.$Locate(transition.$BeginTime == undefined ? streamLineLength : transition.$BeginTime, 1);
3932            }
3933
3934            streamLineLength = CreateAnimators(streamLineLength, captionItem.$Children);
3935
3936            if (transition3) {
3937                var animator3 = CreateAnimator(captionElmt, transition3, 1);
3938                animator3.$Locate(streamLineLength, 1);
3939                _Self.$Combine(animator3);
3940                _ImmediateOutCaptionHanger.$Combine(animator3);
3941            }
3942
3943            if (animator)
3944                _Self.$Combine(animator);
3945        });
3946
3947        return streamLineLength;
3948    }
3949
3950    _Self.$Revert = function () {
3951        _Self.$GoToPosition(_Self.$GetPosition_OuterEnd() * (playIn || 0));
3952        _ImmediateOutCaptionHanger.$GoToBegin();
3953    };
3954
3955    //Constructor
3956    {
3957        _ImmediateOutCaptionHanger = new $JssorAnimator$(0, 0);
3958
3959        CreateAnimators(0, _PlayMode ? GetCaptionItems(container, 1) : []);
3960    }
3961};
3962
3963var $JssorCaptionSlideo$ = function (container, captionSlideoOptions, playIn) {
3964    $JssorDebug$.$Execute(function () {
3965        if (!captionSlideoOptions.$CaptionTransitions) {
3966            $JssorDebug$.$Error("'$CaptionSlideoOptions' option error, '$CaptionSlideoOptions.$CaptionTransitions' not specified.");
3967        }
3968        else if (!$Jssor$.$IsArray(captionSlideoOptions.$CaptionTransitions)) {
3969            $JssorDebug$.$Error("'$CaptionSlideoOptions' option error, '$CaptionSlideoOptions.$CaptionTransitions' is not an array.");
3970        }
3971    });
3972
3973    var _This = this;
3974
3975    var _Easings;
3976    var _TransitionConverter = {};
3977    var _CaptionTransitions = captionSlideoOptions.$CaptionTransitions;
3978
3979    $JssorAnimator$.call(_This, 0, 0);
3980
3981    function ConvertTransition(transition, isEasing) {
3982        $Jssor$.$Each(transition, function (property, name) {
3983            var performName = _TransitionConverter[name];
3984            if (performName) {
3985                if (isEasing || name == "e") {
3986                    if ($Jssor$.$IsNumeric(property)) {
3987                        property = _Easings[property];
3988                    }
3989                    else if ($Jssor$.$IsPlainObject(property)) {
3990                        ConvertTransition(property, true);
3991                    }
3992                }
3993
3994                transition[performName] = property;
3995                delete transition[name];
3996            }
3997        });
3998    }
3999
4000    function GetCaptionItems(element, level) {
4001
4002        var itemsToPlay = [];
4003
4004        var captionElmts = $Jssor$.$Children(element);
4005        $Jssor$.$Each(captionElmts, function (captionElmt, i) {
4006            var isCaption = $Jssor$.$AttributeEx(captionElmt, "u") == "caption";
4007            if (isCaption) {
4008                var transitionName = $Jssor$.$AttributeEx(captionElmt, "t");
4009                var transition = _CaptionTransitions[$Jssor$.$ParseInt(transitionName)] || _CaptionTransitions[transitionName];
4010
4011                var transitionName2 = $Jssor$.$AttributeEx(captionElmt, "t2");
4012                var transition2 = _CaptionTransitions[$Jssor$.$ParseInt(transitionName2)] || _CaptionTransitions[transitionName2];
4013
4014                var itemToPlay = { $Elmt: captionElmt, $Transition: transition, $Transition2: transition2 };
4015                if (level < 3) {
4016                    itemsToPlay.concat(GetCaptionItems(captionElmt, level + 1));
4017                }
4018                itemsToPlay.push(itemToPlay);
4019            }
4020        });
4021
4022        return itemsToPlay;
4023    }
4024
4025    function CreateAnimator(captionElmt, transitions, lastStyles, forIn) {
4026
4027        $Jssor$.$Each(transitions, function (transition) {
4028            ConvertTransition(transition);
4029
4030            var animatorOptions = {
4031                $Easing: transition.$Easing,
4032                $Round: transition.$Round,
4033                $During: transition.$During,
4034                $Setter: $Jssor$.$StyleSetterEx()
4035            };
4036
4037            var fromStyles = $Jssor$.$Extend($Jssor$.$GetStyles(captionItem, transition), lastStyles);
4038
4039            var animator = new $JssorAnimator$(transition.b || 0, transition.d, animatorOptions, captionElmt, fromStyles, transition);
4040
4041            !forIn == !playIn && _This.$Combine(animator);
4042
4043            var castOptions;
4044            lastStyles = $Jssor$.$Extend(lastStyles, $Jssor$.$Cast(fromStyles, transition, 1, animatorOptions.$Easing, animatorOptions.$During, animatorOptions.$Round, animatorOptions, castOptions));
4045        });
4046
4047        return lastStyles;
4048    }
4049
4050    function CreateAnimators(captionItems) {
4051
4052        $Jssor$.$Each(captionItems, function (captionItem, i) {
4053
4054            $JssorDebug$.$Execute(function () {
4055                if (captionItem.length) {
4056                    var top = $Jssor$.$CssTop(captionItem.$Elmt);
4057                    var left = $Jssor$.$CssLeft(captionItem.$Elmt);
4058                    var width = $Jssor$.$CssWidth(captionItem.$Elmt);
4059                    var height = $Jssor$.$CssHeight(captionItem.$Elmt);
4060
4061                    var error = null;
4062
4063                    if (isNaN(top))
4064                        error = "style 'top' not specified";
4065                    else if (isNaN(left))
4066                        error = "style 'left' not specified";
4067                    else if (isNaN(width))
4068                        error = "style 'width' not specified";
4069                    else if (isNaN(height))
4070                        error = "style 'height' not specified";
4071
4072                    if (error)
4073                        throw new Error("Caption " + (i + 1) + " definition error, " + error + ".\r\n" + captionItem.$Elmt.outerHTML);
4074                }
4075            });
4076
4077            var captionElmt = captionItem.$Elmt;
4078
4079            var captionItemWidth = $Jssor$.$CssWidth(captionItem);
4080            var captionItemHeight = $Jssor$.$CssHeight(captionItem);
4081            var captionParentWidth = $Jssor$.$CssWidth(captionParent);
4082            var captionParentHeight = $Jssor$.$CssHeight(captionParent);
4083
4084            var lastStyles = { $Zoom: 1, $Rotate: 0, $Clip: { $Top: 0, $Right: captionItemWidth, $Bottom: captionItemHeight, $Left: 0 } };
4085
4086            lastStyles = CreateAnimator(captionElmt, captionItem.$Transition, lastStyles, true);
4087            CreateAnimator(captionElmt, captionItem.$Transition2, lastStyles, false);
4088        });
4089    }
4090
4091    _This.$Revert = function () {
4092        _This.$GoToPosition(-1, true);
4093    }
4094
4095    //Constructor
4096    {
4097        _Easings = [
4098            $JssorEasing$.$EaseSwing,
4099            $JssorEasing$.$EaseLinear,
4100            $JssorEasing$.$EaseInQuad,
4101            $JssorEasing$.$EaseOutQuad,
4102            $JssorEasing$.$EaseInOutQuad,
4103            $JssorEasing$.$EaseInCubic,
4104            $JssorEasing$.$EaseOutCubic,
4105            $JssorEasing$.$EaseInOutCubic,
4106            $JssorEasing$.$EaseInQuart,
4107            $JssorEasing$.$EaseOutQuart,
4108            $JssorEasing$.$EaseInOutQuart,
4109            $JssorEasing$.$EaseInQuint,
4110            $JssorEasing$.$EaseOutQuint,
4111            $JssorEasing$.$EaseInOutQuint,
4112            $JssorEasing$.$EaseInSine,
4113            $JssorEasing$.$EaseOutSine,
4114            $JssorEasing$.$EaseInOutSine,
4115            $JssorEasing$.$EaseInExpo,
4116            $JssorEasing$.$EaseOutExpo,
4117            $JssorEasing$.$EaseInOutExpo,
4118            $JssorEasing$.$EaseInCirc,
4119            $JssorEasing$.$EaseOutCirc,
4120            $JssorEasing$.$EaseInOutCirc,
4121            $JssorEasing$.$EaseInElastic,
4122            $JssorEasing$.$EaseOutElastic,
4123            $JssorEasing$.$EaseInOutElastic,
4124            $JssorEasing$.$EaseInBack,
4125            $JssorEasing$.$EaseOutBack,
4126            $JssorEasing$.$EaseInOutBack,
4127            $JssorEasing$.$EaseInBounce,
4128            $JssorEasing$.$EaseOutBounce,
4129            $JssorEasing$.$EaseInOutBounce//,
4130            //$JssorEasing$.$EaseGoBack,
4131            //$JssorEasing$.$EaseInWave,
4132            //$JssorEasing$.$EaseOutWave,
4133            //$JssorEasing$.$EaseOutJump,
4134            //$JssorEasing$.$EaseInJump
4135        ];
4136
4137        var translater = {
4138            $Top: "y",          //top
4139            $Left: "x",         //left
4140            $Bottom: "m",       //bottom
4141            $Right: "t",        //right
4142            $Zoom: "s",         //zoom/scale
4143            $Rotate: "r",       //rotate
4144            $Opacity: "o",      //opacity
4145            $Easing: "e",       //easing
4146            $ZIndex: "i",       //zindex
4147            $Round: "rd",       //round
4148            $During: "du",      //during
4149            $Duration: "d"//,   //duration
4150            //$Begin: "b"
4151        };
4152
4153        $Jssor$.$Each(translater, function (prop, newProp) {
4154            _TransitionConverter[prop] = newProp;
4155        });
4156
4157        CreateAnimators(GetCaptionItems(container, 1));
4158    }
4159};
4160
4161//Event Table
4162
4163//$EVT_CLICK = 21;			    function(slideIndex[, event])
4164//$EVT_DRAG_START = 22;		    function(position[, virtualPosition, event])
4165//$EVT_DRAG_END = 23;		    function(position, startPosition[, virtualPosition, virtualStartPosition, event])
4166//$EVT_SWIPE_START = 24;		function(position[, virtualPosition])
4167//$EVT_SWIPE_END = 25;		    function(position[, virtualPosition])
4168
4169//$EVT_LOAD_START = 26;			function(slideIndex)
4170//$EVT_LOAD_END = 27;			function(slideIndex)
4171
4172//$EVT_POSITION_CHANGE = 202;	function(position, fromPosition[, virtualPosition, virtualFromPosition])
4173//$EVT_PARK = 203;			    function(slideIndex, fromIndex)
4174
4175//$EVT_PROGRESS_CHANGE = 208;
4175	function(slideIndex, progress[, progressBegin, idleBegin, idleEnd, progressEnd])
4176//$EVT_STATE_CHANGE = 209;	    function(slideIndex, progress[, progressBegin, idleBegin, idleEnd, progressEnd])
4177
4178//$EVT_ROLLBACK_START = 210;	function(slideIndex, progress[, progressBegin, idleBegin, idleEnd, progressEnd])
4179//$EVT_ROLLBACK_END = 211;	    function(slideIndex, progress[, progressBegin, idleBegin, idleEnd, progressEnd])
4180
4181//$EVT_SLIDESHOW_START = 206;   function(slideIndex[, progressBegin, slideshowBegin, slideshowEnd, progressEnd])
4182//$EVT_SLIDESHOW_END = 207;     function(slideIndex[, progressBegin, slideshowBegin, slideshowEnd, progressEnd])
4183
4184//http://www.jssor.com/development/reference-api.html

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.