1$(document).ready(function(){ 2 initSlideShow (); // ÑлайдÑÐ¾Ñ 3 initGallery (); 4 initHover(); 5 initAccordion (); 6 initPhotos (); 7 initUp (); 8 initFindLastChild (); 9}); 10function initFindLastChild () { 11 $('ul.sidebar-menu li:last-child').addClass('last-child'); 12 $('table.catalog-table tr:last-child').addClass('last-row'); 13} 14function initUp () { 15 $('.home-btn').click(function(){ 16 $(window).scrollTo('#lay_f1',1500); 17 return false; 18 }) 19} 20function initPhotos () { 21 $('.small-gallery-holder ul a').click(function(){ 22 $(this).parents('ul').find('.active').removeClass('active'); 23 $(this).parents('li').addClass('active'); 24 $(this).parents('.product-card').find('.image-holder img').attr('src',$(this).attr('href')); 25 return false; 26 }); 27} 28function initAccordion () { 29 $('.usefull-info-list .title').click(function(){ 30 if(!$(this).parents('li').hasClass('opened')){ 31 $(this).parents('li').addClass('opened'); 32 $(this).parents('li').find('.usefull-info').slideDown(500); 33 } else { 34 $(this).parents('li').removeClass('opened'); 35 $(this).parents('li').find('.usefull-info').slideUp(500); 36 } 37 return false; 38 }); 39} 40function initHover () { 41 $('#nav > li, .footer-nav > li') 42 .mouseleave(function(){ 43 $(this).css('background-image', ''); 44 $(this).next('li').css('background-image', ''); 45 if($(this).prev().hasClass('active')){ 46 $(this).css('background-image', 'none'); 47 } 48 if($(this).next().hasClass('active')){ 49 $(this).next().css('background-image', 'none'); 50 } 51 }) 52 .mouseenter(function(){ 53 $(this).css('background-image', 'none'); 54 $(this).next('li').css('background-image', 'none'); 55 }); 56 $('#nav li, .footer-nav > li').each(function(){ 57 if($(this).hasClass('active')){ 58 $(this).css('background-image', 'none'); 59 $(this).next('li').css('background-image', 'none'); 60 } 61 }); 62} 63function initGallery () { 64 $('.news .news-section').scrollGallery(); 65 $('.brand-gallery-holder').makeGallery(); 66 $('.gallery-holder').galleryScrollShort({ 67 step:1, 68 duration: 550 69 }); 70 $('.small-gallery-holder').galleryScroll({ 71 step:1, 72 duration: 550 73 }); 74} 75function initSlideShow() { 76 $('div.promo').fadeGallery({ 77 slideElements:'ul.slideshow li', 78 pagerLinks:'ul.slideshow-pager a', 79 pauseOnHover:true, 80 autoRotation:true, 81 switchTime:4000, 82 duration:650, 83 event:'click' 84 }) 85} 86jQuery.fn.scrollGallery = function(o) { 87 o = $.extend( { 88 speed : 300, /* ÑкоÑоÑÑÑ Ð¿ÐµÑемеÑÐµÐ½Ð¸Ñ 1000 = 1ÑекÑнда */ 89 gallery_height : '.news-gallery', 90 gallery_frame : '.news-section', 91 gallery_holder : 'ul.slide-list', 92 btnUp : '.up', 93 btnDown : '.down', 94 gallery_item : 'li' 95 }, o || {}); 96 var steps = 1; 97 return this.each(function(){ 98 phase = 0; 99 main_holder = $(this); 100 var _holder = jQuery(o.gallery_holder, main_holder); 101 var _gheight = jQuery(o.gallery_height, main_holder); 102 var _galleryheight = _gheight.height(); 103 var _btnUp = jQuery(o.btnUp, main_holder); 104 var _btnDown = jQuery(o.btnDown, main_holder); 105 var Fheight = _holder.find(o.gallery_item).size()*(_holder.find(o.gallery_item+':first').outerHeight()); 106 var step = (_holder.find(o.gallery_item+':first').outerHeight()) * steps; 107 _btnUp.bind('click',function(){ 108 if (((parseInt(_holder.css('margin-top'))+step) <= 0) && (phase != 1) ) { 109 _btnDown.removeClass('down-disable'); 110 phase = 1; 111 _holder.animate({marginTop: (parseInt(_holder.css('margin-top'))+step)}, o.speed, function(){ 112 phase = 0; 113 }); 114 } 115 if (((parseInt(_holder.css('margin-top'))+step) == 0)) { 116 _btnUp.addClass('up-disable'); 117 } 118 return false; 119 }); 120 _btnDown.bind('click',function(){ 121 if ((((-1) * (parseInt(_holder.css('margin-top')) - step) + _galleryheight) <= Fheight) && (phase != 1)) { 122 _btnUp.removeClass('up-disable'); 123 phase = 1; 124 _holder.animate({ 125 marginTop: (parseInt(_holder.css('margin-top')) - step) 126 }, o.speed, function(){ 127 phase = 0; 128 if (((-1) * (parseInt(_holder.css('margin-top')) - step) + _galleryheight) >= Fheight) { 129 _btnDown.addClass('down-disable'); 130 } 131 }); 132 } 133 return false; 134 }); 135 }); 136}; 137jQuery.fn.galleryScroll = function(_options){ 138 // defaults options 139 var _options = jQuery.extend({ 140 btPrev: 'a.prev',
141 btNext: 'a.next', 142 holderList: 'div.gallery', 143 scrollElParent: 'ul', 144 scrollEl: 'li', 145 slideNum: false, 146 duration : 1000, 147 step: false, 148 circleSlide: true, 149 disableClass: 'disable', 150 funcOnclick: null, 151 autoSlide:false, 152 innerMargin:0, 153 stepWidth:false 154 },_options); 155 156 return this.each(function(){ 157 var _this = jQuery(this); 158 159 var _holderBlock = jQuery(_options.holderList,_this); 160 var _liPading = _holderBlock.find('ul li').outerWidth()-_holderBlock.find('ul li').width(); 161 var _gWidth = _holderBlock.width(); 162 var _animatedBlock = jQuery(_options.scrollElParent,_holderBlock); 163 var _liWidth = jQuery(_options.scrollEl,_animatedBlock).outerWidth(true); 164 var _liSum = jQuery(_options.scrollEl,_animatedBlock).length * _liWidth - _liPading; 165 var _margin = -_options.innerMargin; 166 var f = 0; 167 var _step = 0; 168 var _autoSlide = _options.autoSlide; 169 var _timerSlide = null; 170 if (!_options.step) _step = _gWidth; else _step = _options.step*_liWidth; 171 if (_options.stepWidth) _step = _options.stepWidth; 172 173 if (!_options.circleSlide) { 174 if (_options.innerMargin == _margin) 175 jQuery(_options.btPrev,_this).addClass('prev-'+_options.disableClass); 176 } 177 if (_options.slideNum && !_options.step) { 178 var _lastSection = 0; 179 var _sectionWidth = 0; 180 while(_sectionWidth < _liSum) 181 { 182 _sectionWidth = _sectionWidth + _gWidth; 183 if(_sectionWidth > _liSum) { 184 _lastSection = _sectionWidth - _liSum; 185 } 186 } 187 } 188 if (_autoSlide) { 189 _timerSlide = setTimeout(function(){ 190 autoSlide(_autoSlide); 191 }, _autoSlide); 192 _animatedBlock.hover(function(){ 193 clearTimeout(_timerSlide); 194 }, function(){ 195 _timerSlide = setTimeout(function(){ 196 autoSlide(_autoSlide) 197 }, _autoSlide); 198 }); 199 } 200 201 // click button 'Next' 202 jQuery(_options.btNext,_this).bind('click',function(){ 203 jQuery(_options.btPrev,_this).removeClass('prev-'+_options.disableClass); 204 if (!_options.circleSlide) { 205 if (_margin + _step > _liSum - _gWidth - _options.innerMargin) { 206 if (_margin != _liSum - _gWidth - _options.innerMargin) { 207 _margin = _liSum - _gWidth + _options.innerMargin; 208 jQuery(_options.btNext,_this).addClass('next-'+_options.disableClass); 209 _f2 = 0; 210 } 211 } else { 212 _margin = _margin + _step; 213 if (_margin == _liSum - _gWidth - _options.innerMargin) { 214 jQuery(_options.btNext,_this).addClass('next-'+_options.disableClass);_f2 = 0; 215 } 216 } 217 } else { 218 if (_margin + _step > _liSum - _gWidth + _options.innerMargin) { 219 if (_margin != _liSum - _gWidth + _options.innerMargin) { 220 _margin = _liSum - _gWidth + _options.innerMargin; 221 } else { 222 _f2 = 1; 223 _margin = -_options.innerMargin; 224 } 225 } else { 226 _margin = _margin + _step; 227 _f2 = 0; 228 } 229 } 230 231 _animatedBlock.animate({marginLeft: -_margin+"px"}, {queue:false,duration: _options.duration }); 232 233 if (_timerSlide) { 234 clearTimeout(_timerSlide); 235 _timerSlide = setTimeout(function(){ 236 autoSlide(_options.autoSlide) 237 }, _options.autoSlide); 238 } 239 240 if (_options.slideNum && !_options.step) jQuery.fn.galleryScroll.numListActive(_margin,jQuery(_options.slideNum, _this),_gWidth,_lastSection); 241 if (jQuery.isFunction(_options.funcOnclick)) { 242 _options.funcOnclick.apply(_this); 243 } 244 return false; 245 }); 246 // click button 'Prev' 247 var _f2 = 1; 248 jQuery(_options.btPrev, _this).bind('click',function(){ 249 jQuery(_options.btNext,_this).removeClass('next-'+_options.disableClass); 250 if (_margin - _step >= -_step - _options.innerMargin && _margin - _step <= -_options.innerMargin) { 251 if (_f2 != 1) { 252 _margin = -_options.innerMargin; 253 _f2 = 1; 254 } else { 255 if (_options.circleSlide) { 256 _margin = _liSum - _gWidth + _options.innerMargin; 257 f=1;_f2=0; 258 } else { 259 _margin = -_options.innerMargin 260 } 261 } 262 } else if (_margin - _step < -_step + _options.innerMargin) { 263 _margin = _margin - _step; 264 f=0; 265 } 266 else {_margin = _margin - _step;f=0;}; 267 268 if (!_options.circleSlide && _margin == _options.innerMargin) { 269 jQuery(this).addClass('prev-'+_options.disableClass); 270 _f2=0; 271 } 272 273 if (!_options.circleSlide && _margin == -_options.innerMargin) jQuery(this).addClass('prev-'+_options.disableClass); 274 _animatedBlock.animate({marginLeft: -_margin + "px"}, {queue:false, duration: _options.duration}); 275 276 if (_options.slideNum && !_options.step) jQuery.fn.galleryScroll.numListActive(_margin,jQuery(_options.slideNum, _this),_gWidth,_lastSection); 277 278 if (_timerSlide) { 279 clearTimeout(_timerSlide); 280 _timerSlide = setTimeout(function(){ 281 autoSlide(_options.autoSlide) 282 }, _options.autoSlide); 283 } 284 285 if (jQuery.isFunction(_options.funcOnclick)) { 286 _options.funcOnclick.apply(_this); 287 } 288 return false; 289 }); 290 291 if (_liSum <= _gWidth) { 292 jQuery(_options.btPrev,_this).addClass('prev-'+_options.disableClass).unbind('click'); 293 jQuery(_options.btNext,_this).addClass('next-'+_options.disableClass).unbind('click'); 294 } 295 // auto slide 296 function autoSlide(autoSlideDuration){ 297 //if (_options.circleSlide) { 298 jQuery(_options.btNext,_this).trigger('click'); 299 //} 300 }; 301 // Number list 302 jQuery.fn.galleryScroll.numListCreate = function(_elNumList, _liSumWidth, _width, _section){ 303 var _numListElC = ''; 304 var _num = 1; 305 var _difference = _liSumWidth + _section; 306 while(_difference > 0) 307 { 308 _numListElC += '<li><a href="">'+_num+'</a></li>'; 309 _num++; 310 _difference = _difference - _width; 311 } 312 jQuery(_elNumList).html('<ul>'+_numListElC+'</ul>'); 313 }; 314 jQuery.fn.galleryScroll.numListActive = function(_marginEl, _slideNum, _width, _section){ 315 if (_slideNum) { 316 jQuery('a',_slideNum).removeClass('active'); 317 var _activeRange = _width - _section-1; 318 var _n = 0; 319 if (_marginEl != 0) { 320 while (_marginEl > _activeRange) { 321 _activeRange = (_n * _width) -_section-1 + _options.innerMargin; 322 _n++; 323 } 324 } 325 var _a = (_activeRange+_section+1 + _options.innerMargin)/_width - 1; 326 jQuery('a',_slideNum).eq(_a).addClass('active'); 327 } 328 }; 329 if (_options.slideNum && !_options.step) { 330 jQuery.fn.galleryScroll.numListCreate(jQuery(_options.slideNum, _this), _liSum, _gWidth,_lastSection); 331 jQuery.fn.galleryScroll.numListActive(_margin, jQuery(_options.slideNum, _this),_gWidth,_lastSection); 332 numClick(); 333 }; 334 function numClick() { 335 jQuery(_options.slideNum, _this).find('a').click(function(){ 336 jQuery(_options.btPrev,_this).removeClass('prev-'+_options.disableClass); 337 jQuery(_options.btNext,_this).removeClass('next-'+_options.disableClass); 338 339 var _indexNum = jQuery(_options.slideNum, _this).find('a').index(jQuery(this)); 340 _margin = (_step*_indexNum) - _options.innerMargin; 341 f=0; _f2=0; 342 if (_indexNum == 0) _f2=1; 343 if (_margin + _step > _liSum) { 344 _margin = _margin - (_margin - _liSum) - _step + _options.innerMargin; 345 if (!_options.circleSlide) jQuery(_options.btNext, _this).addClass('next-'+_options.disableClass); 346 } 347 _animatedBlock.animate({marginLeft: -_margin + "px"}, {queue:false, duration: _options.duration}); 348 349 if (!_options.circleSlide && _margin==0) jQuery(_options.btPrev,_this).addClass('prev-'+_options.disableClass); 350 jQuery.fn.galleryScroll.numListActive(_margin, jQuery(_options.slideNum, _this),_gWidth,_lastSection); 351 352 if (_timerSlide) { 353 clearTimeout(_timerSlide); 354 _timerSlide = setTimeout(function(){ 355 autoSlide(_options.autoSlide) 356 }, _options.autoSlide); 357 } 358 return false; 359 }); 360 }; 361 jQuery(window).resize(function(){ 362 _gWidth = _holderBlock.width(); 363 _liWidth = jQuery(_options.scrollEl,_animatedBlock).outerWidth(true); 364 _liSum = jQuery(_options.scrollEl,_animatedBlock).length * _liWidth; 365 if (!_options.step) _step = _gWidth; else _step = _options.step*_liWidth; 366 if (_options.slideNum && !_options.step) { 367 var _lastSection = 0; 368 var _sectionWidth = 0; 369 while(_sectionWidth < _liSum) 370 { 371 _sectionWidth = _sectionWidth + _gWidth; 372 if(_sectionWidth > _liSum) { 373 _lastSection = _sectionWidth - _liSum; 374 } 375 }; 376 jQuery.fn.galleryScroll.numListCreate(jQuery(_options.slideNum, _this), _liSum, _gWidth,_lastSection); 377 jQuery.fn.galleryScroll.numListActive(_margin, jQuery(_options.slideNum, _this),_gWidth,_lastSection); 378 numClick(); 379 }; 380 //if (_margin == _options.innerMargin) jQuery(this).addClass(_options.disableClass); 381 if (_liSum - _gWidth < _margin - _options.innerMargin) { 382 if (!_options.circleSlide) jQuery(_options.btNext, _this).addClass('next-'+_options.disableClass); 383 _animatedBlock.animate({marginLeft: -(_liSum - _gWidth + _options.innerMargin)}, {queue:false, duration: _options.duration}); 384 }; 385 }); 386 }); 387} 388jQuery.fn.galleryScrollShort = function(_options){ 389 // defaults options 390 var _options = jQuery.extend({ 391 btPrev: 'a.prev',
392 btNext: 'a.next', 393 holderList: 'div.gallery', 394 scrollElParent: 'ul', 395 scrollEl: 'li', 396 slideNum: false, 397 duration : 1000, 398 step: false, 399 circleSlide: true, 400 disableClass: 'disable', 401 funcOnclick: null, 402 autoSlide:false, 403 innerMargin:0, 404 stepWidth:false 405 },_options); 406 407 return this.each(function(){ 408 var _this = jQuery(this); 409 410 var _holderBlock = jQuery(_options.holderList,_this); 411 var _gWidth = _holderBlock.width(); 412 var _animatedBlock = jQuery(_options.scrollElParent,_holderBlock); 413 var _liWidth = jQuery(_options.scrollEl,_animatedBlock).outerWidth(true); 414 var _liSum = (jQuery(_options.scrollEl,_animatedBlock).length * _liWidth) - 8; 415 var _margin = -_options.innerMargin; 416 var f = 0; 417 var _step = 0; 418 var _autoSlide = _options.autoSlide; 419 var _timerSlide = null; 420 if (!_options.step) _step = _gWidth; else _step = _options.step*_liWidth; 421 if (_options.stepWidth) _step = _options.stepWidth; 422 423 if (!_options.circleSlide) { 424 if (_options.innerMargin == _margin) 425 jQuery(_options.btPrev,_this).addClass('prev-'+_options.disableClass); 426 } 427 if (_options.slideNum && !_options.step) { 428 var _lastSection = 0; 429 var _sectionWidth = 0; 430 while(_sectionWidth < _liSum) 431 { 432 _sectionWidth = _sectionWidth + _gWidth; 433 if(_sectionWidth > _liSum) { 434 _lastSection = _sectionWidth - _liSum; 435 } 436 } 437 } 438 if (_autoSlide) { 439 _timerSlide = setTimeout(function(){ 440 autoSlide(_autoSlide); 441 }, _autoSlide); 442 _animatedBlock.hover(function(){ 443 clearTimeout(_timerSlide); 444 }, function(){ 445 _timerSlide = setTimeout(function(){ 446 autoSlide(_autoSlide) 447 }, _autoSlide); 448 }); 449 } 450 451 // click button 'Next' 452 jQuery(_options.btNext,_this).bind('click',function(){ 453 jQuery(_options.btPrev,_this).removeClass('prev-'+_options.disableClass); 454 if (!_options.circleSlide) { 455 if (_margin + _step > _liSum - _gWidth - _options.innerMargin) { 456 if (_margin != _liSum - _gWidth - _options.innerMargin) { 457 _margin = _liSum - _gWidth + _options.innerMargin; 458 jQuery(_options.btNext,_this).addClass('next-'+_options.disableClass); 459 _f2 = 0; 460 } 461 } else { 462 _margin = _margin + _step; 463 if (_margin == _liSum - _gWidth - _options.innerMargin) { 464 jQuery(_options.btNext,_this).addClass('next-'+_options.disableClass);_f2 = 0; 465 } 466 } 467 } else { 468 if (_margin + _step > _liSum - _gWidth + _options.innerMargin) { 469 if (_margin != _liSum - _gWidth + _options.innerMargin) { 470 _margin = _liSum - _gWidth + _options.innerMargin; 471 } else { 472 _f2 = 1; 473 _margin = -_options.innerMargin; 474 } 475 } else { 476 _margin = _margin + _step; 477 _f2 = 0; 478 } 479 } 480 481 _animatedBlock.animate({marginLeft: -_margin+"px"}, {queue:false,duration: _options.duration }); 482 483 if (_timerSlide) { 484 clearTimeout(_timerSlide); 485 _timerSlide = setTimeout(function(){ 486 autoSlide(_options.autoSlide) 487 }, _options.autoSlide); 488 } 489 490 if (_options.slideNum && !_options.step) jQuery.fn.galleryScroll.numListActive(_margin,jQuery(_options.slideNum, _this),_gWidth,_lastSection); 491 if (jQuery.isFunction(_options.funcOnclick)) { 492 _options.funcOnclick.apply(_this); 493 } 494 return false; 495 }); 496 // click button 'Prev' 497 var _f2 = 1; 498 jQuery(_options.btPrev, _this).bind('click',function(){ 499 jQuery(_options.btNext,_this).removeClass('next-'+_options.disableClass); 500 if (_margin - _step >= -_step - _options.innerMargin && _margin - _step <= -_options.innerMargin) { 501 if (_f2 != 1) { 502 _margin = -_options.innerMargin; 503 _f2 = 1; 504 } else { 505 if (_options.circleSlide) { 506 _margin = _liSum - _gWidth + _options.innerMargin; 507 f=1;_f2=0; 508 } else { 509 _margin = -_options.innerMargin 510 } 511 } 512 } else if (_margin - _step < -_step + _options.innerMargin) { 513 _margin = _margin - _step; 514 f=0; 515 } 516 else {_margin = _margin - _step;f=0;}; 517 518 if (!_options.circleSlide && _margin == _options.innerMargin) { 519 jQuery(this).addClass('prev-'+_options.disableClass); 520 _f2=0; 521 } 522 523 if (!_options.circleSlide && _margin == -_options.innerMargin) jQuery(this).addClass('prev-'+_options.disableClass); 524 _animatedBlock.animate({marginLeft: -_margin + "px"}, {queue:false, duration: _options.duration}); 525 526 if (_options.slideNum && !_options.step) jQuery.fn.galleryScroll.numListActive(_margin,jQuery(_options.slideNum, _this),_gWidth,_lastSection); 527 528 if (_timerSlide) { 529 clearTimeout(_timerSlide); 530 _timerSlide = setTimeout(function(){ 531 autoSlide(_options.autoSlide) 532 }, _options.autoSlide); 533 } 534 535 if (jQuery.isFunction(_options.funcOnclick)) { 536 _options.funcOnclick.apply(_this); 537 } 538 return false; 539 }); 540 541 if (_liSum <= _gWidth) { 542 jQuery(_options.btPrev,_this).addClass('prev-'+_options.disableClass).unbind('click'); 543 jQuery(_options.btNext,_this).addClass('next-'+_options.disableClass).unbind('click'); 544 } 545 // auto slide 546 function autoSlide(autoSlideDuration){ 547 //if (_options.circleSlide) { 548 jQuery(_options.btNext,_this).trigger('click'); 549 //} 550 }; 551 // Number list 552 jQuery.fn.galleryScroll.numListCreate = function(_elNumList, _liSumWidth, _width, _section){ 553 var _numListElC = ''; 554 var _num = 1; 555 var _difference = _liSumWidth + _section; 556 while(_difference > 0) 557 { 558 _numListElC += '<li><a href="">'+_num+'</a></li>'; 559 _num++; 560 _difference = _difference - _width; 561 } 562 jQuery(_elNumList).html('<ul>'+_numListElC+'</ul>'); 563 }; 564 jQuery.fn.galleryScroll.numListActive = function(_marginEl, _slideNum, _width, _section){ 565 if (_slideNum) { 566 jQuery('a',_slideNum).removeClass('active'); 567 var _activeRange = _width - _section-1; 568 var _n = 0; 569 if (_marginEl != 0) { 570 while (_marginEl > _activeRange) { 571 _activeRange = (_n * _width) -_section-1 + _options.innerMargin; 572 _n++; 573 } 574 } 575 var _a = (_activeRange+_section+1 + _options.innerMargin)/_width - 1; 576 jQuery('a',_slideNum).eq(_a).addClass('active'); 577 } 578 }; 579 if (_options.slideNum && !_options.step) { 580 jQuery.fn.galleryScroll.numListCreate(jQuery(_options.slideNum, _this), _liSum, _gWidth,_lastSection); 581 jQuery.fn.galleryScroll.numListActive(_margin, jQuery(_options.slideNum, _this),_gWidth,_lastSection); 582 numClick(); 583 }; 584 function numClick() { 585 jQuery(_options.slideNum, _this).find('a').click(function(){ 586 jQuery(_options.btPrev,_this).removeClass('prev-'+_options.disableClass); 587 jQuery(_options.btNext,_this).removeClass('next-'+_options.disableClass); 588 589 var _indexNum = jQuery(_options.slideNum, _this).find('a').index(jQuery(this)); 590 _margin = (_step*_indexNum) - _options.innerMargin; 591 f=0; _f2=0; 592 if (_indexNum == 0) _f2=1; 593 if (_margin + _step > _liSum) { 594 _margin = _margin - (_margin - _liSum) - _step + _options.innerMargin; 595 if (!_options.circleSlide) jQuery(_options.btNext, _this).addClass('next-'+_options.disableClass); 596 } 597 _animatedBlock.animate({marginLeft: -_margin + "px"}, {queue:false, duration: _options.duration}); 598 599 if (!_options.circleSlide && _margin==0) jQuery(_options.btPrev,_this).addClass('prev-'+_options.disableClass); 600 jQuery.fn.galleryScroll.numListActive(_margin, jQuery(_options.slideNum, _this),_gWidth,_lastSection); 601 602 if (_timerSlide) { 603 clearTimeout(_timerSlide); 604 _timerSlide = setTimeout(function(){ 605 autoSlide(_options.autoSlide) 606 }, _options.autoSlide); 607 } 608 return false; 609 }); 610 }; 611 jQuery(window).resize(function(){ 612 _gWidth = _holderBlock.width(); 613 _liWidth = jQuery(_options.scrollEl,_animatedBlock).outerWidth(true); 614 _liSum = jQuery(_options.scrollEl,_animatedBlock).length * _liWidth; 615 if (!_options.step) _step = _gWidth; else _step = _options.step*_liWidth; 616 if (_options.slideNum && !_options.step) { 617 var _lastSection = 0; 618 var _sectionWidth = 0; 619 while(_sectionWidth < _liSum) 620 { 621 _sectionWidth = _sectionWidth + _gWidth; 622 if(_sectionWidth > _liSum) { 623 _lastSection = _sectionWidth - _liSum; 624 } 625 }; 626 jQuery.fn.galleryScroll.numListCreate(jQuery(_options.slideNum, _this), _liSum, _gWidth,_lastSection); 627 jQuery.fn.galleryScroll.numListActive(_margin, jQuery(_options.slideNum, _this),_gWidth,_lastSection); 628 numClick(); 629 }; 630 //if (_margin == _options.innerMargin) jQuery(this).addClass(_options.disableClass); 631 if (_liSum - _gWidth < _margin - _options.innerMargin) { 632 if (!_options.circleSlide) jQuery(_options.btNext, _this).addClass('next-'+_options.disableClass); 633 _animatedBlock.animate({marginLeft: -(_liSum - _gWidth + _options.innerMargin)}, {queue:false, duration: _options.duration}); 634 }; 635 }); 636 }); 637} 638jQuery.fn.makeGallery = function(o) { 639 o = $.extend( { 640 interval : 1800, /* инÑеÑвал вÑаÑÐµÐ½Ð¸Ñ 1000 = 1ÑекÑнда */ 641 speed : 800, /* ÑкоÑоÑÑÑ Ð¿ÐµÑемеÑÐµÐ½Ð¸Ñ 1000 = 1ÑекÑнда */ 642 gallery_frame : '.gallery', 643 gallery_holder : 'ul', 644 gallery_item : 'li' 645 }, o || {}); 646 return this.each( 647 function() { 648 var _phase = true; 649 main_holder = $(this); 650 main_holder.find('.prev').click(function(){ 651 if (_phase) { 652 _phase = false; 653 oneStepMinus(); 654 } 655 return false; 656 }); 657 main_holder.find('.next').click(function(){ 658 if (_phase) { 659 _phase = false; 660 oneStepPlus();
661 } 662 return false; 663 }); 664 function oneStepPlus () { 665 var step = (main_holder.find(o.gallery_item).outerWidth()); 666 main_holder.find(o.gallery_holder).animate({marginLeft:step*(-1)}, o.speed, function(){ 667 $(this).append($(this).find(o.gallery_item+':first')); 668 $(this).css('margin-left','0'); 669 _phase = true; 670 }); 671 }; 672 function oneStepMinus () { 673 var step = (main_holder.find(o.gallery_item).outerWidth()); 674 main_holder.find(o.gallery_holder).css('margin-left',-step).prepend(main_holder.find(o.gallery_holder).find(o.gallery_item+':last')); 675 main_holder.find(o.gallery_holder).animate({marginLeft:0}, o.speed, function(){ 676 $(this).css('margin-left','0'); 677 _phase = true; 678 }); 679 }; 680 }); 681}; 682jQuery.fn.fadeGallery = function(_options){ 683 var _options = jQuery.extend({ 684 slideElements:'div.slideset > div', 685 pagerLinks:'ul.switcher a', 686 btnNext:'a.next', 687 btnPrev:'a.prev', 688 btnPlayPause:'a.play-pause', 689 pausedClass:'paused', 690 playClass:'playing', 691 activeClass:'active', 692 pauseOnHover:true, 693 autoRotation:false, 694 autoHeight:false, 695 switchTime:3000, 696 duration:650, 697 event:'click' 698 },_options); 699 700 return this.each(function(){ 701 var _this = jQuery(this); 702 var _slides = jQuery(_options.slideElements, _this); 703 var _pagerLinks = jQuery(_options.pagerLinks, _this); 704 var _btnPrev = jQuery(_options.btnPrev, _this); 705 var _btnNext = jQuery(_options.btnNext, _this); 706 var _btnPlayPause = jQuery(_options.btnPlayPause, _this); 707 var _pauseOnHover = _options.pauseOnHover; 708 var _autoRotation = _options.autoRotation; 709 var _activeClass = _options.activeClass; 710 var _pausedClass = _options.pausedClass; 711 var _playClass = _options.playClass; 712 var _autoHeight = _options.autoHeight; 713 var _duration = _options.duration; 714 var _switchTime = _options.switchTime; 715 var _controlEvent = _options.event; 716 717 var _hover = false; 718 var _prevIndex = 0; 719 var _currentIndex = 0; 720 var _slideCount = _slides.length; 721 var _timer; 722 if(!_slideCount) return; 723 _slides.hide().eq(_currentIndex).show(); 724 if(_autoRotation) _this.removeClass(_pausedClass).addClass(_playClass); 725 else _this.removeClass(_playClass).addClass(_pausedClass); 726 727 if(_btnPrev.length) { 728 _btnPrev.bind(_controlEvent,function(){ 729 prevSlide(); 730 return false; 731 }); 732 } 733 if(_btnNext.length) { 734 _btnNext.bind(_controlEvent,function(){ 735 nextSlide(); 736 return false; 737 }); 738 } 739 if(_pagerLinks.length) { 740 _pagerLinks.each(function(_ind){ 741 jQuery(this).bind(_controlEvent,function(){ 742 if(_currentIndex != _ind) { 743 _prevIndex = _currentIndex; 744 _currentIndex = _ind; 745 switchSlide(); 746 } 747 return false; 748 }); 749 }); 750 } 751 752 if(_btnPlayPause.length) { 753 _btnPlayPause.bind(_controlEvent,function(){ 754 if(_this.hasClass(_pausedClass)) { 755 _this.removeClass(_pausedClass).addClass(_playClass); 756 _autoRotation = true; 757 autoSlide(); 758 } else { 759 if(_timer) clearRequestTimeout(_timer); 760 _this.removeClass(_playClass).addClass(_pausedClass); 761 } 762 return false; 763 }); 764 } 765 766 function prevSlide() { 767 _prevIndex = _currentIndex; 768 if(_currentIndex > 0) _currentIndex--; 769 else _currentIndex = _slideCount-1; 770 switchSlide(); 771 } 772 function nextSlide() { 773 _prevIndex = _currentIndex; 774 if(_currentIndex < _slideCount-1) _currentIndex++; 775 else _currentIndex = 0; 776 switchSlide(); 777 } 778 function refreshStatus() { 779 if(_pagerLinks.length) _pagerLinks.removeClass(_activeClass).eq(_currentIndex).addClass(_activeClass); 780 _slides.eq(_prevIndex).removeClass(_activeClass); 781 _slides.eq(_currentIndex).addClass(_activeClass); 782 } 783 function switchSlide() { 784 _slides.stop(true,true); 785 _slides.eq(_prevIndex).fadeOut(_duration); 786 _slides.eq(_currentIndex).fadeIn(_duration); 787 refreshStatus();
788 autoSlide(); 789 } 790 791 function autoSlide() { 792 if(!_autoRotation || _hover) return; 793 if(_timer) clearRequestTimeout(_timer); 794 _timer = requestTimeout(nextSlide,_switchTime+_duration); 795 } 796 if(_pauseOnHover) { 797 _this.hover(function(){ 798 _hover = true; 799 if(_timer) clearRequestTimeout(_timer); 800 },function(){ 801 _hover = false; 802 autoSlide(); 803 }); 804 } 805 refreshStatus(); 806 autoSlide(); 807 }); 808} 809/* 810 * Drop in replace functions for setTimeout() & setInterval() that 811 * make use of requestAnimationFrame() for performance where available 812 * http://www.joelambert.co.uk 813 * 814 * Copyright 2011, Joe Lambert. 815 * Free to use under the MIT license. 816 * http://www.opensource.org/licenses/mit-license.php 817 */ 818 819// requestAnimationFrame() shim by Paul Irish 820// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 821window.requestAnimFrame = (function() { 822 return window.requestAnimationFrame || 823 window.webkitRequestAnimationFrame || 824 window.mozRequestAnimationFrame || 825 window.oRequestAnimationFrame || 826 window.msRequestAnimationFrame || 827 function(/* function */ callback, /* DOMElement */ element){ 828 window.setTimeout(callback, 1000 / 60); 829 }; 830})(); 831/** 832 * Behaves the same as setTimeout except uses requestAnimationFrame() where possible for better performance 833 * @param {function} fn The callback function 834 * @param {int} delay The delay in milliseconds 835 */ 836 837window.requestTimeout = function(fn, delay) { 838 if( !window.requestAnimationFrame && 839 !window.webkitRequestAnimationFrame && 840 !window.mozRequestAnimationFrame && 841 !window.oRequestAnimationFrame && 842 !window.msRequestAnimationFrame) 843 return window.setTimeout(fn, delay); 844 845 var start = new Date().getTime(), 846 handle = new Object(); 847 848 function loop(){ 849 var current = new Date().getTime(), 850 delta = current - start; 851 852 delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop); 853 }; 854 855 handle.value = requestAnimFrame(loop); 856 return handle; 857}; 858 859/** 860 * Behaves the same as clearInterval except uses cancelRequestAnimationFrame() where possible for better performance 861 * @param {int|object} fn The callback function 862 */ 863window.clearRequestTimeout = function(handle) { 864 window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) : 865 window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : 866 window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) : 867 window.oCancelRequestAnimationFrame ? window.oCancelRequestAnimationFrame(handle.value) : 868 window.msCancelRequestAnimationFrame ? msCancelRequestAnimationFrame(handle.value) : 869 clearTimeout(handle); 870}; 871 872/** 873 * jQuery.ScrollTo - Easy element scrolling using jQuery. 874 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com 875 * Dual licensed under MIT and GPL. 876 * Date: 5/25/2009 877 * @author Ariel Flesler 878 * @version 1.4.2 879 * 880 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html 881 */ 882;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}
882if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(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.