PageSourceSearch

https://www.hornstein-fotografie.de/wp-content/themes/fluxus/fluxus/js/jquery.tinyscrollbar.js?ver=1.4.1

js hornstein-fotografie.de collected 2026-10-07 04:51:09 UTC 9,508 bytes, 256 lines download raw bytes

1/*
2 * Tiny Scrollbar
3 * http://www.baijs.nl/tinyscrollbar/
4 *
5 * Dual licensed under the MIT or GPL Version 2 licenses.
6 * http://www.opensource.org/licenses/mit-license.php
7 * http://www.opensource.org/licenses/gpl-2.0.php
8 *
9 * Date: 13 / 08 / 2012
10 * @version 1.81
11 * @author Maarten Baijs
12 *
13 */
14( function( $ )
15{
16
17    $.tiny = $.tiny || { };
18
19    $.tiny.scrollbar = {
20        options: {
21                axis         : 'y'    // vertical or horizontal scrollbar? ( x || y ).
22            ,   wheel        : 40     // how many pixels must the mouswheel scroll at a time.
23            ,   scroll       : true   // enable or disable the mousewheel.
24            ,   lockscroll   : true   // return scrollwheel to browser if there is no more content.
25            ,   size         : 'auto' // set the size of the scrollbar to auto or a fixed number.
26            ,   sizethumb    : 'auto' // set the size of the thumb to auto or a fixed number.
27            ,   invertscroll : false  // Enable mobile invert style scrolling
28        }
29    };
30
31    $.fn.tinyscrollbar = function( params )
32    {
33        var options = $.extend( {}, $.tiny.scrollbar.options, params );
34
35        this.each( function()
36        {
37            $( this ).data('tsb', new Scrollbar( $( this ), options ) );
38        });
39
40        return this;
41    };
42
43    $.fn.tinyscrollbar_update = function(sScroll)
44    {
45        return $( this ).data( 'tsb' ).update( sScroll );
46    };
47
48    function Scrollbar( root, options )
49    {
50        var oSelf       = this
51        ,   oWrapper    = root
52        ,   oViewport   = { obj: $( '.viewport', root ) }
53        ,   oContent    = { obj: $( '.overview', root ) }
54        ,   oScrollbar  = { obj: $( '.scrollbar', root ) }
55        ,   oTrack      = { obj: $( '.track', oScrollbar.obj ) }
56        ,   oThumb      = { obj: $( '.thumb', oScrollbar.obj ) }
57        ,   sAxis       = options.axis === 'x'
58        ,   sDirection  = sAxis ? 'left' : 'top'
59        ,   sSize       = sAxis ? 'Width' : 'Height'
60        ,   iScroll     = 0
61        ,   iPosition   = { start: 0, now: 0 }
62        ,   iMouse      = {}
63        ,   touchEvents = 'ontouchstart' in document.documentElement
64        ,   rebindEvents = 0
65        ,   eventHandlers = []
66        ;
67
68        function initialize()
69        {
70            oSelf.update();
71            setEvents();
72
73            return oSelf;
74        }
75
76        this.update = function( sScroll )
77        {
78            oViewport[ options.axis ] = oViewport.obj[0][ 'offset'+ sSize ];
79            oContent[ options.axis ]  = oContent.obj[0][ 'scroll'+ sSize ];
80            oContent.ratio            = oViewport[ options.axis ] / oContent[ options.axis ];
81
82            oScrollbar.obj.toggleClass( 'disable', oContent.ratio >= 1 );
83
84            oTrack[ options.axis ] = options.size === 'auto' ? oViewport[ options.axis ] : options.size;
85            oThumb[ options.axis ] = Math.min( oTrack[ options.axis ], Math.max( 0, ( options.sizethumb === 'auto' ? ( oTrack[ options.axis ] * oContent.ratio ) : options.sizethumb ) ) );
86
87            oScrollbar.ratio = options.sizethumb === 'auto' ? ( oContent[ options.axis ] / oTrack[ options.axis ] ) : ( oContent[ options.axis ] - oViewport[ options.axis ] ) / ( oTrack[ options.axis ] - oThumb[ options.axis ] );
88
89            iScroll = ( sScroll === 'relative' && oContent.ratio <= 1 ) ? Math.min( ( oContent[ options.axis ] - oViewport[ options.axis ] ), Math.max( 0, iScroll )) : 0;
90            iScroll = ( sScroll === 'bottom' && oContent.ratio <= 1 ) ? ( oContent[ options.axis ] - oViewport[ options.axis ] ) : isNaN( parseInt( sScroll, 10 ) ) ? iScroll : parseInt( sScroll, 10 );
91
92            setSize();
93        };
94
95        function setSize()
96        {
97            var sCssSize = sSize.toLowerCase();
98
99            oThumb.obj.css( sDirection, iScroll / oScrollbar.ratio );
100            oContent.obj.css( sDirection, -iScroll );
101            iMouse.start = oThumb.obj.offset()[ sDirection ];
102
103            oScrollbar.obj.css( sCssSize, oTrack[ options.axis ] );
104            oTrack.obj.css( sCssSize, oTrack[ options.axis ] );
105            oThumb.obj.css( sCssSize, oThumb[ options.axis ] );
106        }
107
108        function setEvents()
109        {
110            if( ! touchEvents )
111            {
112                oThumb.obj.bind( 'mousedown', start );
113                oTrack.obj.bind( 'mouseup', drag );
114            }
115            else
116            {
117                oViewport.obj[0].ontouchstart = function( event )
118                {
119                    if( 1 === event.touches.length )
120                    {
121                        if ( oScrollbar.obj.is( '.disable' ) ) {
122                            return true;
123                        }
124                        start( event.touches[ 0 ] );
125                        event.stopPropagation();
126                    }
127                };
128            }
129
130            if( options.scroll && window.addEventListener )
131            {
132                oWrapper[0].addEventListener( 'DOMMouseScroll', wheel, false );
133                oWrapper[0].addEventListener( 'mousewheel', wheel, false );
134            }
135            else if( options.scroll )
136            {
137                oWrapper[0].onmousewheel = wheel;
138            }
139        }
140
141        function start( event )
142        {
143            $( "body" ).addClass( "noSelect" );
144
145            var oThumbDir   = parseInt( oThumb.obj.css( sDirection ), 10 );
146            iMouse.start    = sAxis ? event.pageX : event.pageY;
147            iPosition.start = oThumbDir == 'auto' ? 0 : oThumbDir;
148
149            if( ! touchEvents )
150            {
151                $( document ).bind( 'mousemove', drag );
152                $( document ).bind( 'mouseup', end );
153                oThumb.obj.bind( 'mouseup', end );
154            }
155            else
156            {
157                document.ontouchmove = function( event )
158                {
159                    event.preventDefault();
160                    drag( event.touches[ 0 ] );
161                };
162                document.ontouchend = end;
163            }
164        }
165
166        function wheel( event )
167        {
168            if( oContent.ratio < 1 )
169            {
170
171                var oEvent = event || window.event,
172                    iDelta = oEvent.wheelDelta ? oEvent.wheelDelta / 120 : -oEvent.detail / 3;
173
174                iScroll -= iDelta * options.wheel;
175                iScroll = Math.min( ( oContent[ options.axis ] - oViewport[ options.axis ] ), Math.max( 0, iScroll ));
176
177                oThumb.obj.css( sDirection, iScroll / oScrollbar.ratio );
178                oContent.obj.css( sDirection, -iScroll );
179
180                if( options.lockscroll || ( iScroll !== ( oContent[ options.axis ] - oViewport[ options.axis ] ) && iScroll !== 0 ) )
181                {
182                    var windowEvents = $._data(window, 'events');
183
184                    /**
185                     * We want to temporary unbind every mousewheel event
186                     * that is binded to window object.
187                     */
188                    if ( (typeof windowEvents === 'object') && windowEvents.mousewheel && windowEvents.mousewheel.length ) {
189
190                        // debounce rebinding
191                        clearTimeout(rebindEvents);
192
193                        // save and unbind all mousewheel event handlers
194                        $.each(windowEvents.mousewheel, function (index, event) {
195
196                            // check if it has not been previously unbinded
197                            if (event.handler != $.noop) {
198                                eventHandlers['event_' + event.guid] = event.handler;
199                                event.handler = $.noop;
200                            }
201
202                        });
203
204                        // rebind mousewheel after 100ms
205                        rebindEvents = setTimeout(function () {
206
207                            $.each(windowEvents.mousewheel, function (index, event) {
208
209                                if (event.handler == $.noop) {
210                                    event.handler = eventHandlers['event_' + event.guid];
211                                }
212
213                            });
214
215                        }, 100);
216
217                    }
218
219                    oEvent = $.event.fix( oEvent );
220                    oEvent.preventDefault();
221                }
222            }
223        }
224
225        function drag( event )
226        {
227            if( oContent.ratio < 1 )
228            {
229                if( options.invertscroll && touchEvents )
230                {
231                    iPosition.now = Math.min( ( oTrack[ options.axis ] - oThumb[ options.axis ] ), Math.max( 0, ( iPosition.start + ( iMouse.start - ( sAxis ? event.pageX : event.pageY ) ))));
232                }
233                else
234                {
235                     iPosition.now = Math.min( ( oTrack[ options.axis ] - oThumb[ options.axis ] ), Math.max( 0, ( iPosition.start + ( ( sAxis ? event.pageX : event.pageY ) - iMouse.start))));
236                }
237
238                iScroll = iPosition.now * oScrollbar.ratio;
239                oContent.obj.css( sDirection, -iScroll );
240                oThumb.obj.css( sDirection, iPosition.now );
241            }
242        }
243
244        function end()
245        {
246            $( "body" ).removeClass( "noSelect" );
247            $( document ).unbind( 'mousemove', drag );
248            $( document ).unbind( 'mouseup', end );
249            oThumb.obj.unbind( 'mouseup', end );
250            document.ontouchmove = document.ontouchend = null;
251        }
252
253        return initialize();
254    }
255
256}(jQuery));

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