PageSourceSearch

https://www.hotelflamingo.it/wp-content/themes/my-dms-hotel/sections/my-reviews/unoslider.js?ver=1.0

js hotelflamingo.it collected 2026-10-04 13:26:50 UTC 7,298 bytes, 240 lines download raw bytes

1/*
2 * UnoSlider
3 * This script is a plugin for jQuery
4 * Version: 1.0.4
5 * Author: Nelson Polanco
6 * http://unoslider.npmedia.net
7 */
8
9(function ($) {
10    $.fn.unoSlider = function(options) {
11        // Support multiple elements
12        if (this.length > 1){
13            this.each(function() { $(this).unoSlider(options); });
14            return this;
15        }
16
17        // Setup options
18        var defaults = {
19            // Default options go here
20            animSpeed: 250,
21            speed: 8,   // Seconds
22            auto: true,
23            easing: 'swing',
24            next: false,
25            prev: false,
26            transition: 'slide',
27            pause: false,
28            bullets: false,
29            selector: 'li',
30            callback: function(){},
31            width: false
32        };
33
34        options = $.extend({}, defaults, options);
35
36        // Setup private variables
37        var s = this;
38        s.$views = $( s.find(options.selector) ).addClass('sliderView');
39        s.css({ width: options.width });
40        s.$views.css({ width: options.width });
41        s.$nav = $( s.find('.unosliderNav') );
42        s.navItems = [];
43        s.viewWidth = s.width();
44        s.animTimer = options.animSpeed;
45        s.timerSpeed = options.speed*1000;
46        s.easing = options.easing;
47        s.transition = options.transition;
48
49        // Set the current slide
50        s.current = s.$views[0];
51        $(s.current).parent().css({height: $(s.current).height()})
52        s.addClass('unoSlider');
53
54        var bulletClick = function(){
55            navClick($(this));
56        };
57
58        // Loop through each view
59        for(var i=0; i < s.$views.length; i++){
60            var $view = $(s.$views[i]);
61            var $bullet = $('<span>&bull;</span>'); // Create a bullet
62
63            // Create a jQuery object out of the view
64            s.$views[i] = $view;
65
66            // Add the index as data to each view and bullet
67            $view.add($bullet).data('idx', i);
68
69            // Add bullets to nav and collect them in an array
70            s.$nav.append($bullet);
71            s.navItems[i]= $bullet;
72
73            // Bullet click events
74            $bullet.bind('click', bulletClick);
75        } // For each views
76
77        // Bullets click handler
78        var navClick = function($b){
79            var next = $b.data('idx'); // Current bullet's index
80            var prev = s.current.data('idx');
81
82            initSlide(prev, next); // Pass in previous index
83            s.resetTimer();
84        }; // Bullets click
85
86        // Set current
87        var setCurrent = function(idx){
88            // Remove the "current" class from all elements
89            s.$views.add(s.navItems).each(function(){
90                this.removeClass('current');
91            });
92
93            // Add "current" class to the items with the index that was passed in
94            $(s.$views[idx]).add($(s.navItems[idx])).addClass('current');
95            // Set current
96            s.current = s.$views[idx];
97        }; // setCurrent
98
99        var initSlide = function(prev, next){
100            // If this is the last view, set next as the first view so that it loops around
101            if(next >= s.$views.length){
102                next = 0;
103            }else if( next < 0  ){
104                next = s.$views.length-1;
105            }
106
107            if( prev < next ){
108                animateForward(prev, next);
109            } else if (prev > next){
110                animateBackwards(prev,next);
111            } // if else prev > next
112
113            if (typeof options.callback === 'function') { // Make sure the callback is a function
114               options.callback.call(next); // Pass back the current index
115            }
116
117            setCurrent(next);
118        }; // initSlide
119
120        if(options.next){
121            $(options.next).live('click', function(e) {
122              // Live handler called
123              e.preventDefault();
124              s.goForward();
125              s.resetTimer();
126            });
127        }
128
129        if(options.prev){
130            $(options.prev).live('click', function(e) {
131              // Live handler called
132              e.preventDefault();
133              s.goBack();
134              s.resetTimer();
135            });
136        }
137
138        /***********************************
139        Functions
140        ***********************************/
141        function animateForward(sl1, sl2){
142            // Animate prev out
143            s.$views[sl1].stop().animate({
144                'left': (s.viewWidth*-1)/4+'px',
145                'opacity': '0'
146            },s.animTimer, s.easing ,function(){
147                s.$views[sl1].css({'left':s.viewWidth+'px'});
148            });
149
150            // Animate next in
151
152            s.$views[sl2].css({'left':s.viewWidth/4+'px'}).stop().animate({
153                    'left':'0',
154                    'opacity':'1'
155                },s.animTimer, s.easing, function(){
156                	s.$views[sl2].parent().animate({
157                			height: s.$views[sl2].height()
158                		},500);
159            });
160
161        }
162
163        function animateBackwards(sl1, sl2){
164            // Animate prev out
165            s.$views[sl1].stop().animate({
166                    'left':s.viewWidth/4+'px',
167                    'opacity':'0'
168                },s.animTimer, s.easing, function(){
169                    s.$views[sl1].css({'left': s.viewWidth/4+'px'});
170            });
171
172            // Animate Next in
173            s.$views[sl2].css({'left': (s.viewWidth*-1)/4+'px'}).stop().animate({
174                    'left':'0',
175                    'opacity': '1'
176                },s.animTimer, s.easing, function(){
177                	s.$views[sl2].parent().animate({
178                			height: s.$views[sl2].height()
179                		},500);
180            });
181        }
182
183
184        /***************************************
185        Public Functions
186        ***************************************/
187        s.initialize = function() {
188            // First run? Set the current as the first item
189            if(this.length > 0){
190                setCurrent(0);
191                s.startTimer();
192            }
193            return this;
194        };
195
196        s.startTimer = function(){
197            if(options.auto){
198                s.t = window.setInterval(function(){
199                        s.goForward();
200                }, s.timerSpeed);
201            }
202        };
203
204        s.killTimer = function(){
205            window.clearInterval(s.t);
206        };
207
208        s.resetTimer = function(){
209            s.killTimer();
210            s.startTimer();
211        };
212
213        s.goForward = function(){
214            // Go forward one view forward
215            var prev = s.current.data('idx'),
216                    next = prev+1; // Current bullet's index
217
218            initSlide(prev, next);
219        };
220
221        s.goBack = function(){
222            // Go back one view forward
223            var prev = s.current.data('idx'),
224            next = prev-1; // Current bullet's index
225
226            initSlide(prev, next);
227        };
228
229        s.goTo = function(i /*num*/){
230            // Go specific view
231            var prev = s.current.data('idx'),
232                    next = i-1; // Current bullet's index
233
234            initSlide(prev, next);
235        };
236
237        return this.initialize();
238    };  // End namespace $.fn.unoSlider
239
240})(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.