PageSourceSearch

https://only-best-news.ru/js/only-best-news-plugins.js

js only-best-news.ru collected 2026-10-08 00:53:15 UTC 5,508 bytes, 196 lines download raw bytes

1(function($) {
2
3	$.fn.easySlider = function(options){
4	  
5		// default configuration properties
6		var defaults = {			
7			prevId: 		'prevBtn',
8			prevText: 		'<i class="fa fa-chevron-left"></i>',
9			nextId: 		'nextBtn',	
10			nextText: 		'<i class="fa fa-chevron-right"></i>',
11			controlsShow:	true,
12			controlsBefore:	'',
13			controlsAfter:	'',	
14			controlsFade:	true,
15			firstId: 		'firstBtn',
16			firstText: 		'First',
17			firstShow:		false,
18			lastId: 		'lastBtn',	
19			lastText: 		'Last',
20			lastShow:		false,				
21			vertical:		false,
22			speed: 			300,
23			auto:			false,
24			pause:			4000,
25			continuous:		false, 
26			numeric: 		false,
27			numericId: 		'controls'
28		}; 
29		
30		var options = $.extend(defaults, options);  
31				
32		this.each(function() {  
33			var obj = $(this); 				
34			var s = $("li", obj).length;
35			var w = $("li", obj).width(); 
36			var h = $("li", obj).height(); 
37			var clickable = true;
38			obj.width(w); 
39			obj.height(h); 
40			obj.css("overflow","hidden");
41			var ts = s-1;
42			var t = 0;
43			$("ul", obj).css('width',s*w);			
44			
45			if(options.continuous){
46				$("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px"));
47				$("ul", obj).append($("ul li:nth-child(2)", obj).clone());
48				$("ul", obj).css('width',(s+1)*w);
49			};				
50			
51			if(!options.vertical) $("li", obj).css('float','left');
52								
53			if(options.controlsShow){
54				var html = options.controlsBefore;				
55				if(options.numeric){
56					html += '<ol id="'+ options.numericId +'"></ol>';
57				} else {
58					if(options.firstShow) html += '<span id="'+ options.firstId +'"><a href=\"javascript:void(0);\">'+ options.firstText +'</a></span>';
59					html += ' <span id="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></span>';
60					html += ' <span id="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></span>';
61					if(options.lastShow) html += ' <span id="'+ options.lastId +'"><a href=\"javascript:void(0);\">'+ options.lastText +'</a></span>';				
62				};
63				
64				html += options.controlsAfter;						
65				$(obj).after(html);										
66			};
67			
68			if(options.numeric){									
69				for(var i=0;i<s;i++){						
70					$(document.createElement("li"))
71						.attr('id',options.numericId + (i+1))
72						.html('<a rel='+ i +' href=\"javascript:void(0);\">'+ (i+1) +'</a>')
73						.appendTo($("#"+ options.numericId))
74						.click(function(){							
75							animate($("a",$(this)).attr('rel'),true);
76						}); 												
77				};							
78			} else {
79				$("a","#"+options.nextId).click(function(){		
80					animate("next",true);
81				});
82				$("a","#"+options.prevId).click(function(){		
83					animate("prev",true);				
84				});	
85				$("a","#"+options.firstId).click(function(){		
86					animate("first",true);
87				});				
88				$("a","#"+options.lastId).click(function(){		
89					animate("last",true);				
90				});				
91			};
92			
93			function setCurrent(i){
94				i = parseInt(i)+1;
95				$("li", "#" + options.numericId).removeClass("current");
96				$("li#" + options.numericId + i).addClass("current");
97			};
98			
99			function adjust(){
100				if(t>ts) t=0;		
101				if(t<0) t=ts;	
102				if(!options.vertical) {
103					$("ul",obj).css("margin-left",(t*w*-1));
104				} else {
105					$("ul",obj).css("margin-left",(t*h*-1));
106				}
107				clickable = true;
108				if(options.numeric) setCurrent(t);
109			};
110			
111			function animate(dir,clicked){
112				if (clickable){
113					clickable = false;
114					var ot = t;				
115					switch(dir){
116						case "next":
117							t = (ot>=ts) ? (options.continuous ? t+1 : ts) : t+1;						
118							break; 
119						case "prev":
120							t = (t<=0) ? (options.continuous ? t-1 : 0) : t-1;
121							break; 
122						case "first":
123							t = 0;
124							break; 
125						case "last":
126							t = ts;
127							break; 
128						default:
129							t = dir;
130							break; 
131					};	
132					var diff = Math.abs(ot-t);
133					var speed = diff*options.speed;						
134					if(!options.vertical) {
135						p = (t*w*-1);
136						$("ul",obj).animate(
137							{ marginLeft: p }, 
138							{ queue:false, duration:speed, complete:adjust }
139						);				
140					} else {
141						p = (t*h*-1);
142						$("ul",obj).animate(
143							{ marginTop: p }, 
144							{ queue:false, duration:speed, complete:adjust }
145						);					
146					};
147					
148					if(!options.continuous && options.controlsFade){					
149						if(t==ts){
150							$("a","#"+options.nextId).hide();
151							$("a","#"+options.lastId).hide();
152						} else {
153							$("a","#"+options.nextId).show();
154							$("a","#"+options.lastId).show();					
155						};
156						if(t==0){
157							$("a","#"+options.prevId).hide();
158							$("a","#"+options.firstId).hide();
159						} else {
160							$("a","#"+options.prevId).show();
161							$("a","#"+options.firstId).show();
162						};					
163					};				
164					
165					if(clicked) clearTimeout(timeout);
166					if(options.auto && dir=="next" && !clicked){;
167						timeout = setTimeout(function(){
168							animate("next",false);
169						},diff*options.speed+options.pause);
170					};
171			
172				};
173				
174			};
175			// init
176			var timeout;
177			if(options.auto){;
178				timeout = setTimeout(function(){
179					animate("next",false);
180				},options.pause);
181			};		
182			
183			if(options.numeric) setCurrent(0);
184		
185			if(!options.continuous && options.controlsFade){					
186				$("a","#"+options.prevId).hide();
187				$("a","#"+options.firstId).hide();				
188			};				
189			
190		});
191	  
192	};
193
194})(jQuery);
195
196

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.