PageSourceSearch

https://gkb81.ru/wp-content/plugins/logos-showcase/js/carousel.js

js gkb81.ru collected 2026-09-24 20:19:32 UTC 7,745 bytes, 294 lines download raw bytes

1	var ls_curr_slider = [];
2
3	//initial trigger
4	jQuery(document).ready(function($){
5
6		ls_trigger_sliders(); 
7		
8	});
9
10	//to load after an ajax
11	jQuery(document).ajaxSuccess(function($) {
12
13		//ls_trigger_sliders(); 
14		//console.log('I am loading');
15		//console.log(lssliderparam);
16			
17	});
18
19
20
21
22	//to trigger the slider reload on orientation change.
23	jQuery(document).ready(function($){
24
25
26		//jQuery(window).on('resize orientationchange', function($) {
27			jQuery(window).on('null', function($) {
28
29			clearTimeout(jQuery.data(this, 'resizeTimer'));
30		    jQuery.data(this, 'resizeTimer', setTimeout(function() {
31
32
33		       
34		       	for (var i = 0; i < ls_curr_slider.length; i++) {
35
36
37					if (typeof ls_curr_slider[i] != 'undefined') {
38
39
40					  ls_curr_slider[i].destroySlider();
41					  ls_curr_slider[i].unbind();
42					  ls_curr_slider[i] = undefined;
43					 
44					}
45
46				}
47
48				for (var key in lssliderparam) {	
49					jQuery(lssliderparam[key]['divid']).css("opacity", 1).parent().prop( "style", null );
50
51				}
52
53				jQuery('.lshowcase-logos').each(function(){
54					jQuery(this).attr('style','');
55				});
56
57				ls_trigger_sliders();
58
59		    }, 500));
60
61		});
62
63
64	});
65	
66
67
68	//function to trigger sliders
69	function ls_trigger_sliders() {
70
71		for (var key in lssliderparam) {			
72
73			 var auto = (lssliderparam[key]['auto'] === 'true');
74			 var pause = parseInt(lssliderparam[key]['pause']);
75			 var autohover = (lssliderparam[key]['autohover'] === 'true');
76			 var ticker = (lssliderparam[key]['ticker'] === 'true');
77			 var tickerhover = (lssliderparam[key]['tickerhover'] === 'true');
78			 var usecss = (lssliderparam[key]['usecss'] === 'true');
79			 var autocontrols = (lssliderparam[key]['autocontrols'] === 'true');
80			 var speed = parseInt(lssliderparam[key]['speed']);
81			 var slidemargin = parseInt(lssliderparam[key]['slidemargin']);
82			 var infiniteloop = (lssliderparam[key]['infiniteloop'] === 'true');
83			 var pager = (lssliderparam[key]['pager'] === 'true');
84			 var controls = (lssliderparam[key]['controls'] === 'true');
85			 var slidewidth = parseFloat(lssliderparam[key]['slidewidth']);
86			 var minslides = parseInt(lssliderparam[key]['minslides']);
87			 var maxslides = parseInt(lssliderparam[key]['maxslides']);
88			 var moveslides = parseInt(lssliderparam[key]['moveslides']);
89			 var tmode = lssliderparam[key]['mode']; //options: 'horizontal', 'vertical', 'fade'
90			 var direction = lssliderparam[key]['direction'];
91
92			 var next = '';
93			 var prev = '';
94
95			 if(lssliderparam[key]['next']!=''){
96			 	next = lssliderparam[key]['next'];
97			 }
98			 if(lssliderparam[key]['prev']!=''){
99			 	prev = lssliderparam[key]['prev'];
100			 }
101			 
102
103			 //remove pager space by setting pager to false for ticker
104			 if(ticker == true) {
105			 	controls = false;
106			 }
107
108			 var sliderDiv = jQuery(lssliderparam[key]['divid']);
109			 //sometimes the div is passed wrong, so we built a temp fix here:
110			 //if(sliderDiv==false) {
111			 	//sliderDiv = $('.lshowcase-wrap-carousel-1');
112			 //}
113
114			 //To improve responsive behaviour we force the limit of 1 slide in small viewports
115			 if(maxslides==0 && ticker == false) {
116
117			 	var view_width = sliderDiv.parent().width();
118
119			 	if(controls == true ) { view_width = view_width-70; }
120
121				 var slider_real = slidemargin + slidewidth;
122				 maxslides = Math.floor(view_width/slider_real);
123
124				 //not to ignore the minimum value
125				 if(maxslides < minslides) {
126				 	maxslides = minslides;
127				 }
128
129				 if(moveslides==0) {
130				 	moveslides = maxslides;
131				 }
132
133			 } 
134			 
135			 if(maxslides==0 && ticker != false) { 
136			 	maxslides = 99;
137			 }
138
139
140			//fix bug of 1 slider only infinite loop not working
141	        //another solution could be adding the slidemargin to 
142	        //the slideWidth and align the images in the center
143	        if (maxslides <= 1 && ticker == false) {
144	            //set margin to null
145	            slidemargin = 0;
146	            //make sure max slides is set to 1
147	            maxslides = 1;
148	            //make sure moveslides is set to 1
149	            moveSlides = 1;
150
151	        }
152
153			sliderDiv.fadeIn('fast');
154		    
155
156		    ls_curr_slider[key] = sliderDiv.bxSlider({				
157		    auto: auto,		
158			pause: pause,
159			autoHover: autohover,
160			ticker: ticker,
161			tickerHover: tickerhover,
162			useCSS: usecss,
163			autoControls: autocontrols,
164			mode: tmode, 
165			speed: speed,
166			slideMargin: slidemargin,
167			infiniteLoop: infiniteloop,
168		    pager: pager, 
169			controls: controls,
170		    slideWidth: slidewidth,
171		    minSlides: minslides,
172		    maxSlides: maxslides,
173		    moveSlides: moveslides,
174		    autoDirection: direction,
175		    nextText: next, 
176		    prevText: prev,
177		    //captions: true,
178            //Make Slider Start again after controls get clicked (useful for auto slide)
179            /*
180            onSlideAfter: function() {
181                ls_curr_slider[key].stopAuto();
182                ls_curr_slider[key].startAuto();
183            },
184            */
185		    onSliderLoad: function(currentIndex){ 
186
187		    	var sl = sliderDiv.parent().parent();		    	
188
189		    		var marg = '0 35px';
190
191		    		if(controls == false ) { marg = 'none'; }
192
193				   sl.css({
194						margin: marg
195						}); 
196
197				   sl.parent().css({
198						maxWidth: sl.width()+80
199						}); 
200
201
202				   //to align elements in the center in ticker
203				   /*
204					We change the class, becasue the lshowcase-slide has a float:none!important that breaks
205					the ticker code. 
206					Note: Seems safari doesn't trigger the ticker = true if there are other sliders non-ticker in the page
207				   */
208				  
209				   if(ticker == true) {
210
211				   	sliderheight = sliderDiv.parent().height();
212
213		                if(sliderheight>0) {
214		                	sliderDiv.find(".lshowcase-slide")
215		                	.addClass('lshowcase-ticker-slide')
216		                	.removeClass('lshowcase-slide')
217		                	.css("height",sliderheight + 'px');
218		                }
219					
220				   }
221
222
223				   /* Tooltip code *
224				   /* Fix for cloned elements. Run tooltip code only after the slider is loaded
225
226				   var toshow = 'title'; 		
227
228					jQuery('.lshowcase-tooltip').tooltip({
229					content: function () { return jQuery(this).attr(toshow) },
230					close: function( event, ui ) {
231						    ui.tooltip.hover(
232						        function () {
233						            jQuery(this).stop(true).fadeTo(400, 1); 
234						            //.fadeIn("slow"); // doesn't work because of stop()
235						        },
236						        function () {
237						            jQuery(this).fadeOut("400", function(){ jQuery(this).remove(); })
238						        }
239						    );
240						  },
241					position: {
242					my: "center bottom-20",
243					at: "center top",
244					using: function( position, feedback ) {
245					jQuery( this ).css( position );
246					jQuery( "<div>" )
247					.addClass( "lsarrow" )
248					.addClass( feedback.vertical )
249					.addClass( feedback.horizontal )
250					.appendTo( this );
251					}
252					}
253					});
254
255					
256
257				   /* End tooltip code */
258				  
259		    }
260
261			});
262
263		} 
264
265		//Use Custom Controls
266		if( jQuery('#ls-slider-prev').length )  
267
268		{
269
270			//custom controls
271			jQuery("#ls-slider-prev").click(function(){
272			    ls_curr_slider[0].goToPrevSlide();
273			    ls_curr_slider[1].goToPrevSlide();
274			    ls_curr_slider[0].stopAuto();
275			    ls_curr_slider[1].stopAuto();
276			});
277
278			jQuery("#ls-slider-next").click(function(){
279			    ls_curr_slider[0].goToNextSlide();
280			    ls_curr_slider[1].goToNextSlide();
281			    ls_curr_slider[0].stopAuto();
282			    ls_curr_slider[1].stopAuto();
283			});
284
285		}
286
287		
288
289
290	}
291
292
293
294

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.