PageSourceSearch

https://freelogistic.ru/templates/freelogistic/js/jquery.main.js

js freelogistic.ru collected 2026-10-04 15:07:24 UTC 9,510 bytes, 328 lines download raw bytes

1j(function($){
2
3$(document).ready(function(){
4    $(function init(){
5	if($('select').size()) var select=$('select').select();
6    });
7
8
9    
10    $(function() {
11        $( ".slider" ).each(function(){
12            var _slider = $(this);
13            _slider.slider({
14                min: 0,
15	        value : 0,
16                range : "min",
17                max :1,
18    		slide: function( event, ui ) {
19            	    $('.to',_slider).val(ui.value);
20                }
21            });
22            _slider.append('<input class="to" type="hidden" value="'+_slider.slider( "value", 0 )+'" />');
23        });
24    });
25    
26    scrollPageTop(".up-link");
27    initPopup ();
28	
29	
30});
31/* инициализация функций popup*/
32
33	function initPopup() {
34		var _popupholder = '.popup-holder'
35			_popup = '.popup';
36		popupBg ();
37		$('a[rel=lnk_popup]').click(function(){//для открываюшей попап ссылки пишем rel="lnk_popup"
38			var _calledpopup = $($(this).attr('href'));
39			_calledpopup.fadeIn(200);
40			return false;
41		});
42		$(_popupholder+' .bg,'+_popupholder+' .close').click(function(){
43			$(this).parents(_popupholder).fadeOut(200);
44			return false;
45		});
46		function popupBg () {
47			$(_popupholder).css('height','auto');
48			if ($(document).height() < $(window).height()) {
49				$(_popupholder).css('height',$(window).height());
50			} else {
51				$(_popupholder).css('height',$(document).height());
52			}
53		};
54		$(window).resize(function(){
55			popupBg ();
56		});
57	};
58
59//прокрутка страницы вверх
60//update start
61function scrollPageTop(link){
62    $(link).click(function(e){
63        $("body, html").animate({"scrollTop":0},1000);
64        e.preventDefault();
65    });
66}
67//update end
68//gallery
69$(function(){
70	initSlideShow();
71});
72function initSlideShow() {
73	$('div.gallery-holder').fadeGallery({
74		slideElements:'.gallery>li',
75		autoPage:true, /* true/false */
76		pagerLinks:'.switcher',
77		pauseOnHover:true,
78		autoRotation:true,
79		switchTime:4000,
80		duration:650,
81		event:'click',
82		btnNext:'a.next',
83		btnPrev:'a.prev',
84		heightElement : "" //делает резиновой галлерею по элементу
85	});
86}
87jQuery.fn.fadeGallery = function(_options){
88	var _options = jQuery.extend({
89		slideElements:'div.slideset > div',
90		autoPage:false,
91		pagerLinks:'ul.switcher a',
92		btnNext:'a.next',
93		btnPrev:'a.prev',
94		btnPlayPause:'a.play-pause',
95		pausedClass:'paused',
96		playClass:'playing',
97		activeClass:'active',
98		pauseOnHover:true,
99		autoRotation:false,
100		autoHeight:false,
101		switchTime:3000,
102		duration:650,
103		event:'click',
104		heightElement : ".image img" //делает резиновой галлерею по элементу
105	},_options);
106
107	return this.each(function(){
108		var _this = jQuery(this);
109		var _slides = jQuery(_options.slideElements, _this);
110		var _autoPage = _options.autoPage;
111		var _pagerLinks = jQuery(_options.pagerLinks, _this);
112		var _btnPrev = jQuery(_options.btnPrev, _this);
113		var _btnNext = jQuery(_options.btnNext, _this);
114		var _btnPlayPause = jQuery(_options.btnPlayPause, _this);
115		var _pauseOnHover = _options.pauseOnHover;
116		var _autoRotation = _options.autoRotation;
117		var _activeClass = _options.activeClass;
118		var _pausedClass = _options.pausedClass;
119		var _playClass = _options.playClass;
120		var _autoHeight = _options.autoHeight;
121		var _duration = _options.duration;
122		var _switchTime = _options.switchTime;
123		var _controlEvent = _options.event;
124		var _heightElement = _options.heightElement;
125
126		var _hover = false;
127		var _prevIndex = 0;
128		var _currentIndex = 0;
129		var _slideCount = _slides.length;
130		var _timer;
131		if(!_slideCount) return;
132		_slides.hide().eq(_currentIndex).show();
133		if(_autoRotation) _this.removeClass(_pausedClass).addClass(_playClass);
134		else _this.removeClass(_playClass).addClass(_pausedClass);
135		if (_autoPage) {
136			_pagerLinks.html('<ul>');
137			for (i = 0; i < _slideCount; i++) {
138				$('ul', _pagerLinks).append('<li><a href="#">' + i + '</a></li>')
139			};
140					}
141		if(_btnPrev.length) {
142			_btnPrev.bind(_controlEvent,function(){
143				prevSlide();
144				return false;
145			});
146		}
147		if(_btnNext.length) {
148			_btnNext.bind(_controlEvent,function(){
149				nextSlide();
150				return false;
151			});
152		}
153		if (_autoPage) {
154			if ($('li', _pagerLinks.length)) {
155				$('a', _pagerLinks).each(function(_ind){
156					jQuery(this).bind(_controlEvent, function(){
157						if (_currentIndex != _ind) {
158							_prevIndex = _currentIndex;
159							_currentIndex = _ind;
160							switchSlide();
161						}
162						return false;
163					});
164				});
165			}
166		} else {
167			if (_pagerLinks.length) {
168				_pagerLinks.each(function(_ind){
169					jQuery(this).bind(_controlEvent, function(){
170						if (_currentIndex != _ind) {
171							_prevIndex = _currentIndex;
172							_currentIndex = _ind;
173							switchSlide();
174						}
175						return false;
176					});
177				});
178			}
179		}
180		//для резиновости
181			if(_heightElement){
182				var _img = new Image();
183				_img.src = $(_heightElement + ":first",_this).attr('src');
184				_img.onload= function(){
185					$(_this).height($(_heightElement + ":first",_this).height());
186				};
187				
188				
189				_this.height($(_heightElement + ":visible",_this).height());
190				$(window).resize(function(){
191					_this.height($(_heightElement + ":visible",_this).height());
192				});
193			}
194			//
195		if(_btnPlayPause.length) {
196			_btnPlayPause.bind(_controlEvent,function(){
197				if(_this.hasClass(_pausedClass)) {
198					_this.removeClass(_pausedClass).addClass(_playClass);
199					_autoRotation = true;
200					autoSlide();
201				} else {
202					if(_timer) clearRequestTimeout(_timer);
203					_this.removeClass(_playClass).addClass(_pausedClass);
204				}
205				return false;
206			});
207		}
208
209		function prevSlide() {
210			_prevIndex = _currentIndex;
211			if(_currentIndex > 0) _currentIndex--;
212			else _currentIndex = _slideCount-1;
213			switchSlide();
214		}
215		function nextSlide() {
216			_prevIndex = _currentIndex;
217			if(_currentIndex < _slideCount-1) _currentIndex++;
218			else _currentIndex = 0;
219			switchSlide();
220		}
221		function refreshStatus() {
222			if (_autoPage) {
223				if ($('li', _pagerLinks.length)) 
224					$('li', _pagerLinks).removeClass(_activeClass).eq(_currentIndex).addClass(_activeClass);
225			} else {
226				if (_pagerLinks.length) 
227					_pagerLinks.removeClass(_activeClass).eq(_currentIndex).addClass(_activeClass);
228			}
229			_slides.eq(_prevIndex).removeClass(_activeClass);
230			_slides.eq(_currentIndex).addClass(_activeClass);
231		}
232		function switchSlide() {
233			_slides.stop(true,true);
234			_slides.eq(_prevIndex).fadeOut(_duration);
235			_slides.eq(_currentIndex).fadeIn(_duration);
236			//для резиновости
237			if(_heightElement){
238				_this.height($(_heightElement + ":visible",_this).outerHeight(true));
239				$(window).resize(function(){
240					_this.height($(_heightElement + ":visible",_this).outerHeight(true));
241				});
242			}
243			//
244			refreshStatus();
245			autoSlide();
246		}
247
248		function autoSlide() {
249			if(!_autoRotation || _hover) return;
250			if(_timer) clearRequestTimeout(_timer);
251			_timer = requestTimeout(nextSlide,_switchTime+_duration);
252		}
253		if(_pauseOnHover) {
254			_this.hover(function(){
255				_hover = true;
256				if(_timer) clearRequestTimeout(_timer);
257			},function(){
258				_hover = false;
259				autoSlide();
260			});
261		}
262		refreshStatus();
263		autoSlide();
264	});
265}
266/*
267 * Drop in replace functions for setTimeout() & setInterval() that
268 * make use of requestAnimationFrame() for performance where available
269 * http://www.joelambert.co.uk
270 *
271 * Copyright 2011, Joe Lambert.
272 * Free to use under the MIT license.
273 * http://www.opensource.org/licenses/mit-license.php
274 */
275
276// requestAnimationFrame() shim by Paul Irish
277// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
278window.requestAnimFrame = (function() {
279	return  window.requestAnimationFrame   ||
280			window.webkitRequestAnimationFrame ||
281			window.mozRequestAnimationFrame    ||
282			window.oRequestAnimationFrame      ||
283			window.msRequestAnimationFrame     ||
284			function(/* function */ callback, /* DOMElement */ element){
285				window.setTimeout(callback, 1000 / 60);
286			};
287})();
288/**
289 * Behaves the same as setTimeout except uses requestAnimationFrame() where possible for better performance
290 * @param {function} fn The callback function
291 * @param {int} delay The delay in milliseconds
292 */
293
294window.requestTimeout = function(fn, delay) {
295	if( !window.requestAnimationFrame      	&&
296		!window.webkitRequestAnimationFrame &&
297		!window.mozRequestAnimationFrame    &&
298		!window.oRequestAnimationFrame      &&
299		!window.msRequestAnimationFrame)
300			return window.setTimeout(fn, delay);
301
302	var start = new Date().getTime(),
303		handle = new Object();
304
305	function loop(){
306		var current = new Date().getTime(),
307			delta = current - start;
308
309		delta >
309= delay ? fn.call() : handle.value = requestAnimFrame(loop);
310	};
311
312	handle.value = requestAnimFrame(loop);
313	return handle;
314};
315
316/**
317 * Behaves the same as clearInterval except uses cancelRequestAnimationFrame() where possible for better performance
318 * @param {int|object} fn The callback function
319 */
320window.clearRequestTimeout = function(handle) {
321    window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) :
322    window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value)	:
323    window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) :
324    window.oCancelRequestAnimationFrame	? window.oCancelRequestAnimationFrame(handle.value) :
325    window.msCancelRequestAnimationFrame ? msCancelRequestAnimationFrame(handle.value) :
326    clearTimeout(handle);
327};
328});

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.