1/* 2 * UnoSlider - http://unoslider.com 3 * Support: http://codecanyon.net/user/Unodor#contact 4 * 5 * Version: 1.7 6 * 7 * DO NOT use this file in production. Use minified version instead 8 */ 9 10;(function($){ 11 12 // console.log wrapper 13 function log(data){ 14 console.log(data); 15 } 16 17 // UID generator 18 var uniqueID = (function() { 19 var id = 0; 20 return function() { return id++; }; 21 })(); 22 23 $.UnoSlider = function(options, base){ 24 var $ = jQuery; 25 var $this = base; 26 27 var defaults = { 28 slidesTag: 'li', 29 scale: true, 30 preloader: 'progress', 31 tooltip: true, 32 preset: false, 33 width: false, 34 height: false, 35 order: 'inorder', 36 touch: true, 37 mobile: true, 38 responsive: true, 39 responsiveLayers: false, 40 indicator: { 41 autohide: false, 42 position: '' 43 }, 44 navigation: { 45 autohide: ['play', 'pause'], 46 next: 'Next', 47 prev: 'Previous', 48 play: 'Play', 49 stop: 'Pause' 50 }, 51 slideshow: { 52 speed: 1, 53 timer: true, 54 hoverPause: true, 55 infinite: true, 56 autostart: true, 57 continuous: true 58 }, 59 block: { 60 vertical: 9, 61 horizontal: 3 62 }, 63 animation: { 64 speed: 500, 65 delay: 50, 66 color: '#fff', 67 transition: 'grow', 68 variation: 'topleft', 69 pattern: 'diagonal', 70 direction: 'topleft' 71 } 72 }; 73 74 var preset = { 75 animation: { 76 speed: 500, 77 delay: 50, 78 color: '#fff', 79 transition: 'grow', 80 variation: 'topleft', 81 pattern: 'diagonal', 82 direction: 'topleft' 83 }, 84 block: { 85 vertical: 9, 86 horizontal: 3 87 } 88 }; 89 90 var defaults_cfg = $.extend(true, defaults, $.UnoSlider.defaults); 91 var preset_base_cfg = $.extend({}, defaults, $.UnoSlider.defaults); 92 var cfg = $.extend(true, defaults_cfg, options); 93 94 var slides = $this.find(cfg.slidesTag); 95 var activeSlideNum = 0; 96 var interval = new Array; 97 var controls = ''; 98 var running = false; 99 var stoped = false; 100 var force = false; 101 var lastSlideNum = 0; 102 103 var intervalStartTime; 104 var intervalStopTime; 105 var timebarStartTime; 106 var timebarStopTime; 107 var layerTimer; 108 var layerRunning = false; 109 110 var layerAnimation = []; 111 112 var block = {}; 113 114 var columns; 115 var rows; 116 117 var uid = uniqueID(); 118 119 var lists = $this.find(cfg.slidesTag).css({ 120 opacity: 0, 121 display: "none" 122 }); 123 124 var loaded = 0; 125 126 if(typeof cfg.width !== 'undefined' && cfg.width !== null && cfg.width){ 127 $this.css({width: cfg.width}); 128 } 129 130 if(typeof cfg.height !== 'undefined' && cfg.height !== null && cfg.height){ 131 $this.css({height: cfg.height}); 132 } 133 134 $this.main = { 135 136 // slider initialize 137 init: function(){ 138 slides.filter(":first").css({ 139 'z-index': 1, 140 display: "block" 141 }).addClass('unoslider_active'); 142 143 // show preloader 144 $this.preloader.init($this.main.start); 145 }, 146 147 centerImage: function(){ 148 var images = slides.find('img').not('.unoslider_layers img, .unoslider_caption img, div > img'); 149 150 images.css({maxWidth: 'none'}); 151 152 // keep image centered 153 function keepCentered(){ 154 var sliderWidth = $this.width(); 155 156 images.each(function(i, img){ 157 var $img = $(img) 158 var width = $img.context.width; 159 var margin = (width-sliderWidth) / 2 * -1; 160 161 $img.css({ 162 marginLeft: margin 163 }); 164 }) 165 166 } 167 168 $(window).resize(function(){ 169 keepCentered(); 170 }); 171 172 // center image on load 173 keepCentered(); 174 }, 175 176 // start slider 177 start: function(){ 178 var layerDelay = 0; 179 180 // more than one slide 181 if(slides.length > 1){ 182 stoped = !cfg.slideshow.autostart ? true : false; 183 if(cfg.indicator) $this.navigation.indicator(); 184 $this.navigation.generate(); 185 if(cfg.slideshow.timer) $this.timebar.set(); 186 if(cfg.slideshow.hoverPause) $this.slideshow.pauseOnHover(); 187 } 188 189 if(cfg.touch && $this.main.is_mobile()) $this.touch.init(); 190 191 $this.layer.generate(); 192 193 if(cfg.responsiveLayers){ 194 $this.layer.responsive(); 195 }else{ 196 if(!cfg.scale) $this.main.centerImage(); 197 } 198 199 $this.main.scaleSlides(); 200 201 $this.tooltip.generate(); 202 203 var firstSlide = $this.children('li:first'); 204 205 // show captions and layers on first slide 206 setTimeout(function(){ 207 layerDelay = $this.layer.show(firstSlide); 208 209 if(cfg.tooltip) $this.tooltip.show(firstSlide); 210 211 if(slides.length > 1){ 212 if(cfg.slideshow.autostart){ 213 layerTimer = setTimeout(function(){ 214 $this.slideshow.start(); 215 }, layerDelay); 216 } 217 } 218 219 }, 500); 220 }, 221 222 // scale images to fit the slider dimensions 223 scaleSlides: function(){ 224 var img = slides.find('img').not('.unoslider_layers img, .unoslider_caption img, div > img'); 225 var slides_content = slides.children().filter(':not(.unoslider_caption, .unoslider_layers)');
226 var div = $('<div class="unoslider_slider_area"></div>').css({overflow: 'hidden', width: '100%', height: $this.height(), position: 'absolute'}); 227 228 // wrap into the div because an overflow 229 slides_content.each(function(){ 230 $(this).wrap(div); 231 }); 232 233 234 slides.find('.unoslider_slider_area div img').each(function(){ 235 var theImage = new Image(); 236 theImage.src = this.src; 237 238 if(typeof $(this).attr('height') === 'undefined') 239 $(this).height(theImage.height); 240 241 if(typeof $(this).attr('width') === 'undefined') 242 $(this).width(theImage.width); 243 }); 244 245 // per-slide settings 246 var scale = cfg.scale; 247 if((typeof cfg[activeSlideNum+1] != 'undefined') && (typeof cfg[activeSlideNum+1].scale != 'undefined')){ 248 scale = cfg[activeSlideNum+1].scale; 249 } 250 251 if(scale){ 252 img.css({width: '100%', height: '100%' }); 253 } 254 }, 255 256 // generate blocks curtain 257 generateCurtain: function(content){ 258 var generateBlocks = true; 259 var X = 0; 260 var Y = 0; 261 var i = 1; 262 var content_cube; 263 264 var vertical = cfg.block.vertical; 265 if((typeof cfg[activeSlideNum+1] != 'undefined') && (typeof cfg[activeSlideNum+1].block != 'undefined') && (typeof cfg[activeSlideNum+1].block.vertical != 'undefined')){ 266 vertical = cfg[activeSlideNum+1].block.vertical; 267 } 268 269 var horizontal = cfg.block.horizontal; 270 if((typeof cfg[activeSlideNum+1] != 'undefined') && (typeof cfg[activeSlideNum+1].block != 'undefined') && (typeof cfg[activeSlideNum+1].block.horizontal != 'undefined')){ 271 horizontal = cfg[activeSlideNum+1].block.horizontal; 272 } 273 274 columns = vertical; 275 rows = horizontal; 276 277 // count dimensions 278 block = { 279 width: Math.ceil($this.width() / vertical), 280 height: Math.ceil($this.height() / horizontal) 281 }; 282 283 var blocks_area = $('<div class="unoslider_blocks_area"></div>').css({overflow: 'hidden', width: $this.width(), height: $this.height(), position: 'absolute', top: '0px', left: '0px', 'z-index': 3}).appendTo($this[0]); 284 var blocks = $('<div class="unoslider_blocks"></div>').css({width: $this.width(), height: $this.height(), position: 'relative'}).appendTo(blocks_area); 285 286 // generate 287 while (generateBlocks) { 288 content_cube = $('<div class="unoslider_cube_content"></div>').css({ 289 position: 'absolute', 290 left: -X, 291 top: -Y, 292 width: $this.width(), 293 height: $this.height() 294 }); 295 296 $('<div id="block_' + i + '" class="unoslider_cube"></div>').appendTo(blocks).css({ 297 'z-index': 2, 298 position: 'absolute', 299 display: 'none', 300 top: Y, 301 left: X, 302 width: block.width, 303 height: block.height, 304 overflow: 'hidden' 305 }).append(content_cube); 306 307 i++; 308 309 X += block.width; 310 311 if (X >= $this.width()) { 312 X = 0; 313 Y += block.height; 314 } 315 316 if (Y >= $this.height()) generateBlocks = false; 317 } 318 319 // add data (image, custom html...) 320 var $content = $(content); 321 $content.find('video').remove(); 322 $this.find('.unoslider_cube_content').html($content); 323 324 // disable clicks when the blocks move 325 $('.unoslider_cube').click(function(){ 326 return false; 327 }); 328 }, 329 330 // prepare the slider for the upcoming transition 331 prepare: function(slideData){ 332 running = true; 333 $this.main.generateCurtain(slideData.html()); 334 335 return $this.main.setDirection(); 336 }, 337 338 // execute animation 339 execute: function(direction, duration, currentSlide, nextSlide, handChange, delayedChange){ 340 if(cfg.tooltip) $this.tooltip.hide(); 341 342 if(delayedChange === false){ 343 setTimeout(function(){ 344 $this.slideshow.switchSlides(currentSlide, nextSlide); 345 }, 10); 346 } 347 348 var delay = direction['celkem'] + duration; 349 350 currentSlide.delay(delay).animate({ 351 opacity: 0 352 }, 1, function(){ 353 if(delayedChange === true) $this.slideshow.switchSlides(currentSlide, nextSlide); 354 355 nextSlide.animate({}, 1, function () { 356 $this.children(".unoslider_blocks_area").remove(); 357 $this.children(".unoslider_cube").remove(); 358 359 var layerDelay = $this.layer.show(nextSlide); 360 361 if((handChange === true && (cfg.slideshow.continuous === true || !cfg.slideshow)) || handChange === false){ 362 running = false;
363 layerTimer = setTimeout(function(){ 364 layerRunning = false; 365 if(stoped === false) $this.slideshow.restart(); 366 }, layerDelay); 367 } 368 369 if(cfg.tooltip) $this.tooltip.show(nextSlide); 370 }); 371 }); 372 }, 373 374 counter: 0, 375 376 // preset animations 377 presets: function(){ 378 379 // presets object is provided 380 if(typeof cfg === 'object' && typeof cfg.preset === 'object'){ 381 var index = cfg.order === 'random' ? Math.floor(Math.random() * cfg.preset.length) : this.counter; 382 383 if(typeof cfg.preset[index] == 'string'){ 384 if(cfg.preset[index] in $this.preset){ 385 $this.preset[cfg.preset[index]](); 386 }else{ 387 alert('There is no preset named "'+cfg.preset[index]+'"'); 388 } 389 }else{ 390 cfg.animation = $.extend({}, preset.animation, cfg.preset[index].animation); 391 cfg.block = $.extend({}, preset.block, cfg.preset[index].block); 392 } 393 394 if((this.counter+1) < cfg.preset.length){ 395 this.counter++; 396 }else{ 397 this.counter = 0; 398 } 399 400 }else{ 401 if(cfg.preset) $this.preset.init(); 402 } 403 }, 404 405 // mobile devices checker 406 is_mobile: function(){ 407 var mobile = navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|Android)/); 408 return mobile; 409 }, 410 411 // mobile optimized presets 412 mobilePresets: function(){ 413 cfg.block = { vertical: 1, horizontal: 1 }; 414 415 if($this.touch.reverse){ 416 cfg.animation = { speed: 300, delay: 0, transition: 'slide_in', variation: 'left', pattern: 'horizontal' }; 417 }else{ 418 cfg.animation = { speed: 300, delay: 0, transition: 'slide_in', variation: 'right', pattern: 'horizontal' }; 419 } 420 421 $this.touch.reverse = false; 422 }, 423 424 // responsive design enabled 425 responsive: function(){ 426 var base_width = $this.width(); 427 var base_height = $this.height(); 428 var ratio = (base_width / base_height); 429 $this.data('base_width', base_width); 430 $this.data('base_height', base_height); 431 432 // fit to width 433 function fit(){ 434 if($this.parent().width() < (base_width)){ 435 $this.width('100%'); 436 $this.find('.unoslider_slider_area').width('100%'); 437 }else{ 438 $this.css({width: base_width, height: base_height }); 439 $this.find('.unoslider_slider_area').css({width: base_width, height: base_height }); 440 } 441 442 var cropHeight = Math.floor((($this.width()/ratio)/1))*1; 443 $this.height(cropHeight); 444 $this.find('.unoslider_slider_area').height(cropHeight); 445 } 446 447 $(window).resize(function(){ 448 fit(false); 449 }); 450 451 // responsive fit on load 452 fit(true); 453 }, 454 455 // set right transition 456 setTransition: function(currentSlide, nextSlide, handChange){ 457 458 if(cfg.mobile && $this.main.is_mobile()){ 459 this.mobilePresets(); 460 }else{ 461 this.presets(); 462 } 463 464 var transition = cfg.animation.transition; 465 if((typeof cfg[activeSlideNum + 1] != 'undefined') && (typeof cfg[activeSlideNum + 1].animation != 'undefined') && (typeof cfg[activeSlideNum + 1].animation.transition != 'undefined')){ 466 transition = cfg[activeSlideNum + 1].animation.transition; 467 } 468 469 var variation = cfg.animation.variation; 470 if((typeof cfg[activeSlideNum + 1] != 'undefined') && (typeof cfg[activeSlideNum + 1].animation != 'undefined') && (typeof cfg[activeSlideNum + 1].animation.variation != 'undefined')){ 471 variation = cfg[activeSlideNum + 1].animation.variation; 472 } 473 474 // all possible transitions 475 var transitions = { 476 swap: ['top', 'right', 'bottom', 'left'], 477 stretch: ['center', 'vertical', 'horizontal', 'alternate'], 478 squeeze: ['center', 'vertical', 'horizontal', 'alternate'], 479 shrink: ['topleft', 'topright', 'bottomleft', 'bottomright'], 480 grow: ['topleft', 'topright', 'bottomleft', 'bottomright'], 481 slide_in: ['top', 'right', 'bottom', 'left', 'alternate_vertical', 'alternate_horizontal'], 482 slide_out: ['top', 'right', 'bottom', 'left', 'alternate_vertical', 'alternate_horizontal'], 483 drop: ['topleft', 'topright', 'bottomleft', 'bottomright', 'top', 'right', 'bottom', 'left', 'alternate_vertical', 'alternate_horizontal'], 484 appear: ['topleft', 'topright', 'bottomleft', 'bottomright', 'top', 'right', 'bottom', 'left', 'alternate_vertical', 'alternate_horizontal'], 485 flash: [], 486 fade: [] 487 }; 488 489 function in_array(a){ 490 var o = {}; 491 for(var i = 0; i < a.length; i++){ 492 o[a[i]] = ''; 493 } 494 return o; 495 } 496 497 var final_transition = transition; 498 499 // build 500 if(transitions[transition].length > 0){ 501 if(variation in in_array(transitions[transition])){ 502 final_transition = transition+'_'+variation; 503 }else{ 504 final_transition = transition+'_'+transitions[transition][0]; 505 } 506 } 507 508 $this.transition[final_transition](currentSlide, nextSlide, handChange); 509 510 }, 511
512 // set right direction 513 setDirection: function(){ 514 var direction = cfg.animation.direction; 515 if((typeof cfg[activeSlideNum+1] != 'undefined') && (typeof cfg[activeSlideNum+1].animation != 'undefined') && (typeof cfg[activeSlideNum+1].animation.direction != 'undefined')){ 516 direction = cfg[activeSlideNum+1].animation.direction; 517 } 518 519 var type = cfg.animation.pattern; 520 if((typeof cfg[activeSlideNum+1] != 'undefined') && (typeof cfg[activeSlideNum+1].animation != 'undefined') && (typeof cfg[activeSlideNum+1].animation.pattern != 'undefined')){ 521 type = cfg[activeSlideNum+1].animation.pattern; 522 } 523 524 // all possible patterns 525 var directions = { 526 horizontal: ['top', 'bottom', 'topleft', 'topright', 'bottomleft', 'bottomright'], 527 vertical: ['left', 'right', 'topleft', 'topright', 'bottomleft', 'bottomright'], 528 diagonal: ['topleft', 'topright', 'bottomleft', 'bottomright'], 529 random: [], 530 spiral: ['topleft', 'topright', 'bottomleft', 'bottomright'], 531 horizontal_zigzag: ['topleft', 'topright', 'bottomleft', 'bottomright'], 532 vertical_zigzag: ['topleft', 'topright', 'bottomleft', 'bottomright'], 533 chess: [], 534 explode: ['center', 'top', 'right', 'bottom', 'left'], 535 implode: ['center', 'top', 'right', 'bottom', 'left'], 536 example: [] 537 }; 538 539 function in_array(a){ 540 var o = {}; 541 for(var i=0;i<a.length;i++){ 542 o[a[i]]=''; 543 } 544 return o; 545 } 546 547 var final_direction = type; 548 549 // build 550 if(directions[type].length > 0){ 551 if(direction in in_array(directions[type])){ 552 final_direction = type+'_'+direction; 553 }else{ 554 final_direction = type+'_'+directions[type][0]; 555 } 556 } 557 558 return $this.direction[final_direction](); 559 } 560 561 }; 562 563 $this.touch = { 564 565 moving: false, 566 startX: null, 567 reverse: false, 568 569 // initialize touch interface 570 init: function(){ 571 572 // touch enabled device? 573 if ('ontouchstart' in document.documentElement) { 574 575 // remove prev and next when touch is enabled 576 $this.find('.unoslider_left').remove(); 577 $this.find('.unoslider_right').remove(); 578 579 $this[0].addEventListener('touchstart', $this.touch.start, false); 580 } 581 }, 582 583 // touch started 584 start: function(event){ 585 if (event.touches.length == 1) { 586 this.startX = event.touches[0].pageX; 587 this.moving = true; 588 $this[0].addEventListener('touchmove', $this.touch.move, false); 589 } 590 }, 591 592 // touch move 593 move: function(event){ 594 if(this.moving) { 595 var x = event.touches[0].pageX; 596 var dx = this.startX - x; 597 598 if(Math.abs(dx) >= 50) { 599 $this.touch.end(); 600 if(dx > 0) { 601 $this.touch.left(); 602 } else { 603 $this.touch.right(); 604 } 605 } 606 } 607 }, 608 609 // touch end 610 end: function(){ 611 $this[0].removeEventListener('touchmove', $this.touch.move); 612 this.startX = null; 613 this.moving = false; 614 }, 615 616 // left wipe 617 left: function(){ 618 if(running === false){ 619 $this.touch.reverse = false; 620 $this.slideshow.next(); 621 } 622 }, 623 624 // right wipe 625 right: function(){ 626 if(running === false){ 627 $this.touch.reverse = true; 628 $this.slideshow.prev(); 629 } 630 } 631 632 }; 633 634 $this.layer = { 635 636 // generate layers 637 generate: function(){ 638 $this.find('.unoslider_layers').children().hide(); 639 }, 640 641 responsive: function(){ 642 $this.find('.unoslider_layers').children().each(function(){ 643 var self = $(this); 644 self.css('position', 'absolute'); 645 self.data('width', parseInt(self.width())); 646 self.data('height', parseInt(self.height())); 647 self.data('left', parseInt(self.css('left'))); 648 self.data('top', parseInt(self.css('top'))); 649 650 var original_width = parseInt(self.data('width')); 651 var original_height = parseInt(self.data('height')); 652 var original_left = parseInt(self.data('left')); 653 var original_top = parseInt(self.data('top')); 654 655 var responsive_width = (original_width / $this.data('base_width')) * 100; 656 var responsive_height = (original_height / $this.data('base_height')) * 100; 657 var responsive_left = (original_left / $this.data('base_width')) * 100; 658 var responsive_top = (original_top / $this.data('base_height')) * 100; 659 660 self.width(responsive_width+'%'); 661 self.height(responsive_height+'%'); 662 self.css({left: responsive_left+'%'}); 663 self.css({top: responsive_top+'%'}); 664 }); 665 666 // make the text responsive 667 $this.layer.scale_text(); 668 }, 669 670 scale_text: function(){ 671 var maxFontSize = 50; 672 var minFontSize = 5; 673 var compressor = 1; 674 675 var resizer = function(init) { 676 $this.find('.unoslider_layers').children().each(function(){ 677 var self = $(this); 678 679 if(init === true){ 680 self.data('font_size', self.css('font-size')); 681 } 682 683 var scale = ($this.width() * 100) / $this.data('base_width'); 684 var original_font_size = self.data('font_size'); 685 var font_size = (parseInt(original_font_size) * (scale / 100)); 686 687 self.css('font-size', font_size); 688 }); 689 }; 690 691 // Call on load 692 resizer(true); 693 694 // Call on resize 695 $(window).resize(function(){ 696 resizer(false); 697 }); 698 }, 699 700 // start animation 701 show: function(slide){ 702 $this.find('.unoslider_layers').children().css({'z-index': 1, position: 'absolute'}).hide(); 703 704 var layers = $(slide).find('.unoslider_layers').children().length; 705 var delays = [];
706 var delay = 250; 707 var duration = 300; 708 var i; 709 var animation; 710 711 layerRunning = true; 712 713 i = 1; 714 $(slide).find('.unoslider_layers').children().each(function(){ 715 delays.push(delay * i); 716 i++; 717 }); 718 719 i = 0; 720 $(slide).find('.unoslider_layers').children().each(function(){ 721 var $self = $(this); 722 723 var tridy = ['slide_top', 'slide_right', 'slide_bottom', 'slide_left', 'fade']; 724 725 for(x in tridy){ 726 if($self.hasClass(tridy[x])){ 727 animation = $this.layer[tridy[x]](); 728 break; 729 } 730 } 731 732 $self.css(animation['css']); 733 layerAnimation[i] = $self.delay(delays[i]).animate(animation['animate'], {duration: duration}); 734 735 i++; 736 }); 737 738 return layers === 0 ? 0 : delays[layers - 1] + (duration * layers); 739 }, 740 741 slide_top: function(){ 742 var slider_height = $this.data('base_height'); 743 var shift = !cfg.responsiveLayers ? 20 + 'px' : ((20 / slider_height) * 100) + '%'; 744 745 var animate = { top: "-="+shift, opacity: 1 }; 746 var css = { top: "+="+shift, display: 'block', opacity: 0 }; 747 748 return {css: css, animate: animate}; 749 }, 750 751 slide_bottom: function(){ 752 var slider_height = $this.data('base_height'); 753 var shift = !cfg.responsiveLayers ? 20 + 'px' : ((20 / slider_height) * 100) + '%'; 754 755 var animate = { top: "+="+shift, opacity: 1 }; 756 var css = { top: "-="+shift, display: 'block', opacity: 0 }; 757 758 return {css: css, animate: animate}; 759 }, 760 761 slide_right: function(){ 762 var slider_width = $this.data('base_width'); 763 var shift = !cfg.responsiveLayers ? 20 + 'px' : ((20 / slider_width) * 100) + '%'; 764 765 var animate = { left: "+="+shift, opacity: 1 }; 766 var css = { left: "-="+shift, display: 'block', opacity: 0 }; 767 768 return {css: css, animate: animate}; 769 }, 770 771 slide_left: function(){ 772 var slider_width = $this.data('base_width'); 773 var shift = !cfg.responsiveLayers ? 20 + 'px' : ((20 / slider_width) * 100) + '%'; 774 775 var animate = { left: "-="+shift, opacity: 1 }; 776 var css = { left: "+="+shift, display: 'block', opacity: 0 }; 777 778 return {css: css, animate: animate}; 779 }, 780 781 fade: function(){ 782 var animate = { opacity: 1 }; 783 var css = { display: 'block', opacity: 0 }; 784 785 return {css: css, animate: animate}; 786 } 787 788 }; 789 790 $this.timebar = { 791 792 pause: function(){ 793 794 var timebar = $this.find('.unoslider_timer'); 795 796 $(timebar).stop(); 797 timebarStopTime = new Date; 798 }, 799 800 resume: function(){ 801 var timer = $this.find('.unoslider_timer'); 802 803 var now; 804 if(typeof timebarStopTime !== 'undefined') 805 now = timebarStopTime.getTime(); 806 807 var before; 808 if(typeof timebarStartTime !== 'undefined') 809 before = timebarStartTime.getTime(); 810 811 var baseTimeout = ($this.timer.speed() * 1000); 812 813 var remaining = baseTimeout - (now - before); 814 815 if(remaining <= baseTimeout) 816 this.start(remaining); 817 }, 818 819 // create timebar 820 set: function(){ 821 return $('<div class="unoslider_timer"></div>').css({'z-index': 1}).width('0%').appendTo($this[0]); 822 }, 823 824 start: function(delay){ 825 var remaining = delay || $this.timer.speed() * 1000; 826 var timer = $this.find('.unoslider_timer'); 827 828 timebarStartTime = new Date(); 829 830 if(typeof delay === 'undefined') 831 timer.show(); 832 833 timer.animate({ 834 width: '100%' 835 }, remaining, null, function(){ 836 $this.timebar.hide(); 837 }); 838 }, 839 840 stop: function(){ 841 var timebar = $this.find('.unoslider_timer'); 842 $(timebar).stop().width('0%').hide(); 843 }, 844 845 hide: function(){ 846 $this.find('.unoslider_timer').width('0%').hide(); 847 } 848 849 }; 850 851 $this.timer = { 852 853 // slides change interval 854 speed: function(){ 855 856 var time = cfg.slideshow.speed; 857 858 if((typeof cfg[activeSlideNum+1] != 'undefined') && (typeof cfg[activeSlideNum+1].slideshow != 'undefined') && (typeof cfg[activeSlideNum+1].slideshow.speed != 'undefined')){ 859 time = cfg[activeSlideNum+1].slideshow.speed; 860 } 861 862 return time; 863 }, 864 865 start: function(delay){ 866 867 var remaining = delay || this.speed() * 1000; 868 869 intervalStartTime = new Date(); 870 871 interval[uid] = setTimeout(function(){ 872 activeSlideNum++; 873 874 if (activeSlideNum == slides.length) 875 activeSlideNum = 0; 876 877 $this.slideshow.changeTo(activeSlideNum, false); 878 879 }, remaining); 880 }, 881 882 pause: function(){ 883 clearInterval(interval[uid]); 884 intervalStopTime = new Date; 885 }, 886 887 resume: function(){ 888 var now; 889 if(typeof intervalStopTime !== 'undefined') 890 now = intervalStopTime.getTime(); 891 892 var before; 893 if(typeof intervalStartTime !== 'undefined') 894 before = intervalStartTime.getTime(); 895 896 var baseTimeout = (this.speed() * 1000); 897 var remaining = baseTimeout - (now - before); 898 899 if(remaining <= baseTimeout) 900 this.start(remaining); 901 } 902 }; 903 904 $this.navigation = { 905 906 // create navigation 907 generate: function(){ 908 var self = this; 909 910 if(cfg.navigation){
911 var container = $('<div class="unoslider_navigation_container"></div>').appendTo($this[0]); 912 913 if(cfg.slideshow){ 914 var play = $('<a title="'+cfg.navigation.play+'" class="unoslider_play unoslider_navigation">'+cfg.navigation.play+'</a>').appendTo(container); 915 var stop = $('<a title="'+cfg.navigation.stop+'" class="unoslider_pause unoslider_navigation">'+cfg.navigation.stop+'</a>').appendTo(container); 916 917 if(stoped){ 918 stop.addClass("unoslider_hide").hide(); 919 }else{ 920 play.addClass("unoslider_hide").hide(); 921 } 922 } 923 924 $('<a title="'+cfg.navigation.prev+'" class="unoslider_left unoslider_navigation">'+cfg.navigation.prev+'</a>').appendTo(container); 925 $('<a title="'+cfg.navigation.next+'" class="unoslider_right unoslider_navigation">'+cfg.navigation.next+'</a>').appendTo(container); 926 927 $this.find('.unoslider_right').click(function(){ 928 if(running === false){ 929 $this.slideshow.next(); 930 } 931 }); 932 933 $this.find('.unoslider_left').click(function(){ 934 if(running === false){ 935 $this.slideshow.prev(); 936 } 937 }); 938 939 $this.find('.unoslider_pause').click(function(){ 940 if(!stoped){ 941 stoped = true; 942 self.changeState('stop'); 943 $this.slideshow.stop(); 944 } 945 }); 946 947 $this.find('.unoslider_play').click(function(){ 948 if(stoped){ 949 self.changeState('play'); 950 stoped = false; 951 force = true; 952 $this.slideshow.start(); 953 } 954 }); 955 956 $(".unoslider_navigation").css({ 957 'z-index': 5, 958 position: 'absolute' 959 }); 960 } 961 962 self.autohide(); 963 }, 964 965 // navigation autohide 966 autohide: function(){ 967 var selector = ''; 968 969 if(cfg.indicator.autohide){ 970 selector += '.unoslider_indicator,'; 971 } 972 973 if(cfg.navigation.autohide){ 974 var timer; 975 976 if(cfg.navigation.autohide !== true){ 977 var items = cfg.navigation.autohide; 978 979 for(var i = 0; i < items.length; i++){ 980 selector += ('.unoslider_' + items[i] + ','); 981 } 982 983 }else{ 984 selector += '.unoslider_navigation'; 985 } 986 } 987 988 var last_comma = /,$/; 989 selector = selector.replace(last_comma, ""); 990 991 var container = $this.find(selector); 992 993 container.each(function(){ 994 $(this).hide(); 995 }); 996 997 $this.hover(function() { 998 if(timer) { 999 clearTimeout(timer); 1000 timer = null; 1001 } 1002 1003 timer = setTimeout(function() { 1004 container.not('.unoslider_hide').fadeIn(); 1005 }, 200); 1006 1007 }, function(){ 1008 if(timer) { 1009 clearTimeout(timer); 1010 timer = null; 1011 } 1012 1013 timer = setTimeout(function() { 1014 container.not('.unoslider_hide').fadeOut(); 1015 }, 200); 1016 }); 1017 }, 1018 1019 // switch between pause and play button 1020 changeState: function(state){ 1021 if(state == 'stop'){ 1022 $this.find('.unoslider_play').removeClass('unoslider_hide').show(); 1023 $this.find('.unoslider_pause').addClass("unoslider_hide").hide(); 1024 }else if(state == 'play'){ 1025 $this.find('.unoslider_play').addClass("unoslider_hide").hide(); 1026 $this.find('.unoslider_pause').removeClass('unoslider_hide').show(); 1027 } 1028 }, 1029 1030 // create bullet indicator 1031 indicator: function(){ 1032 var appendTo = cfg.indicator.position || $this[0]; 1033 var activeClass = 'unoslider_indicator_active'; 1034 1035 controls = $('<div class="unoslider_indicator"></div>').css({'z-index': 6}); 1036 1037 !cfg.indicator.position ? controls.appendTo(appendTo) : controls.insertAfter(appendTo); 1038 1039 slides.each(function(slide) { 1040 $('<a title="' + (slide + 1) + '" class="'+activeClass+'">' + (slide + 1) + '</a>').appendTo(controls).bind("click", function(){ 1041 if(running === false) $this.slideshow.changeTo(slide, true); 1042 }); 1043 1044 activeClass = ""; 1045 }); 1046 } 1047 1048 }; 1049 1050 $this.slideshow = { 1051 1052 // stop slideshow on mouseover 1053 pauseOnHover: function(){ 1054 $this.hover(function(){ 1055 if(running === false && !stoped && layerRunning === false){ 1056 $this.timebar.pause(); 1057 $this.timer.pause(); 1058 } 1059 }, function(){ 1060 if(running === false && !stoped && layerRunning === false){ 1061 $this.timebar.resume(); 1062 $this.timer.resume(); 1063 } 1064 }); 1065 }, 1066 1067 start: function(){ 1068 $('.unoslider_preloader').remove(); 1069 1070 stoped = false;
1071 1072 if(cfg.slideshow){ 1073 if(!cfg.slideshow.infinite && !force && activeSlideNum == (slides.length - 1)){ // stop slideshow on last slide 1074 $this.slideshow.stop(); 1075 $this.navigation.changeState('stop'); 1076 }else{ // continue slideshow 1077 $this.timebar.start(); 1078 $this.timer.start(null); 1079 force = false; 1080 } 1081 } 1082 }, 1083 1084 stop: function(){ 1085 stoped = true; 1086 1087 clearTimeout(interval[uid]); 1088 $this.timebar.stop(); 1089 }, 1090 1091 // clear timeout and start slideshow 1092 restart: function(){ 1093 clearTimeout(interval[uid]); 1094 this.start(); 1095 }, 1096 1097 // slides change 1098 changeTo: function(changeTo, handChange){ 1099 clearTimeout(layerTimer); 1100 1101 $.each(layerAnimation, function(i){ 1102 this.stop(false, true); 1103 $(this).hide(); 1104 }); 1105 1106 layerAnimation = []; 1107 1108 // last slide 1109 if(changeTo != activeSlideNum){ 1110 activeSlideNum = changeTo; 1111 } 1112 1113 if(handChange === true){ 1114 if(lastSlideNum === activeSlideNum){ 1115 return false; 1116 } 1117 1118 var tmp = stoped ? stoped = true : stoped = false; 1119 $this.slideshow.stop(); 1120 stoped = tmp ? true : false; 1121 1122 if(!cfg.slideshow.continuous){ 1123 stoped = true; 1124 $this.navigation.changeState('stop'); 1125 } 1126 } 1127 1128 var currentSlide = slides.filter(".unoslider_active"); 1129 var nextSlide = slides.filter(":eq("+ activeSlideNum +")"); 1130 1131 $this.main.setTransition(currentSlide, nextSlide, handChange); 1132 1133 if (cfg.indicator !== false) { 1134 controls.find(".unoslider_indicator_active").removeClass("unoslider_indicator_active"); 1135 controls.find("a:eq("+ activeSlideNum +")").addClass("unoslider_indicator_active"); 1136 } 1137 1138 lastSlideNum = activeSlideNum; 1139 }, 1140 1141 next: function(){ 1142 var next = (activeSlideNum+1 == slides.length) ? 0 : activeSlideNum + 1; 1143 1144 this.changeTo(next, true); 1145 }, 1146 1147 prev: function(){ 1148 var prev = (activeSlideNum === 0) ? slides.length-1 : activeSlideNum - 1; 1149 this.changeTo(prev, true); 1150 }, 1151 1152 switchSlides: function(currentSlide, nextSlide){ 1153 currentSlide.css({ 1154 display: 'none', 1155 'z-index': 0, 1156 position: 'relative', 1157 opacity: 0 1158 }).removeClass('unoslider_active'); 1159 1160 nextSlide.css({ 1161 display: 'block', 1162 opacity: 1, 1163 position: 'relative', 1164 'z-index': 1 1165 }).addClass('unoslider_active'); 1166 } 1167 1168 }; 1169 1170 $this.tooltip = { 1171 1172 height: 0, 1173 1174 generate: function(){ 1175 if(cfg.tooltip){ 1176 var caption; 1177 var img; 1178 1179 $this.find('.unoslider_caption').removeClass('unoslider_caption').addClass('unoslider_caption_data').hide(); 1180 1181 slides.each(function(){ 1182 img = $(this).find('img'); 1183 1184 if(img.length >= 1){ 1185 caption = img.attr('title'); 1186 if(typeof caption !== 'undefined'){ 1187 img.removeAttr('title'); 1188 $('<div class="unoslider_caption_data">'+caption+'</div>').appendTo(this).hide(); 1189 } 1190 } 1191 }); 1192 1193 $('<div class="unoslider_caption"></div>').hide().css({'z-index': 5}).appendTo($this); 1194 }else{ 1195 $this.find('.unoslider_caption').remove(); 1196 } 1197 1198 this.height = $this.find('.unoslider_caption').height(); 1199 }, 1200 1201 show: function(slide){ 1202 var html = $(slide).find('.unoslider_caption_data').html(); 1203 if(html) $this.find('.unoslider_caption').html(html).fadeIn(); 1204 }, 1205 1206 hide: function(){ 1207 $this.find('.unoslider_caption').fadeOut(); 1208 } 1209 }; 1210 1211 $this.preset = { 1212 1213 init: function(){ 1214 if(cfg.preset in $this.preset){ 1215 $this.preset[cfg.preset](); 1216 }else{ 1217 alert('There is no preset named "'+cfg.preset+'"'); 1218 } 1219 }, 1220 1221 // calculate number of blocks 1222 autosize: function(){ 1223 var ratio = $this.width() / $this.height(); 1224 var vertical = Math.round(ratio * ratio * (ratio / 2)); 1225 var horizontal = Math.round(ratio * (ratio / 2)); 1226 1227 vertical = (typeof options === 'object' && typeof options.block !== 'undefined' && typeof options.block['vertical'] !== 'undefined') ? options.block['vertical'] : preset_base_cfg.block['vertical']; 1228 horizontal = (typeof options === 'object' && typeof options.block !== 'undefined' && typeof options.block['horizontal'] !== 'undefined') ? options.block['horizontal'] : preset_base_cfg.block['horizontal']; 1229 1230 var ret = {}; 1231 ret['vertical'] = vertical; 1232 ret['horizontal'] = horizontal; 1233 1234 return ret; 1235 }, 1236 1237 chess: function(){ 1238 var block = this.autosize(); 1239 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1240 cfg.animation = { speed: 300, delay: 300, transition: 'swap', variation: 'bottom', pattern: 'chess' }; 1241 }, 1242 flash: function(){ 1243 var block = this.autosize(); 1244 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1245 cfg.animation = { speed: 500, delay: 30, transition: 'flash', pattern: 'random' }; 1246 }, 1247 spiral_reversed: function(){ 1248 var block = this.autosize(); 1249 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1250 cfg.animation = { speed: 350, delay: 30, transition: 'shrink', variation: 'bottomright', pattern: 'spiral', direction: 'bottomright' }; 1251 }, 1252 spiral: function(){ 1253 var block = this.autosize(); 1254 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1255 cfg.animation = { speed: 350, delay: 30, transition: 'shrink', variation: 'topleft', pattern: 'spiral', direction: 'topleft' }; 1256 }, 1257 sq_appear: function(){ 1258 var block = this.autosize(); 1259 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1260 cfg.animation = { speed: 500, delay: 50, transition: 'appear', variation: 'topleft', pattern: 'diagonal', direction: 'topleft' }; 1261 }, 1262 sq_flyoff: function(){ 1263 var block = this.autosize(); 1264 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1265 cfg.animation = { speed: 400, delay: 100, transition: 'drop', variation: 'bottomright', pattern: 'diagonal', direction: 'topleft' }; 1266 }, 1267 sq_drop: function(){ 1268 var block = this.autosize(); 1269 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1270 cfg.animation = { speed: 600, delay: 150, transition: 'drop', variation: 'topleft', pattern: 'diagonal', direction: 'topleft' }; 1271 }, 1272 explode: function(){ 1273 var block = this.autosize(); 1274 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1275 cfg.animation = { speed: 500, delay: 50, transition: 'stretch', variation: 'center', pattern: 'explode', direction: 'center' }; 1276 }, 1277 implode: function(){ 1278 var block = this.autosize(); 1279 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1280 cfg.animation = { speed: 500, delay: 50, transition: 'squeeze', variation: 'center', pattern: 'implode', direction: 'center' }; 1281 }, 1282 sq_squeeze: function(){ 1283 var block = this.autosize(); 1284 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1285 cfg.animation = { speed: 600, delay: 100, transition: 'squeeze', variation: 'center', pattern: 'horizontal', direction: 'top' }; 1286 }, 1287 sq_random: function(){ 1288 var block = this.autosize(); 1289 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1290 cfg.animation = { speed: 500, delay: 20, transition: 'grow', variation: 'topleft', pattern: 'random' }; 1291 }, 1292 sq_diagonal_rev: function(){ 1293 var block = this.autosize(); 1294 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1295 cfg.animation = { speed: 500, delay: 50, transition: 'grow', variation: 'bottomright', pattern: 'diagonal', direction: 'bottomright' }; 1296 }, 1297 sq_diagonal: function(){ 1298 var block = this.autosize(); 1299 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1300 cfg.animation = { speed: 500, delay: 50, transition: 'grow', variation: 'topleft', pattern: 'diagonal', direction: 'topleft' }; 1301 }, 1302 sq_fade_random: function(){ 1303 var block = this.autosize(); 1304 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1305 cfg.animation = { speed: 600, delay: 20, transition: 'fade', pattern: 'random' }; 1306 }, 1307 sq_fade_diagonal_rev: function(){ 1308 var block = this.autosize(); 1309 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1310 cfg.animation = { speed: 600, delay: 100, transition: 'fade', pattern: 'diagonal', direction: 'bottomright' }; 1311 }, 1312 sq_fade_diagonal: function(){ 1313 var block = this.autosize(); 1314 cfg.block = { vertical: block['vertical'], horizontal: block['horizontal'] }; 1315 cfg.animation = { speed: 600, delay: 100, transition: 'fade', pattern: 'diagonal', direction: 'topleft' }; 1316 }, 1317 fountain: function(){ 1318 var block = this.autosize(); 1319 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1320 cfg.animation = { speed: 500, delay: 100, transition: 'slide_in', variation: 'bottom', pattern: 'explode', direction: 'center' }; 1321 }, 1322 blind_bottom: function(){ 1323 var block = this.autosize(); 1324 cfg.block = { vertical: 1, horizontal: block['horizontal'] };
1325 cfg.animation = { speed: 800, delay: 80, transition: 'swap', variation: 'top', pattern: 'horizontal', direction: 'bottom' }; 1326 }, 1327 blind_top: function(){ 1328 var block = this.autosize(); 1329 cfg.block = { vertical: 1, horizontal: block['horizontal'] }; 1330 cfg.animation = { speed: 800, delay: 80, transition: 'swap', variation: 'bottom', pattern: 'horizontal', direction: 'top' }; 1331 }, 1332 blind_right: function(){ 1333 var block = this.autosize(); 1334 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1335 cfg.animation = { speed: 800, delay: 80, transition: 'swap', variation: 'right', pattern: 'horizontal', direction: 'topright' }; 1336 }, 1337 blind_left: function(){ 1338 var block = this.autosize(); 1339 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1340 cfg.animation = { speed: 800, delay: 80, transition: 'swap', variation: 'right', pattern: 'horizontal', direction: 'topleft' }; 1341 }, 1342 shot_right: function(){ 1343 var block = this.autosize(); 1344 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1345 cfg.animation = { speed: 500, delay: 50, transition: 'stretch', variation: 'horizontal', pattern: 'horizontal', direction: 'topright' }; 1346 }, 1347 shot_left: function(){ 1348 var block = this.autosize(); 1349 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1350 cfg.animation = { speed: 500, delay: 50, transition: 'stretch', variation: 'horizontal', pattern: 'horizontal', direction: 'topleft' }; 1351 }, 1352 alternate_vertical: function(){ 1353 var block = this.autosize(); 1354 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1355 cfg.animation = { speed: 800, delay: 0, transition: 'slide_in', variation: 'alternate_vertical', pattern: 'vertical', direction: 'topleft' }; 1356 }, 1357 alternate_horizontal: function(){ 1358 var block = this.autosize(); 1359 cfg.block = { vertical: 1, horizontal: block['horizontal'] }; 1360 cfg.animation = { speed: 800, delay: 0, transition: 'slide_in', variation: 'alternate_horizontal', pattern: 'horizontal', direction: 'topleft' }; 1361 }, 1362 zipper_right: function(){ 1363 var block = this.autosize(); 1364 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1365 cfg.animation = { speed: 500, delay: 80, transition: 'slide_in', variation: 'alternate_vertical', pattern: 'horizontal', direction: 'topright' }; 1366 }, 1367 zipper_left: function(){ 1368 var block = this.autosize(); 1369 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1370 cfg.animation = { speed: 500, delay: 80, transition: 'slide_in', variation: 'alternate_vertical', pattern: 'horizontal', direction: 'topleft' }; 1371 }, 1372 bar_slide_random: function(){ 1373 var block = this.autosize(); 1374 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1375 cfg.animation = { speed: 500, delay: 70, transition: 'slide_in', pattern: 'random' }; 1376 }, 1377 bar_slide_bottomright: function(){ 1378 var block = this.autosize(); 1379 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1380 cfg.animation = { speed: 500, delay: 70, transition: 'slide_in', variation: 'bottom', pattern: 'horizontal', direction: 'bottomright' }; 1381 }, 1382 bar_slide_bottomleft: function(){ 1383 var block = this.autosize(); 1384 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1385 cfg.animation = { speed: 500, delay: 70, transition: 'slide_in', variation: 'bottom', pattern: 'horizontal', direction: 'bottomleft' }; 1386 }, 1387 bar_slide_topright: function(){ 1388 var block = this.autosize(); 1389 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1390 cfg.animation = { speed: 500, delay: 70, transition: 'slide_in', variation: 'top', pattern: 'horizontal', direction: 'topright' }; 1391 }, 1392 bar_slide_topleft: function(){ 1393 var block = this.autosize(); 1394 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1395 cfg.animation = { speed: 500, delay: 70, transition: 'slide_in', variation: 'top', pattern: 'horizontal', direction: 'topleft' }; 1396 }, 1397 bar_fade_bottom: function(){ 1398 var block = this.autosize(); 1399 cfg.block = { vertical: 1, horizontal: block['horizontal'] }; 1400 cfg.animation = { speed: 500, delay: 100, transition: 'fade', pattern: 'horizontal', direction: 'bottom' }; 1401 }, 1402 bar_fade_top: function(){ 1403 var block = this.autosize(); 1404 cfg.block = { vertical: 1, horizontal: block['horizontal'] }; 1405 cfg.animation = { speed: 500, delay: 100, transition: 'fade', pattern: 'horizontal', direction: 'top' }; 1406 }, 1407 bar_fade_right: function(){ 1408 var block = this.autosize(); 1409 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1410 cfg.animation = { speed: 500, delay: 50, transition: 'fade', pattern: 'horizontal', direction: 'topright' }; 1411 }, 1412 bar_fade_left: function(){ 1413 var block = this.autosize(); 1414 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1415 cfg.animation = { speed: 500, delay: 50, transition: 'fade', pattern: 'horizontal', direction: 'topleft' }; 1416 }, 1417 bar_fade_random: function(){ 1418 var block = this.autosize(); 1419 cfg.block = { vertical: block['vertical'], horizontal: 1 }; 1420 cfg.animation = { speed: 500, delay: 50, transition: 'fade', pattern: 'random' }; 1421 }, 1422 v_slide_top: function(){ 1423 cfg.block = { vertical: 1, horizontal: 1 }; 1424 cfg.animation = { speed: 500, delay: 0, transition: 'slide_in', variation: 'top', pattern: 'horizontal', direction: 'topleft' }; 1425 }, 1426 h_slide_right: function(){ 1427 cfg.block = { vertical: 1, horizontal: 1 }; 1428 cfg.animation = { speed: 500, delay: 0, transition: 'slide_in', variation: 'right', pattern: 'horizontal', direction: 'topleft' }; 1429 }, 1430 v_slide_bottom: function(){ 1431 cfg.block = { vertical: 1, horizontal: 1 }; 1432 cfg.animation = { speed: 500, delay: 0, transition: 'slide_in', variation: 'bottom', pattern: 'horizontal', direction: 'topleft' }; 1433 }, 1434 h_slide_left: function(){ 1435 cfg.block = { vertical: 1, horizontal: 1 }; 1436 cfg.animation = { speed: 500, delay: 0, transition: 'slide_in', variation: 'left', pattern: 'horizontal', direction: 'topleft' }; 1437 }, 1438 stretch: function(){ 1439 cfg.block = { vertical: 1, horizontal: 1 };
1440 cfg.animation = { speed: 800, delay: 0, transition: 'stretch', variation: 'horizontal', pattern: 'horizontal', direction: 'topleft' }; 1441 }, 1442 squeez: function(){ 1443 cfg.block = { vertical: 1, horizontal: 1 }; 1444 cfg.animation = { speed: 800, delay: 0, transition: 'squeeze', variation: 'horizontal', pattern: 'horizontal', direction: 'topleft' }; 1445 }, 1446 fade: function(){ 1447 cfg.block = { vertical: 1, horizontal: 1 }; 1448 cfg.animation = { speed: 700, delay: 0, transition: 'fade', pattern: 'horizontal', direction: 'topleft' }; 1449 }, 1450 none: function(){ 1451 cfg.block = { vertical: 1, horizontal: 1 }; 1452 cfg.animation = { speed: 0, delay: 0, transition: 'fade', pattern: 'horizontal', direction: 'topleft' }; 1453 } 1454 }; 1455 1456 $this.transition = { 1457 1458 speed: function(){ 1459 var speed = cfg.animation.speed; 1460 1461 if((typeof cfg[activeSlideNum+1] != 'undefined') && (typeof cfg[activeSlideNum+1].animation != 'undefined') && (typeof cfg[activeSlideNum+1].animation.speed != 'undefined')){ 1462 speed = cfg[activeSlideNum+1].animation.speed; 1463 } 1464 1465 return parseInt(speed); 1466 }, 1467 1468 animation: function(direction, animate, duration){ 1469 var row = 1; 1470 var col = 1; 1471 var item = 0; 1472 1473 while (row <= rows) { 1474 while (col <= columns) { 1475 item = (columns * row - (columns - col)); 1476 1477 $this.find("#block_" + item).delay(direction['zpozdeni'][item]).animate(animate, {duration: duration}); 1478 col++; 1479 } 1480 row++; col = 1; 1481 } 1482 }, 1483 1484 base_animation: function(css, animate, delayed, direction, currentSlide, nextSlide, handChange){ 1485 var duration = this.speed(); 1486 1487 $this.find('.unoslider_cube').css(css); 1488 1489 this.animation(direction, animate, duration); 1490 1491 $this.main.execute(direction, duration, currentSlide, nextSlide, handChange, delayed); 1492 }, 1493 move_animation: function(css, animate, direction, opacity, currentSlide, nextSlide, handChange){ 1494 var duration = this.speed(); 1495 1496 $this.find('.unoslider_cube').css({ 1497 display: 'block', 1498 opacity: opacity 1499 }); 1500 1501 $this.find('.unoslider_blocks').css(css); 1502 1503 this.animation(direction, animate, duration); 1504 1505 $this.main.execute(direction, duration, currentSlide, nextSlide, handChange, true); 1506 }, 1507 drop_animation: function(animate, direction, currentSlide, nextSlide, handChange){ 1508 var duration = this.speed(); 1509 1510 $this.find('.unoslider_cube').css({ 1511 display: 'block', 1512 opacity: 1 1513 }); 1514 1515 this.animation(direction, animate, duration); 1516 1517 $this.main.execute(direction, duration, currentSlide, nextSlide, handChange, false); 1518 }, 1519 1520 alternate_animation: function(css_even, css_odd, animate_even, animate_odd, direction, currentSlide, nextSlide, handChange, delayed){ 1521 var duration = this.speed(); 1522 var row = 1; 1523 var col = 1; 1524 var item = 0; 1525 1526 $this.find('.unoslider_cube:even').css(css_even); 1527 1528 $this.find('.unoslider_cube:odd').css(css_odd); 1529 1530 while (row <= rows) { 1531 while (col <= columns) { 1532 item = (columns * row - (columns - col)); 1533 1534 $this.find("#block_" + item).delay(direction['zpozdeni'][item]).animate(item % 2 == 1 ? animate_even : animate_odd, { duration: duration }); 1535 1536 col++; 1537 } 1538 row++; col = 1; 1539 } 1540 1541 $this.main.execute(direction, duration, currentSlide, nextSlide, handChange, delayed); 1542 }, 1543 1544 fade: function(currentSlide, nextSlide, handChange){ 1545 var direction = $this.main.prepare(currentSlide); 1546 1547 var css = { 1548 display: 'block', 1549 width: block.width, 1550 height: block.height 1551 }; 1552 1553 var animate = { 1554 opacity: 0 1555 }; 1556 1557 this.base_animation(css, animate, false, direction, currentSlide, nextSlide, handChange); 1558 }, 1559 1560 flash: function(currentSlide, nextSlide, handChange){ 1561 var duration = this.speed(); 1562 var row = 1; 1563 var col = 1; 1564 var item = 0; 1565 var selector; 1566 1567 var direction = $this.main.prepare(currentSlide); 1568 1569 var color = 'white'; 1570 if((typeof cfg[activeSlideNum+1] != 'undefined') && (typeof cfg[activeSlideNum+1].animation != 'undefined') && (typeof cfg[activeSlideNum+1].animation.color != 'undefined')){ 1571 color = cfg[activeSlideNum+1].animation.color; 1572 }else if((typeof cfg != 'undefined') && (typeof cfg.animation != 'undefined') && (typeof cfg.animation.color != 'undefined')){ 1573 color = cfg.animation.color; 1574 } 1575 1576 $this.find('.unoslider_cube').css({ 1577 display: 'block', 1578 backgroundColor: color 1579 }); 1580 1581 while (row <= rows) { 1582 while (col <= columns) { 1583 item = (columns * row - (columns - col)); 1584 1585 selector = "#block_" + item; 1586 1587 $this.find(selector).delay(direction['zpozdeni'][item]).animate({ 1588 opacity: 0 1589 }, {
1590 duration: duration 1591 }); 1592 1593 $this.find(selector).children().delay(direction['zpozdeni'][item]).animate({ 1594 opacity: 0 1595 }, { 1596 duration: 0 1597 }); 1598 1599 col++; 1600 } 1601 row++; 1602 col = 1; 1603 } 1604 1605 $this.main.execute(direction, duration, currentSlide, nextSlide, handChange, false); 1606 }, 1607 1608 appear_topleft: function(currentSlide, nextSlide, handChange){ 1609 var direction = $this.main.prepare(nextSlide); 1610 1611 var css = { 1612 top: ''+(block.height * 2)+'px', 1613 left: ''+(block.height * 2)+'px' 1614 }; 1615 1616 var animate = { 1617 top: '-='+(block.height*2)+'px', 1618 left: '-='+(block.height*2)+'px', 1619 opacity: 1 1620 }; 1621 1622 this.move_animation(css, animate, direction, 0, currentSlide, nextSlide, handChange); 1623 }, 1624 appear_topright: function(currentSlide, nextSlide, handChange){ 1625 var direction = $this.main.prepare(nextSlide); 1626 1627 var css = { 1628 top: ''+(block.height * 2)+'px', 1629 left: '-'+(block.height * 2)+'px' 1630 }; 1631 1632 var animate = { 1633 top: '-='+(block.height*2)+'px', 1634 left: '+='+(block.height*2)+'px', 1635 opacity: 1 1636 }; 1637 1638 this.move_animation(css, animate, direction, 0, currentSlide, nextSlide, handChange); 1639 }, 1640 appear_bottomleft: function(currentSlide, nextSlide, handChange){ 1641 var direction = $this.main.prepare(nextSlide); 1642 1643 var css = { 1644 top: '-'+(block.height * 2)+'px', 1645 left: ''+(block.height * 2)+'px' 1646 }; 1647 1648 var animate = { 1649 top: '+='+(block.height*2)+'px', 1650 left: '-='+(block.height*2)+'px', 1651 opacity: 1 1652 }; 1653 1654 this.move_animation(css, animate, direction, 0, currentSlide, nextSlide, handChange); 1655 }, 1656 appear_bottomright: function(currentSlide, nextSlide, handChange){ 1657 var direction = $this.main.prepare(nextSlide); 1658 1659 var css = { 1660 top: '-'+(block.height * 2)+'px', 1661 left: '-'+(block.height * 2)+'px' 1662 }; 1663 1664 var animate = { 1665 top: '+='+(block.height*2)+'px', 1666 left: '+='+(block.height*2)+'px', 1667 opacity: 1 1668 }; 1669 1670 this.move_animation(css, animate, direction, 0, currentSlide, nextSlide, handChange); 1671 }, 1672 appear_top: function(currentSlide, nextSlide, handChange){ 1673 var direction = $this.main.prepare(nextSlide); 1674 1675 var css = { 1676 top: '-'+(block.height * 2)+'px' 1677 }; 1678 1679 var animate = { 1680 top: '+='+(block.height*2)+'px', 1681 opacity: 1 1682 }; 1683 1684 this.move_animation(css, animate, direction, 0, currentSlide, nextSlide, handChange); 1685 }, 1686 appear_right: function(currentSlide, nextSlide, handChange){ 1687 var direction = $this.main.prepare(nextSlide); 1688 1689 var css = { 1690 left: '+'+(block.width / 2)+'px' 1691 }; 1692 1693 var animate = { 1694 left: '-='+(block.width / 2)+'px', 1695 opacity: 1 1696 }; 1697 1698 this.move_animation(css, animate, direction, 0, currentSlide, nextSlide, handChange); 1699 }, 1700 appear_bottom: function(currentSlide, nextSlide, handChange){ 1701 var direction = $this.main.prepare(nextSlide); 1702 1703 var css = { 1704 top: '+'+(block.height * 2)+'px' 1705 }; 1706 1707 var animate = { 1708 top: '-='+(block.height*2)+'px', 1709 opacity: 1 1710 }; 1711 1712 this.move_animation(css, animate, direction, 0, currentSlide, nextSlide, handChange); 1713 }, 1714 appear_left: function(currentSlide, nextSlide, handChange){ 1715 var direction = $this.main.prepare(nextSlide); 1716 1717 var css = { 1718 left: '-'+(block.width / 2)+'px' 1719 }; 1720 1721 var animate = { 1722 left: '+='+(block.width / 2)+'px', 1723 opacity: 1 1724 }; 1725 1726 this.move_animation(css, animate, direction, 0, currentSlide, nextSlide, handChange); 1727 }, 1728 appear_alternate_vertical: function(currentSlide, nextSlide, handChange){ 1729 var direction = $this.main.prepare(nextSlide); 1730 1731 var animate_odd = { 1732 top: '-='+(block.height*2)+'px', 1733 opacity: 1 1734 }; 1735 1736 var animate_even = { 1737 top: '+='+(block.height*2)+'px', 1738 opacity: 1 1739 }; 1740 1741 var css_even = { 1742 display: 'block', 1743 top: '-='+(block.height * 2)+'px', 1744 opacity: 0 1745 }; 1746 1747 var css_odd = { 1748 display: 'block', 1749 top: '+='+(block.height * 2)+'px', 1750 opacity: 0 1751 }; 1752 1753 this.alternate_animation(css_even, css_odd, animate_even, animate_odd, direction, currentSlide, nextSlide, handChange, true); 1754 }, 1755 appear_alternate_horizontal: function(currentSlide, nextSlide, handChange){ 1756 var direction = $this.main.prepare(nextSlide); 1757 1758 var animate_odd = { 1759 left: '+='+(block.width*2)+'px', 1760 opacity: 1 1761 }; 1762 1763 var animate_even = { 1764 left: '-='+(block.width*2)+'px', 1765 opacity: 1 1766 }; 1767 1768 var css_even = { 1769 display: 'block', 1770 left: '+='+(block.width * 2)+'px', 1771 opacity: 0 1772 }; 1773 1774 var css_odd = { 1775 display: 'block', 1776 left: '-='+(block.width * 2)+'px', 1777 opacity: 0 1778 }; 1779 1780 this.alternate_animation(css_even, css_odd, animate_even, animate_odd, direction, currentSlide, nextSlide, handChange, true); 1781 }, 1782 1783 drop_topleft: function(currentSlide, nextSlide, handChange){ 1784 var direction = $this.main.prepare(currentSlide); 1785 1786 var animate = { 1787 top: '+='+(block.height*2)+'px', 1788 left: '+='+(block.height*2)+'px', 1789 opacity: 0 1790 }; 1791 1792 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 1793 }, 1794 drop_topright: function(currentSlide, nextSlide, handChange){ 1795 var direction = $this.main.prepare(currentSlide); 1796 1797 var row = 1; 1798 var col = 1; 1799 var item = 0; 1800 1801 var t = 1; 1802 while (row <= rows) { 1803 while (col <= columns) { 1804 item = (columns * row - (columns - col)); 1805 1806 selector = "#block_" + item; 1807 1808 $this.find(selector).css({ 1809 'z-index': (t*columns*rows)-col 1810 }); 1811 1812 col++; 1813 } 1814 t++; row++; col = 1; 1815 } 1816 1817 var animate = { 1818 top: '+='+(block.height*2)+'px', 1819 left: '-='+(block.height*2)+'px', 1820 opacity: 0 1821 }; 1822 1823 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 1824 }, 1825 drop_bottomleft: function(currentSlide, nextSlide, handChange){ 1826 var direction = $this.main.prepare(currentSlide); 1827 1828 var row = 1; 1829 var col = 1; 1830 var item = 0; 1831 1832 var t = columns*rows; 1833 while (row <= rows) { 1834 while (col <= columns) { 1835 item = (columns * row - (columns - col)); 1836 1837 selector = "#block_" + item; 1838 1839 $this.find(selector).css({ 1840 'z-index': (t*columns*rows)+col 1841 }); 1842 1843 col++; 1844 } 1845 t--; row++; col = 1; 1846 } 1847 1848 var animate = { 1849 top: '-='+(block.height*2)+'px', 1850 left: '+='+(block.height*2)+'px', 1851 opacity: 0 1852 }; 1853 1854 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 1855 }, 1856 drop_bottomright: function(currentSlide, nextSlide, handChange){ 1857 var direction = $this.main.prepare(currentSlide); 1858 1859 var row = 1; 1860 var col = 1; 1861 var item = 0; 1862 1863 var t = columns*rows; 1864 while (row <= rows) { 1865 while (col <= columns) { 1866 item = (columns * row - (columns - col)); 1867 1868 selector = "#block_" + item; 1869 1870 $this.find(selector).css({ 1871 'z-index': (t+columns)-col 1872 }); 1873 1874 col++; 1875 } 1876 t--; row++; col = 1; 1877 } 1878 1879 var animate = { 1880 top: '-='+(block.height*2)+'px', 1881 left: '-='+(block.height*2)+'px', 1882 opacity: 0 1883 }; 1884 1885 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 1886 }, 1887 drop_top: function(currentSlide, nextSlide, handChange){ 1888 var direction = $this.main.prepare(currentSlide); 1889 1890 var animate = { 1891 top: '+='+(block.height*2)+'px', 1892 opacity: 0 1893 }; 1894 1895 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 1896 }, 1897 drop_right: function(currentSlide, nextSlide, handChange){ 1898 var direction = $this.main.prepare(currentSlide); 1899 1900 var row = 1; 1901 var col = 1; 1902 var item = 0; 1903 1904 while (row <= rows) { 1905 while (col <= columns) { 1906 item = (columns * row - (columns - col)); 1907 1908 selector = "#block_" + item; 1909 1910 $this.find(selector).css({ 1911 'z-index': (columns*rows)-col 1912 }); 1913 1914 col++; 1915 } 1916 row++; col = 1; 1917 } 1918 1919 var animate = { 1920 left: '-='+(block.height*2)+'px', 1921 opacity: 0 1922 }; 1923 1924 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 1925 }, 1926 drop_bottom: function(currentSlide, nextSlide, handChange){ 1927 var direction = $this.main.prepare(currentSlide); 1928 1929 var row = 1; 1930 var col = 1; 1931 var item = 0; 1932 1933 var t = columns*rows; 1934 while (row <= rows) { 1935 while (col <= columns) { 1936 item = (columns * row - (columns - col)); 1937 1938 selector = "#block_" + item; 1939 1940 $this.find(selector).css({ 1941 'z-index': (t*columns*rows)+col 1942 }); 1943 1944 col++; 1945 } 1946 t--; row++; col = 1; 1947 } 1948 1949 var animate = { 1950 top: '-='+(block.height*2)+'px', 1951 opacity: 0 1952 }; 1953 1954 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 1955 }, 1956 drop_left: function(currentSlide, nextSlide, handChange){ 1957 var direction = $this.main.prepare(currentSlide); 1958 1959 var animate = { 1960 left: '+='+(block.height*2)+'px', 1961 opacity: 0 1962 }; 1963 1964 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 1965 }, 1966 drop_alternate_vertical: function(currentSlide, nextSlide, handChange){ 1967 var direction = $this.main.prepare(currentSlide); 1968 1969 var animate_odd = { 1970 top: '+='+(block.height*2)+'px', 1971 opacity: 0 1972 }; 1973 1974 var css_even = { 1975 display: 'block' 1976 }; 1977 1978 var css_odd = { 1979 display: 'block' 1980 }; 1981 1982 var row = 1; 1983 var col = 1; 1984 var item = 0; 1985 1986 var t = columns*rows; 1987 while (row <= rows) { 1988 while (col <= columns) { 1989 item = (columns * row - (columns - col)); 1990 1991 selector = "#block_" + item; 1992 1993 $this.find(selector).css({ 1994 'z-index': (t*columns*rows)+col 1995 }); 1996 1997 col++; 1998 } 1999 t--; row++; col = 1; 2000 } 2001 2002 var animate_even = { 2003 top: '-='+(block.height*2)+'px', 2004 opacity: 0 2005 }; 2006 2007 this.alternate_animation(css_even, css_odd, animate_even, animate_odd, direction, currentSlide, nextSlide, handChange, false); 2008 }, 2009 drop_alternate_horizontal: function(currentSlide, nextSlide, handChange){ 2010 var direction = $this.main.prepare(currentSlide); 2011 2012 var animate_odd = { 2013 left: '+='+(block.width*2)+'px', 2014 opacity: 0 2015 }; 2016 2017 var css_even = { 2018 display: 'block', 2019 opacity: 1 2020 }; 2021 2022 var css_odd = { 2023 display: 'block', 2024 opacity: 1 2025 }; 2026 2027 var row = 1; 2028 var col = 1; 2029 var item = 0; 2030 2031 while (row <= rows) { 2032 while (col <= columns) { 2033 item = (columns * row - (columns - col)); 2034 2035 selector = "#block_" + item; 2036 2037 $this.find(selector).css({ 2038 'z-index': (columns*rows)-col 2039 }); 2040 2041 col++; 2042 } 2043 row++; col = 1; 2044 } 2045 2046 var animate_even = { 2047 left: '-='+(block.width*2)+'px', 2048 opacity: 0 2049 }; 2050 2051 this.alternate_animation(css_even, css_odd, animate_even, animate_odd, direction, currentSlide, nextSlide, handChange, false); 2052 }, 2053 2054 slide_in_bottom: function(currentSlide, nextSlide, handChange){ 2055 var direction = $this.main.prepare(nextSlide); 2056 2057 var css = { 2058 top: '+'+(block.height * rows)+'px' 2059 }; 2060 2061 var animate = { 2062 top: '-='+(block.height * rows)+'px' 2063 }; 2064 2065 this.move_animation(css, animate, direction, 1, currentSlide, nextSlide, handChange); 2066 }, 2067 slide_in_right: function(currentSlide, nextSlide, handChange){ 2068 var direction = $this.main.prepare(nextSlide); 2069 2070 var css = { 2071 left: '+'+(block.width * columns)+'px' 2072 }; 2073 2074 var animate = { 2075 left: '-='+(block.width * columns)+'px' 2076 }; 2077 2078 this.move_animation(css, animate, direction, 1, currentSlide, nextSlide, handChange); 2079 }, 2080 slide_in_top: function(currentSlide, nextSlide, handChange, type){ 2081 var direction = $this.main.prepare(nextSlide); 2082 2083 var css = { 2084 top: '-'+(block.height * rows)+'px' 2085 }; 2086 2087 var animate = { 2088 top: '+='+(block.height * rows)+'px' 2089 }; 2090 2091 this.move_animation(css, animate, direction, 1, currentSlide, nextSlide, handChange); 2092 }, 2093 slide_in_left: function(currentSlide, nextSlide, handChange, type){ 2094 var direction = $this.main.prepare(nextSlide); 2095 2096 var css = { 2097 left: '-'+(block.width * columns)+'px' 2098 }; 2099 2100 var animate = { 2101 left: '+='+(block.width * columns)+'px' 2102 }; 2103 2104 this.move_animation(css, animate, direction, 1, currentSlide, nextSlide, handChange); 2105 }, 2106 slide_in_alternate_vertical: function(currentSlide, nextSlide, handChange, type){ 2107 var direction = $this.main.prepare(nextSlide); 2108 2109 var animate_odd = { 2110 top: '+='+(block.height * rows)+'px' 2111 }; 2112 2113 var animate_even = { 2114 top: '-='+(block.height * rows)+'px' 2115 }; 2116 2117 var css_even = { 2118 display: 'block', 2119 top: '+='+(block.height * rows)+'px' 2120 }; 2121 2122 var css_odd = { 2123 display: 'block', 2124 top: '-='+(block.height * rows)+'px' 2125 }; 2126 2127 this.alternate_animation(css_even, css_odd, animate_even, animate_odd, direction, currentSlide, nextSlide, handChange, true); 2128 }, 2129 slide_in_alternate_horizontal: function(currentSlide, nextSlide, handChange, type){ 2130 var direction = $this.main.prepare(nextSlide); 2131 2132 var animate_odd = { 2133 left: '+='+(block.width * columns)+'px' 2134 }; 2135 2136 var animate_even = { 2137 left: '-='+(block.width * columns)+'px' 2138 }; 2139 2140 var css_even = { 2141 display: 'block', 2142 left: '+='+(block.width * columns)+'px' 2143 }; 2144 2145 var css_odd = { 2146 display: 'block', 2147 left: '-='+(block.width * columns)+'px' 2148 }; 2149 2150 this.alternate_animation(css_even, css_odd, animate_even, animate_odd, direction, currentSlide, nextSlide, handChange, true); 2151 }, 2152 2153 slide_out_top: function(currentSlide, nextSlide, handChange){ 2154 var direction = $this.main.prepare(currentSlide); 2155 2156 var animate = { 2157 top: '+='+(block.height*rows)+'px' 2158 }; 2159 2160 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 2161 }, 2162 slide_out_right: function(currentSlide, nextSlide, handChange){ 2163 var direction = $this.main.prepare(currentSlide); 2164 2165 var row = 1; 2166 var col = 1; 2167 var item = 0; 2168 2169 while (row <= rows) { 2170 while (col <= columns) { 2171 item = (columns * row - (columns - col)); 2172 2173 selector = "#block_" + item; 2174 2175 $this.find(selector).css({ 2176 'z-index': (columns*rows)-col 2177 }); 2178 2179 col++; 2180 } 2181 row++; col = 1; 2182 } 2183 2184 var animate = { 2185 left: '-='+(block.width*columns)+'px' 2186 }; 2187 2188 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 2189 }, 2190 slide_out_bottom: function(currentSlide, nextSlide, handChange){ 2191 var direction = $this.main.prepare(currentSlide); 2192 2193 var row = 1; 2194 var col = 1; 2195 var item = 0; 2196 2197 var t = columns*rows; 2198 while (row <= rows) { 2199 while (col <= columns) { 2200 item = (columns * row - (columns - col)); 2201 2202 selector = "#block_" + item; 2203 2204 $this.find(selector).css({ 2205 'z-index': (t*columns*rows)+col 2206 }); 2207 2208 col++; 2209 } 2210 t--; row++; col = 1; 2211 } 2212 2213 var animate = { 2214 top: '-='+(block.height*rows)+'px' 2215 }; 2216 2217 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 2218 }, 2219 slide_out_left: function(currentSlide, nextSlide, handChange){ 2220 var direction = $this.main.prepare(currentSlide); 2221 2222 var animate = { 2223 left: '+='+(block.width*columns)+'px' 2224 }; 2225 2226 this.drop_animation(animate, direction, currentSlide, nextSlide, handChange); 2227 }, 2228 slide_out_alternate_vertical: function(currentSlide, nextSlide, handChange){ 2229 var direction = $this.main.prepare(currentSlide); 2230 2231 var animate_odd = { 2232 top: '+='+(block.height*rows)+'px' 2233 }; 2234 2235 var css_even = { 2236 display: 'block' 2237 }; 2238 2239 var css_odd = { 2240 display: 'block' 2241 }; 2242 2243 var row = 1; 2244 var col = 1; 2245 var item = 0; 2246 2247 var t = columns*rows; 2248 while (row <= rows) { 2249 while (col <= columns) { 2250 item = (columns * row - (columns - col)); 2251 2252 selector = "#block_" + item; 2253 2254 $this.find(selector).css({ 2255 'z-index': (t*columns*rows)+col 2256 }); 2257 2258 col++; 2259 } 2260 t--; row++; col = 1; 2261 } 2262 2263 var animate_even = { 2264 top: '-='+(block.height*rows)+'px' 2265 }; 2266 2267 this.alternate_animation(css_even, css_odd, animate_even, animate_odd, direction, currentSlide, nextSlide, handChange, false); 2268 }, 2269 slide_out_alternate_horizontal: function(currentSlide, nextSlide, handChange){ 2270 var direction = $this.main.prepare(currentSlide); 2271 2272 var animate_odd = { 2273 left: '+='+(block.width*columns)+'px' 2274 }; 2275 2276 var css_even = { 2277 display: 'bloc
2277k' 2278 }; 2279 2280 var css_odd = { 2281 display: 'block' 2282 }; 2283 2284 var row = 1; 2285 var col = 1; 2286 var item = 0; 2287 2288 while (row <= rows) { 2289 while (col <= columns) { 2290 item = (columns * row - (columns - col)); 2291 2292 selector = "#block_" + item; 2293 2294 $this.find(selector).css({ 2295 'z-index': (columns*rows)-col 2296 }); 2297 2298 col++; 2299 } 2300 row++; col = 1; 2301 } 2302 2303 var animate_even = { 2304 left: '-='+(block.width*columns)+'px' 2305 }; 2306 2307 this.alternate_animation(css_even, css_odd, animate_even, animate_odd, direction, currentSlide, nextSlide, handChange, false); 2308 }, 2309 2310 grow_topleft: function(currentSlide, nextSlide, handChange){ 2311 var direction = $this.main.prepare(nextSlide); 2312 2313 var css = { 2314 display: 'block', 2315 width: 0, 2316 height: 0 2317 }; 2318 2319 var animate = { 2320 width: block.width, 2321 height: block.height 2322 }; 2323 2324 this.base_animation(css, animate, true, direction, currentSlide, nextSlide, handChange); 2325 }, 2326 grow_topright: function(currentSlide, nextSlide, handChange){ 2327 var direction = $this.main.prepare(nextSlide); 2328 2329 var css = { 2330 display: 'block', 2331 width: 0, 2332 height: 0, 2333 left: '+='+(block.width)+'px' 2334 }; 2335 2336 var animate = { 2337 width: block.width, 2338 height: block.height, 2339 left: '-='+(block.width)+'px' 2340 }; 2341 2342 this.base_animation(css, animate, true, direction, currentSlide, nextSlide, handChange); 2343 }, 2344 grow_bottomleft: function(currentSlide, nextSlide, handChange){ 2345 var direction = $this.main.prepare(nextSlide); 2346 2347 var css = { 2348 display: 'block', 2349 width: 0, 2350 height: 0, 2351 top: '+='+(block.height)+'px' 2352 }; 2353 2354 var animate = { 2355 width: block.width, 2356 height: block.height, 2357 top: '-='+(block.height)+'px' 2358 }; 2359 2360 this.base_animation(css, animate, true, direction, currentSlide, nextSlide, handChange); 2361 }, 2362 grow_bottomright: function(currentSlide, nextSlide, handChange){ 2363 var direction = $this.main.prepare(nextSlide); 2364 2365 var css = { 2366 display: 'block', 2367 width: 0, 2368 height: 0, 2369 top: '+='+(block.height)+'px', 2370 left: '+='+(block.width)+'px' 2371 }; 2372 2373 var animate = { 2374 width: block.width, 2375 height: block.height, 2376 top: '-='+(block.height)+'px', 2377 left: '-='+(block.width)+'px' 2378 }; 2379 2380 this.base_animation(css, animate, true, direction, currentSlide, nextSlide, handChange); 2381 }, 2382 2383 shrink_topleft: function(currentSlide, nextSlide, handChange){ 2384 var direction = $this.main.prepare(currentSlide); 2385 2386 var css = { 2387 display: 'block' 2388 }; 2389 2390 var animate = { 2391 height: 0, 2392 width: 0 2393 }; 2394 2395 this.base_animation(css, animate, false, direction, currentSlide, nextSlide, handChange); 2396 }, 2397 shrink_topright: function(currentSlide, nextSlide, handChange){ 2398 var direction = $this.main.prepare(currentSlide); 2399 2400 var css = { 2401 display: 'block' 2402 }; 2403 2404 var animate = { 2405 height: 0, 2406 width: 0, 2407 left: '+='+(block.width)+'px' 2408 }; 2409 2410 this.base_animation(css, animate, false, direction, currentSlide, nextSlide, handChange); 2411 }, 2412 shrink_bottomleft: function(currentSlide, nextSlide, handChange){ 2413 var direction = $this.main.prepare(currentSlide); 2414 2415 var css = { 2416 display: 'block' 2417 }; 2418 2419 var animate = { 2420 height: 0, 2421 width: 0, 2422 top: '+='+(block.height)+'px' 2423 }; 2424 2425 this.base_animation(css, animate, false, direction, currentSlide, nextSlide, handChange); 2426 }, 2427 shrink_bottomright: function(currentSlide, nextSlide, handChange){ 2428 var direction = $this.main.prepare(currentSlide); 2429 2430 var css = { 2431 display: 'block' 2432 }; 2433 2434 var animate = { 2435 height: 0, 2436 width: 0, 2437 top: '+='+(block.height)+'px', 2438 left: '+='+(block.width)+'px' 2439 }; 2440 2441 this.base_animation(css, animate, false, direction, currentSlide, nextSlide, handChange); 2442 }, 2443 2444 squeeze_center: function(currentSlide, nextSlide, handChange){ 2445 var direction = $this.main.prepare(currentSlide); 2446 2447 var css = { 2448 display: 'block' 2449 }; 2450 2451 var animate = { 2452 height: 0, 2453 width: 0, 2454 top: '+='+(block.height / 2)+'px', 2455 left: '+='+(block.width / 2)+'px' 2456 }; 2457 2458 this.base_animation(css, animate, false, direction, currentSlide, nextSlide, handChange); 2459 }, 2460 squeeze_vertical: function(currentSlide, nextSlide, handChange){ 2461 var direction = $this.main.prepare(currentSlide); 2462 2463 var css = { 2464 display: 'block' 2465 }; 2466 2467 var animate = { 2468 width: 0, 2469 left: '+='+(block.width / 2)+'px' 2470 }; 2471 2472 this.base_animation(css, animate, false, direction, currentSlide, nextSlide, handChange); 2473 }, 2474 squeeze_horizontal: function(currentSlide, nextSlide, handChange){ 2475 var direction = $this.main.prepare(currentSlide); 2476 2477 var css = { 2478 display: 'block' 2479 }; 2480 2481 var animate = { 2482 height: 0, 2483 top: '+='+(block.height / 2)+'px' 2484 }; 2485 2486 this.base_animation(css, animate, false, direction, currentSlide, nextSlide, handChange); 2487 }, 2488 squeeze_alternate: function(currentSlide, nextSlide, handChange){ 2489 var direction = $this.main.prepare(currentSlide); 2490 2491 var css_odd = { 2492 display: 'block' 2493 }; 2494 2495 var animate_odd = { 2496 width: 0, 2497 left: '+='+(block.width / 2)+'px' 2498 }; 2499 2500 var css_even = { 2501 display: 'block' 2502 }; 2503 2504 var animate_even = { 2505 height: 0, 2506 top: '+='+(block.height / 2)+'px' 2507 }; 2508 2509 this.alternate_animation(css_even, css_odd, animate_even, animate_odd, direction, currentSlide, nextSlide, handChange, false); 2510 }, 2511 2512 stretch_vertical: function(currentSlide, nextSlide, handChange){ 2513 var direction = $this.main.prepare(nextSlide); 2514 2515 var css = { 2516 display: 'block', 2517 width: 0, 2518 left: '+='+(block.width / 2)+'px' 2519 }; 2520 2521 var animate = { 2522 width: block.width, 2523 left: '-='+(block.width / 2)+'px' 2524 }; 2525 2526 this.base_animation(css, animate, true, direction, currentSlide, nextSlide, handChange); 2527 }, 2528 stretch_horizontal: function(currentSlide, nextSlide, handChange){ 2529 var direction = $this.main.prepare(nextSlide); 2530 2531 var css = { 2532 display: 'block', 2533 height: 0, 2534 top: '+='+(block.height / 2)+'px' 2535 }; 2536 2537 var animate = { 2538 height: block.height, 2539 top: '-='+(block.height / 2)+'px' 2540 }; 2541 2542 this.base_animation(css, animate, true, direction, currentSlide, nextSlide, handChange); 2543 }, 2544 stretch_center: function(currentSlide, nextSlide, handChange){ 2545 var direction = $this.main.prepare(nextSlide); 2546 2547 var css = { 2548 display: 'block', 2549 height: 0, 2550 width: 0, 2551 top: '+='+(block.height / 2)+'px', 2552 left: '+='+(block.width / 2)+'px' 2553 }; 2554 2555 var animate = { 2556 height: block.height, 2557 width: block.width, 2558 top: '-='+(block.height / 2)+'px', 2559 left: '-='+(block.width / 2)+'px' 2560 }; 2561 2562 this.base_animation(css, animate, true, direction, currentSlide, nextSlide, handChange); 2563 }, 2564 stretch_alternate: function(currentSlide, nextSlide, handChange){ 2565 var direction = $this.main.prepare(nextSlide); 2566 2567 var css_odd = { 2568 display: 'block', 2569 height: 0, 2570 top: '+='+(block.height / 2)+'px' 2571 }; 2572 2573 var animate_odd = { 2574 height: block.height, 2575 top: '-='+(block.height / 2)+'px' 2576 }; 2577 2578 var css_even = { 2579 display: 'block', 2580 width: 0, 2581 left: '+='+(block.width / 2)+'px' 2582 }; 2583 2584 var animate_even = { 2585 width: block.width, 2586 left: '-='+(block.width / 2)+'px' 2587 }; 2588 2589 this.alternate_animation(css_even, css_odd, animate_even, animate_odd, direction, currentSlide, nextSlide, handChange, true); 2590 }, 2591 2592 swap_bottom: function(currentSlide, nextSlide, handChange){ 2593 var direction = $this.main.prepare(nextSlide); 2594 2595 var css = { 2596 display: 'block', 2597 height: 0 2598 }; 2599 2600 var animate = { 2601 height: block.height 2602 }; 2603 2604 this.base_animation(css, animate, true, direction, currentSlide, nextSlide, handChange); 2605 }, 2606 swap_top: function(currentSlide, nextSlide, handChange){ 2607 var direction = $this.main.prepare(currentSlide); 2608 2609 var css = { 2610 display: 'block' 2611 }; 2612 2613 var animate = { 2614 height: 0 2615 }; 2616 2617 this.base_animation(css, animate, false, direction, currentSlide, nextSlide, handChange); 2618 }, 2619 swap_right: function(currentSlide, nextSlide, handChange){ 2620 var direction = $this.main.prepare(nextSlide); 2621 2622 var css = { 2623 display: 'block', 2624 width: 0 2625 }; 2626 2627 var animate = { 2628 width: block.width 2629 }; 2630 2631 this.base_animation(css, animate, true, direction, currentSlide, nextSlide, handChange); 2632 }, 2633 swap_left: function(currentSlide, nextSlide, handChange){ 2634 var direction = $this.main.prepare(currentSlide); 2635 2636 var css = { 2637 display: 'block' 2638 }; 2639 2640 var animate = { 2641 width: 0 2642 }; 2643 2644 this.base_animation(css, animate, false, direction, currentSlide, nextSlide, handChange); 2645 } 2646 2647 }; 2648 2649 $this.direction = { 2650 2651 delay: function(){
2652 var delay = cfg.animation.delay; 2653 2654 if((typeof cfg[activeSlideNum+1] != 'undefined') && (typeof cfg[activeSlideNum+1].animation != 'undefined') && (typeof cfg[activeSlideNum+1].animation.delay != 'undefined')){ 2655 delay = cfg[activeSlideNum+1].animation.delay; 2656 } 2657 2658 return parseInt(delay); 2659 }, 2660 2661 direction: function(){ 2662 var direction = cfg.animation.direction; 2663 2664 if((typeof cfg[activeSlideNum+1] != 'undefined') && (typeof cfg[activeSlideNum+1].animation != 'undefined') && (typeof cfg[activeSlideNum+1].animation.direction != 'undefined')){ 2665 direction = cfg[activeSlideNum+1].animation.direction; 2666 } 2667 2668 return direction; 2669 }, 2670 2671 horizontal_top: function(){ 2672 var blockDelay = this.delay(); 2673 var row = 1; 2674 var column = 1; 2675 var item = 0; 2676 var delay = 0; 2677 var delays = []; 2678 var result = []; 2679 2680 while(row <= rows){ 2681 while(column <= columns){ 2682 item = (columns * row - (columns - column)); 2683 delay = blockDelay * row; 2684 delays[item] = delay; 2685 2686 column++; 2687 } 2688 row++; 2689 column = 1; 2690 } 2691 2692 result['celkem'] = delay; 2693 result['zpozdeni'] = delays; 2694 2695 return result; 2696 }, 2697 horizontal_bottom: function(){ 2698 var top = $this.direction.horizontal_top(); 2699 2700 top['zpozdeni'][top['zpozdeni'].length] = 0; 2701 top['zpozdeni'].reverse(); 2702 2703 return top; 2704 }, 2705 horizontal_topleft: function(){ 2706 var blockDelay = this.delay(); 2707 var row = 1; 2708 var column = 1; 2709 var item = 0; 2710 var delay = 0; 2711 var delays = []; 2712 var result = []; 2713 2714 while(row <= rows){ 2715 while(column <= columns){ 2716 item = (columns * row - (columns - column)); 2717 delay = blockDelay * item; 2718 delays[item] = delay; 2719 2720 column++; 2721 } 2722 row++; 2723 column = 1; 2724 } 2725 2726 result['celkem'] = delay; 2727 result['zpozdeni'] = delays; 2728 2729 return result; 2730 }, 2731 horizontal_topright: function(){ 2732 var blockDelay = this.delay(); 2733 var row = 1; 2734 var column = 1; 2735 var item = 0; 2736 var delay = 0; 2737 var delays = []; 2738 var result = []; 2739 2740 var t = 0; 2741 2742 while(row <= rows){ 2743 while(column <= columns){ 2744 item = (columns * row - (columns - column)); 2745 t = column-1; 2746 delay = blockDelay * columns * row - (t*blockDelay); 2747 delays[item] = delay; 2748 2749 column++; 2750 } 2751 row++; 2752 column = 1; 2753 } 2754 2755 var max = item * blockDelay; 2756 2757 result['celkem'] = max; 2758 result['zpozdeni'] = delays; 2759 2760 return result; 2761 }, 2762 horizontal_bottomleft: function(){ 2763 var topRight = $this.direction.horizontal_topright(); 2764 2765 topRight['zpozdeni'][topRight['zpozdeni'].length] = 0; 2766 topRight['zpozdeni'].reverse(); 2767 2768 return topRight; 2769 }, 2770 horizontal_bottomright: function(){ 2771 var topLeft = $this.direction.horizontal_topleft(); 2772 2773 topLeft['zpozdeni'][topLeft['zpozdeni'].length] = 0; 2774 topLeft['zpozdeni'].reverse(); 2775 2776 return topLeft; 2777 }, 2778 2779 vertical_left: function(){ 2780 var blockDelay = this.delay(); 2781 var row = 1; 2782 var column = 1; 2783 var item = 0; 2784 var delay = 0; 2785 var delays = []; 2786 var result = []; 2787 2788 while(row <= rows){ 2789 while(column <= columns){ 2790 2791 delay = (blockDelay * column); 2792 item = (columns * row - (columns - column)); 2793 delays[item] = delay; 2794 2795 column++; 2796 } 2797 row++; 2798 column = 1; 2799 } 2800 2801 result['celkem'] = delay; 2802 result['zpozdeni'] = delays; 2803 2804 return result; 2805 }, 2806 vertical_right: function(){ 2807 var left = $this.direction.vertical_left(); 2808 2809 left['zpozdeni'][left['zpozdeni'].length] = 0; 2810 left['zpozdeni'].reverse(); 2811 2812 return left; 2813 }, 2814 vertical_topleft: function(){ 2815 var blockDelay = this.delay(); 2816 var row = 1; 2817 var column = 1; 2818 var item = 0; 2819 var delay = 0; 2820 var delays = []; 2821 var result = []; 2822 2823 while(row <= rows){
2824 delay = (blockDelay * row); 2825 while(column <= columns){ 2826 item = (columns * row - (columns - column)); 2827 delays[item] = delay; 2828 delay += rows * blockDelay; 2829 2830 column++; 2831 } 2832 row++; 2833 column = 1; 2834 } 2835 2836 var max = item * blockDelay; 2837 2838 result['celkem'] = max; 2839 result['zpozdeni'] = delays; 2840 2841 return result; 2842 }, 2843 vertical_topright: function(){ 2844 var bottomLeft = $this.direction.vertical_bottomleft(); 2845 2846 bottomLeft['zpozdeni'][bottomLeft['zpozdeni'].length] = 0; 2847 bottomLeft['zpozdeni'].reverse(); 2848 2849 return bottomLeft; 2850 }, 2851 vertical_bottomleft: function(){ 2852 var blockDelay = this.delay(); 2853 var row = 1; 2854 var column = 1; 2855 var item = 0; 2856 var delay = 0; 2857 var delays = []; 2858 var result = []; 2859 2860 var t = 0; 2861 2862 while(row <= rows){ 2863 while(column <= columns){ 2864 item = (columns * row - (columns - column)); 2865 t = row-1; 2866 delay = blockDelay * rows * column - (t*blockDelay); 2867 delays[item] = delay; 2868 2869 column++; 2870 } 2871 row++; 2872 column = 1; 2873 } 2874 2875 var max = item * blockDelay; 2876 2877 result['celkem'] = max; 2878 result['zpozdeni'] = delays; 2879 2880 return result; 2881 }, 2882 vertical_bottomright: function(){ 2883 var topLeft = $this.direction.vertical_topleft(); 2884 2885 topLeft['zpozdeni'][topLeft['zpozdeni'].length] = 0; 2886 topLeft['zpozdeni'].reverse(); 2887 2888 return topLeft; 2889 }, 2890 2891 diagonal_topleft: function(){ 2892 var blockDelay = this.delay(); 2893 var row = 1; 2894 var column = 1; 2895 var item = 0; 2896 var delay = 0; 2897 var delays = []; 2898 var result = []; 2899 2900 while(row <= rows){ 2901 var x = row; 2902 while(column <= columns){ 2903 item = (columns * row - (columns - column)); 2904 delay = blockDelay * x; 2905 delays[item] = delay; 2906 2907 column++; 2908 x++; 2909 } 2910 row++; 2911 column = 1; 2912 } 2913 2914 result['celkem'] = delay; 2915 result['zpozdeni'] = delays; 2916 2917 return result; 2918 }, 2919 diagonal_topright: function(){ 2920 var blockDelay = this.delay(); 2921 var row = 1; 2922 var column = 1; 2923 var item = 0; 2924 var delay = 0; 2925 var delays = []; 2926 var result = []; 2927 var max = 0; 2928 2929 while(row <= rows){ 2930 var x = columns + (row-1); 2931 while(column <= columns){ 2932 item = (columns * row - (columns - column)); 2933 delay = blockDelay * x; 2934 delays[item] = delay; 2935 2936 if(delay > max){ 2937 max = delay; 2938 } 2939 2940 column++; 2941 x--; 2942 } 2943 row++; 2944 column = 1; 2945 } 2946 2947 result['celkem'] = max; 2948 result['zpozdeni'] = delays; 2949 2950 return result; 2951 }, 2952 diagonal_bottomright: function(){ 2953 var topLeft = $this.direction.diagonal_topleft(); 2954 2955 topLeft['zpozdeni'][topLeft['zpozdeni'].length] = 0; 2956 topLeft['zpozdeni'].reverse(); 2957 2958 return topLeft; 2959 }, 2960 diagonal_bottomleft: function(){ 2961 var topRight = $this.direction.diagonal_topright(); 2962 2963 topRight['zpozdeni'][topRight['zpozdeni'].length] = 0; 2964 topRight['zpozdeni'].reverse(); 2965 2966 return topRight; 2967 }, 2968 2969 random: function(){ 2970 var blockDelay = this.delay(); 2971 var row = 1; 2972 var column = 1; 2973 var item = 0; 2974 var delay = 0; 2975 var delays = []; 2976 var result = []; 2977 var tmp; 2978 var random = 0; 2979 2980 while(row <= rows){ 2981 while(column <= columns){ 2982 item = (columns * row - (columns - column)); 2983 2984 delay = blockDelay * item; 2985 delays[item] = delay; 2986 2987 column++; 2988 } 2989 row++; 2990 column = 1; 2991 } 2992 2993 if(item) { 2994 while(--item) { 2995 random = Math.floor(Math.random() * (item + 1)); 2996 tmp = delays[random]; 2997 delays[random] = delays[item]; 2998 delays[item] = tmp; 2999 } 3000 } 3001 3002 result['celkem'] = delay; 3003 result['zpozdeni'] = delays; 3004 3005 return result; 3006 }, 3007 3008 spiral_topleft: function(){ 3009 var blockDelay = this.delay(); 3010 var row = 1; 3011 var column = 1; 3012 var item = 0; 3013 var delay = 0; 3014 var delays = []; 3015 var result = []; 3016 3017 var i,j,c,r; 3018 var l = 0; 3019 3020 while(row <= rows){ 3021 while(column <= columns){ 3022 item = (columns * row - (columns - column)); 3023 3024 delay = blockDelay * item; 3025 delays[item] = delay; 3026 3027 column++; 3028 } 3029 row++; 3030 column = 1; 3031 } 3032 3033 var output_array = [rows.length]; 3034
3035 for(i = 0; i < rows; i++){ 3036 output_array[i] = [columns.length]; 3037 for(j = 0; j < columns; j++){ 3038 output_array[i][j] = j; 3039 } 3040 } 3041 3042 for(i = 0, c = columns - 1, r = rows - 1; c >= 0 && r >= 0; i++, c--, r--){ 3043 for(j = i; j <= c; j++){ // Traversing Forward 3044 if(l == rows * columns) break; 3045 output_array[i][j] = delays[l++]; 3046 } 3047 3048 for(j = i + 1; j <= r; j++){ // Traversing Downward 3049 if(l == rows * columns) break; 3050 output_array[j][c] = delays[l++]; 3051 } 3052 3053 for(j = c - 1; j >= i; j--){ // Traversing Backward 3054 if(l == rows * columns) break; 3055 output_array[r][j] = delays[l++]; 3056 } 3057 3058 for(j = r - 1; j > i; j--){ // Traversing Upward 3059 if(l == rows * columns) break; 3060 output_array[j][i] = delays[l++]; 3061 } 3062 } 3063 3064 for(i = 0; i < rows; i++){ 3065 for(j = 0; j < columns; j++){ 3066 item = (columns * (i+1) - (columns - (j+1))); 3067 delays[item] = output_array[i][j]; 3068 } 3069 } 3070 3071 result['celkem'] = delay; 3072 result['zpozdeni'] = delays; 3073 3074 return result; 3075 }, 3076 spiral_topright: function(){ 3077 var blockDelay = this.delay(); 3078 var row = 1; 3079 var column = 1; 3080 var item = 0; 3081 var delay = 0; 3082 var delays = []; 3083 var result = []; 3084 3085 var i,j,c,r; 3086 var l = 0; 3087 3088 while(row <= rows){ 3089 while(column <= columns){ 3090 item = (columns * row - (columns - column)); 3091 3092 delay = blockDelay * item; 3093 delays[item] = delay; 3094 3095 column++; 3096 } 3097 row++; 3098 column = 1; 3099 } 3100 3101 var output_array = [rows.length]; 3102 3103 for(i = 0; i < rows; i++){ 3104 output_array[i] = [columns.length]; 3105 for(j = 0; j < columns; j++){ 3106 output_array[i][j] = j; 3107 } 3108 } 3109 3110 for(i = 0, c = columns - 1, r = rows - 1; c >= 0 && r >= 0; i++, c--, r--){ 3111 for(j = i ; j <= c; j++){ // Traversing Forward 3112 if(l == rows * columns) break; 3113 output_array[i][j] = delays[l++]; 3114 } 3115 3116 for(j = i + 1; j <= r; j++){ // Traversing Downward 3117 if(l == rows * columns) break; 3118 output_array[j][c] = delays[l++]; 3119 } 3120 3121 for(j = c - 1; j >= i; j--){ // Traversing Backward 3122 if(l == rows * columns) break; 3123 output_array[r][j] = delays[l++]; 3124 } 3125 3126 for(j = r - 1; j > i; j--){ // Traversing Upward 3127 if(l == rows * columns) break; 3128 output_array[j][i] = delays[l++]; 3129 } 3130 } 3131 3132 for(i = 0; i < output_array.length; i++){ 3133 output_array[i].reverse(); 3134 } 3135 3136 for(i = 0; i < rows; i++){ 3137 for(j = 0; j < columns; j++){ 3138 item = (columns * (i+1) - (columns - (j+1))); 3139 delays[item] = output_array[i][j]; 3140 } 3141 } 3142 3143 result['celkem'] = delay; 3144 result['zpozdeni'] = delays; 3145 3146 return result; 3147 }, 3148 spiral_bottomleft: function(){ 3149 var topRight = $this.direction.spiral_topright(); 3150 3151 topRight['zpozdeni'][topRight['zpozdeni'].length] = 0; 3152 topRight['zpozdeni'].reverse(); 3153 3154 return topRight; 3155 }, 3156 spiral_bottomright: function(){ 3157 var topLeft = $this.direction.spiral_topleft(); 3158 3159 topLeft['zpozdeni'][topLeft['zpozdeni'].length] = 0; 3160 topLeft['zpozdeni'].reverse(); 3161 3162 return topLeft; 3163 }, 3164 3165 horizontal_zigzag_topleft: function(){ 3166 var blockDelay = this.delay(); 3167 var row = 1; 3168 var column = 1; 3169 var item = 0; 3170 var delay = 0; 3171 var delays = []; 3172 var result = []; 3173 var multiplier = 0; 3174 var max = 0; 3175 var i = 1; 3176 3177 while(row <= rows){ 3178 while(column <= columns){ 3179 item = (columns * row - (columns - column)); 3180 3181 if(i % 2 === 0){ 3182 multiplier = (columns * row - column) + 1; 3183 }else{ 3184 multiplier = item; 3185 } 3186 3187 delay = blockDelay * multiplier; 3188 3189 if(delay > max){ 3190 max = delay; 3191 } 3192 3193 delays[item] = delay; 3194 column++; 3195 } 3196 i++; row++; column = 1; 3197 } 3198 3199 result['celkem'] = max; 3200 result['zpozdeni'] = delays; 3201 3202 return result; 3203 }, 3204 horizontal_zigzag_topright: function(){ 3205 var blockDelay = this.delay(); 3206 var row = 1; 3207 var column = 1; 3208 var item = 0; 3209 var delay = 0; 3210 var delays = []; 3211 var result = []; 3212 var multiplier = 0; 3213 var max = 0; 3214 var i = 1; 3215 var tmp = []; 3216 3217 while(row <= rows){ 3218 delays = []; 3219 3220 while(column <= columns){ 3221 item = (columns * row - (columns - column)); 3222 3223 if(i % 2 === 0){ 3224 multiplier = (columns * row - column) + 1; 3225 }else{ 3226 multiplier = item; 3227 } 3228
3229 delay = blockDelay * multiplier; 3230 if(delay > max) max = delay; 3231 3232 delays[column] = delay; 3233 column++; 3234 } 3235 3236 tmp[row] = delays.reverse(); 3237 i++; row++; column = 1; 3238 } 3239 3240 var ret = []; 3241 var x = 1; 3242 3243 for(i = 1; i <= rows; i++) { 3244 for(var j = 0; j < columns; j++) { 3245 ret[x] = tmp[i][j]; 3246 x++; 3247 } 3248 } 3249 3250 result['celkem'] = max; 3251 result['zpozdeni'] = ret; 3252 3253 return result; 3254 }, 3255 horizontal_zigzag_bottomright: function(){ 3256 var topLeft = $this.direction.horizontal_zigzag_topleft(); 3257 3258 topLeft['zpozdeni'][topLeft['zpozdeni'].length] = 0; 3259 topLeft['zpozdeni'].reverse(); 3260 3261 return topLeft; 3262 }, 3263 horizontal_zigzag_bottomleft: function(){ 3264 var topRight = $this.direction.horizontal_zigzag_topright(); 3265 3266 topRight['zpozdeni'][topRight['zpozdeni'].length] = 0; 3267 topRight['zpozdeni'].reverse(); 3268 3269 return topRight; 3270 }, 3271 3272 vertical_zigzag_topleft: function(){ 3273 var blockDelay = this.delay(); 3274 var row = 1; 3275 var column = 1; 3276 var item = 0; 3277 var delay = 0; 3278 var delays = []; 3279 var result = []; 3280 3281 while(row <= rows){
3282 delay = (blockDelay * row); 3283 3284 while(column <= columns){ 3285 item = (columns * row - (columns - column)); 3286 3287 delays[item] = delay; 3288 3289 if(column % 2 === 0){ 3290 delay += (row+(row-1)) * blockDelay; 3291 }else{ 3292 delay += (rows-(row-1) + rows-(row)) * blockDelay; 3293 } 3294 3295 column++; 3296 } 3297 row++; column = 1; 3298 } 3299 3300 var max = item * blockDelay; 3301 3302 result['celkem'] = max; 3303 result['zpozdeni'] = delays; 3304 3305 return result; 3306 }, 3307 vertical_zigzag_topright: function(){ 3308 var blockDelay = this.delay(); 3309 var row = 1; 3310 var column = 1; 3311 var item = 0; 3312 var delay = 0; 3313 var delays = []; 3314 var result = []; 3315 var tmp = []; 3316 3317 while(row <= rows){ 3318 delay = (blockDelay * row); 3319 delays = []; 3320 3321 while(column <= columns){ 3322 item = (columns * row - (columns - column)); 3323 3324 delays[column] = delay; 3325 3326 if(column % 2 === 0){ 3327 delay += (row+(row-1)) * blockDelay; 3328 }else{ 3329 delay += (rows-(row-1) + rows-(row)) * blockDelay; 3330 } 3331 3332 column++; 3333 } 3334 3335 tmp[row] = delays.reverse(); 3336 3337 row++; column = 1; 3338 } 3339 3340 var ret = []; 3341 var x = 1; 3342 3343 for(i = 1; i <= rows; i++){ 3344 for(var j = 0; j < columns; j++){ 3345 ret[x] = tmp[i][j]; 3346 x++; 3347 } 3348 } 3349 3350 var max = item * blockDelay; 3351 3352 result['celkem'] = max; 3353 result['zpozdeni'] = ret; 3354 3355 return result; 3356 }, 3357 vertical_zigzag_bottomright: function(){ 3358 var topLeft = $this.direction.vertical_zigzag_topleft(); 3359 3360 topLeft['zpozdeni'][topLeft['zpozdeni'].length] = 0; 3361 topLeft['zpozdeni'].reverse(); 3362 3363 return topLeft; 3364 }, 3365 vertical_zigzag_bottomleft: function(){ 3366 var topRight = $this.direction.vertical_zigzag_topright(); 3367 3368 topRight['zpozdeni'][topRight['zpozdeni'].length] = 0; 3369 topRight['zpozdeni'].reverse(); 3370 3371 return topRight; 3372 }, 3373 3374 chess: function(){ 3375 var blockDelay = this.delay(); 3376 var row = 1; 3377 var column = 1; 3378 var item = 0; 3379 var delay = 0; 3380 var delays = [0]; 3381 var result = []; 3382 3383 var mutator = 0; 3384 3385 while(row <= rows){ 3386 while(column <= columns){ 3387 item = (columns * row - (columns - column)); 3388 3389 if(columns % 2 ==1){ 3390 if(item % 2 == 1) delay = blockDelay; 3391 else delay = blockDelay * 2; 3392 }else{ 3393 if(((item + mutator) % 2) == 1) delay = blockDelay; 3394 else delay = blockDelay * 2; 3395 } 3396 3397 delays[item] = delay; 3398 3399 column++; 3400 } 3401 mutator++; row++; column = 1; 3402 } 3403 3404 result['celkem'] = blockDelay*2; 3405 result['zpozdeni'] = delays; 3406 3407 return result; 3408 }, 3409 3410 explode: function(center_column, center_row, index){ 3411 var blockDelay = this.delay(); 3412 var row = 1; 3413 var column = 1; 3414 var item = 0; 3415 var delay = 0; 3416 var delays = []; 3417 var result = []; 3418 3419 while(row <= rows){ 3420 while(column <= columns){ 3421 3422 item = (columns * row - (columns - column)); 3423 3424 if(row <= center_row){ 3425 if(column <= center_column) delay = blockDelay * (((center_column - column) + 1) + (center_row - row)); 3426 else delay = blockDelay * (((column - center_column) + 1) + (center_row - row)); 3427 }else{ 3428 if(column <= center_column) delay = blockDelay * (((center_column - column) + 1) + (row - center_row)); 3429 else delay = blockDelay * (((column - center_column) + 1) + (row - center_row)); 3430 } 3431 3432 delays[item] = delay; 3433 column++; 3434 } 3435 row++; column = 1; 3436 } 3437 3438 result['celkem'] = (typeof index !== 'undefined') ? delays[index] : delay; 3439 result['zpozdeni'] = delays; 3440 3441 return result; 3442 }, 3443 explode_center: function(){ 3444 var center_column = Math.round(columns / 2); 3445 var center_row = Math.round(rows / 2); 3446 3447 return this.explode(center_column, center_row); 3448 }, 3449 explode_left: function(){ 3450 var center_column = 1; 3451 var center_row = Math.round(rows / 2); 3452 3453 return this.explode(center_column, center_row); 3454 }, 3455 explode_right: function(){ 3456 var center_column = columns; 3457 var center_row = Math.round(rows / 2); 3458 3459 return this.explode(center_column, center_row, 1); 3460 }, 3461 explode_top: function(){ 3462 var center_column = Math.round(columns / 2); 3463 var center_row = 1; 3464 3465 return this.explode(center_column, center_row); 3466 }, 3467 explode_bottom: function(){ 3468 var center_column = Math.round(columns / 2); 3469 var center_row = rows; 3470 3471 return this.explode(center_column, center_row, 1); 3472 }, 3473 3474 implode: function(center_column, center_row){ 3475 var blockDelay = this.delay(); 3476 var row = 1; 3477 var column = 1; 3478 var item = 0;
3479 var delay = 0; 3480 var delays = []; 3481 var result = []; 3482 3483 while(row <= rows){ 3484 while(column <= columns){ 3485 3486 item = (columns * row - (columns - column)); 3487 3488 if(center_row != 1 && row <= center_row){ 3489 if(center_column != 1 && column <= center_column) delay = blockDelay * ((row + column) - 1); 3490 else delay = blockDelay * ((row + (columns - column))); 3491 }else{ 3492 if(center_column != 1 && column <= center_column) delay = blockDelay * ((((rows - row) + 1) + column) - 1); 3493 else delay = blockDelay * ((((rows - row) + 1) + (columns - column))); 3494 } 3495 3496 delays[item] = delay; 3497 column++; 3498 } 3499 row++; column = 1; 3500 } 3501 3502 result['zpozdeni'] = delays; 3503 3504 delays.splice (0,1); 3505 result['celkem'] = Math.max.apply(Math, delays); 3506 delays.unshift(undefined); 3507 3508 return result; 3509 }, 3510 implode_center: function(){ 3511 var center_column = Math.round(columns / 2); 3512 var center_row = Math.round(rows / 2); 3513 3514 return this.implode(center_column, center_row); 3515 }, 3516 implode_left: function(){ 3517 var center_column = columns; 3518 var center_row = Math.round(rows / 2); 3519 3520 return this.implode(center_column, center_row); 3521 }, 3522 implode_right: function(){ 3523 var center_column = 1; 3524 var center_row = Math.round(rows / 2); 3525 3526 return this.implode(center_column, center_row); 3527 }, 3528 implode_top: function(){ 3529 var center_column = Math.round(columns / 2); 3530 var center_row = rows; 3531 3532 return this.implode(center_column, center_row); 3533 }, 3534 implode_bottom: function(){ 3535 var center_column = Math.round(columns / 2); 3536 var center_row = 1; 3537 3538 return this.implode(center_column, center_row); 3539 } 3540 }; 3541 3542 $this.preloader = { 3543 3544 // initialize preloader 3545 init: function(callback){ 3546 var images = $this.find('img'); 3547 var imagesCount = images.length; 3548 if(cfg.responsive) $this.main.responsive(); 3549 3550 slides.children().each(function(){ 3551 var bg = $(this).css("background-image"); 3552 if(bg !== 'none'){ 3553 var bgImage = new Image; 3554 bgImage.src = bg.replace(/"/g,"").replace(/url\(|\)$/ig, ""); 3555 images.push(bgImage); 3556 } 3557 }); 3558 3559 if(images.length > 0){ 3560 $('<div class="unoslider_preloader"></div>').css({ 3561 position: 'absolute', 3562 textAlign: 'center', 3563 width: '100%' 3564 }).prependTo($this); 3565 3566 images.each(function(){ 3567 var img = new Image; 3568 var $thisImg = $(this); 3569 3570 img.src = this.src; 3571 3572 if (!img.complete) { 3573 $(img).bind("load error", function(){ 3574 $this.preloader.show($thisImg, callback, imagesCount); 3575 }); 3576 } else { 3577 $this.preloader.show($thisImg, callback, imagesCount); 3578 } 3579 }); 3580 }else{ 3581 $(lists[0]).css("display", "block").animate({ 3582 opacity: 1 3583 }, 500); 3584 3585 if($.isFunction(callback)){ 3586 callback.call(); 3587 } 3588 } 3589 }, 3590 3591 // update progress and show the slider 3592 show: function(img, callback, imagesCount){ 3593 loaded++; 3594 3595 var loader = $this.find('.unoslider_preloader'); 3596 3597 if(loaded == imagesCount){ 3598 $(lists[0]).css("display", "block").animate({ 3599 opacity: 1 3600 }, 500, function () { 3601 loader.remove(); 3602 }); 3603 3604 if($.isFunction(callback)){ 3605 callback.call(); 3606 } 3607 } 3608 3609 switch(cfg.preloader){ 3610 case 'spinner': 3611 $(loader).empty(); 3612 $('<div class="unoslider_spinner"></div>').css({width: '100%', height: '100%'}).appendTo(loader); 3613 break; 3614 default: 3615 $(loader).empty(); 3616 var progress = $('<span></span>').css({width: (loaded / imagesCount * 100).toFixed(0)+'%'}); 3617 $(loader).css({'padding-top': $this.height() / 2 +'px', height: '50%'}); 3618 $('<div class="unoslider_progress"></div>').appendTo(loader).append(progress); 3619 break; 3620 } 3621 } 3622 }; 3623 3624 // start slider 3625 $this.main.init(); 3626 3627 // public methods 3628 this.stop = function(){ 3629 stoped = true; 3630 $this.navigation.changeState('stop'); 3631 $this.slideshow.stop(); 3632 }; 3633 this.play = function(){ 3634 if(stoped){ 3635 $this.navigation.changeState('play'); 3636 $this.slideshow.start(); 3637 stoped = false;
3638 } 3639 }; 3640 this.next = function(){ 3641 if(running === false) $this.slideshow.next(); 3642 }; 3643 this.prev = function(){ 3644 if(running === false) $this.slideshow.prev(); 3645 }; 3646 this.goto = function(num){ 3647 if(running === false){ 3648 if(num > slides.size()){ 3649 alert("You can't go to slide number "+num+", slider contains only "+slides.size()+" slides"); 3650 }else{ 3651 $this.slideshow.changeTo(num-1, true); 3652 } 3653 } 3654 }; 3655 this.cfg = function(config){ 3656 $.extend(true, cfg, config); 3657 }; 3658 3659 }; 3660 3661 $.fn.unoslider = function(options){ 3662 return (new $.UnoSlider(options, $(this))); 3663 }; 3664 3665 $.UnoSlider.defaults = {}; 3666 3667})(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.