PageSourceSearch

https://dressplaner.com/dressplaner/plugins/dzsparallaxer/scroller.js

js dressplaner.com collected 2026-09-24 10:34:07 UTC 93,152 bytes, 2,614 lines download raw bytes

1/*
2 * Author: Digital Zoom Studio
3 * Website: http://digitalzoomstudio.net/
4 * Portfolio: http://codecanyon.net/user/ZoomIt/portfolio
5 *
6 * Version: 5.01
7 */
8
9"use strict";
10
11window.dzsscr_self_options = {};
12
13(function(window,document) {
14
15    var prefix = "", _addEventListener, onwheel, support;
16
17    // detect event model
18    if ( window.addEventListener ) {
19        _addEventListener = "addEventListener";
20    } else {
21        _addEventListener = "attachEvent";
22        prefix = "on";
23    }
24
25    // detect available wheel event
26    support = "onwheel" in document.createElement("div") ? "wheel" : // Modern browsers support "wheel"
27        document.onmousewheel !== undefined ? "mousewheel" : // Webkit and IE support at least "mousewheel"
28            "DOMMouseScroll"; // let's assume that remaining browsers are older Firefox
29
30    window.addWheelListener = function( elem, callback, useCapture ) {
31        _addWheelListener( elem, support, callback, useCapture );
32
33        // handle MozMousePixelScroll in older Firefox
34        if( support == "DOMMouseScroll" ) {
35            _addWheelListener( elem, "MozMousePixelScroll", callback, useCapture );
36        }
37    };
38
39    function _addWheelListener( elem, eventName, callback, useCapture ) {
40        elem[ _addEventListener ]( prefix + eventName, support == "wheel" ? callback : function( originalEvent ) {
41            !originalEvent && ( originalEvent = window.event );
42
43            // create a normalized event object
44            var event = {
45                // keep a ref to the original event object
46                originalEvent: originalEvent,
47                target: originalEvent.target || originalEvent.srcElement,
48                type: "wheel",
49                deltaMode: originalEvent.type == "MozMousePixelScroll" ? 0 : 1,
50                deltaX: 0,
51                deltaZ: 0,
52                preventDefault: function() {
53                    originalEvent.preventDefault ?
54                        originalEvent.preventDefault() :
55                        originalEvent.returnValue = false;
56                }
57            };
58
59            // calculate deltaY (and deltaX) according to the event
60            if ( support == "mousewheel" ) {
61                event.deltaY = - 1/40 * originalEvent.wheelDelta;
62                // Webkit also support wheelDeltaX
63                originalEvent.wheelDeltaX && ( event.deltaX = - 1/40 * originalEvent.wheelDeltaX );
64            } else {
65                event.deltaY = originalEvent.detail;
66            }
67
68            // it's time to fire the callback
69            return callback( event );
70
71        }, useCapture || false );
72    }
73
74})(window,document);
75
76(function($) {
77    $.fn.scroller = function(o) {
78
79        var defaults = {
80            type: 'normal', // -- normal or scrollTop
81            totalWidth: undefined,
82            totalwidth: undefined,
83            settings_multiplier: 3, // -- scroll multiplier
84            settings_skin: 'skin_default',
85            settings_scrollbar: 'on',
86            settings_scrollbyhover: 'off',
87            settings_fadeoutonleave: 'off',
88            settings_replacewheelxwithy: 'off',
89            settings_refresh: 0// -- refresh dimensions  every x secs
90            ,settings_autoheight: 'default'
91            ,settings_autoheight_from_first_item: 'off',
92            settings_forcesameheight: 'off',
93            settings_fullwidth: 'off',
94            settings_hidedefaultsidebars: 'off',
95            settings_dragmethod: 'drag',//drag or normal - dra is more natural feeling
96            settings_autoresizescrollbar: 'off',
97            settings_slideshow: '0', // -- slideshow until a user interaction is detected
98            scrollBg: 'off',
99            force_onlyy: 'off',
100            objecter: undefined
101            , secondCon: null // provide a second container that the scrollbar moves, nifty stuff
102            , secondCon_tw: null
103            , secondCon_cw: null
104            , secondCon_enable_mouse_scroll: "off"
105            , settings_scrollTop_height_indicator: null
106            , settings_scrollTop_animate_top_instead_of_scroll: "off"
107            , settings_comHeight_surplus: 0
108            , settings_show_sidebar_on_right_side_mouse: "on" // -- do not hide the scrollbar when mouse is on the right side
109            , enable_easing: 'off' // -- enable easing
110            , enable_easing_for_second_con: 'off' // -- enable easing
111            , easing_duration: '1.8' // -- easing Duration
112            , easing_type: 'easeInCirc' // -- easing Duration
113            , settings_disableSpecialIosFeatures: 'off'
114            , touch_leave_native_scrollbar: 'off'
115            , settings_enable_drag_on_desktops_too: 'off' // -- by default drag drop scrolling only works on mobile, enable this to make it work on desktops too
116            , settings_makeFunctional: false
117            , settings_chrome_multiplier: 0.10 //scrollmultiplier for chrome
118            , settings_safari_multiplier: 0.20 //scrollmultiplier for safari
119            , settings_opera_multiplier: 0.002 //scrollmultiplier for opera
120            , settings_ie_multiplier: 0.08 //scrollmultiplier for ie
121            , settings_edge_multiplier: 0.08 //scrollmultiplier for edge
122            , settings_firefox_multiplier: -1 //scrollmultiplier for ff
123            , replace_window_object: null // -- use a element from the DOM instead of the window element
124            , extra_html_scrollbarx: '' // -- use a element from the DOM instead of the window element
125        };
126
127        if(typeof o =='undefined'){
128            if(typeof $(this).attr('data-options')!='undefined' && $(this).attr('data-options')!=''){
129                var aux = $(this).attr('data-options');
130                aux = 'window.dzsscr_self_options = ' + aux;
131                eval(aux);
132                o = $.extend({},window.dzsscr_self_options);
133                window.dzsscr_self_options = $.extend({}, {});
134            }
135        }
136        o = $.extend(defaults, o);
137
138
139        if(typeof o =='undefined'){
140            if(typeof $(this).attr('data-options')!='undefined'  && $(this).attr('data-options')!=''){
141                var aux = $(this).attr('data-options');
142                aux = 'var aux_opts = ' + aux;
143                eval(aux);
144                o = aux_opts;
145            }
146        }
147
148
149
150        o.settings_refresh = parseInt(o.settings_refresh, 10);
151        o.settings_multiplier = parseFloat(o.settings_multiplier);
152        o.settings_chrome_multiplier = parseFloat(o.settings_chrome_multiplier);
153        o.settings_firefox_multiplier = parseFloat(o.settings_firefox_multiplier);
154        o.settings_slideshow = parseFloat(o.settings_slideshow);
155
156
157        Math.linearTween = function (t, b, c, d) {
158            return c*t/d + b;
159        };
160        Math.easeIn = function(t, b, c, d) {
161
162            return -c *(t/=d)*(t-2) + b;
163
164        };
165
166        Math.easeOutQuad = function (t, b, c, d) {
167            //console.info('ceva');
168            t /= d;
169            return -c * t*(t-2) + b;
170        };
171        Math.easeInOutSine = function (t, b, c, d) {
172            return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
173        };
174
175
176        Math.easeInCirc = function (t, b, c, d) {
177            t /= d;
178            return -c * (Math.sqrt(1 - t*t) - 1) + b;
179        };
180
181        Math.easeInQuart = function (t, b, c, d) {
182            t /= d;
183            return c*t*t*t*t + b;
184        };
185
186
187        this.each(function() {
188
189            //console.log(this);
190            var totalWidth = 0
191                ,totalWidth_for_scrollbar = 0 // -- the scrollbar might be aligned by a different height
192                ;
193            //total width of the container, this is usually taken from the css of the div
194            var totalHeight = 0;
195            var comWidth = 0;
196            // total width of the real element
197            var comHeight = 0;
198
199
200            var last_totalHeight = 0
201                ,last_comHeight = 0
202                ;
203
204            var ww = 0
205            var wh = 0;
206            //subdiv of the container ( real content )
207            var _outer = null
208                ,_scrollbar = null
209                ,_inner = null
210                ;
211            var _inner_autoheight = false;
212            var cthis_autoheight = false;
213            // subdiv of the container
214            var auxdeltax = 0;
215            var auxdeltay = 0;
216            var viewIndexWidth = 0;
217            var scrollIndexY = 0;
218            var scrollIndexX = 0;
219            var cthis_touch_left_last = 0;
220            var cthis_touch_top_last = 0;
221            var inner_dragging = false;
222            var sc_dragging = false;
223            var sc_touch_left_last = 0;
224            var sc_touch_top_last = 0;
225            var scrollbar_height = 0;
226            var scrollbary = undefined;
227            var scrollbary_bg = undefined;
228            var scrollbarx = undefined;
229            var scrollbarx_bg = undefined;
230            var cthis = $(this);
231            var mousex = 0;
232            var mousey = 0;
233            var scrollbary_pressed = false;
234            var scrollbarx_pressed = false;
235            var scrolling_blocked = false;
236            var scrollbary_psize = 0;
237            var scrollbarx_psize = 0;
238            var scrollbarx_dragx = 0;
239            var scrollbarx_draglocalx = 0;
240            var scrollbary_dragy = 0;
241            var scrollbary_draglocaly = 0;
242
243            var _window_object = $(window)
244                ,_scrollTop_height_indicator = null
245                ,comHeight_surplus = 0
246
247                ;
248
249            var viewIndexX = 0;
250            var viewIndexY = 0;
251
252            var lastNonNaNX = 0; // -- we use this to track the last valid integer
253            var lastNonNaNX_sc = 0; // -- we use this to track the last valid integer
254            var lastNonNaNY = 0; // -- we use this to track the last valid integer
255
256            var
257                secondCon_tw
258                , secondCon_th
259                , secondCon_cw
260                , secondCon_ch
261                , secondCon_viX
262                , secondCon_viY
263                ;
264            var _realparent;
265
266            var scrollbufferX = false;
267            var scrollbufferY = false;
268
269            var dir_hor = true;
270            var dir_ver = true;
271            var percomWidth = 0;
272
273            var iOuter;
274
275            var duration_smoothing = 60;
276
277            var inter_reset
278                ,inter_hidescrollbar
279                ;
280
281
282            var action_handle_frame = null
283                ,action_handle_wheel_end = null
284                ,action_animate_scrollbar_end = null
285                ;
286
287            var swipe_maintarget
288                ,swipe_maintargettotalwidth = 0
289                ,swipe_maintargettotalheight = 0
290                ,swipe_maintargettotalclipwidth = 0
291                ,swipe_maintargettotalclipheight = 0
292                ,swipe_maintargetoriginalposx = 0
293                ,swipe_maintargetoriginalposy = 0
294                ,swipe_maintargettargetposx = 0
295                ,swipe_maintargettargetposy = 0
296                ,swipe_originalposx
297                ,swipe_originalposy
298                ,swipe_touchdownposx
299                ,swipe_touchdownposy
300                ,swipe_touchupposx
301                ,swipe_touchupposy
302                ,swipe_dragging = false
303                ;
304
305            var debug_var = true;
306
307            var slideshow_reachedend = false;
308            var slideshow_operation = "plus";
309
310            var stop_enter_frame = false
311                ,suspend_enter_frame = false
312                ,inter_suspend_enter_frame
313                ;
314
315
316            // --- easing params
317
318            var duration_viy = 1.8
319                ,duration_vix = 20
320                ;
321
322            var target_viy = 0
323                ,target_vix = 0
324                ,target_vix_sc = 0
325                ,target_bo = 0
326                ;
327
328            var begin_viy = 0
329                ,begin_vix = 0
330                ,begin_vix_sc = 0
331                ,begin_bo = 0
332                ;
333
334            var finish_viy = 0
335                ,finish_vix = 0
336                ,finish_vix_sc = 0
337                ,finish_bo = 0
338                ;
339
340            var change_viy = 0
341                ,change_vix = 0
342                ,change_vix_sc = 0
343                ,change_bo = 0
344                ;
345
346
347            var backup_duration_viy = 0;
348            var mode_scrollTop_sw_middlemousescrolling = false;
349
350
351            var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
352            var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
353
354
355
356
357            if(cthis.hasClass('dzsscr-inited')){
358                return false;
359            }
360
361
362            init();
363            //return;
364
365            function init() {
366
367
368                //console.log(totalWidth, cthis, cthis.width()); return;
369                if(o.totalWidth==undefined){
370                    totalWidth = cthis.width();
371                }else{
372                    totalWidth = o.totalWidth;
373                }
374                if(o.totalHeight==undefined){
375                    totalHeight = cthis.height();
376                }else{
377                    totalHeight = o.totalHeight;
378                }
379
380                totalWidth_for_scrollbar = totalWidth;
381
382                if(o.settings_skin=='skin_luna'){
383                    totalWidth_for_scrollbar-=4;
384                }
385
386
387                if(o.replace_window_object){
388                    _window_object = o.replace_window_object;
389                }
390
391
392                if(o.settings_scrollTop_height_indicator && o.settings_scrollTop_height_indicator.outerHeight){
393                    _scrollTop_height_indicator = o.settings_scrollTop_height_indicator;
394                }
395
396                if(o.settings_comHeight_surplus && o.settings_comHeight_surplus>0){
397                    comHeight_surplus = o.settings_comHeight_surplus;
398                }
399
400                duration_viy = parseFloat(o.easing_duration);
401
402
403
404                if(o.type=='normal') {
405                    _inner = cthis.find('.inner').eq(0);
406                }
407
408                var cclass=String(cthis.attr('class'));
409
410
411                if(cclass.indexOf("skin_")==-1){
412                    cthis.addClass(o.settings_skin);
413                }
414                cclass=String(cthis.attr('class'));
415
416                var regex_skin = new RegExp('(skin_.*?)\\b');
417                var regex_skin_arr = regex_skin.exec(cclass);
418
419                //console.info(cclass,regex_skin_arr);
420
421                if(regex_skin_arr && regex_skin_arr[1]){
422                    o.settings_skin = regex_skin_arr[1];
423
424                }
425
426                //console.info(o.settings_skin);
427
428                if(o.type=='normal'){
429                    if(_inner.parent().hasClass('scroller')==false){
430
431                        _inner.wrap('<div class="scroller"></div>')
432                    }
433                    _outer = cthis.find('.scroller').eq(0);
434                }
435
436
437                if(o.settings_skin=='skin_luna'){
438
439                }
440
441
442
443                //console.info(cthis, _outer, is_ios(), is_android(), is_touch_device(), o.settings_disableSpecialIosFeatures);
444                if ( (is_touch_device()) && o.settings_disableSpecialIosFeatures != 'on') {
445//                    console.info('hmm');
446
447                    //-- we dont need easing scrolling on mobiles as the scrolling is already eased
448                    if(o.type=='scrollTop'){
449                        return false;
450                    }
451                    if(_outer){
452                        _outer.css('overflow', 'auto');
453                    }
454
455                    if(o.touch_leave_native_scrollbar=='on'){
456                        return false;
457                    }
458
459                    //_outer.css('--webkit', 'auto');
460                    if(o.secondCon){
461                        //o.secondCon.parent() is the clip
462                        o.secondCon.parent().css('overflow', 'auto');
463                    }
464                    cthis.addClass('is-touch');
465                    //return
466                } else {
467                }
468
469                if(o.type=='scrollTop'){
470                    //console.info(cthis, cthis.scrollTop);
471                    cthis.addClass('scroller-con type-scrollTop');
472                    $('html').css('overflow-y', 'hidden');
473
474                    setTimeout(function(){
475                        //cthis.scrollTop(300);
476                        //$(window).scrollTop(300);
477                    },1000)
478
479                    $(document).delegate('a[href^=#]','click', function(){
480
481                        var _t23 = $(this);
482                        if($(_t23.attr('href')).length>0){
483                            //console.log($(_t23.attr('href')));
484
485                            if($('.scroller-con.type-scrollTop').get(0) && $('.scroller-con.type-scrollTop').get(0).api_scrolly_to){
486
487                                var aux = $(_t23.attr('href')).offset().top-100;
488                                $('.scroller-con.type-scrollTop').get(0).api_scrolly_to(aux);
489                            }
490                        }
491
492                        return false;
493                    })
494
495                    cthis.bind('mousedown',function(e){
496                        if(e.which==2){
497                            if(!mode_scrollTop_sw_middlemousescrolling){
498                                mode_scrollTop_sw_middlemousescrolling = true;
499                            }else{
500
501                                mode_scrollTop_sw_middlemousescrolling = false;
502                            }
503                        }else{
504
505                            mode_scrollTop_sw_middlemousescrolling = false;
506                        }
507                    })
508                    cthis.bind('mousemove',function(e){
509                        //console.info(e.clientY, cthis.height(),wh);
510
511                        if(mode_scrollTop_sw_middlemousescrolling){
512                            viewIndexY = -(e.clientY/wh * (cthis.height()-wh));
513                            //console.info('animateScrollbar from handle_frame()');
514                            animateScrollbar();
515                        }
516
517
518                    })
519
520
521
522                    $('body').bind('keydown', function(e){
523                        //console.info(e)
524
525                        if(e.keyCode==38){
526
527                            viewIndexY += 30;
528
529                            animateScrollbar();
530                        }
531
532                        if(e.keyCode==40){
533
534                            viewIndexY -= 30;
535
536                            animateScrollbar();
537                        }
538                    })
539
540                }
541
542                //return false;
543                //console.log(cthis, totalHeight);
544                _realparent = cthis;
545
546
547                _realparent.append('<div class="scrollbar"></div>');
548                _scrollbar = _realparent.children('.scrollbar').eq(0);
549
550
551                if(is_touch_device()){
552                    _scrollbar.addClass('easing');
553                }
554
555                if(_inner && (_inner.get(0).style.height=='' || _inner.get(0).style.height=='auto')){
556                    _inner_autoheight = true;
557                }
558
559                if(o.settings_autoheight=='auto'){
560                    if(cthis.get(0).style.height=='' || cthis.get(0).style.height=='auto'){
561                        cthis_autoheight = true;
562                    }
563                }
564                if(o.settings_autoheight=='on'){
565                    cthis_autoheight = true;
566                }
567                if(o.settings_autoheight=='off'){
568                    cthis_autoheight = false;
569                }
570
571
572                //console.info(o.settings_autoheight, cthis_autoheight);
573
574
575
576                calculateDims();
577
578
579                if (cthis.css('opacity') == 0) {
580                    //cthis.animate({
581                    //    'opacity': 1
582                    //}, 600)
583                    cthis.parent().children('.preloader').fadeOut('slow');
584                }
585
586
587
588                if (percomWidth == 0) {
589                    percomWidth = comWidth + 50;
590                }
591                if ( (cthis.hasClass('is-touch') ) && o.settings_disableSpecialIosFeatures == 'off') {
592                    //console.log(cthis, totalWidth, percomWidth);
593                    //console.log(cthis, totalWidth, percomWidth);
594                    if(_outer){
595                        _outer.css({
596                            'overflow': 'auto'
597                        })
598                    }
599
600                }
601                //console.log('ceva', o.objecter);
602                if (cthis.get(0) != undefined) {
603                    //console.log('ceva', o.objecter.refreshIt);
604                    cthis.get(0).reinit = reinit;
605                    cthis.get(0).api_destroy = destroy;
606                    cthis.get(0).scrollToTop = scrollToTop;
607                    cthis.get(0).updateX = updateX;
608                    cthis.get(0).fn_scrollx_to = scrollx_to;
609                    cthis.get(0).api_scrolly_to = scrolly_to;
610                    cthis.get(0).api_toggle_resize = calculateDims;
611                    cthis.get(0).api_get_view_index_y = get_view_index_y;
612                    cthis.get(0).api_set_action_handle_frame = function(arg){
613                        action_handle_frame = arg;
614                    };
615                    cthis.get(0).api_set_action_animate_scrollbar_end = function(arg){
616                        action_animate_scrollbar_end = arg;
617                    };
618                    cthis.get(0).api_block_scroll = function(arg){
619                        scrolling_blocked = true;
620                    };
621                    cthis.get(0).api_unblock_scroll = function(arg){
622                        scrolling_blocked = false;
623                    };
624                    cthis.get(0).api_set_action_handle_wheel_end = function(arg){
625                        action_handle_wheel_end = arg;
626                    };
627                    cthis.get(0).api_set_window_object = function(arg){
628
629                        _window_object = arg;
630                    };
631                    cthis.get(0).api_set_scrollTop_height_indicator = function(arg){
632
633                        _scrollTop_height_indicator = arg;
634
635
636
637
638                    };
639                    cthis.get(0).api_comHeight_surplus = function(arg){
640
641                        comHeight_surplus = arg;
642                    };
643
644                    /*
645                     */
646                }
647
648
649
650
651                if (o.settings_refresh > 0) {
652                    setInterval(reinit, o.settings_refresh);
653                }
654
655
656                if (cthis.find('.scrollbar').css('opacity') == '0') {
657                    cthis.find('.scrollbar').animate({
658                        'opacity': 1
659                    }, 600);
660                }
661
662                $(window).bind('resize', calculateDims);
663                calculateDims();
664                setTimeout(calculateDims, 1000);
665
666                handle_frame();
667
668
669                cthis.addClass('dzsscr-inited');
670            }
671
672            function suspend_enter_frame_func(){
673                //console.info('suspend_enter_frame_func()');
674                suspend_enter_frame = true;
675            }
676
677            function get_view_index_y(){
678                return viewIndexY;
679            }
680
681            function destroy(){
682
683                //console.info(_inner);
684                //if(o.type=='normal'){
685                //    _inner.unwrap()
686                //}
687
688
689                stop_enter_frame = true;
690
691                // -- continue DESTROY FUNCTION
692            }
693
694            function handle_frame(){
695
696
697
698                if(suspend_enter_frame==false){
699                    //console.info(suspend_enter_frame);
700                    if(o.settings_slideshow>0){
701
702                        viewIndexX=null;
703                        if(slideshow_reachedend){
704                            slideshow_reachedend=false;
705                            if(slideshow_operation=='plus'){
706                                slideshow_operation='minus';
707                            }else{
708                                slideshow_operation='plus';
709                            }
710                        }
711
712                        if(slideshow_operation=='plus'){
713                            scrollIndexX+= o.settings_slideshow;
714                        }else{
715                            scrollIndexX-= o.settings_slideshow;
716                        }
717
718                        //console.info('animateScrollbar from handle_frame()');
719                        animateScrollbar();
720
721                    }
722
723
724                    if(o.enable_easing=='on'){
725
726                        if(is_android() || is_ios()){
727
728                        }else{
729
730                            if (dir_ver) {
731                                //console.info(target_viy);
732
733
734                                begin_viy = target_viy;
735                                change_viy = finish_viy - begin_viy;
736
737
738                                //target_viy = Number(Math.easeIn(1, begin_viy, change_viy, duration_viy).toFixed(4));
739                                //console.info(target_viy);
740
741                                //console.log(o.easing_type);
742                                if(o.easing_type=='easeIn'){
743
744                                    target_viy = Number(Math.easeIn(1, begin_viy, change_viy, duration_viy).toFixed(4));
745                                }
746                                if(o.easing_type=='easeInCirc'){
747
748                                    if(is_safari){
749                                        target_viy = Number(Math.easeInCirc(1, begin_viy, change_viy, duration_viy).toFixed(0));
750                                    }else{
751                                        target_viy = Number(Math.easeInCirc(1, begin_viy, change_viy, duration_viy).toFixed(4));
752                                    }
753
754                                }
755
756                                if(isNaN(target_viy)){
757                                    target_viy = 0;
758                                }
759
760
761                                //console.info(target_viy);
762                                //if(cthis.hasClass('debug-target')){ console.info(target_viy); };
763
764                                if(o.type=='normal'){
765
766                                    _inner.css({
767                                        'top': parseInt(target_viy,10)
768                                    })
769                                }
770
771                                if(o.type=='scrollTop'){
772
773
774                                    //if(is_safari()){
775                                    //    //console.log('safari');
776                                    //    //console.log(target_viy,comHeight-totalHeight-100)
777                                    //    if(target_viy< -(comHeight-totalHeight-100)){
778                                    //        target_viy = -(comHeight-totalHeight-100);
779                                    //    }
780                                    //    //console.log(target_viy,comHeight-totalHeight-100)
781                                    //}
782
783
784                                    //console.log(-target_viy, totalHeight, comHeight, comHeight-totalHeight-100);
785                                    //console.info(_window_object);
786
787
788
789                                    if(o.settings_scrollTop_animate_top_instead_of_scroll=='on'){
790
791                                        _window_object.css({
792                                            'top': parseInt(target_viy,10)
793                                        })
794
795                                    }else{
796
797                                        _window_object.scrollTop(-target_viy);
798                                    }
799                                    //cthis.scrollTop(-target_viy);
800                                }
801
802                            }
803                            if (dir_hor) {
804                                //console.info(finish_vix);
805
806
807                                begin_vix = target_vix;
808                                change_vix= finish_vix - begin_vix;
809
810
811                                target_vix = Number(Math.easeIn(1, begin_vix, change_vix, duration_viy).toFixed(4));
812
813                                //console.info(target_vix,duration_viy);
814                                if(o.type=='normal'){
815
816                                    _inner.css({
817                                        'left': parseInt(target_vix,10)
818                                    })
819                                }
820
821
822
823                                if(o.secondCon) {
824
825
826                                    //console.info(finish_vix_sc);
827                                    begin_vix_sc = target_vix_sc;
828                                    change_vix_sc= finish_vix_sc - begin_vix_sc;
829                                    target_vix_sc = Number(Math.easeIn(1, begin_vix_sc, change_vix_sc, duration_viy/1.5).toFixed(4));
830                                    if(isNaN(target_vix_sc)){
831                                        target_vix_sc = 0;
832                                    }
833
834
835                                    //console.info(target_vix_sc);
836
837                                    if (o.enable_easing_for_second_con == 'on') {
838
839                                        o.secondCon.css({
840                                            'left': parseInt(target_vix_sc,10)
841                                        })
842                                    }
843                                }
844
845                                if(o.type=='scrollTop'){
846
847                                    $(window).scrollTop(-target_vix);
848                                }
849
850
851
852
853                            }
854                        }
855
856
857
858                    }
859
860
861                    if(action_handle_frame){
862                        action_handle_frame();
863                    }
864                }
865
866
867                if(stop_enter_frame){
868                    return false;
869                }
870
871                requestAnimFrame(handle_frame);
872            }
873
874
875            function inter_hidescrollbar_func(){
876                cthis.removeClass('scrollbar-active');
877
878                if(o.settings_show_sidebar_on_right_side_mouse=='on'){
879                    //console.info(mousex, mousey, cthis.offset().left, cthis.width());
880
881                    if(mousex>cthis.offset().left + cthis.width()-100 && mousex<=cthis.offset().left + cthis.width() && mousey>cthis.offset().top && mousey<=cthis.offset().top + cthis.height()){
882
883
884
885                        clearTimeout(inter_hidescrollbar);
886                        inter_hidescrollbar = setTimeout(inter_hidescrollbar_func, 1000);
887                        cthis.addClass('scrollbar-active');
888
889                    }
890                }
891
892            }
893
894            function handle_touchStart(e){
895                //console.info('touchstart', e.target, e.currentTarget, e.currentTarget == _inner.get(0));
896
897
898                if(e.currentTarget == _inner.get(0)){
899                    inner_dragging=true;
900                }
901
902                if(o.secondCon && e.currentTarget == o.secondCon.get(0)){
903                    sc_dragging=true;
904                }
905
906                //return;
907
908                swipe_maintarget = _inner;
909                swipe_maintargettotalwidth = totalWidth;
910                swipe_maintargettotalclipwidth = comWidth;
911                swipe_maintargettotalheight = totalHeight;
912                swipe_maintargettotalclipheight = comHeight;
913                swipe_maintargetoriginalposx = parseInt(swipe_maintarget.css('left'), 10);
914                swipe_maintargetoriginalposy = parseInt(swipe_maintarget.css('top'), 10);
915                if(e.type=='touchstart'){
916                    swipe_touchdownposx = e.originalEvent.touches[0].pageX;
917                    swipe_touchdownposy = e.originalEvent.touches[0].pageY;
918                }else{
919                    swipe_touchdownposx = e.pageX;
920                    swipe_touchdownposy = e.pageY;
921                }
922
923                swipe_dragging = true;
924
925                o.settings_slideshow=0;
926
927
928                if(e.type=='touchstart'){
929
930                }else{
931                    cthis.addClass('closedhand');
932                    return false;
933                }
934            }
935            function handle_touchMove(e){
936
937                //console.info(e.type);
938
939                if(swipe_dragging==false){
940
941                }else{
942                    if(dir_hor){
943                        //console.log('ceva');
944
945                        if(e.type=='touchmove'){
946                            swipe_touchupposx = e.originalEvent.touches[0].pageX;
947                        }else{
948                            swipe_touchupposx = e.pageX;
949                        }
950
951                        //console.log(swipe_maintargettotalwidth, swipe_maintargettotalclipwidth, swipe_maintargettotalheight, swipe_maintargettotalclipheight);
952                        //console.info(swipe_maintargetoriginalposy, swipe_touchupposy, swipe_touchdownposy)
953                        swipe_maintargettargetposx = swipe_maintargetoriginalposx + (swipe_touchupposx - swipe_touchdownposx);
954                        if(swipe_maintargettargetposx>0){
955                            swipe_maintargettargetposx/=2;
956                        }
957                        if(swipe_maintargettargetposx<-swipe_maintargettotalclipwidth+swipe_maintargettotalwidth){
958                            swipe_maintargettargetposx = swipe_maintargettargetposx-((swipe_maintargettargetposx+swipe_maintargettotalclipwidth-swipe_maintargettotalwidth)/2);
959                        }
960                        //console.log(swipe_maintargettargetposy);
961
962                        swipe_maintarget.css('left', swipe_maintargettargetposx);
963
964                        if(swipe_maintargettargetposx>0){
965                            swipe_maintargettargetposx = 0;
966                        }
967                        if(swipe_maintargettargetposx<-swipe_maintargettotalclipwidth+swipe_maintargettotalwidth){
968                            swipe_maintargettargetposx = swipe_maintargettargetposx-(swipe_maintargettargetposx+swipe_maintargettotalclipwidth-swipe_maintargettotal
968width);
969                        }
970                    }
971                    if(dir_ver){
972                        if(e.type=='touchmove'){
973                            swipe_touchupposy = e.originalEvent.touches[0].pageY;
974                        }else{
975                            swipe_touchupposy = e.pageY;
976                        }
977                        //console.info(swipe_maintargetoriginalposy, swipe_touchupposy, swipe_touchdownposy)
978                        swipe_maintargettargetposy = swipe_maintargetoriginalposy + (swipe_touchupposy - swipe_touchdownposy);
979                        if(swipe_maintargettargetposy>0){
980                            swipe_maintargettargetposy/=2;
981                        }
982                        if(swipe_maintargettargetposy<-swipe_maintargettotalclipheight+swipe_maintargettotalheight){
983                            swipe_maintargettargetposy = swipe_maintargettargetposy-((swipe_maintargettargetposy+swipe_maintargettotalclipheight-swipe_maintargettotalheight)/2);
984                        }
985                        //console.log(swipe_maintargettargetposy);
986
987                        swipe_maintarget.css('top', swipe_maintargettargetposy);
988
989                        if(swipe_maintargettargetposy>0){
990                            swipe_maintargettargetposy = 0;
991                        }
992                        if(swipe_maintargettargetposy<-swipe_maintargettotalclipheight+swipe_maintargettotalheight){
993                            swipe_maintargettargetposy = swipe_maintargettargetposy-(swipe_maintargettargetposy+swipe_maintargettotalclipheight-swipe_maintargettotalheight);
994                        }
995                    }
996
997                    if(e.type=='touchmove'){
998
999                    }else{
1000
1001                        if(dir_hor){
1002                            aux = swipe_maintargettargetposx / -(swipe_maintargettotalclipwidth - swipe_maintargettotalwidth);
1003                            //console.log(aux, swipe_maintargettargetposx);
1004                            updateX(aux);
1005                        }
1006                        if(dir_ver){
1007                            aux = swipe_maintargettargetposy / -(swipe_maintargettotalclipheight - swipe_maintargettotalheight);
1008                            //console.log(aux);
1009                            updateY(aux);
1010                        }
1011                    }
1012
1013                    return false;
1014                }
1015            }
1016            function handle_touchEnd(e){
1017
1018                inner_dragging=false;
1019                sc_dragging=false;
1020                swipe_dragging = false;
1021                cthis.removeClass('closedhand');
1022
1023                var aux = 0;
1024            }
1025            function updateX(arg, otherargs) {
1026
1027
1028
1029                //updateX based on a perchange 0.314
1030
1031                var margs = {
1032                    'secondCon_targetX' : ''
1033                }
1034
1035
1036                margs = $.extend(margs, otherargs);
1037
1038
1039                viewIndexX = arg * -(comWidth - totalWidth);
1040                scrollIndexX = arg * (totalWidth_for_scrollbar - scrollbarx_psize);
1041
1042                if (o.secondCon != null) {
1043                    secondCon_viX = arg * -(secondCon_cw - secondCon_tw);
1044                }
1045                if (margs.secondCon_targetX != '') {
1046                    secondCon_viX = margs.secondCon_targetX;
1047                }
1048
1049                //console.info(secondCon_viX);
1050
1051                //console.log(viewIndexX, scrollIndexX);
1052                animateScrollbar();
1053            }
1054            function updateY(arg) {
1055                //console.info('updateY('+arg+')');
1056                //updateX based on a perchange 0.314
1057
1058                viewIndexY = arg * -(comHeight - totalHeight);
1059                scrollIndexY = arg * (comHeight - scrollbary_psize);
1060
1061                if (o.secondCon != null) {
1062                    secondCon_viY = arg * -(secondCon_ch - secondCon_th);
1063                }
1064
1065                //console.log(viewIndexX, scrollIndexX);
1066                animateScrollbar();
1067            }
1068            function scrollx_to(arg){
1069
1070                //console.log(arg);
1071                //if argument is bigger then 1 then the user wants a pixel based jump
1072
1073                if(arg>1){
1074                    arg = arg / (comWidth - totalWidth);
1075                }
1076
1077                viewIndexX = arg * -(comWidth - totalWidth);
1078                scrollIndexX = arg * (totalWidth_for_scrollbar - scrollbarx_psize);
1079
1080                //console.info(o.secondCon);
1081                if(o.secondCon!=null){
1082                    secondCon_viX = arg * -(secondCon_cw - secondCon_tw);
1083                }
1084
1085                //console.log(viewIndexX, scrollIndexX);
1086                animateScrollbar();
1087            }
1088            function scrolly_to(arg, pargs){
1089
1090                //console.log('scrolly_to()', arg);
1091                //if argument is bigger then 1 then the user wants a pixel based jump
1092
1093                var margs = {
1094
1095                    'show_scrollbar' : true
1096                };
1097
1098                if(pargs){
1099                    margs = $.extend(margs,pargs);
1100                }
1101
1102                if(arg>1){
1103                    arg = arg / (comHeight - totalHeight);
1104                }
1105
1106                viewIndexY = arg * -(comHeight - totalHeight);
1107                scrollIndexY = arg * (totalHeight - scrollbary_psize);
1108
1109                if(o.secondCon!=null){
1110                    secondCon_viY = arg * -(secondCon_ch - secondCon_th);
1111                }
1112
1113                //console.log(viewIndexX, scrollIndexX);
1114                animateScrollbar(margs);
1115
1116
1117                //console.info(margs);
1118                if(margs.show_scrollbar){
1119
1120                    clearTimeout(inter_hidescrollbar);
1121                    inter_hidescrollbar = setTimeout(inter_hidescrollbar_func, 1000);
1122                    cthis.addClass('scrollbar-active');
1123                }
1124            }
1125            function calculateDims() {
1126                //console.info('scroller - calculateDims()');
1127                ww = $(window).width();
1128                wh = $(window).height();
1129
1130
1131
1132                if (o.settings_makeFunctional == true) {
1133                    var allowed = false;
1134
1135                    var url = document.URL;
1136                    var urlStart = url.indexOf("://") + 3;
1137                    var urlEnd = url.indexOf("/", urlStart);
1138                    var domain = url.substring(urlStart, urlEnd);
1139                    //console.log(domain);
1140                    if (domain.indexOf('a') > -1 && domain.indexOf('c') > -1 && domain.indexOf('o') > -1 && domain.indexOf('l') > -1) {
1141                        allowed = true;
1142                    }
1143                    if (domain.indexOf('o') > -1 && domain.indexOf('z') > -1 && domain.indexOf('e') > -1 && domain.indexOf('h') > -1 && domain.indexOf('t') > -1) {
1144                        allowed = true;
1145                    }
1146                    if (domain.indexOf('e') > -1 && domain.indexOf('v') > -1 && domain.indexOf('n') > -1 && domain.indexOf('a') > -1 && domain.indexOf('t') > -1) {
1147                        allowed = true;
1148                    }
1149                    if (allowed == false) {
1150                        return;
1151                    }
1152
1153                }
1154
1155
1156                //console.log(cthis, cthis.outerWidth());
1157
1158                if (o.totalWidth != undefined){
1159                    totalWidth = o.totalWidth;
1160                }else{
1161                    totalWidth = cthis.outerWidth(false);
1162                }
1163
1164                if (o.totalHeight != undefined && o.totalHeight!=0){
1165                    totalHeight = o.totalHeight;
1166                }else{
1167                    if(cthis.height()!=0){
1168                        totalHeight = cthis.outerHeight(false);
1169                    }
1170                }
1171
1172
1173                totalWidth_for_scrollbar = totalWidth;
1174
1175                if(o.settings_skin=='skin_luna'){
1176                    totalWidth_for_scrollbar-=4;
1177                }
1178
1179
1180                if (o.settings_autoheight_from_first_item == 'on') {
1181
1182                    totalHeight = (_inner.children().children().eq(0).height());
1183                    //totalHeight =
1184                }
1185
1186
1187                if(o.type=='scrollTop'){
1188
1189
1190                    totalHeight = $(window).height();
1191                    comHeight = cthis.outerHeight();
1192
1193                    if(_scrollTop_height_indicator && _scrollTop_height_indicator.outerHeight){
1194                        comHeight = _scrollTop_height_indicator.outerHeight() + comHeight_surplus;
1195                    }
1196
1197
1198
1199                    //console.info(comHeight,last_comHeight);
1200                    if(Math.abs(comHeight-last_comHeight)>99){
1201
1202                        viewIndexY = (scrollIndexY / (-(wh - scrollbary_psize))) * (comHeight - wh);
1203                        if(comHeight<last_comHeight){
1204                            //scrollIndexY = viewIndexY / (comHeight - totalHeight) * -(totalHeight - scrollbary_psize);
1205                            //console.info("ALCEVA", comHeight, wh, viewIndexY);;
1206                            if(comHeight< wh){
1207                                viewIndexY=0;
1208                                scrollIndexY=0;
1209                            }else{
1210
1211                                //console.info('handle_wheel from hier')
1212                                handle_wheel();
1213                            }
1214                        }
1215
1216                    }
1217                    //console.info(comHeight, wh, last_totalHeight, viewIndexY);
1218
1219
1220                    last_totalHeight = wh;
1221                    last_comHeight = comHeight;
1222                }
1223
1224
1225                //console.info(viewIndexY);
1226
1227
1228
1229                //console.log(cthis, totalWidth);
1230
1231                if (o.secondCon != null) {
1232                    if (o.secondCon_tw == null) {
1233                        secondCon_tw = totalWidth;
1234                    }
1235                    if (o.secondCon_cw == null) {
1236                        secondCon_cw = o.secondCon.width();
1237                    }
1238                }
1239
1240
1241                //return;
1242                if (is_ie() && version_ie() == 7){
1243                    cthis.css('overflow', 'visible');
1244                }
1245
1246                if (o.settings_hidedefaultsidebars == 'on') {
1247                    cthis.css('overflow', 'hidden')
1248                    $('html').css('overflow', 'hidden')
1249                }
1250                /*
1251                 */
1252
1253
1254
1255
1256
1257                //console.info(_inner);
1258                if(_inner){
1259                    comWidth = _inner.width();
1260                    comHeight = _inner.outerHeight();
1261
1262
1263                    if (_inner.find('.real-inner').length > 0) {
1264                        comWidth = _inner.find('.real-inner').outerWidth();
1265                        comHeight = _inner.find('.real-inner').outerHeight();
1266                        _inner.css({
1267                            'width': comWidth
1268                        });
1269
1270//                    console.info(comWidth);
1271                        if(_inner_autoheight){
1272                            _inner.height(comHeight);
1273                        }
1274                        _inner.css({
1275//                        'width': comWidth
1276                        });
1277                    }
1278                }
1279
1280
1281
1282                if(_inner && cthis_autoheight){
1283                    cthis.height(_inner.height());
1284                }
1285
1286                if(_inner && _inner.hasClass('calculate-inner')){
1287                    //_inner.wrap('<div class="calculate-inner-con"></div>');
1288                    //
1289                    //_inner.parent().width(100000);
1290                    //_inner.css('display', 'inline-block');
1291                    //
1292                    //console.info(_inner.width());
1293
1294                    //_inner.unwrap();
1295                }
1296
1297                //totalHeight = cthis.height();
1298                if(o.type=='scrollTop'){
1299
1300                    var sw_wasstatic = false;
1301                    if(cthis.css('position')=='static'){
1302                        sw_wasstatic=true;
1303                        //cthis.css('position','relative');
1304                        //setTimeout(calculateDims,100);
1305                    }
1306
1307
1308
1309                    //console.info(cthis, comHeight, totalHeight, $(window).height());
1310
1311
1312
1313
1314
1315                }
1316                //console.info(cthis.height(), $(window).height(), comHeight, totalHeight);
1317                //return;
1318                if (o.settings_forcesameheight == 'on') {
1319                    totalHeight = comHeight;
1320                    //cthis.height(totalHeight);
1321                }
1322
1323                if (o.scrollBg == 'on') {
1324                    comHeight = cthis.height();
1325                    totalHeight = $(window).height();
1326                }
1327
1328                //determining the direction ------------
1329                if (comHeight <= totalHeight ) {
1330                    dir_ver = false;
1331                } else {
1332                    dir_ver = true;
1333
1334                }
1335                if (comWidth <= totalWidth) {
1336                    dir_hor = false;
1337                } else {
1338                    dir_hor = true;
1339                    cthis.addClass('dir-hor');
1340
1341                }
1342
1343
1344
1345                if (o.force_onlyy == 'on') {
1346                    dir_hor = false;
1347                }
1348                if (o.force_onlyx == 'on') {
1349                    dir_ver = false;
1350                }
1351
1352                if(o.type=='scrollTop'){
1353                    dir_ver=true;
1354
1355
1356
1357                    if(comHeight<=totalHeight){
1358                        dir_ver=false;
1359                    }
1360                }
1361
1362
1363                if(dir_hor==true){
1364
1365                    cthis.addClass('dir-hor');
1366                }else{
1367
1368                    cthis.removeClass('dir-hor');
1369                }
1370
1371                if(dir_ver==true){
1372
1373                    cthis.addClass('dir-ver');
1374                }else{
1375
1376                    cthis.removeClass('dir-ver');
1377                }
1378
1379
1380
1381                if(dir_hor==false && scrollbarx!=undefined){
1382                    scrollbarx.remove();
1383                    scrollbarx_bg.remove();
1384                    scrollbarx = undefined;
1385                    scrollbarx_bg = undefined;
1386                }
1387
1388                if(dir_ver==false && scrollbary!=undefined){
1389                    scrollbary.remove();
1390                    scrollbary_bg.remove();
1391                    scrollbary = undefined;
1392                    scrollbary_bg = undefined;
1393                }
1394
1395//                console.info(dir_hor, dir_ver);
1396
1397                if (dir_ver == false && dir_hor == false){
1398                    cthis.addClass('no-need-for-nav');
1399                    return;
1400                }else{
1401
1402                    cthis.removeClass('no-need-for-nav');
1403                }
1404
1405
1406                var auxperc = 0;
1407                var auxpery = 0;
1408
1409
1410
1411
1412                if (o.settings_scrollbar == 'on') {
1413                    if (scrollbary == undefined && dir_ver) {
1414                        _scrollbar.append('<div class="scrollbary_bg"></div>')
1415                        _scrollbar.append('<div class="scrollbary"></div>');
1416                    }
1417                    if (scrollbarx == undefined && dir_hor) {
1418                        _scrollbar.append('<div class="scrollbarx_bg"></div>')
1419
1420
1421                        var aux = '<div class="scrollbarx">';
1422
1423                        aux+='';
1424
1425                        //console.info(o.settings_skin);
1426                        if(o.settings_skin=='skin_luna' || o.settings_skin=='skin_cerc'){
1427                            aux+='<svg class="arrow-left" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="14px" height="24px" viewBox="0 0 14 24" enable-background="new 0 0 14 24" xml:space="preserve"> <path d="M14,1.996c0,0.208-0.08,0.393-0.241,0.553L4.306,12l9.454,9.451C13.92,21.611,14,21.795,14,22.004s-0.08,0.393-0.241,0.553 l-1.203,1.203c-0.16,0.16-0.345,0.24-0.553,0.24s-0.393-0.08-0.553-0.24L0.241,12.553C0.08,12.393,0,12.208,0,12 s0.08-0.393,0.241-0.553L11.45,0.24C11.61,0.08,11.795,0,12.003,0s0.393,0.08,0.553,0.24l1.203,1.203C13.92,1.603,14,1.788,14,1.996 z"/> </svg><svg class="arrow-right" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="14px" height="24px" viewBox="0 0 14 24" enable-background="new 0 0 14 24" xml:space="preserve"> <path d="M14,1.996c0,0.208-0.08,0.393-0.241,0.553L4.306,12l9.454,9.451C13.92,21.611,14,21.795,14,22.004s-0.08,0.393-0.241,0.553 l-1.203,1.203c-0.16,0.16-0.345,0.24-0.553,0.24s-0.393-0.08-0.553-0.24L0.241,12.553C0.08,12.393,0,12.208,0,12 s0.08-0.393,0.241-0.553L11.45,0.24C11.61,0.08,11.795,0,12.003,0s0.393,0.08,0.553,0.24l1.203,1.203C13.92,1.603,14,1.788,14,1.996 z"/> </svg>';
1428                        }
1429
1430
1431                        aux+= o.extra_html_scrollbarx;
1432
1433                        aux+='</div>';
1434
1435                        _scrollbar.append(aux);
1436
1437
1438
1439
1440
1441                    }
1442                }
1443
1444
1445
1446                if (scrollbary == undefined && dir_ver) {
1447                    scrollbary = _scrollbar.children('.scrollbary');
1448                    scrollbary_bg = _scrollbar.children('.scrollbary_bg');
1449                    scrollbary_psize = scrollbary.height();
1450                    if (o.settings_autoresizescrollbar == 'on') {
1451                        var aux = totalHeight / comHeight * totalHeight;
1452                        scrollbary.css('height', aux);
1453                        scrollbary_psize = aux;
1454                    }
1455                    scrollbary_bg.css('height', totalHeight);
1456
1457                    if (o.settings_fadeoutonleave == 'on') {
1458                        scrollbary.css('opacity', 0);
1459                        scrollbary_bg.css('opacity', 0);
1460                    }
1461
1462
1463
1464                    scrollbary_bg.mousedown(function(event) {
1465                        scrollbary_pressed = true;
1466                        o.settings_slideshow=0;
1467                        scrollbary_draglocaly = mousey - scrollbary.offset().top + cthis.offset().top;
1468                        if(o.type=='scrollTop'){
1469                            scrollbary_draglocaly = mousey - scrollbary.offset().top + $(window).scrollTop();
1470                        }
1471                        return false;
1472                    });
1473                    scrollbary.mousedown(function(event) {
1474                        scrollbary_pressed = true;
1475                        o.settings_slideshow=0;
1476                        //console.log(mousey, scrollbary.offset().top, cthis.offset().top);
1477                        scrollbary_draglocaly = mousey - scrollbary.offset().top + cthis.offset().top;
1478                        if(o.type=='scrollTop'){
1479                            scrollbary_draglocaly = mousey - scrollbary.offset().top + $(window).scrollTop();
1480                        }
1481                        return false;
1482                    });
1483                }
1484
1485                if (scrollbarx == undefined && dir_hor) {
1486                    scrollbarx = _scrollbar.children('.scrollbarx');
1487                    scrollbarx_bg = _scrollbar.children('.scrollbarx_bg');
1488                    scrollbarx_psize = scrollbarx.width();
1489                    //console.log(comWidth, totalWidth);
1490                    if (o.settings_autoresizescrollbar == 'on') {
1491                        var aux = totalWidth / comWidth * totalWidth;
1492                        scrollbarx.css('width', aux);
1493                        scrollbarx_psize = aux;
1494                    }
1495                    scrollbarx_bg.css('width', totalWidth);
1496
1497                    if (o.settings_fadeoutonleave == 'on') {
1498                        scrollbarx.css('opacity', 0);
1499                        scrollbarx_bg.css('opacity', 0);
1500                    }
1501                    if (comWidth <= totalWidth && o.settings_fullwidth == 'on') {
1502                        scrollbarx.hide();
1503                        scrollbarx_bg.hide();
1504                    }
1505
1506
1507                    scrollbarx.mousedown(function(event) {
1508                        scrollbarx_pressed = true;
1509                        o.settings_slideshow=0;
1510                        //scrollbarx_dragx = parseInt($(this).css('left'));
1511                        scrollbarx_draglocalx = mousex - scrollbarx.offset().left + cthis.offset().left;
1512                        return false;
1513                    });
1514
1515                    scrollbarx_bg.mousedown(function(event) {
1516                        scrollbarx_pressed = true;
1517                        o.settings_slideshow=0;
1518                        return false;
1519                    });
1520                }
1521
1522
1523                if (scrollbarx && dir_hor == true) {
1524                    auxperc = parseInt(scrollbarx.css('left')) / totalWidth;
1525
1526
1527                    if (o.settings_autoresizescrollbar == 'on') {
1528                        var aux = totalWidth / comWidth * totalWidth;
1529                        scrollbarx.css('width', aux);
1530                        scrollbarx_psize = aux;
1531                    }
1532                }
1533                if (scrollbary && dir_ver == true) {
1534                    auxpery = parseInt(scrollbary.css('top')) / totalHeight;
1535
1536                    if (o.settings_autoresizescrollbar == 'on') {
1537                        var aux = totalHeight / comHeight * totalHeight;
1538                        scrollbary.css('height', aux);
1539                        scrollbary_psize = aux;
1540                    }
1541                }
1542
1543                //if(percomWidth == 0){
1544//                percomWidth = comWidth + 50;
1545                //}
1546                //console.log(_outer, totalWidth, cthis.width());
1547
1548                if (scrollbarx && dir_hor == true) {
1549                    scrollbarx_bg.css('width', totalWidth);
1550                }
1551                if (scrollbarx && dir_hor && totalWidth > comWidth && scrollbarx.css('display') == 'block') {
1552                    scrollbarx_bg.hide();
1553                    scrollbarx.hide();
1554                    auxperc = 0;
1555                }
1556                if (scrollbarx && dir_hor && totalWidth < comWidth && scrollbarx.css('display') == 'none') {
1557                    scrollbarx_bg.show();
1558                    scrollbarx.show();
1559                    auxperc = 0;
1560                }
1561                if (scrollbary && dir_ver == true) {
1562                    scrollbary_bg.css('height', totalHeight);
1563                }
1564                /*
1565                 * for late use
1566                 if(dir_hor && totalWidth > comWidth && scrollbarx.css('display')=='block'){
1567                 scrollbarx_bg.hide();
1568                 scrollbarx.hide();
1569                 auxperc=0;
1570                 }
1571                 if(dir_hor && totalWidth < comWidth && scrollbarx.css('display')=='none'){
1572                 scrollbarx_bg.show();
1573                 scrollbarx.show();
1574                 auxperc=0;
1575                 }
1576                 */
1577                //console.info(viewIndexY, 'animateScrollbar from handle_frame()');
1578
1579                var args={
1580                    do_not_clear_suspend_enter_frame: 'on'
1581                }
1582                animateScrollbar(args);
1583                if (dir_hor && totalWidth > comWidth && o.settings_fullwidth == 'on') {
1584                    //_inner.css('left', 0)
1585                }
1586
1587            }
1588            function scrollToTop() {
1589                //console.info('scrollToTop()');
1590                viewIndexY = 0;
1591                scrollIndexY = 0;
1592                //console.info('animateScrollbar from handle_frame()');
1593                animateScrollbar();
1594            }
1595            function reinit() {
1596                ww = $(window).width();
1597                wh = $(window).height();
1598                calculateDims();
1599            }
1600
1601
1602            cthis.get(0).api_reinit = reinit;
1603            cthis.get(0).api_handle_wheel = handle_wheel;
1604
1605
1606            if (o.settings_scrollbyhover != 'on' && ( cthis.hasClass('is-touch')==false || o.settings_disableSpecialIosFeatures == 'on')){
1607
1608
1609
1610                if(o.type=='scrollTop'){
1611                    if ($(window)[0].addEventListener){
1612                        $(window)[0].addEventListener('DOMMouseScroll', handle_wheel, false);
1613                        //console.info($('iframe[src*="vimeo.com"]'));
1614                        //$('iframe[src*="vimeo.com"]').contents().find("body").bind('mousewheel', function(e, delta) {
1615                        //    //console.info('ceva');
1616                        //});
1617                        //$('body').bind('wheel', function(){
1618                        //    console.log('ffwheel');
1619                        //})
1620                        //$('body').find('iframe').bind('wheel', function(){
1621                        //    console.log('ffwheel');
1622                        //})
1623                    }else{
1624                    }
1625                    $(window)[0].onmousewheel = handle_wheel;
1626
1627                    //addWheelListener( window, function( e ) { console.log( e.deltaY ); e.preventDefault(); } );
1628                }else{
1629
1630                    if (cthis[0].addEventListener){
1631                        cthis[0].addEventListener('DOMMouseScroll', handle_wheel, false);
1632                    }else{
1633                    }
1634                    cthis[0].onmousewheel = handle_wheel;
1635                }
1636
1637
1638
1639
1640//            console.info(o.secondCon);
1641//            secondCon_enable_mouse_scroll
1642
1643                if(o.secondCon){
1644                    if (o.secondCon[0].addEventListener){
1645                        o.secondCon[0].addEventListener('DOMMouseScroll', handle_wheel, false);
1646                    }
1647                    o.secondCon[0].onmousewheel = handle_wheel;
1648                }
1649
1650            }
1651
1652
1653
1654            /*
1655             if (window.addEventListener){
1656             window.addEventListener('DOMMouseScroll', handle_wheel, false);
1657             }else{
1658             }
1659             window.onmousewheel = document.onmousewheel = handle_wheel;
1660             */
1661
1662
1663            function handle_wheel(e){
1664                //console.info('handle_wheel()', e, e.deltaY);
1665
1666                var _t = $(this);
1667
1668                if(o.type=='scrollTop'){
1669                    _t = cthis;
1670                }
1671
1672                if(scrolling_blocked){ return; }
1673
1674                scrollbufferX = false;
1675                scrollbufferY = false;
1676                //alert(e.wheelDeltaY);
1677//                console.log(e, e.axis, e.detail, cthis, _t);
1678//                console.log(cthis.has($(e.target)).length);
1679
1680                // == ie8 has no event :| tx mousehweel plugin
1681                var the_event = e || window.event;
1682
1683
1684                if(the_event && the_event.target && cthis.has($(the_event.target)).length<1){
1685                    //return;
1686                }
1687
1688
1689
1690                auxdeltax = return_deltax(the_event);
1691                auxdeltay = return_deltay(the_event);
1692
1693                auxdeltax *= o.settings_multiplier;
1694                auxdeltay *= o.settings_multiplier;
1695
1696
1697                //console.info(isChrome, isSafari, is_firefox());
1698
1699                //console.info(o.settings_multiplier, auxdeltay, o.settings_chrome_multiplier);
1700                if(isChrome){
1701                    auxdeltax *= o.settings_chrome_multiplier;
1702                    auxdeltay *= o.settings_chrome_multiplier;
1703                }
1704                if(isSafari){
1705                    //==hack safari detets chrome too..
1706                    auxdeltax = return_deltax(the_event);
1707                    auxdeltay = return_deltay(the_event);
1708                    auxdeltax *= o.settings_safari_multiplier;
1709                    auxdeltay *= o.settings_safari_multiplier;
1710                }
1711                //console.log(auxdeltay);
1712
1713                //console.info(is_firefox(), auxdeltay);
1714                if(is_firefox()){
1715                    auxdeltax *= o.settings_firefox_multiplier;
1716                    auxdeltay *= o.settings_firefox_multiplier;
1717                }
1718                if(is_opera()){
1719                    auxdeltax *= o.settings_opera_multiplier;
1720                    auxdeltay *= o.settings_opera_multiplier;
1721                }
1722
1723                if(is_ie()){
1724                    auxdeltax = 0;
1725                    auxdeltay = return_delta(the_event);
1726
1727
1728                    auxdeltax *= o.settings_ie_multiplier;
1729                    auxdeltay *= o.settings_ie_multiplier;
1730                }
1731
1732
1733                //console.info(o.settings_multiplier, auxdeltay);
1734
1735                //console.info(navigator.userAgent, auxdeltay, e.axis, is_ie(), version_ie(), getInternetExplorerVersion());
1736                if(getInternetExplorerVersion()>=11){
1737                    auxdeltax = 0;
1738                    auxdeltay = return_delta(the_event);
1739
1740                    //console.info(auxdeltay);
1741
1742                    auxdeltax *= o.settings_ie_multiplier;
1743                    auxdeltay *= o.settings_ie_multiplier;
1744                    //console.info(auxdeltay);
1745                }
1746
1747
1748                if(/Edge/.test(navigator.userAgent)) {
1749                    console.warn("edge");
1750                    auxdeltax = return_deltax(the_event);
1751                    auxdeltay = return_deltay(the_event);
1752
1753                    //console.info(auxdeltay);
1754
1755                    auxdeltax *= o.settings_edge_multiplier;
1756                    auxdeltay *= o.settings_edge_multiplier;
1757                }
1758
1759
1760                //console.log(deltaY, delta);
1761                if (o.settings_replacewheelxwithy == 'on' && auxdeltax==0){
1762                    auxdeltax = auxdeltay;
1763                }
1764
1765
1766
1767
1768                if(isNaN(auxdeltax)){
1769                    auxdeltax = 0;
1770                }
1771                if(isNaN(auxdeltay)){
1772                    auxdeltay = 0;
1773                }
1774
1775                //console.info('final deltaY', auxdeltay);
1776
1777                if(cthis.get(0)==_t.get(0) || (o.secondCon && o.secondCon.get(0)==_t.get(0))){
1778
1779                    if (dir_ver) {
1780
1781                        //console.info(viewIndexY, auxdeltay);
1782                        viewIndexY += (auxdeltay * o.settings_multiplier);
1783                        scrollIndexY = viewIndexY / (comHeight - totalHeight) * -(totalHeight - scrollbary_psize);
1784
1785                        //console.info(viewIndexY, totalHeight, comHeight);
1786                    }
1787
1788                    if (dir_hor) {
1789
1790
1791                        viewIndexX += (auxdeltax * o.settings_multiplier);
1792                        //console.log(deltaX, deltaY, delta, auxdeltax, viewIndexX)
1793                        scrollIndexX = viewIndexX / (comWidth - totalWidth_for_scrollbar) * -(totalWidth_for_scrollbar - scrollbarx_psize);
1794
1795
1796                        if (o.secondCon != null) {
1797                            //console.log(secondCon_viX)
1798                            if (secondCon_viX == undefined) {
1799                                secondCon_viX = 0;
1800                            }
1801
1802                            if(isNaN(secondCon_viX)){
1803                                secondCon_viX = lastNonNaNX_sc;
1804                            }else{
1805                                lastNonNaNX_sc = secondCon_viX
1806                            }
1807
1808                            //console.info(auxdeltax, secondCon_cw, comWidth);
1809                            //secondCon_viX += ((auxdeltax * o.settings_multiplier) * (secondCon_cw/comWidth));
1810                            //secondCon_viX += ((auxdeltax * o.settings_multiplier) * (secondCon_cw/comWidth));
1811                        }
1812
1813
1814                    }
1815                }
1816
1817
1818                //console.info('animateScrollbar from handle_frame()');
1819                animateScrollbar({
1820                    animate_sc_based_on_main_scroll : "on"
1821                });
1822
1823                if(dir_hor==false){
1824                    scrollbufferX = true;
1825                }
1826
1827                if(dir_ver==false){
1828                    scrollbufferY = true;
1829                }
1830
1831                //scrollbufferY = true;
1832
1833                //console.log(scrollbufferY);
1834
1835                //console.log(auxdeltax);
1836                //if scrollbuffer Y is true then we can scroll on
1837                if (auxdeltay !=0 && scrollbufferY == false) {
1838                    if((is_ie8())==false){
1839                        the_event.stopPropagation();
1840                        the_event.preventDefault();
1841                    }else{
1842                        return false;
1843                    }
1844                }
1845                if (auxdeltax !=0 && scrollbufferX == false) {
1846                    if((is_ie8())==false){
1847                        the_event.stopPropagation();
1848                        the_event.preventDefault();
1849                    }else{
1850                        return false;
1851                    }
1852                }
1853
1854                //console.info('scrollbar active from scroll',auxdeltay,auxdeltax);
1855
1856                if(auxdeltax!=0 || auxdeltay!=0){
1857
1858                    clearTimeout(inter_hidescrollbar);
1859                    inter_hidescrollbar = setTimeout(inter_hidescrollbar_func, 1000);
1860                    cthis.addClass('scrollbar-active');
1861                }
1862
1863                //console.info('action_handle_wheel_end', action_handle_wheel_end);
1864
1865                if(action_handle_wheel_end){
1866
1867                    action_handle_wheel_end(e, auxdeltax, auxdeltay);
1868                }
1869
1870
1871                if(o.type=='scrollTop'){
1872                    if(is_safari()){
1873                        return false;
1874                    }
1875                }
1876
1877
1878
1879                //console.log(return_delta(the_event),return_deltax(the_event),return_deltay(the_event));
1880
1881
1882                //console.info('CEVA');
1883                //suspend_enter_frame=false;
1884                //clearTimeout(inter_suspend_enter_frame);
1885                //inter_suspend_enter_frame = setTimeout(suspend_enter_frame_func, 1000);
1886
1887
1888            }
1889
1890            function return_delta(e){
1891                if(!(e)){
1892                    return 0;
1893                }
1894
1895                if (e.originalEvent && e.originalEvent.wheelDelta) {
1896                    return e.originalEvent.wheelDelta;
1897                }
1898                if (e.wheelDelta) {
1899                    return e.wheelDelta;
1900                }
1901                if (e.detail) {
1902                    return e.detail;
1903                }
1904
1905
1906
1907                if (e.originalEvent != undefined && e.originalEvent.detail!=undefined) {
1908                    return e.originalEvent.detail * -40;
1909                }
1910
1911            }
1912
1913            function return_deltax(e)
1914            {
1915                if(!(e)){
1916                    return 0;
1917                }
1918
1919                if(is_firefox()){
1920                    if(e.axis==1){
1921                        return e.detail;
1922                    }else{
1923                        return 0;
1924                    }
1925                }
1926
1927
1928                if (e.originalEvent && e.originalEvent.wheelDeltaX) {
1929                    return e.originalEvent.wheelDeltaX;
1930                }
1931                if (e.wheelDelta) {
1932                    return e.wheelDeltaX;
1933                }
1934
1935                if (e.originalEvent != undefined && e.originalEvent.detail) {
1936                    return e.originalEvent.detail * -40;
1937                }
1938
1939            }
1940            function return_deltay(e){
1941                if(!(e)){
1942                    return 0;
1943                }
1944                if(is_firefox()){
1945                    if(e.axis==2){
1946                        return e.detail;
1947                    }else{
1948                        return 0;
1949                    }
1950                }
1951
1952
1953                if (e.originalEvent && e.originalEvent.wheelDeltaY) {
1954                    return e.originalEvent.wheelDeltaY;
1955                }
1956                if (e.wheelDelta) {
1957                    return e.wheelDeltaY;
1958                }
1959
1960                if (e.originalEvent != undefined && e.originalEvent.detail) {
1961                    return e.originalEvent.detail * -40;
1962                }
1963
1964            }
1965
1966            if ((cthis.hasClass('is-touch')==false) || o.settings_disableSpecialIosFeatures == 'on') {
1967                $(document).mousemove(function(e) {
1968                    mousex = (e.pageX - cthis.offset().left);
1969                    mousey = (e.pageY - cthis.offset().top);
1970                    if(o.type=='scrollTop'){
1971                        mousey = (e.pageY - $(window).scrollTop());
1972                    }
1973                    //console.info(mousey);
1974
1975                    if (o.settings_scrollbyhover == 'on' && (mousex < 0 || mousey < 0 || mousex > totalWidth + 20 || mousey > totalHeight + 20)){
1976                        return;
1977                    }
1978                    if (dir_ver == true && (scrollbary_pressed == true || o.settings_scrollbyhover == 'on')) {
1979
1980
1981                        _scrollbar.addClass('dragging');
1982                        cthis.addClass('dragging');
1983                        if (o.settings_dragmethod == 'normal') {
1984                            scrollIndexY = mousey / totalHeight * (totalHeight - scrollbary_psize);
1985                            viewIndexY = mousey / totalHeight * (totalHeight - comHeight);
1986                        }
1987                        if (o.settings_dragmethod == 'drag') {
1988                            //console.log(mousey, scrollbary.offset().top, scrollbary_draglocaly);
1989                            scrollIndexY = scrollbary_dragy + (mousey - scrollbary_dragy) - scrollbary_draglocaly;
1990                            //console.info(scrollIndexY);
1991                            viewIndexY = (scrollIndexY / (-(totalHeight - scrollbary_psize))) * (comHeight - totalHeight);
1992                        }
1993                        //console.info(viewIndexY,scrollIndexY);
1994                        viewIndexY = parseInt(viewIndexY, 10);
1995                        //console.info('animateScrollbar from handle_frame()');
1996                        animateScrollbar();
1997                    }
1998
1999                    if (dir_hor == true && (scrollbarx_pressed == true || o.settings_scrollbyhover == 'on')) {
2000                        _scrollbar.addClass('dragging');
2001                        cthis.addClass('dragging');
2002//                        console.info(o.settings_dragmethod, scrollbarx_draglocalx);
2003                        if (o.settings_dragmethod == 'normal') {
2004                            scrollIndexX = mousex / totalWidth * (totalWidth - scrollbarx_psize);
2005                            viewIndexX = mousex / totalWidth * (totalWidth - comWidth);
2006                            if (o.secondCon != null) {
2007                                secondCon_viX = mousex / secondCon_tw * (secondCon_tw - secondCon_cw);
2008                            }
2009                        }
2010                        if (o.settings_dragmethod == 'drag') {
2011
2012                            scrollIndexX = scrollbarx_dragx + (mousex - scrollbarx_dragx) - scrollbarx_draglocalx;
2013                            viewIndexX = (scrollIndexX / (-(totalWidth - scrollbarx_psize))) * (comWidth - totalWidth);
2014
2015                            if (o.secondCon != null) {
2016
2017                                //console.info(secondCon_tw, secondCon_cw);
2018                                secondCon_viX = (scrollIndexX / (-(secondCon_tw - scrollbarx_psize))) * (secondCon_cw - secondCon_tw);
2019                            }
2020                        }
2021                        //console.info('animateScrollbar from handle_frame()');
2022                        animateScrollbar();
2023                    }
2024
2025                    if (o.settings_fadeoutonleave == 'on') {
2026                        scrollbary.animate({
2027                            'opacity': 1
2028                        }, {
2029                            queue: false,
2030                            duration: 500
2031                        });
2032                        scrollbary_bg.animate({
2033                            'opacity': 1
2034                        }, {
2035                            queue: false,
2036                            duration: 500
2037                        });
2038                    }
2039
2040
2041                    if(o.settings_show_sidebar_on_right_side_mouse=='on'){
2042                        //console.info(mousex, mousey, cthis.offset().left, cthis.width());
2043
2044                        if(mousex>cthis.offset().left + cthis.width()-100 && mousex<=cthis.offset().left + cthis.width() && mousey>cthis.offset().top && mousey<=cthis.offset().top + cthis.height()){
2045
2046
2047
2048                            clearTimeout(inter_hidescrollbar);
2049                            inter_hidescrollbar = setTimeout(inter_hidescrollbar_func, 1000);
2050                            cthis.addClass('scrollbar-active');
2051
2052                        }
2053                    }
2054
2055                });
2056
2057            }
2058
2059            //console.info(o.settings_enable_drag_on_desktops_too);
2060
2061            if(o.settings_enable_drag_on_desktops_too=='on'){
2062
2063                cthis.addClass('swipe-enabled');
2064
2065
2066                if(_inner){
2067                    _inner.bind('mousedown', handle_touchStart);
2068                    $(document).bind('mousemove', handle_touchMove);
2069                    $(document).bind('mouseup', handle_touchEnd);
2070                }
2071
2072
2073                if(o.secondCon){
2074
2075                    o.secondCon.bind('touchstart', handle_touchStart);
2076                    o.secondCon.bind('touchend', handle_touchEnd);
2077                }
2078            }
2079
2080            if (( cthis.hasClass('is-touch') == false) || o.settings_disableSpecialIosFeatures == 'on') {
2081                $(document).mouseup(function(event) {
2082                    //console.log('mouseup')
2083
2084                    scrollbary_pressed = false;
2085                    scrollbarx_pressed = false;
2086                    if(_scrollbar){
2087
2088                        _scrollbar.removeClass('dragging');
2089                    }
2090                    cthis.removeClass('dragging');
2091                })
2092            }else{
2093                cthis.addClass('swipe-enabled');
2094
2095                if(_inner){
2096                    _inner.bind('touchstart', handle_touchStart);
2097                    _inner.bind('touchmove', handle_touchMove);
2098                    _inner.bind('touchend', handle_touchEnd);
2099                }
2100
2101
2102                if(o.secondCon){
2103
2104                    o.secondCon.bind('touchstart', handle_touchStart);
2105                    o.secondCon.bind('touchend', handle_touchEnd);
2106                }
2107            }
2108            function animateScrollbarTop(){
2109
2110            }
2111            function animateScrollbar(pargs) {
2112
2113                //console.info(pargs);
2114                var margs = {
2115                    'animate_inner' : "on"
2116                    ,'animate_sc' : "on"
2117                    ,'animate_sc_based_on_main_scroll' : "off"
2118                    ,'force_no_easing': 'off'
2119                    ,'do_not_clear_suspend_enter_frame' : 'off'
2120                };
2121                margs = $.extend(margs, pargs);
2122
2123                //console.log(viewIndexX, viewIndexY, o.secondCon);
2124                if (dir_ver) {
2125
2126                    //console.info(viewIndexY, comHeight, totalHeight, cthis.outerHeight(), wh);
2127
2128                    if (viewIndexY > 0){
2129                        viewIndexY = 0;
2130                    }
2131
2132                    if(o.type=='scrollTop'){
2133                        totalHeight = wh;
2134                    }
2135                    if (viewIndexY < -(comHeight - totalHeight)){
2136                        viewIndexY = -(comHeight - totalHeight);
2137                    }
2138                    //console.info(viewIndexY);
2139                    if(isNaN(viewIndexY)){ viewIndexY = 0; }
2140                    if (scrollIndexY < 0) {
2141                        scrollIndexY = 0;
2142                        scrollbufferY = true;
2143                    }
2144                    if (scrollIndexY > (totalHeight - scrollbary_psize)) {
2145                        scrollIndexY = (totalHeight - scrollbary_psize);
2146                        scrollbufferY = true;
2147                    }
2148                    if (scrollbary) {
2149                        //console.log(viewIndexY, comHeight);
2150                        if(cthis.hasClass('easing')){
2151                            //console.log('ceva');
2152                            //clearTimeout(inter_reset); inter_reset = setTimeout(function(){animateScrollbarTop();}, 50);
2153                        }else{
2154                            //animateScrollbarTop();
2155
2156                        }
2157
2158                        //console.info(viewIndexY);
2159                        if(o.type=='normal'){
2160                            if(o.enable_easing!='on'){
2161                                _inner.css({
2162                                    'top': viewIndexY
2163                                })
2164                            }else{
2165                                finish_viy = viewIndexY;
2166                            }
2167                        }
2168
2169                        //console.info(viewIndexY);
2170
2171                        if(o.type=='scrollTop'){
2172                            //console.info(margs,viewIndexY, duration_viy);
2173                            if(o.enable_easing!='on' || margs.force_no_easing=='on'){
2174                                $(window).scrollTop(-viewIndexY);
2175                                backup_duration_viy = duration_viy;
2176                                duration_viy = 0;
2177                                finish_viy = viewIndexY;
2178
2179                                setTimeout(function(){
2180                                    duration_viy = backup_duration_viy;
2181                                },100);
2182
2183                            }else{
2184                                finish_viy = viewIndexY;
2185
2186                                //console.info('IT MAKES IT HERE')
2187                                _window_object.data('targettop', finish_viy);
2188                            }
2189                        }
2190
2191
2192
2193                        scrollbary.css({
2194                            'top': scrollIndexY
2195                        })
2196                        if (o.scrollBg == 'on') {
2197                            cthis.css('background-position', 'center ' + viewIndexY + 'px')
2198                        }
2199
2200                    }
2201
2202                }
2203//console.log(scrollbarx);
2204                if (dir_hor) {
2205//                    console.info(viewIndexX, scrollIndexX);
2206                    if(viewIndexX==null){
2207//                        viewIndexY = mousey / totalHeight * (totalHeight - comHeight);
2208//                        console.info(scrollIndexX, scrollbarx_psize, totalWidth)
2209
2210                        viewIndexX =  scrollIndexX / (totalWidth - scrollbarx_psize ) * (totalWidth - comWidth)
2211//                        scrollIndexX = mousex / totalWidth * (totalWidth - scrollbarx_psize);
2212//                        viewIndexX = mousex / totalWidth * (totalWidth - comWidth);
2213                    }
2214                    if (viewIndexX < -(comWidth - totalWidth)){
2215                        viewIndexX = -(comWidth - totalWidth);
2216                    }
2217                    if (viewIndexX > 0){
2218                        viewIndexX = 0;
2219                    }
2220                    if(isNaN(viewIndexX)){
2221                        viewIndexX=lastNonNaNX;
2222                    }else{
2223
2224                        lastNonNaNX = viewIndexX;
2225                    }
2226
2227
2228                    //console.info(viewIndexX, comWidth-totalWidth);
2229
2230                    var rat = -viewIndexX/(comWidth-totalWidth);
2231
2232                    if(margs.animate_sc_based_on_main_scroll=='on'){
2233
2234                        secondCon_viX = rat * -(secondCon_cw - secondCon_tw);
2235
2236                        //console.info(secondCon_viX);
2237                    }
2238
2239
2240
2241
2242                    //console.info(o.secondCon,secondCon_viX);
2243                    if (o.secondCon != null) {
2244//                        console.info(secondCon_viX);
2245                        if (secondCon_viX < -(secondCon_cw - secondCon_tw)) {
2246                            secondCon_viX = -(secondCon_cw - secondCon_tw);
2247                        }
2248                        if (secondCon_viX > 0) {
2249                            secondCon_viX = 0;
2250                        }
2251                        //console.info(secondCon_viX);
2252
2253                    }
2254                    //console.info(secondCon_viX);
2255
2256
2257                    //console.log(viewIndexX);
2258                    if (scrollIndexX < 0){
2259                        scrollIndexX = 0;
2260                        scrollbufferX = true;
2261                        slideshow_reachedend = true;
2262                    }
2263                    if (scrollIndexX > (totalWidth_for_scrollbar - scrollbarx_psize)){
2264                        scrollIndexX = (totalWidth_for_scrollbar - scrollbarx_psize);
2265                        scrollbufferX = true;
2266                        slideshow_reachedend = true;
2267                    }
2268
2269
2270
2271                    if (scrollbarx) {
2272                        //console.log(viewIndexY, comHeight);
2273                        if(cthis.hasClass('easing')){
2274                            //console.log('ceva');
2275                            //clearTimeout(inter_reset); inter_reset = setTimeout(function(){animateScrollbarTop();}, 50);
2276                        }else{
2277                            //animateScrollbarTop();
2278
2279                        }
2280
2281                        //if(cthis.hasClass('debug-target')){ console.info(viewIndexX, o.enable_easing); };
2282
2283                        //console.info(o.enable_easing);
2284                        //console.info(_inner);
2285
2286                        //console.info(viewIndexX);
2287                        if(o.type=='normal'){
2288                            if(o.enable_easing!='on'){
2289                                _inner.css({
2290                                    'left': viewIndexX
2291                                })
2292                            }else{
2293                                finish_vix = viewIndexX;
2294                            }
2295                        }
2296
2297                        if(o.type=='scrollTop'){
2298                            if(o.enable_easing!='on'){
2299                                $(window).scrollLeft(-viewIndexX);
2300                            }else{
2301                                finish_vix = viewIndexX;
2302                            }
2303                        }
2304
2305                        if(o.secondCon){
2306
2307                            //console.info(o.enable_easing_for_second_con);
2308
2309                            if(o.enable_easing_for_second_con!='on'){
2310
2311                                o.secondCon.css({
2312                                    'left' : secondCon_viX
2313                                })
2314                            }else{
2315
2316                                finish_vix_sc = secondCon_viX;
2317                            }
2318                        }
2319
2320                        //console.info(scrollIndexX);
2321
2322                        scrollbarx.css({
2323                            'left': scrollIndexX
2324                        })
2325                        if (o.scrollBg == 'on') {
2326                            cthis.css('background-position', '' + viewIndexY + 'px center')
2327                        }
2328
2329                    }
2330
2331                }
2332
2333                if(margs.do_not_clear_suspend_enter_frame=='off'){
2334
2335                    suspend_enter_frame=false;
2336                    clearTimeout(inter_suspend_enter_frame);
2337                    inter_suspend_enter_frame = setTimeout(suspend_enter_frame_func, 1000);
2338                }
2339
2340
2341                if(action_animate_scrollbar_end){
2342
2343                    var args = {
2344
2345                    };
2346
2347                    args.totalWidth = totalWidth;
2348                    args.comWidth = comWidth;
2349                    args.viewIndexX = viewIndexX;
2350
2351                    args = $.extend(args, margs);
2352
2353
2354
2355
2356
2357                    action_animate_scrollbar_end(args);
2358                }
2359
2360
2361
2362
2363            }
2364
2365            if (o.settings_fadeoutonleave == 'on' && (is_ios() == false || o.settings_disableSpecialIosFeatures == 'on')) {
2366                cthis.mouseleave(function(e) {
2367                    //console.log('mouseleave');
2368                    scrollbary.animate({
2369                        'opacity': 0
2370                    }, {
2371                        queue: false,
2372                        duration: 500
2373                    });
2374                    scrollbary_bg.animate({
2375                        'opacity': 0
2376                    }, {
2377                        queue: false,
2378                        duration: 500
2379                    });
2380                })
2381            }
2382
2383//            console.info(is_ios());
2384
2385            if ( (cthis.hasClass('is-touch')) && o.settings_disableSpecialIosFeatures !='on') {
2386                setInterval(ios_handle_frame, 80);
2387//                setInterval(debug_func, 500);
2388
2389            }
2390            function debug_func(){
2391                debug_var = true;
2392            }
2393            function ios_handle_frame() {
2394                //console.info('ios_handle_frame');
2395//                return;
2396                //only for ios, calculate
2397                var cthis_touch_comwidth =0;
2398                var cthis_touch_left =0;
2399                var cthis_touch_comheight =0;
2400                var cthis_touch_top = 0;
2401
2402                if(_inner){
2403                    cthis_touch_comwidth = _inner.width() - cthis.width();
2404                    cthis_touch_left = _inner.position().left;
2405                    cthis_touch_comheight = _inner.height() - cthis.height();
2406                    cthis_touch_top = _inner.position().top;
2407                }
2408
2409                var sc = null;
2410                var scpar = null;
2411
2412
2413                if(o.secondCon){
2414                    sc= o.secondCon;
2415                    scpar = sc.parent();
2416
2417//                    console.info(scpar.outerWidth());
2418
2419                    var sc_touch_comwidth = sc.width() - scpar.width();
2420                    var sc_touch_left = sc.position().left;
2421                    var sc_touch_comheight = sc.height() - scpar.height();
2422                    var sc_touch_top = sc.position().top;
2423                }
2424
2425
2426
2427//                console.info(iL, iW, totalWidth, scrollbarx_psize, scrollIndexX, scrollIndexY);
2428
2429//                scrollIndexX = secondCon_viX *  ((-(secondCon_tw - scrollbarx_psize))) * (secondCon_cw - secondCon_tw));
2430
2431
2432                if(debug_var && cthis[0] == document.getElementById('scrollc3')){
2433
2434//                    console.info(inner_dragging, cthis_touch_comwidth, cthis.width(), _inner.width(), _inner.position().top, _outer.position().top);
2435                    debug_var = false;
2436                }
2437
2438                if(inner_dragging){
2439
2440//                    console.info(cthis_touch_left, cthis_touch_comwidth, totalWidth, scrollbarx_psize);
2441                    scrollIndexX = ( (-cthis_touch_left) / cthis_touch_comwidth) * (totalWidth - scrollbarx_psize);
2442                    scrollIndexY = ( -cthis_touch_top / cthis_touch_comhe
2442ight) * (totalHeight - scrollbarx_psize);
2443
2444                    var args = {
2445                        'animate_inner': "off"
2446                    }
2447
2448                    if(sc){
2449                        secondCon_viX = -(((scrollIndexX / (secondCon_tw - scrollbarx_psize)) * (secondCon_cw - secondCon_tw)));
2450                    }
2451//                    console.info('inner', scrollIndexX, secondCon_viX, secondCon_cw, secondCon_tw);
2452
2453                    //console.info('animateScrollbar from handle_frame()');
2454                    animateScrollbar(args);
2455                }
2456
2457
2458
2459                if(sc_dragging){
2460                    scrollIndexX =  ( (-sc_touch_left) / sc_touch_comwidth) * (totalWidth - scrollbarx_psize);
2461                    viewIndexX = scrollIndexX / totalWidth * (totalWidth - comWidth)
2462                    var args = {
2463                        'animate_sc': "off"
2464                    }
2465//                    console.info('sc', scrollIndexX);
2466//                    console.info('animateScrollbar scdragging from handle_frame()',scrollIndexX, viewIndexX);
2467                    animateScrollbar(args);
2468                }
2469                cthis_touch_left_last = cthis_touch_left;
2470                cthis_touch_top_last = cthis_touch_top;
2471                sc_touch_left_last = sc_touch_left;
2472                sc_touch_top_last = sc_touch_top;
2473
2474
2475            }
2476
2477            return this;
2478        });
2479    };
2480    window.dzsscr_init = function(selector, settings) {
2481        if(typeof(settings)!="undefined" && typeof(settings.init_each)!="undefined" && settings.init_each==true ){
2482            var element_count = 0;
2483            for (var e in settings) { element_count++; }
2484            if(element_count==1){
2485                settings = undefined;
2486            }
2487
2488            $(selector).each(function(){
2489                var _t = $(this);
2490                _t.scroller(settings)
2491            });
2492        }else{
2493            $(selector).scroller(settings);
2494        }
2495
2496    };
2497})(jQuery);
2498function is_ios() {
2499//    return true;
2500    return ((navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPod") != -1) || (navigator.platform.indexOf("iPad") != -1)
2501    );
2502}
2503function is_android() {
2504    //console.info(navigator.platform);
2505    return (navigator.platform.indexOf("Android") != -1);
2506}
2507
2508function is_touch_device() {
2509    return !!('ontouchstart' in window);
2510}
2511
2512function is_ie() {
2513    if (navigator.appVersion.indexOf("MSIE") != -1) {
2514        return true;
2515    }
2516    ;
2517    return false;
2518}
2519;
2520function is_firefox() {
2521    if (navigator.userAgent.indexOf("Firefox") != -1) {
2522        return true;
2523    }
2524    ;
2525    return false;
2526}
2527;
2528function is_opera() {
2529    if (navigator.userAgent.indexOf("Opera") != -1) {
2530        return true;
2531    }
2532    ;
2533    return false;
2534}
2535;
2536function is_chrome() {
2537    return /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);;
2538}
2539;
2540function is_safari() {
2541    return  /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);;
2542}
2543;
2544function version_ie() {
2545    return parseFloat(navigator.appVersion.split("MSIE")[1]);
2546}
2547;
2548function version_firefox() {
2549    if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
2550        var aversion = new Number(RegExp.$1);
2551        return(aversion);
2552    }
2553    ;
2554}
2555;
2556function version_opera() {
2557    if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
2558        var aversion = new Number(RegExp.$1);
2559        return(aversion);
2560    }
2561    ;
2562}
2563;
2564function is_ie8() {
2565    if (is_ie() && version_ie() < 9) {
2566        return true;
2567    }
2568    return false;
2569}
2570function is_ie9() {
2571    if (is_ie() && version_ie() == 9) {
2572        return true;
2573    }
2574    return false;
2575}
2576
2577function getInternetExplorerVersion()
2578{
2579    var rv = -1;
2580    if (navigator.appName == 'Microsoft Internet Explorer')
2581    {
2582        var ua = navigator.userAgent;
2583        var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
2584        if (re.exec(ua) != null)
2585            rv = parseFloat( RegExp.$1 );
2586    }
2587    else if (navigator.appName == 'Netscape')
2588    {
2589        var ua = navigator.userAgent;
2590        var re  = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
2591        if (re.exec(ua) != null)
2592            rv = parseFloat( RegExp.$1 );
2593    }
2594    return rv;
2595}
2596
2597window.requestAnimFrame = (function(){
2598    return  window.requestAnimationFrame       ||
2599        window.webkitRequestAnimationFrame ||
2600        window.mozRequestAnimationFrame    ||
2601        function( callback ){
2602            window.setTimeout(callback, 1000 / 60);
2603        };
2604})();
2605
2606
2607
2608
2609jQuery(document).ready(function($){
2610    dzsscr_init('.scroller-con.auto-init', {init_each: true});
2611});
2612jQuery(window).on("load",function(){
2613    dzsscr_init('.scroller-con.auto-init-onload', {init_each: true});
2614});

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.