PageSourceSearch

https://ms-singkil.go.id/modules/mod_sp_smart_slider/tmpl/maxima/js/maxima.slider.js

js ms-singkil.go.id collected 2026-10-02 00:02:39 UTC 7,738 bytes, 243 lines download raw bytes

1/**
2 * @author    JoomShaper http://www.joomshaper.com
3 * @copyright Copyright (C) 2010 - 2013 JoomShaper
4 * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2
5 */;
6 (function ($) {
7    var methods = {
8        currentIndex: 0,
9        prevIndex: 0,
10        nextIndex: 0,
11        totalItems: 0,
12        settings: {},
13        canvasWidth: 0,
14        canvasHeight: 0,
15        elements: '',
16        prevIndex: function () {
17            var c = this.currentIndex;
18            c--;
19            if (c < 0)
20                c = this.totalItems - 1;
21            return c;
22        },
23        nextIndex: function () {
24            var c = this.currentIndex;
25            c++;
26            if (c >= (this.totalItems))
27                c = 0;
28            return c;
29        },
30
31        currentIndex: function () {
32            return this.currentIndex;
33        },
34
35        prev: function () {
36            clearTimeout(this.autoplay);
37            this.currentIndex--;
38            if (this.currentIndex < 0) {
39               this.currentIndex = this.totalItems - 1;
40               this.prevIndex = methods['prevIndex'].call(this);
41           }
42           var $this = this;
43           methods['run'].call(this);
44       },
45
46       next: function () {
47        clearTimeout(this.autoplay);
48        this.currentIndex++;
49        if (this.currentIndex >=this.totalItems){
50           this.currentIndex = 0;
51           this.nextIndex = methods['nextIndex'].call(this);
52       }
53       methods['run'].call(this);
54   },
55
56   play: function () {
57    var $this = this;
58    this.autoplay = setTimeout(function () {
59        methods['next'].call($this);
60    }, 1000);
61},
62
63
64preloader: function () {
65    var loadedImage = new Image();
66            var preloadImages = this.settings.preloadImages; // should array
67            var $this = this;
68
69            //this.items.removeClass(this.settings.animateInClass).addClass( this.settings.animateOutClass );
70
71
72            if (this.settings.showPreloader != true || preloadImages.length < 1) {
73                $(this.settings.preloader).remove();
74                methods['start'].call(this);
75                this.elements.trigger('onSlide');
76            } else {
77                for (i = 0; i < preloadImages.length; i++) loadedImage.src = preloadImages[i];
78                    $(loadedImage).load(function () {
79                        $($this.settings.preloader).fadeOut('fast', function () {
80                            $(this).remove();
81                        });
82                        methods['start'].call($this);
83                        $this.elements.trigger('onSlide');
84                    });
85            }
86        },
87
88        autoplay: function () {
89
90            var $this = this;
91            if (this.settings.autoplay == true) {
92                this.autoplay = setTimeout(function () {
93                    methods['next'].call($this);
94                }, this.settings.interval);
95            }
96        },
97
98        pause: function () {
99            clearTimeout(this.autoplay);
100        },
101
102        goTo: function (index) {
103            clearTimeout(this.autoplay);
104            if( this.currentIndex==index ){
105                return false;
106            }
107            this.currentIndex = index;
108            methods['run'].call(this);
109        },
110
111        run: function () {
112            clearTimeout(this.delay);
113            clearTimeout(this.autoplay);
114            var $this = this;
115            var $item = this.items; //.removeClass(this.settings.animateInClass).addClass(this.settings.animateOutClass);
116
117            $item.each(function(){
118                if( $(this).hasClass($this.settings.animateInClass) ){
119                   $(this).removeClass($this.settings.animateInClass).addClass($this.settings.animateOutClass);
120               }
121           });
122
123            this.delay = setTimeout(function () {
124
125                //$item.addClass($this.settings.animateOutClass);
126
127                
128               
129                $item.removeClass($this.settings.animateOutClass);
130                $item.eq($this.currentIndex).removeClass($this.settings.animateOutClass).addClass($this.settings.animateInClass);
131
132
133
134                //$this.prevIndex = methods['prevIndex'].call($this);
135                //$this.nextIndex = methods['nextIndex'].call($this);
136
137                //$item.eq( $this.prevIndex ).removeClass('nextIndex').addClass('prevIndex');
138                //$item.eq( $this.nextIndex ).removeClass('prevIndex').addClass('nextIndex');
139
140                $this.elements.trigger('onSlide');
141            }, this.settings.delay);
142
143            methods['autoplay'].call(this);
144        },
145
146
147        start: function () {
148            clearTimeout(this.delay);
149            clearTimeout(this.autoplay);
150            var $this = this;
151            var $item = this.items; //.removeClass(this.settings.animateInClass).addClass(this.settings.animateOutClass);
152
153            this.delay = setTimeout(function () {
154
155                //$item.addClass($this.settings.animateOutClass);
156
157                $item.eq($this.currentIndex)
158                .removeClass($this.settings.animateOutClass)
159                .addClass($this.settings.animateInClass);
160
161                //$this.prevIndex = methods['prevIndex'].call($this);
162                //$this.nextIndex = methods['nextIndex'].call($this);
163
164                //$item.eq( $this.prevIndex ).removeClass('nextIndex').addClass('prevIndex');
165                //$item.eq( $this.nextIndex ).removeClass('prevIndex').addClass('nextIndex');
166
167                $this.elements.trigger('onSlide');
168            }, this.settings.delay);
169
170            methods['autoplay'].call(this);
171        },
172
173
174
175
176        resize: function (fn) {
177            if (this.settings.fullWidth == true) {
178                this.elements.height($(window).width() * this.ratioHeight);
179            }
180        },
181
182        onSlide: function (fn) {
183            var $this = this;
184            this.elements.bind('onSlide', function (event) {
185                fn($this.currentIndex, $this.items, event);
186            });
187        },
188
189        init: function (elements, settings) {
190            this.currentIndex = 0;
191            this.elements = elements;
192            this.items = $(elements).find('>*');
193
194            this.totalItems = this.items.length;
195            this.settings = settings;
196
197            this.canvasWidth = this.settings.canvasWidth;
198            this.canvasHeight = this.settings.canvasHeight;
199
200            this.ratioHeight = this.settings.rHeight / this.settings.rWidth;
201            this.ratioWidth = this.settings.rWidth / this.settings.rHeight;
202
203            this.elements.width(this.canvasWidth);
204            this.elements.height(this.canvasHeight);
205
206            var $this = this;
207            this.items.each(function (i) {
208                $(this).addClass($this.settings.itemClassPrefix + (i + 1));
209            });
210        },
211
212    };
213
214    $.fn.maximaSlider = function (options, param) {
215
216        var settings = $.extend({
217            preloadImages: [],
218            autoplay: true,
219            preloader: '.sp-preloader',
220            showPreloader: true,
221            interval: 5000,
222            delay: 1000,
223            itemClassPrefix: 'item-',
224            rWidth: 0,
225            rHeight: 0,
226            fullWidth: false,
227            animateInClass: 'animate-in',
228            animateOutClass: 'animate-out',
229        }, options);
230
231        return this.each(function (index, element) {
232
233            if (typeof (options) === 'string') {
234               methods[options].call(this, param);
235           } else {
236            methods['init'].call(this, $(this), settings);
237            methods['preloader'].call(this);
238            methods['autoplay'].call(this);
239            methods['resize'].call(this);
240        }
241    });
242    }
243})(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.