1/* 2 3 _____ _ _ _ _____ 4 / ___/| (*) | | | |/ ___/ v 5.0.7 5 | (___ | |_ __| | ___ ____ | | (___ 6 \___ \| | |/ _` |/ _ / __/ _ | |\___ \ 7 ____) | | | (_| | __\__ \ | |__| |____) | 8 /_____/|_|_|\__,_|\___/___/ \____//_____/ 9 10 11This file contains scripts required for the proper functionality and display 12of your Slides Project. It also requires plugins.js and jquery-3.4.1 to run this script properly. 13 14https://designmodo.com/slides/ 15 16*/ 17 18window.inAction = 1; 19window.allowSlide = 1; 20window.blockScroll = 1; 21window.effectOffset = 500; 22window.effectSpeed = 1000; 23window.slideSpeed = 1000; 24window.cleanupDelay = 1400; 25window.horizontalMode = 0; 26window.sidebarShown = 0; 27window.loadingProgress = 0; 28window.smoothScroll = 0; 29window.scrollSpeed = 0.5; 30window.preload = 1; 31window.setHashLink = 1; 32window.hideSidebarOnBodyClick = 1; 33window.collectScrolls = 0; 34window.sliderStatus = 0; 35window.minScrollToSlide = 500; 36window.minSwipeToSlide = 4; 37window.enableMobileZoom = 0; 38window.hideOnScrollSensitivity = 100; 39window.allowParallaxOnMobile = 1; 40window.hidePopupOnBodyClick = 1; 41window.disableKeyNavigation = 0; 42 43var $html = $('html'); 44 45//On Window load 46$(window).on('load', function(){ 47 window.loaded = 1; 48}); 49 50//On DOM ready 51$(document).ready(function() { "use strict"; 52 var $body = $('body'); 53 54 //add window a trigger 55 setTimeout(function(){ 56 $(window).trigger('ready'); 57 },1); 58 59 //Redraw 60 $body.hide().show(0); 61 62 //Detect mode 63 window.isScroll = $body.hasClass('scroll'); 64 window.isSimplifiedMobile = $body.hasClass('simplifiedMobile'); 65 if (window.isScroll || window.isSimplifiedMobile && window.isMobile) { $html.addClass('scrollable'); } 66 67 $html.addClass('page-ready'); 68 69 //Set speed 70 if ($body.hasClass('fast')){ 71 //fast 72 window.slideSpeed = 700; 73 window.cleanupDelay = 1200; 74 window.effectSpeed = 800; 75 window.scrollSpeed = 0.35; 76 window.effectOffset = 400; 77 } else if ($body.hasClass('slow')){ 78 //slow 79 window.slideSpeed = 1400; 80 window.cleanupDelay = 2000; 81 window.effectSpeed = 1400; 82 window.scrollSpeed = .8; 83 window.effectOffset = 600; 84 } 85 86 //How many stages? 87 window.stage = 1; 88 window.stages = $('.slide').length; 89 90 //Horizonal Mode 91 if ($body.hasClass('horizontal')){ 92 window.horizontalMode = 1; 93 } 94 95 //Preload 96 if ($body.hasClass('noPreload')){ 97 window.preload = 0; 98 } 99 100 //Is it animated? 101 if ($body.hasClass('animated')){ 102 window.isAnimated = "auto"; 103 } else if ($body.hasClass('animateOnEvent')) { 104 window.isAnimated = "animateOnEvent"; 105 if (window.isMobile) { 106 window.isAnimated = "auto"; 107 $body.removeClass('animateOnEvent').addClass('animated'); 108 } 109 } 110 111 //Remove animation for Simplified Mobile Option 112 if (window.isSimplifiedMobile && window.isMobile) { 113 window.isAnimated = false; 114 $body.removeClass('animated animateOnEvent'); 115 $("[class*='ae-']").addClass('done'); 116 } 117 118 if (!window.isAnimated) { 119 window.cleanupDelay = 0; 120 } 121 122 //Is scroll hijacked? 123 if ($body.hasClass('smoothScroll') && !window.isMobile){ 124 window.smoothScroll = 1; 125 } 126 127 //Check hash on start 128 function updateHash(){ 129 var hashLink = window.location.href.split("#")[1]; 130 if (hashLink) { 131 //find a slide 132 if ( $('.slide[data-name="' +hashLink+ '"]').length > 0 ){ 133 //asking for the slide? 134 var requestedElement = $('.slide[data-name="' +hashLink+ '"]'); 135 136 //scroll to a desired slide 137 if ( (window.isMobile && window.isSimplifiedMobile) || window.isScroll ){ 138 //scroll mode 139 if (requestedElement.length) { 140 if (!window.preload || window.loaded) { 141 $('html,body').stop().clearQueue().animate({scrollTop:requestedElement.position().top},window.effectSpeed); 142 } else { 143 $(window).on('load', function(){ 144 $('html,body').stop().clearQueue().animate({scrollTop:requestedElement.position().top},window.effectSpeed); 145 }); 146 } 147 } 148 } else { 149 //slide mode 150 window.stage = $('.slide').index(requestedElement) + 1; 151 showSlide(window.stage); 152 } 153 } 154 } 155 } 156 157 updateHash(); 158 159 //Listen history changes 160 $(window).on('popstate',function(e) { 161 setTimeout(function(){ 162 updateHash(); 163 },100); 164 e.preventDefault(); 165 }); 166 167 //Show Progress Bar 168 if (window.preload){ 169 var imgs = []; 170 $("*").each(function() { 171 var img_path; 172 if($(this).css("background-image") !== "none") { 173 img_path = $(this).css("background-image").replace(/.*\s?url\([\'\"]?/, '').replace(/[\'\"]?\).*/, ''); 174 } else if ($(this).is('img')){ 175 img_path = $(this).attr("src"); 176 } 177 // if( !/(linear-|data:).+/.test(img_path) ) 178 if( img_path && !/(repeating-)?(linear|radial)-gradient.+/.test(img_path) ) 179 imgs.push(img_path); 180 }); 181 182 window.images = imgs.length; 183 window.progressBar = $('.progress-bar'); 184 185 //preload images (sort of)
186 $.cacheImage(imgs, { complete: function () { 187 window.loadingProgress++; 188 updateProgressBar(); 189 }}); 190 191 //show progress 192 function updateProgressBar(){ 193 194 //loading 195 var progress = window.loadingProgress/window.images; 196 197 // animate 198 window.progressBar.css('width',progress * 100 + "%"); 199 200 if (window.loadingProgress == window.images) { 201 window.progressBar.addClass('loaded'); 202 } 203 } 204 205 updateProgressBar(); 206 } 207 208 //Initiate slide 209 showSlide(window.stage); 210 211 //On page load 212 if (!window.preload || !window.images || window.loaded) { 213 runTheCode(); 214 } 215 216 if (!window.loaded) { 217 $(window).on('load', function(){ 218 runTheCode(); 219 }); 220 } 221 222 function runTheCode(){ 223 $html.addClass('page-loaded'); 224 window.inAction = 0; 225 window.blockScroll = 0; 226 window.loaded = 1; 227 228 setTimeout(function(){ 229 if (window.isScroll){ 230 updateScroll(); 231 updateNavigation(); 232 } if (window.isMobile && window.isSimplifiedMobile){ 233 $('.slide').addClass('selected animate active'); 234 updateScroll(); 235 updateNavigation(); 236 } else { 237 showSlide(window.stage); 238 } 239 },500); 240 } 241 242 243 244 245 246 247 248 249/*** 250 * _____ _ _ _ _____ _ 251 * / ____| (_) | | / ____| | 252 * | (___ | |_ __| | ___ | | | |__ __ _ _ __ __ _ ___ 253 * \___ \| | |/ _` |/ _ \ | | | '_ \ / _` | '_ \ / _` |/ _ \ 254 * ____) | | | (_| | __/ | |____| | | | (_| | | | | (_| | __/ 255 * |_____/|_|_|\__,_|\___| \_____|_| |_|\__,_|_| |_|\__, |\___| 256 * __/ | 257 * Slide Appearance Manager |___/ 258 */ 259 260 function showSlide(requested){ 261 262 requested = parseInt(requested); 263 264 if ( window.isMobile && window.isSimplifiedMobile || window.isScroll ){ 265 return; 266 } 267 268 updateNavigation(); 269 270 var newSlide = $('.slide').eq(requested - 1), 271 currenSlide = $('.slide.selected'), 272 currenSlideIndex = currenSlide.index('.slide') + 1; 273 274 //cleanup 275 hideDropdown(); 276 unzoomImage(); 277 hideSidebar(); 278 window.allowSlide = 1; 279 280 //reset 281 $body.removeClass('sidebarShown lastSlide firstSlide hidePanel-top hidePanel-bottom'); 282 283 //It it first or last stage? 284 if (window.setStageClasses != 0) { 285 if (window.stage === 1){ 286 $body.addClass('firstSlide'); 287 } 288 if ((window.stages === window.stage)&&(window.stages !== 1)) { 289 $body.addClass('lastSlide'); 290 } 291 292 $body.removeClassByPrefix("stage-").addClass('stage-'+window.stage); 293 } 294 295 //white slide? 296 if ( newSlide.hasClass('whiteSlide') ){ 297 $body.addClass('whiteSlide'); 298 } else { 299 $body.removeClass('whiteSlide'); 300 } 301 302 //prepare slides for transporting 303 if (currenSlideIndex !== requested && window.setStageClasses != 0){ 304 currenSlide.removeClass('selected').addClass('active'); 305 newSlide.removeClass('before after').addClass('selected active'); 306 307 //set order 308 newSlide.prevAll('.slide').addClass('before').removeClass('after'); 309 newSlide.nextAll('.slide').addClass('after').removeClass('before'); 310 311 //set a trigger 312 $(window).trigger("slideChange", [parseInt(requested), newSlide]); 313 } 314 315 //set hash 316 if (window.setHashLink){ 317 if (newSlide.attr('data-name') || newSlide.attr('id')) { 318 window.location.hash = (newSlide.attr('data-name')) ? newSlide.attr('data-name') : newSlide.attr('id'); 319 } else if ((window.location.toString().indexOf('#')>0)&&(location.protocol !== "file:")&&(location.href.split('#')[0])){ 320 if (history.pushState) { 321 window.history.pushState("", "", location.href.split('#')[0]); 322 } else { 323 window.location.hash = ""; 324 } 325 } 326 } 327 328 //prepare to show slide 329 newSlide.find('.content, .container').scrollTop(0); 330 331 if (window.loaded){ 332 //wait for animation 333 window.blockScroll = 1; 334 335 setTimeout(function(){ 336 if (currenSlideIndex !== requested){ 337 if (window.animationLoop === 0) { 338 currenSlide.removeClass('active'); 339 } else { 340 currenSlide.removeClass('active animate'); 341 } 342 } 343 344 //avoid accident scrolls 345 window.blockScroll = 0; 346 },window.effectSpeed); 347
348 if (window.effectOffset > window.slideSpeed) { window.effectOffset = window.slideSpeed; } 349 350 setTimeout(function(){ 351 newSlide.addClass('animate'); 352 },window.slideSpeed - window.effectOffset); 353 354 355 //clear element animation on done 356 if (window.animationLoop != 0) { 357 $('.done').removeClass('done'); 358 } 359 360 $(".slide.selected [class*='ae-']").one('webkitTransitionEnd oTransitionEnd msTransitionEnd transitionend', function(){ 361 var $this = $(this); 362 setTimeout(function(){ $this.addClass("done"); },window.effectOffset); 363 }); 364 } 365 //end showSlide(); 366 } 367 368 //remove animation from a clickable element 369 $(".animated").on("click", "[class*='ae-']:not('.done')", function(){ $(this).addClass('done'); }); 370 371 //Change slide 372 window.changeSlide = function(n){ 373 if (n === "increase"){ 374 if ((window.stage + 1) >= window.stages){ 375 n = window.stages; 376 } else { 377 n = window.stage + 1; 378 } 379 } else if (n === "decrease"){ 380 if ((window.stage - 1) < 1){ 381 n = 1; 382 } else { 383 n = window.stage - 1; 384 } 385 } 386 387 if ( window.isMobile && window.isSimplifiedMobile || window.isScroll ){ 388 window.stage = n; 389 var requestedElement = $('.slide:eq('+ (window.stage - 1) +')'), 390 finalPosition = $(requestedElement).offset().top; 391 392 $('html,body').stop().clearQueue().animate({scrollTop:finalPosition},window.effectSpeed); 393 } else { 394 if ((n !== window.stage)&&( n <= window.stages)){ 395 if (window.inAction !== 1){ 396 window.inAction = 1; 397 window.stage = n; 398 399 var delay = 0; 400 if ($('.zoom-overlay-open').length > 0) { 401 unzoomImage(); 402 delay = 550; 403 } 404 405 setTimeout(function(){ 406 showSlide(window.stage); 407 setTimeout(function(){ window.inAction = 0; }, window.slideSpeed); 408 }, delay); 409 } 410 } 411 } 412 }; 413 414 $('.nextSlide').on('click', function(){ 415 window.changeSlide('increase'); 416 }); 417 418 $('.prevSlide').on('click', function(){ 419 window.changeSlide('decrease'); 420 }); 421 422 $('.toFirstSlide').on('click', function(){ 423 window.changeSlide(1); 424 if (history.pushState) { 425 window.history.pushState("", "", location.href.split('#')[0]); 426 } else { 427 window.location.hash = ""; 428 } 429 430 hideSidebar(); 431 }); 432 433 $('.toLastSlide').on('click', function(){ 434 window.changeSlide(window.stages); 435 if (history.pushState) { 436 window.history.pushState("", "", location.href.split('#')[0]); 437 } else { 438 window.location.hash = ""; 439 } 440 hideSidebar(); 441 }); 442 443 $('[class*="toSlide-"]').on('click', function(){ 444 var num = parseInt($(this).attr('class').split('toSlide-')[1].split(' ')[0]); 445 window.changeSlide(num); 446 hideSidebar(); 447 }); 448 449 //zoom out image 450 function unzoomImage(type){ 451 if ($('.zoom-overlay-open').length > 0){ 452 $('.zoom-img').click(); 453 454 if (type) { 455 $('.zoom-img-wrap, .zoom-overlay').remove(); 456 } 457 } 458 } 459 460 //set 461 $(window).on('resize load ready',function(){ 462 //cleanup after image zoom 463 $('[data-action="zoom"]').removeAttr('style'); 464 if ($('.zoom-overlay').length > 0){ 465 unzoomImage('fast'); 466 } 467 468 //common stuff 469 window.windowHeight = $(window).height(); 470 window.windowWidth = $(window).width(); 471 window.documentHeight = $(document).height(); 472 }); 473 474 475 476 477 478 479 480 481/*** * 482 * | | | 483 * | 484 * _____ * _ _ 485 * / ____| | | | | 486 * | (___ ___ _ __ ___ | | | 487 * \___ \ / __| '__/ _ \| | | 488 * ____) | (__| | | (_) | | | 489 * |_____/ \___|_| \___/|_|_| 490 * 491 * Scrolling 492 */ 493 494 var eventCount = 0, 495 eventCountStart; 496 497 $('html,body').on('DOMMouseScroll mousewheel scroll touchmove', function(event){ 498 var $currentSection = $('.slide.selected .content'), 499 scrollsize = Math.ceil(Math.abs(event.deltaY) * event.deltaFactor), 500 browserScrollRate = (window.isFirefox) ? 2 : 1, 501 OSScrollRate = (window.isWindows) ? browserScrollRate * 2 : browserScrollRate, 502 wheelDelta = (event.originalEvent.wheelDelta) ? event.originalEvent.wheelDelta : event.deltaY * event.deltaFactor, 503 energy = wheelDelta * browserScrollRate * OSScrollRate, 504 scrollDirection = (event.deltaY >= 0) ? "up" : "down", 505 curSecScrolltop = $currentSection.scrollTop(), 506 currentSectionHeight = $currentSection.find('.container').outerHeight(), 507 deviceZoom = detectZoom.device(), 508 minScrollToSlide = (window.isFirefox && window.isWindows) ? 200 : window.minScrollToSlide; 509 510 //skip empty events 511 if (!scrollsize) return; 512 513 //scroll mode 514 if (window.isScroll && ((!window.sidebarShown)&&(!window.popupS
514hown)&&(!window.blockScroll))) { 515 516 //smooth scroll 517 if (window.smoothScroll && !window.isMobile){ 518 519 //lock default scroll 520 //event.preventDefault(); 521 522 if (energy > 1500) { energy = 1500; } 523 if (energy < -1000) { energy = -1500; } 524 525 var scrollObject = $(window), 526 scrollTop = scrollObject.scrollTop(), 527 finalScroll = scrollTop - energy; 528 529 TweenLite.to(scrollObject, window.scrollSpeed, { 530 scrollTo : { y: finalScroll, autoKill:false }, 531 ease: Power4.easeOut, 532 overwrite: "all" 533 }); 534 535 } else { 536 if (!window.isWindows){ 537 $currentSection.scrollTop(curSecScrolltop - energy); 538 } 539 } 540 } 541 542 //slide mode 543 if ( !window.isScroll && !(window.isMobile && window.isSimplifiedMobile)){ 544 545 // scroll oversized content 546 if ((currentSectionHeight > window.windowHeight)){ 547 548 if ((( scrollDirection === "up" ) && ( $currentSection.scrollTop() === 0 )) || (( scrollDirection === "down" ) && ( $currentSection.scrollTop() + window.windowHeight >= Math.floor(currentSectionHeight / deviceZoom) ))){ 549 window.allowSlide = 1; 550 } else { 551 window.allowSlide = 0; 552 } 553 554 //hide panels on scroll 555 if (window.panelsToHide) { 556 if (scrollDirection === "down" && $currentSection.scrollTop() > 0) { 557 $body.addClass('hidePanel-top'); 558 } else if (scrollDirection === "up"){ 559 $body.removeClass('hidePanel-top'); 560 } 561 562 $body.addClass('hidePanel-bottom'); 563 564 if (scrollDirection === "down" && $currentSection.scrollTop() + window.windowHeight >= Math.floor(currentSectionHeight / deviceZoom)) { 565 $body.removeClass('hidePanel-bottom'); 566 } else if (scrollDirection === "up"){ 567 $body.addClass('hidePanel-bottom'); 568 } 569 } 570 571 if ((!window.sidebarShown)&&(!window.popupShown)&&(!window.blockScroll)) { 572 573 if (window.smoothScroll){ 574 //lock default scroll 575 //event.preventDefault(); 576 577 //smooth scroll 578 if (energy > 1500) { energy = 1500; } 579 if (energy < -1000) { energy = -1500; } 580 581 TweenLite.to($currentSection, 0.5, { 582 scrollTo : { y: curSecScrolltop - energy, autoKill:false }, 583 ease: Power4.easeOut, 584 overwrite: 5 585 }); 586 587 } else { 588 curSecScrolltop = (scrollDirection === "up") ? curSecScrolltop - scrollsize : curSecScrolltop + scrollsize; 589 $currentSection.scrollTop(curSecScrolltop); 590 } 591 } 592 //end scroll oversized content 593 } 594 595 if (window.allowSlide && scrollsize) { 596 if (scrollDirection == "down") { 597 window.collectScrolls = window.collectScrolls + scrollsize; 598 } else { 599 window.collectScrolls = window.collectScrolls - scrollsize; 600 } 601 602 setTimeout(function(){ 603 window.collectScrolls = 0; 604 },200); 605 } 606 607 //change slide on medium user scroll 608 if ((Math.abs(window.collectScrolls) >= minScrollToSlide) && (window.allowSlide) && (!window.sidebarShown) && (!window.popupShown) && (!window.disableOnScroll)){ 609 610 window.collectScrolls = 0; 611 612 //should we even.. 613 if ((scrollDirection === "down" && window.stage !== window.stages)||(scrollDirection === "up" && window.stage !== 1)){ 614 615 //ok let's go 616 if (window.inAction !== 1){ 617 if (scrollDirection === "down"){ 618 window.changeSlide('increase'); 619 } else { 620 window.changeSlide('decrease'); 621 } 622 } 623 } 624 } 625 } 626 //end on mousewheel event 627 }); 628 629 //scroll or simplified mobile 630 if ( (window.isMobile && window.isSimplifiedMobile) || window.isScroll ){ 631 $(window).on('DOMMouseScroll mousewheel scroll touchmove load', function(){ 632 if (window.updateScroll != 0) updateScroll(); 633 }); 634 } 635 636 //Hide share with delay 637 var hideDropdownOnScrollDelay = 0; 638 639 function updateScroll(){ 640 641 //Hide dropdown 642 hideDropdownOnScrollDelay++; 643 if (hideDropdownOnScrollDelay >= 2){ 644 hideDropdown();
645 hideDropdownOnScrollDelay = 0; 646 } 647 648 $('.slide').each(function(index, element) { 649 650 var $element = $(element), 651 elementIndex = $element.index('.slide'), 652 scrollTop = $(document).scrollTop(), 653 positionY = $element.offset().top, 654 elementHeight = $element.height(), 655 halfWay = (window.windowHeight/2 > elementHeight) ? elementHeight/2 : window.windowHeight/2, 656 halfOnScreen = ((positionY < (window.windowHeight + scrollTop - halfWay)) && (positionY > (scrollTop - elementHeight + halfWay))), 657 scale = (((scrollTop + window.windowHeight) - positionY) / (window.windowHeight + elementHeight) - 0.5) * 2, 658 allowToSelect = true; 659 660 //checking first slide 661 if (scrollTop === 0) { 662 if (index === 0) { 663 allowToSelect = true; 664 } else { 665 allowToSelect = false; 666 } 667 } 668 669 //checking last slide 670 if (scrollTop + window.windowHeight === window.documentHeight) { 671 if (index === window.stages - 1) { 672 allowToSelect = true; 673 } else { 674 allowToSelect = false; 675 } 676 } 677 678 if (window.setStageClasses != 0) { 679 if (halfOnScreen && allowToSelect) { 680 //set order 681 682 $element.prevAll('.slide').addClass('before').removeClass('after'); 683 $element.nextAll('.slide').addClass('after').removeClass('before'); 684 $element.addClass('selected animate active').removeClass('after before'); 685 686 if ((window.stage !== elementIndex + 1) || !window.firstTimeTrigger){ 687 window.stage = elementIndex + 1; 688 689 //set a trigger 690 $(window).trigger("slideChange", [window.stage, $element]); 691 692 if (window.stage === 1){ 693 $body.addClass('firstSlide'); 694 } else { 695 $body.removeClass('firstSlide'); 696 } 697 698 if (window.stages === window.stage) { 699 $body.addClass('lastSlide'); 700 } else { 701 $body.removeClass('lastSlide'); 702 } 703 $body.removeClassByPrefix("stage-").addClass('stage-'+window.stage); 704 705 //white slide? 706 if ($element.hasClass('whiteSlide')){ 707 $body.addClass('whiteSlide'); 708 } else { 709 $body.removeClass('whiteSlide'); 710 } 711 712 if (window.isAnimated == "auto") { 713 //clearTimeout(window.clearElementAnimation); 714 window.clearElementAnimation = setTimeout(function(){ 715 $element.find("[class*='ae-']").addClass('done'); 716 }, window.effectSpeed + window.cleanupDelay); 717 } 718 } 719 720 if (!window.firstTimeTrigger){ 721 window.firstTimeTrigger = 1; 722 $(window).trigger("slideChange", [window.stage, $element]); 723 } 724 725 } else { 726 $element.removeClass('selected'); 727 } 728 729 updateNavigation(); 730 } 731 732 //Parallax background 733 if (!window.isMobile || window.isMobile && window.allowParallaxOnMobile) { 734 if ((scale > -1 && scale < 1)) { 735 736 if ($element.hasClass('parallax') || $element.find('.parallax-element')){ 737 738 $element.find('.parallax-element').each(function() { 739 var $el = $(this), 740 velocity = parseInt($el.data('parallax-velocity')) ? parseInt($el.data('parallax-velocity')) : 50, 741 precentage = scale * velocity; 742 743 if (velocity > 100) velocity = 100; 744 $el.css('-webkit-transform',"translate3d(0, " + precentage + "%, 0)").css('transform',"translate3d(0, " + precentage + "%, 0)"); 745 }); 746 } 747 } 748 } 749 }); 750 751 //Animate elements on Scroll 752 if (window.isAnimated == "animateOnEvent") { 753 754 if (!window.preload) { 755 $("[class*='ae-']:not(.done):not(.do)").each(function(i, element) { 756 var $ae = $(element); 757 if (isElementInView($ae)) { 758 $ae.addClass("do").one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function(){ 759 $(this).removeClass("do").addClass("done"); 760 }); 761 } else { 762 if (window.animationLoop == 1) { 763 if (!isElementInView($ae)) { 764 $ae.removeClass('done do'); 765 } 766 } 767 } 768 }); 769 } else if (window.loaded){ 770 $("[class*='ae-']").each(function(i, element) { 771 var $ae = $(element); 772 if (isElementInView($ae)) { 773 $ae.addClass("do").one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function(){ 774 $(this).removeClassByPrefix('ae-').removeClass("do").addClass("done"); 775 }); 776 } 777 }); 778 } 779 } 780 } 781 782 function isElementInView(element) { 783 var pageTop = $(window).scrollTop(), 784 $element = $(element), 785 elementHeight = $element.height(), 786 pageBottom = pageTop + window.windowHeight, 787 elementTop = $element.offset().top, 788 elementBottom = elementTop + elementHeight; 789 790 if (elementHeight >= window.windowHeight/5) { 791 return (pageBottom >= elementTop + elementHeight/5); 792 } else { 793 return ((pageTop < elementTop) && (pageBottom > elementBottom)); 794 } 795 } 796 797 798 799 800 801 802 803 804 805 806/*** 807 * _____ 808 * / ____| (*) 809 * | (_____ ___ _ __ ___ 810 * \___ \ \ /\ / / | '_ \ / _ \ 811 * ____) \ V V /| | |_) | __/ 812 * |_____/ \_/\_/ |_| .__/ \___| 813 * | | 814 * |_| 815 * 816 * Swipes for mobile devices 817 */ 818 819 820 $('.mobile .slides:not(.scroll):not(.simplifiedMobile), .slides.desktopSwipe').swipe({ 821 swipeStatus:function(event, phase, direction, distance){ 822 823 window.allowSwipeUp = 1; 824 window.allowSwipeDown = 1; 825 826 //set height for current slide 827 var $currentSection = $('.slide.selected .content'), 828 currentSectionHeight = Math.floor($currentSection.find('.container').outerHeight()), 829 next = "up", 830 prev = "down", 831 minSwipeToSlide = window.minSwipeToSlide, 832 windowHeight = window.innerHeight; 833 834 if (window.sidebarShown){ 835 $currentSection = $('.sidebar .content'); 836 } 837
838 if (window.popupShown){ 839 $currentSection = $('.popup .content'); 840 } 841 842 if (phase === "start") { 843 window.scrollTop = $currentSection.scrollTop(); 844 } 845 846 //horizontal mode 847 if (window.horizontalMode){ 848 next = "left"; 849 prev = "right"; 850 } 851 852 //lock slide 853 if ( !window.horizontalMode && ( currentSectionHeight > windowHeight) ){ 854 if (window.scrollTop + windowHeight < currentSectionHeight){ 855 window.allowSwipeUp = 0; 856 } 857 if (window.scrollTop > 0) { 858 window.allowSwipeDown = 0; 859 } 860 } 861 862 if (!window.sidebarShown && !window.disableOnSwipe) { 863 if (window.horizontalMode){ 864 if (direction === next && distance > minSwipeToSlide){ 865 window.changeSlide('increase'); 866 } else if (direction === prev && distance > minSwipeToSlide){ 867 window.changeSlide('decrease'); 868 } 869 } else { 870 if (direction === next && distance > minSwipeToSlide && window.allowSwipeUp && window.allowSlide){ 871 window.changeSlide('increase'); 872 } else if (direction === prev && distance > minSwipeToSlide && window.allowSwipeDown && window.allowSlide){ 873 window.changeSlide('decrease'); 874 } 875 } 876 } 877 }, 878 maxTimeThreshold:0, 879 fingers:'all', 880 allowPageScroll:"vertical" 881 }); 882 883 $('.slides.desktopSwipe *').on('click',function(){ 884 $(this).addClass('selectable'); 885 }); 886 887 888 889 890 891 892 893 894/*** 895 * _____ _ 896 * | __ \ | | 897 * | |__) |_ _ _ __ ___| |___ 898 * | ___/ _` | '_ \ / _ \ / __| 899 * | | | (_| | | | | __/ \__ \ 900 * |_| \__,_|_| |_|\___|_|___/ 901 * 902 * Responsive Panels 903 */ 904 905 if($('.panel .compact').length > 0){ 906 907 $('.panel .compact').each(function(index, element) { 908 var panel = $(element).parents('.panel'), 909 desktop = $(panel).find('.desktop'), 910 compact = element, 911 forceMobileView = $(panel).hasClass('forceMobileView'); 912 913 $(window).on('load resize ready',function(){ 914 915 var documentWidth = $(document).width(), 916 panelsPadding = parseInt($(panel).css('padding-left').replace('px','')) + parseInt($(panel).css('padding-right').replace('px','')); 917 918 if ((window.isMobile || $(document).width() < 767) && forceMobileView) { 919 920 $(desktop).addClass('hidden'); 921 $(compact).removeClass('hidden'); 922 923 } else { 924 925 $(desktop).removeClass('hidden'); 926 $(compact).addClass('hidden'); 927 928 var totalWidth = 0; 929 930 desktop.children().each(function(){ 931 if ( $(this).outerWidth() > $(this).children().outerWidth() ){ 932 totalWidth += Math.round($(this).outerWidth()); 933 } else { 934 totalWidth += Math.round($(this).children().outerWidth()); 935 } 936 }); 937 938 // if width of space is not enough or we are on mobile 939 if ((totalWidth + Math.round(panelsPadding) > documentWidth + 2 ) || ((window.isMobile || documentWidth < 767) && forceMobileView)) { 940 $(desktop).addClass('hidden'); 941 $(compact).removeClass('hidden'); 942 } else { 943 $(desktop).removeClass('hidden'); 944 $(compact).addClass('hidden'); 945 } 946 } 947 948 }); 949 950 }); 951 } 952 953 //HIDE PANELS ON SCROLL 954 if ($('.panel.hideOnScroll').length > 0) { 955 window.panelsToHide = true; 956 957 if (window.isScroll || window.isSimplifiedMobile){ 958 var lastScrollTop, 959 i = 0, 960 sensitivity = window.hideOnScrollSensitivity ? window.hideOnScrollSensitivity : 100, 961 panelToHide = $('.panel.hideOnScroll'); 962 963 //hide if height larger than screen size 964 $(window).on('mousewheel', function(event) { 965 var scrollTop = $(this).scrollTop(), 966 $panelToHide = $(panelToHide), 967 scrollSize = Math.ceil(Math.abs(event.deltaY) * event.deltaFactor); 968 969 if (scrollTop > lastScrollTop) { 970 i += scrollSize; 971 if (i >= sensitivity) { 972 $panelToHide.addClass('hide'); 973 i = sensitivity; 974 } 975 } else { 976 i -= scrollSize; 977 if (i <= sensitivity/5) { 978 i = 0; 979 $panelToHide.removeClass('hide'); 980 } 981 } 982 lastScrollTop = scrollTop; 983 984 //show on top and bottom 985 if ((scrollTop + window.windowHeight + sensitivity >= window.documentHeight) || (scrollTop + sensitivity <= 0)) { 986 $panelToHide.removeClass('hide'); 987 } 988 }); 989 } 990 } 991 992 //scroll on mobile 993 if (window.isMobile) { 994 995 var $currentSection = window.isScroll ? $(document) : $('.slide .content'), 996 currentSectionHeight = $currentSection.find('.container').outerHeight(), 997 lastScroll = 0, 998 scrollHeight = Math.max( 999 document.body.scrollHeight, document.documentElement.scrollHeight, 1000 document.body.offsetHeight, document.documentElement.offsetHeight, 1001 document.body.clientHeight, document.documentElement.clientHeight 1002 ), 1003 hidePanelTop = $('.panel.top.hideOnScroll'), 1004 hidePanelBottom = $('.panel.bottom.hideOnScroll'); 1005 1006 $currentSection.on('scroll', function(event){ 1007 1008 if (window.inAction) return; 1009 1010 var $currentSection = $(this), 1011 scrollTop = $(this).scrollTop(), 1012 scrollDirection = (scrollTop > lastScroll) ? "down" : "up"; 1013 1014 if (scrollDirection === "down" && $currentSection.scrollTop() > 0) { 1015 if (hidePanelTop) $body.addClass('hidePanel-top'); 1016 if (hidePanelBottom) $body.addClass('hidePanel-bottom'); 1017 } else if (scrollDirection === "up"){ 1018 $body.removeClass('hidePanel-top hidePanel-bottom'); 1019 } 1020 1021 lastScroll = scrollTop; 1022 }); 1023 } 1024 1025 1026 1027 1028 1029 1030 1031 1032/*** 1033 * _ __ 1034 * | |/ / 1035 * | ' / ___ _ _ ___ 1036 * | < / _ \ | | / __| 1037 * | . \ __/ |_| \__ \ 1038 * |_|\_\___|\__, |___/ 1039 * __/ | 1040 * |___/ 1041 * 1042 * Listen the Keys 1043 */ 1044 1045 $(document).on("keydown",function(e){ 1046 var delta = 2.5, 1047 scrollTime = 0.3, 1048 scrollDistance = 50, 1049 $currentSection = $('.slide.selected .content'), 1050 scrollTop = $currentSection.scrollTop(), 1051 finalScroll = scrollTop + parseInt(delta * scrollDistance); 1052 1053 if (window.disableKeyNavigation || e.target.nodeName.toLowerCase() == 'input' || e.target.nodeName.toLowerCase() == 'textarea') { 1054 return; 1055 } 1056 1057 /* [ â ] & [ PgUp ] */ 1058 if (e.keyCode === 37 || e.keyCode === 33){ 1059 e.preventDefault(); 1060 if (window.horizontalMode){ window.changeSlide('decrease'); } 1061 } 1062 1063 /* [ â ] & [ PgUp ] */ 1064 if (e.keyCode === 38 || e.keyCode === 33){ 1065 if (!window.horizontalMode){ 1066 e.preventDefault(); 1067 window.changeSlide('decrease'); 1068 } else { 1069 e.preventDefault(); 1070 TweenLite.to($currentSection, window.scrollSpeed, { 1071 scrollTo : { y: finalScroll, autoKill:true }, 1072 ease: Power4.easeOut, 1073 overwrite: 5 1074 }); 1075 } 1076 } 1077 1078 /* [ â ] & [ PgDwn ] */ 1079 if (e.keyCode === 39 || e.keyCode === 34){ 1080 if (window.horizontalMode){ 1081 e.preventDefault(); 1082 window.changeSlide('increase'); 1083 } 1084 } 1085 1086 /* [ â ] & [ PgDwn ] */ 1087 if (e.keyCode === 40 || e.keyCode === 34){ 1088 if (!window.horizontalMode) { 1089 e.preventDefault(); 1090 window.changeSlide('increase'); 1091 } else { 1092 e.preventDefault(); 1093 TweenLite.to($currentSection, window.scrollSpeed, { 1094 scrollTo : { y: finalScroll, autoKill:true }, 1095 ease: Power4.easeOut, 1096 overwrite: 5 1097 }); 1098 } 1099 } 1100 1101 /* [ esc ] */ 1102 if (e.keyCode === 27){ 1103 hideSidebar(); 1104 hideDropdown(); 1105 hidePopup(); 1106 unzoomImage(); 1107 } 1108 }); 1109 1110 1111 1112 1113 1114 1115 1116 1117/*** 1118* _ _ _ 1119* | \ | | (*) | | (*) * 1120* | \| | __ ___ ___ __ _ __ _| |_ _ ___ _ __ * 1121* | . ` |/ _` \ \ / | |/ _` |/ _` | __| |/ _ \| '_ \ (*) [Tooltip] 1122* | |\ | (_| |\ V /| | (_| | (_| | |_| | (_) | | | | * 1123* |_| \_|\__,_| \_/ |_|\__, |\__,_|\__|_|\___/|_| |_| * 1124* __/ | 1125* /___/ 1126* 1127* Generate Navigation Dots and Tootlips 1128*/ 1129 1130 1131 1132 var navParent = $('.navigation'), 1133 navigation = $(navParent).find('ul'), 1134 slidesNumber = $('.slide:not(.exclude)').length; 1135 1136 if ($(navigation).length > 0) { 1137 1138 if ($(navigation).is(':empty')) { 1139 1140 $(navigation).each(function(index, element) { 1141 for (var i = 1; i <= slidesNumber; i++){ 1142 1143 // Add Tooltips 1144 var title = $('.slide:not(.exclude):eq('+(i - 1)+')').data('title'); 1145 if (title === undefined) { 1146 $(element).append('<li></li>'); 1147 } else { 1148 $(element).append('<li data-title="'+title+'"></li>'); 1149 } 1150 } 1151 }); 1152 } 1153 1154 //Navigation clicks 1155 $('.navigation li').on("click touchend", function(){ 1156 var thisIndes = $(this).index(), 1157 realIndex = $('.slide:not(.exclude):eq('+thisIndes+')').index('.slide'); 1158 1159 $(this).blur(); 1160 1161 window.changeSlide(realIndex + 1); 1162 }); 1163 1164 if (!$('.side').hasClass('compact')){ 1165 //Collapse sidemenu to compact 1166 $(window).on('load resize ready',function(){ 1167 var containerHeight = window.windowHeight - 140, 1168 container = $('.side').removeClass('compact').find('ul'), 1169 totalWidth = 0; 1170 1171 $(container).children().each(function(){ 1172 totalWidth += Math.round($(this).outerHeight(true)); 1173 }); 1174 1175 if (totalWidth > containerHeight){ 1176 $('.side').addClass('compact'); 1177 } else { 1178 $('.side').removeClass('compact'); 1179 } 1180 }); 1181 } 1182 } 1183 1184 //In-page #Navigation 1185 $("a[href^='#'][target!='_blank']").click(function(e){ 1186 1187 var url = $(this).attr('href'), 1188 hashLink = url.split('#')[1], 1189 requestedElement = hashLink ? $('.slide[id="' +hashLink+ '"], .slide[data-name="' +hashLink+ '"]') : $('.slide:eq(0)'); 1190 1191 if( requestedElement.length > 0 ){ 1192 1193 e.preventDefault(); 1194 1195 if ( window.isMobile && window.isSimplifiedMobile || window.isScroll ){ 1196 var target = requestedElement; 1197 if (target.length) { 1198 $('html,body').stop().clearQueue().animate({scrollTop:target.position().top},1000); 1199 } 1200 if (window.setHashLink){ 1201 window.location.hash = hashLink; 1202 } 1203 } else { 1204 window.stage = $('.slide').index(requestedElement) + 1; 1205 showSlide(window.stage); 1206 } 1207 hideSidebar(); 1208 } 1209 1210 }); 1211 1212 //Update Navigation 1213 function updateNavigation(){ 1214 setTimeout(function(){ 1215 if ( $(navigation).length > 0 ){ 1216 $(navigation).each(function(index, element) { 1217 $(element).find('li.selected').removeClass('selected'); 1218 1219 var $selectedSlide = $('.slide.selected'), 1220 parentSlide = parseInt($selectedSlide.data('parent-slide-id')), 1221 selectedIndex = $selectedSlide.index('.slide:not(.exclude)'); 1222 1223 if (selectedIndex !== -1) { 1224 $(element).find('li').eq(selectedIndex).addClass('selected'); 1225 } else if (parentSlide) {
1226 selectedIndex = $('.slide[data-slide-id="'+ parentSlide +'"]').index('.slide:not(.exclude)'); 1227 $(element).find('li').eq(selectedIndex).addClass('selected'); 1228 } 1229 }); 1230 } 1231 },100); 1232 } 1233 1234 1235 1236 1237 1238 1239 1240 1241/*** 1242* _____ _ _ _ 1243* / ____(_) | | | | 1244* | (___ _ __| | ___| |__ __ _ _ __ 1245* \___ \| |/ _` |/ _ \ '_ \ / _` | '__| 1246* ____) | | (_| | __/ |_) | (_| | | 1247* |_____/|_|\__,_|\___|_.__/ \__,_|_| 1248* 1249* Sidebar Panel 1250*/ 1251 1252 $('.sidebarTrigger[data-sidebar-id]').on('click', function(){ 1253 1254 var sidebarID = $(this).data('sidebar-id'); 1255 window.showSidebar(sidebarID); 1256 1257 }); 1258 1259 window.showSidebar = function(id){ 1260 var sidebarID = id, 1261 element = $('.sidebar[data-sidebar-id="' + sidebarID + '"]'), 1262 isAnimated = $(element).hasClass('animated'); 1263 1264 if (!window.sidebarShown){ 1265 if (element.length > 0) { 1266 window.sidebarShown = 1; 1267 window.allowSlide = 0; 1268 $(element).removeClass('animate active').addClass('visible'); 1269 $html.addClass('sidebarShown sidebar_' + sidebarID); 1270 $(element).find('.content').scrollTop(0); 1271 1272 if (isAnimated){ 1273 clearTimeout(window.removeAnimationTimeout); 1274 setTimeout(function(){ 1275 $(element).addClass('animate active'); 1276 },100); 1277 } 1278 } 1279 } else { 1280 hideSidebar(); 1281 } 1282 1283 //clean up 1284 hideDropdown(); 1285 }; 1286 1287 function hideSidebar(){ 1288 1289 if (window.sidebarShown){ 1290 $html.removeClass('sidebarShown').removeClassByPrefix('sidebar_'); 1291 var $sidebar = $('.sidebar.visible'); 1292 $sidebar.removeClass('visible'); 1293 1294 window.removeAnimationTimeout = setTimeout(function(){ 1295 $sidebar.removeClass('animate active').find('.done').removeClass('done'); 1296 },500); 1297 window.sidebarShown = 0; 1298 window.allowSlide = 1; 1299 } 1300 1301 } 1302 1303 //Hide on click outside 1304 $(document).on('mouseup touchstart', function (e){ 1305 var container = $(".sidebarShown .sidebar, .dropdownTrigger"), 1306 clickTarget = e.target; 1307 1308 if (!container.is(clickTarget) && container.has(clickTarget).length === 0 && window.hideSidebarOnBodyClick && $(clickTarget).hasClass('ignoreBodyClick') === false) { 1309 hideSidebar(); 1310 } 1311 $(window).trigger('sidebarHidden'); 1312 }); 1313 1314 //Hide on .close Click 1315 $('.sidebar .close, .sidebar [data-sidebar-action="close"]').on('click touchstart', function(){ 1316 hideSidebar(); 1317 }); 1318 1319 1320 1321 1322 1323 1324 1325 1326/*** 1327* _____ __ 1328* | __ \ _ _ _ __ | |_ 1329* | |__) ___ _ __ | | | | '_ \ |__| | 1330* | ___/ _ \| '_ \| | | | |_) | |__| 1331* | | | (_) | |_) \__,_| .__/ 1332* |_| \___/| .__/ | | 1333* | | |_| 1334* PopUp |_| 1335*/ 1336 1337 1338 $('.popupTrigger[data-popup-id]').on('click', function(){ 1339 var popupID = $(this).data('popup-id'), 1340 focusOnID = $(this).data('popup-focus-input'); // ID of input to focus on after showing popup 1341 if(typeof(focusOnID)!="string" && focusOnID!=""){ 1342 focusOnID = false; 1343 } 1344 window.showPopup(popupID, focusOnID); 1345 }); 1346 1347 window.showPopup = function(id, focusOn){ 1348 var popupID = id, 1349 focusOnID = focusOn, 1350 element = $('.popup[data-popup-id="' + popupID + '"]'), 1351 isAnimated = element.hasClass('animated'); 1352 1353 if (element.length > 0) { 1354 hideSidebar(); 1355 $(element).addClass('visible'); 1356 1357 //set a trigger
1358 $(window).trigger('popupShown'); 1359 1360 var animatePopup = async function (){ 1361 var promise = new Promise((resolve, reject) => { 1362 if (isAnimated){ 1363 setTimeout(function(){ 1364 $(element).addClass('animate active'); 1365 1366 clearTimeout(window.clearPopupElementAnimation); 1367 window.clearPopupElementAnimation = setTimeout(function(){ 1368 $(element).find("[class*='ae-']").addClass('done'); 1369 resolve("done"); 1370 }, window.effectSpeed + window.cleanupDelay); 1371 },100); 1372 }else{ 1373 resolve("done"); 1374 } 1375 }); 1376 return await promise; 1377 } 1378 1379 animatePopup().then(function(){ 1380 if(focusOnID){ 1381 $(element).find("#"+focusOnID).focus(); 1382 } 1383 }); 1384 1385 $html.addClass('popupShown popup_' + popupID); 1386 $(element).find('.content').scrollTop(0); 1387 window.allowSlide = 0; 1388 1389 //Add Popup ID in the stack 1390 if (!window.popupShown) window.popupShown = []; 1391 window.popupShown.push(popupID); 1392 1393 //Autoplay Iframe, replace data-src to src 1394 var $element = $(element), 1395 iframe = $element.find('iframe'), 1396 HTML5video = $element.find('video'); 1397 1398 if ( iframe.length > 0 ) { 1399 var iframeSrc = $(iframe).attr('src') ? $(iframe).attr('src') : $(iframe).data('src'), 1400 symbol = (iframeSrc.indexOf('?') > -1) ? "&" : "?"; 1401 1402 if ($(element).hasClass('autoplay')){ 1403 $(iframe).attr('src',iframeSrc + symbol + "autoplay=1"); 1404 }else{ 1405 if(!$(iframe).attr('src')){ 1406 $(iframe).attr('src',iframeSrc); 1407 } 1408 } 1409 } else if (HTML5video.length > 0){ 1410 if($(HTML5video).find("source[data-src]").length > 0){ 1411 $(HTML5video).find("source").each(function(){ 1412 if(!$(this).attr('src')){ 1413 $(this).attr('src',$(this).data('src')); 1414 } 1415 }); 1416 $(HTML5video)[0].load(); 1417 } 1418 if ($(element).hasClass('autoplay')){ 1419 $(HTML5video)[0].play(); 1420 } 1421 } 1422 } 1423 1424 //clean up 1425 hideDropdown(); 1426 }; 1427 1428 function hidePopup(popupID) { 1429 popupID = typeof popupID !== 'undefined' ? popupID : false; 1430 1431 if ( $.isArray(window.popupShown) ){ 1432 1433 var popupToHide = popupID ? popupID : window.popupShown.slice(-1)[0], 1434 $element = $('.popup.visible[data-popup-id="' + popupToHide + '"]'), 1435 iframe = $element.find('iframe'), 1436 video = $element.find('video'); 1437 1438 //stop iframe autoplay 1439 if (iframe.length > 0 && $element.hasClass('autoplay')) { 1440 $(iframe).each(function(n, element){ 1441 var iframeSrc = $(element).attr('src'), 1442 symbol = (iframeSrc.indexOf('?autoplay') > -1) ? "?" : "&"; 1443 1444 $(element).attr('src', $(element).attr('src').replace(symbol+'autoplay=1','')); 1445 }); 1446 } 1447 1448 //stop videos 1449 if (video.length > 0) { 1450 $(video).each(function(n, element){ 1451 $(element)[0].pause(); 1452 $(element)[0].currentTime = 0; 1453 }); 1454 } 1455 1456 //clear element animation on done 1457 clearTimeout(window.clearPopupElementAnimation); 1458 $element.addClass('hidePopup'); 1459 $(window).trigger('popupHidden'); 1460 1461 setTimeout(function(){ 1462 window.allowSlide = 1; 1463 1464 $element.removeClass('visible animate active hidePopup').removeAttr('style').find('.done').removeClass('done'); 1465 $html.removeClass('popup_' + popupToHide); 1466 1467 //remove last shown id 1468 if($.isArray(window.popupShown)) { 1469 var i = window.popupShown.indexOf(popupToHide); 1470 if(i != -1) { 1471 window.popupShown.splice(i, 1); 1472 } 1473 } 1474 1475 if (window.popupShown.length <= 0) { 1476 $html.removeClass('popupShown'); 1477 window.popupShown = false; 1478 } 1479 }, 500); 1480 } 1481 } 1482 1483 //Hide on body click 1484 if (window.hidePopupOnBodyClick){ 1485 var isPopupOnMousePressed = false; 1486 $(document).on("mousedown", function (e){ 1487 if($(e.target).closest(".popupShown .popup .popupContent, .popupTrigger").length){ 1488 isPopupOnMousePressed = true; 1489 }else{ 1490 isPopupOnMousePressed = false;
1491 } 1492 }); 1493 $(document).on('click', function (e){ 1494 var container = $(".popupShown .popup .popupContent, .popupTrigger"); 1495 if (!container.is(e.target) && container.has(e.target).length === 0 && container.length > 0 && !isPopupOnMousePressed) { 1496 hidePopup(); 1497 } 1498 }); 1499 } 1500 1501 //Hide on .close Click 1502 $('.popup [data-popup-action="close"]').on('click', function(){ 1503 hidePopup($(this).parents('.popup').data('popup-id')); 1504 }); 1505 1506 //Set hash link on popup reveal (works only with window.setHashLink = 0); 1507 if (window.setPopupHash) { 1508 //Set hash on click 1509 $('.popupTrigger[data-popup-id]').on('click', function(){ 1510 var hash = $(this).attr('data-popup-id'); 1511 window.location.hash = "#" + hash; 1512 }); 1513 1514 //Collect unique hash links 1515 window.setPopupHash = []; 1516 $('.popupTrigger').each(function(){ 1517 var hash = $(this).attr('data-popup-id'); 1518 1519 if($.inArray(hash, window.setPopupHash) == -1) { 1520 window.setPopupHash.push(hash); 1521 } 1522 }); 1523 1524 //Open popup if hash presented 1525 if($.inArray(window.location.hash.split("#")[1], window.setPopupHash) !== -1) { 1526 setTimeout(function(){ 1527 $('.popupTrigger[data-popup-id="'+window.location.hash.split("#")[1]+'"]').click(); 1528 }, 500); 1529 } 1530 1531 $(window).on('popupHidden', function(){ 1532 if (history.pushState) { 1533 window.history.pushState("", "", location.href.split('#')[0]); 1534 } else { 1535 window.location.hash = ""; 1536 } 1537 }); 1538 } 1539 1540 1541 1542/*** 1543* _____ ______ ______ ______ 1544* / ____| | ____| ____| ____| 1545* | | __ __ _| |__ | |__ | |__ 1546* | | |_ |/ _` | __| | __| | __| 1547* | |__| | (_| | | | |____| |____ 1548* \_____|\__,_|_| |______|______| 1549* 1550* Grid and Flex Element Equalizer 1551*/ 1552 1553 $(window).on('resize load ready popupShown',function(){ 1554 1555 setTimeout(function(){ 1556 equalizeElements(); 1557 }, 1); 1558 }); 1559 1560 function equalizeElements(){ 1561 1562 var gridEl = $('.grid.equal, .flex.equal'); 1563 if (gridEl.length) { 1564 $(gridEl).each(function(index, element) { 1565 1566 var screenWidth = window.windowWidth, 1567 collapseWidth = ($(element).hasClass('later')) ? 767 : 1024, 1568 collapseWidth = $(element).data('equal-collapse-width') ? parseInt($(element).data('equal-collapse-width')) : collapseWidth, 1569 equalElement = $(element).find('.equalElement'), 1570 equalMobile = $(this).hasClass('equalMobile'); 1571 1572 if ((screenWidth >= collapseWidth)||(equalMobile)){ 1573 var height = 0; 1574 1575 //fetch max height 1576 $(equalElement).each(function(index, el) { 1577 1578 $(el).css('height','auto'); 1579 1580 if (height < $(el).outerHeight()) { 1581 height = $(el).outerHeight(); 1582 } 1583 1584 }); 1585 1586 //apply 1587 $(element).find('.equalElement').each(function(index, el) { 1588 $(el).css('height', height + "px"); 1589 }); 1590 } else { 1591 $(equalElement).css("height", "auto"); 1592 } 1593 }); 1594 } 1595 } 1596 1597 //Detect Resize 1598 $(window).on('resize',function(){ 1599 $html.addClass('resizing'); 1600 }).on('resizeEnd',function(){ 1601 $html.removeClass('resizing'); 1602 }); 1603 1604 1605 1606 1607 1608 1609 1610 1611/*** 1612* _____ _ _ _ 1613* / ____| (_) | | 1614* | (___ | |_ __| | ___ _ __ 1615* \___ \| | |/ _` |/ _ \ '__| 1616* ____) | | | (_| | __/ | 1617* |_____/|_|_|\__,_|\___|_| 1618* 1619* Slider * *(*)* * 1620*/ 1621 1622 1623 var sliderEl = $('.slider'); 1624 1625 if ($(sliderEl).length > 0) { 1626 1627 $(sliderEl).each(function(index, element) { 1628 1629 //check status 1630 var $el = $(element), 1631 sliderID = $el.data('slider-id'), 1632 nextIndex = $el.find('.selected').index(); 1633 1634 //set status 1635 if (window.sliderStatus) { 1636 $html.removeClassByPrefix("slider_" + sliderID).addClass("slider_" + sliderID + "_" + nextIndex); 1637 } 1638 1639 //autoplay 1640 if ($el.hasClass('autoplay')) { 1641 1642 var interval = ($el.data('slider-interval')) ? parseInt($el.data('slider-interval')) : 5000; 1643 1644 var autoplay = setInterval(function(){ 1645 $el.trigger('next'); 1646 },interval); 1647 1648 //stop interval on user interaction 1649 if ($el.data('slider-stoponclick') != false) {
1650 $('[data-slider-id="'+sliderID+'"]').on('mousedown touchstart', function(){ 1651 clearInterval(autoplay); 1652 }); 1653 } 1654 } 1655 1656 //clickable 1657 if ($el.hasClass('clickable') || $el.hasClass('autoplay')){ 1658 $el.on('click next', function(event){ 1659 1660 var $el = $(this), 1661 sliderID = $el.data('slider-id'), 1662 $slider = $('.slider[data-slider-id="'+sliderID+'"]'), 1663 clickTarget = event.target; 1664 1665 //break 1666 if($(clickTarget).data('slider-event') == "cancel") return; 1667 1668 //for multiple sliders 1669 $slider.each(function(){ 1670 1671 var $el = $(this), 1672 sliderID = $el.data('slider-id'), 1673 $selected = $el.children('.selected'), 1674 $nextElement = $selected.nextOrFirst('li'), 1675 nextIndex = $nextElement.index(), 1676 $controller = $('.controller[data-slider-id="'+sliderID+'"]'), 1677 isAnimated = $el.is('.animated, .animateOnEvent'); 1678 1679 //uselect old 1680 $selected.removeClass('selected').addClass('hide').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function() { 1681 $(this).removeClass('hide'); 1682 }); 1683 1684 //select next 1685 $nextElement.removeClass('hide').addClass('selected'); 1686 1687 //set status 1688 if (window.sliderStatus) { 1689 $html.removeClassByPrefix("slider_" + sliderID).addClass("slider_" + sliderID + "_" + nextIndex); 1690 } 1691 1692 //animated 1693 if (isAnimated) { 1694 $el.addClass('animateOnEvent'); 1695 $el.find('li').removeClassByPrefix('ae-').removeClass('do'); 1696 $el.find('.selected').each(function(index){ 1697 $(this).removeClassByPrefix('ae-').removeClass('do').addClass('ae-' + (index + 1)).addClass('do'); 1698 }); 1699 1700 $(window).scroll(); 1701 } 1702 1703 if (sliderID && $controller.length > 0){ 1704 $controller.each(function(){ 1705 var $controller = $(this); 1706 1707 $controller.children('.selected').removeClass('selected'); 1708 $controller.children('li:eq('+nextIndex+')').addClass('selected'); 1709 }); 1710 } 1711 1712 }); 1713 1714 //set status 1715 if (window.sliderStatus) { 1716 $html.removeClassByPrefix("slider_" + sliderID).addClass("slider_" + sliderID + "_" + nextIndex); 1717 } 1718 }); 1719 } 1720 }); 1721 } 1722 1723 // controller 1724 var $controller = $('.controller'); 1725 1726 if ($controller.length > 0) { 1727 1728 var controllerSelector = $controller.data('controller-selector') ? $controller.data('controller-selector') : "li"; 1729 1730 $controller.on('click', controllerSelector, function(){ 1731 var $controllerElement = $(this), 1732 $controller = $controllerElement.closest('.controller'), 1733 nextIndex = $($controller.find(controllerSelector)).index($controllerElement), 1734 sliderId = $controller.data('slider-id'), 1735 $slider = $('.slider[data-slider-id="'+sliderId+'"]'), 1736 $controllers = $('.controller[data-slider-id="'+sliderId+'"]'); 1737 1738 if (!$controllerElement.hasClass('selected')){ 1739 $controllers.each(function(){ 1740 var $controller = $(this); 1741 1742 $controller.children('.selected').removeClass('selected'); 1743 $controller.children('li:eq('+nextIndex+')').addClass('selected'); 1744 }); 1745 1746 //for multiple sliders 1747 $slider.each(function(){ 1748 var $slider = $(this), 1749 isAnimated = $slider.hasClass('animated'); 1750 1751 $slider.children('.selected').removeClass('selected').addClass('hide').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function() { 1752 $(this).removeClass('hide'); 1753 }); 1754 1755 $slider.children('li').eq(nextIndex).removeClass('hide').addClass('selected'); 1756 1757 //is animated 1758 if (isAnimated) { 1759 $slider.addClass('animateOnEvent'); 1760 $slider.find('>li').removeClassByPrefix('ae-').removeClass('do'); 1761 $slider.find('.selected').each(function(index){ 1762 $(this).removeClassByPrefix('ae-').removeClass('do').addClass('ae-' + (index + 1)).addClass('do'); 1763 }); 1764 1765 $(window).scroll(); 1766 } 1767 }); 1768 1769 //set status 1770 if (window.sliderStatus) { 1771 $html.removeClassByPrefix("slider_" + sliderID).addClass("slider_" + sliderID + "_" + nextIndex); 1772 } 1773 } 1774 }); 1775 } 1776 1777 //Next and prev buttons
1778 $(document).on('click', '[data-slider-action]', function(){ 1779 1780 if ($(this).data('slider-id')){ 1781 var $this = $(this), 1782 $desiredElement, nextIndex, 1783 sliderID = $this.data('slider-id'), 1784 action = $this.data('slider-action'), 1785 $slider = $('.slider[data-slider-id="' + sliderID + '"]'), 1786 $controller = $('.controller[data-slider-id="'+sliderID+'"]'); 1787 1788 //set status 1789 if (window.sliderStatus) { 1790 $html.removeClassByPrefix("slider_" + sliderID).addClass("slider_" + sliderID + "_" + nextIndex); 1791 } 1792 1793 $slider.each(function(){ 1794 var $slider = $(this), 1795 controllerSelector = $controller.data('controller-selector') ? $controller.data('controller-selector') : "li", 1796 $selected = $slider.find('.selected'), 1797 isAnimated = $slider.hasClass('animated'); 1798 1799 //detect direction 1800 if (action === "next"){ 1801 $desiredElement = $selected.nextOrFirst("li"); 1802 } else if (action === "prev") { 1803 $desiredElement = $selected.prevOrLast("li"); 1804 } else if (parseInt(action) || action === 0 ) { 1805 nextIndex = parseInt(action); 1806 $desiredElement =$slider.find('>li:eq(' + nextIndex + ")"); 1807 } 1808 1809 //select element 1810 nextIndex = $desiredElement.index(); 1811 $selected.removeClass('selected'); 1812 $desiredElement.removeClass('hide').addClass('selected'); 1813 1814 //is animated 1815 if (isAnimated) { 1816 $slider.addClass('animateOnEvent'); 1817 $slider.find('li').removeClassByPrefix('ae-').removeClass('do'); 1818 $slider.find('.selected').each(function(index){ 1819 $(this).removeClassByPrefix('ae-').removeClass('do').addClass('ae-' + (index + 1)).addClass('do'); 1820 }); 1821 $(window).scroll(); 1822 } 1823 }); 1824 1825 $controller.each(function(){ 1826 var $controller = $(this); 1827 1828 //change controller 1829 if ((sliderID) && ($controller.length > 0) ){ 1830 $controller.find('.selected').removeClass('selected').addClass('hide').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function() { 1831 $this.removeClass('hide'); 1832 }); 1833 $controller.find(controllerSelector).eq(nextIndex).addClass('selected'); 1834 } 1835 }); 1836 } 1837 }); 1838 1839 //Auto Height 1840 $('[data-slider-id].autoHeight').each(function(index, element) { 1841 $(window).on('click resize load ready next',function(){ 1842 var totalHeight = 0, 1843 el = $(element).find('.selected'); 1844 1845 $(element).find('.selected').children().each(function(){ 1846 totalHeight += Math.round($(this).outerHeight(true)); 1847 }); 1848 1849 $(element).height(totalHeight + "px"); 1850 }); 1851 }); 1852 1853 $(".slider.clickable[data-slider-id], .controller[data-slider-id]").on('click', function(event){ 1854 if($(event.target).data('slider-event') != "cancel") $(window).resize(); 1855 }); 1856 1857 1858 1859 1860 1861 1862 1863/*** 1864* _____ _ 1865* | __ \ | | 1866* | | | |_ __ ___ _ __ __| | _____ ___ __ 1867* | | | | '__/ _ \| '_ \ / _` |/ _ \ \ /\ / / '_ \ 1868* | |__| | | | (_) | |_) | (_| | (_) \ V V /| | | | 1869* |_____/|_| \___/| .__/ \__,_|\___/ \_/\_/ |_| |_| 1870* | | 1871* |_| 1872* 1873* Dropdown Window and Share 1874*/ 1875 1876 1877 window.dropdownShown = false; 1878 //click 1879 $('body').on('click', '.dropdownTrigger', function(){ 1880 showDropdown($(this)); 1881 }); 1882 1883 //hover 1884 $('.dropdownTrigger.hover').hover(function(){ 1885 showDropdown($(this), "hover"); 1886 }); 1887 1888 function showDropdown($this, $isHover){ 1889 $isHover = typeof $isHover !== 'undefined' ? $isHover : false; 1890 1891 //show 1892 var offset = $this.offset(), 1893 position = $this.position(), 1894 offsetY = window.popupShown ? Math.ceil(position.top) : Math.ceil(offset.top), 1895 offsetX = Math.ceil(offset.left), 1896 dropdownID = $this.data('dropdown-id'), 1897 $element = $('.dropdown[data-dropdown-id="' + dropdownID + '"]'), 1898 elementPosition = $this.data('dropdown-position') ? $this.data('dropdown-position') : $element.attr('class'), 1899 setPosition = $element.data('dropdown-set-position') == false ? false : true, 1900 elementPosition = elementPosition.split(' '); 1901 1902 //hide 1903 if (!$isHover) { 1904 hideDropdown(); 1905 } 1906 1907 //vertical position 1908 if ( elementPosition.indexOf('bottom') != -1 ) { 1909 offsetY = offsetY - $element.outerHeight(); 1910 $element.removeClass('top').addClass('bottom'); 1911 } else { 1912 offsetY = offsetY + $this.outerHeight(); 1913 $element.removeClass('bottom').addClass('top'); 1914 } 1915 1916 //horizontal position 1917 if ( elementPosition.indexOf('right') != -1 ) { 1918 offsetX = offsetX - $element.outerWidth() + $this.outerWidth(); 1919 $element.removeClass('left center').addClass('right'); 1920 } else if ( elementPosition.indexOf('left') != -1 ) { 1921 $element.removeClass('right center').addClass('left'); 1922 } else if ( elementPosition.indexOf('center') != -1 ) { 1923 offsetX = offsetX - ($element.outerWidth()/2) + ($this.outerWidth()/2); 1924 $element.removeClass('right left').addClass('center'); 1925 } 1926 1927 $element.addClass('show'); 1928 1929 if (setPosition) { 1930 $element.css('top',offsetY).css('left',offsetX); 1931 } 1932 $html.addClass('dropdownShown dropdown_' + dropdownID); 1933 window.dropdownShown = true; 1934 } 1935 1936 function hideDropdown(){ 1937 //hide 1938 if (window.dropdownShown){ 1939 $html.removeClass('dropdownShown').removeClassByPrefix('dropdown_'); 1940 window.dropdownShown = false;
1941 hideDropdownOnScrollDelay = 0; 1942 $('.dropdown.show').addClass('hide').one('webkitTransitionEnd otransitionend msTransitionEnd transitionend', function(){ 1943 $(this).removeClass('show hide'); 1944 $html.removeClass('dropdownShown').removeClassByPrefix('dropdown_'); 1945 }); 1946 $(window).trigger('dropdownHidden'); 1947 } 1948 } 1949 1950 //remove on resize 1951 $(window).on('resize',function(){ 1952 hideDropdown(); 1953 }); 1954 1955 //remove on click outside 1956 $(document).on('mouseup touchstart', function (e){ 1957 var container = $(".dropdownShown .dropdown"); 1958 if (!container.is(e.target) && container.has(e.target).length === 0 && window.dropdownShown) { 1959 hideDropdown(); 1960 } 1961 }); 1962 1963 //set url for share 1964 window.shareUrl = window.location.href; 1965 if ($('.share').data('url')) { 1966 window.shareUrl = $('.dropdown').data('url'); 1967 } 1968 //set text for share 1969 window.shareText = document.title; 1970 if ($('.share').data('text')) { 1971 window.shareText = $('.dropdown').data('url'); 1972 } 1973 1974 $('.share').sharrre({ 1975 enableHover: false, 1976 url: window.shareUrl, 1977 text: window.shareText, 1978 enableCounter: false, 1979 share: { 1980 twitter: true, 1981 facebook: true, 1982 pinterest: true, 1983 googlePlus: true, 1984 stumbleupon: true, 1985 linkedin: true 1986 }, 1987 1988 buttons: { 1989 pinterest: { 1990 media: $('.dropdown').data('pinterest-image'), 1991 description: $('.dropdown').data('text') + " " + $('.dropdown').data('url') 1992 } 1993 }, 1994 1995 template: $('.share').html(), 1996 1997 render: function(api) { 1998 1999 $(api.element).on('click touchstart', '.social-twitter', function() { 2000 api.openPopup('twitter'); 2001 }); 2002 $(api.element).on('click touchstart', '.social-facebook', function() { 2003 api.openPopup('facebook'); 2004 }); 2005 $(api.element).on('click touchstart', '.social-pinterest', function() { 2006 api.openPopup('pinterest'); 2007 }); 2008 $(api.element).on('click touchstart', '.social-googlePlus', function() { 2009 api.openPopup('googlePlus'); 2010 }); 2011 $(api.element).on('click touchstart', '.social-stumbleupon', function() { 2012 api.openPopup('stumbleupon'); 2013 }); 2014 $(api.element).on('click touchstart', '.social-linkedin', function() { 2015 api.openPopup('linkedin'); 2016 }); 2017 $(api.element).on('click touchstart', '.mail', function() { 2018 var subject = $(this).data('subject') ? $(this).data('subject') : "", 2019 body = $(this).data('body') ? $(this).data('body') : "", 2020 url = $('.dropdown').data('url') ? $('.dropdown').data('url') : window.location.href; 2021 2022 //open email 2023 window.location.href ="mailto:?subject=" + encodeURIComponent( subject ) + "&body=" + encodeURIComponent( body ) + "%20" + url; 2024 }); 2025 2026 } 2027 }); 2028 2029 2030 2031 2032 2033 2034 2035 2036/*** 2037* _____ _ _ 2038* | __ \(_) | | 2039* | | | |_ __ _| | ___ __ _ 2040* | | | | |/ _` | |/ _ \ / _` | 2041* | |__| | | (_| | | (_) | (_| | 2042* |_____/|_|\__,_|_|\___/ \__, | 2043* __/ | 2044* |___/ 2045* Dialog Windows 2046*/ 2047 2048 2049 //show dialog message 2050 $('.dialogTrigger[data-dialog-id]').on('click', function(){ 2051 var dialogID = $(this).data('dialog-id'); 2052 2053 window.showDialog(dialogID) 2054 }); 2055 2056 2057 2058 //reveal the dialog with ID 2059 window.showDialog = function(id) { 2060 2061 var dialogID = id, 2062 $element = $('.dialog[data-dialog-id="' + dialogID + '"]'); 2063 2064 if (!$element.is(':visible')){ 2065 $element.addClass('reveal').slideDown(500,function(){ 2066 $(this).removeClass('reveal').removeClass('hidden'); 2067 }); 2068 } 2069 }; 2070 2071 //hide dialog message 2072 $('.dialog [data-dialog-action="close"], .dialog [data-dialog-action="hide"]').on('click', function(){ 2073 var $element = $(this).parents('.dialog'), 2074 action = $(this).data('dialog-action'), 2075 dialogID = $element.data('dialog-id'), 2076 cookieAge = $element.data('set-cookie'), 2077 cookieName = ($element.data('cookie-name')) ? $element.data('cookie-name') : dialogID, 2078 cookieValue = ($element.data('cookie-value')) ? $element.data('cookie-value') : true, 2079 cookiePath = $element.data('cookie-path'); 2080 2081 $element.addClass('hide').slideUp(500,function(){ 2082 $(this).removeClass('hide'); 2083 2084 if (cookieAge && action == "close"){ 2085 $.cookie(cookieName, cookieValue, { expires: cookieAge, path: cookiePath }); 2086 } 2087 }); 2088 }); 2089 2090 //hide dialog message with cookie 2091 $('.dialog[data-set-cookie]').each(function(index, element) { 2092 var dialogID = $(element).data('dialog-id'), 2093 cookieName = ($(element).data('cookie-name')) ? $(element).data('cookie-name') : dialogID, 2094 cookieValue = ($(element).data('cookie-value')) ? $(element).data('cookie-value') : true; 2095 2096 if ($.cookie(cookieName)){ 2097 $(element).hide(); 2098 } 2099 }); 2100 2101 //links 2102 $('.dialog [data-href]').on('click', function(){ 2103 if ($(this).data('target')){ 2104 window.open($(this).data('href'), '_blank'); 2105 } else { 2106 window.location = $(this).data('href'); 2107 } 2108 }); 2109 2110 //delay reveal for dialog window 2111 $('.dialog.hidden[data-dialog-delay]').each(function(){ 2112 var timeoutDelay = parseFloat($(this).attr('data-dialog-delay')), 2113 $element = $(this); 2114 2115 if (!isNaN(timeoutDelay)) { 2116 setTimeout(function(){ 2117 $element.addClass('reveal').slideDown(500,function(){ 2118 $(this).removeClass('reveal').removeClass('hidden'); 2119 }); 2120 }, timeoutDelay); 2121 } 2122 }); 2123 2124 //delay reveal for dialog window 2125 $('.dialog[data-dialog-hide-delay]').each(function(){ 2126 var timeoutDelay = parseFloat($(this).attr('data-dialog-hide-delay')), 2127 $element = $(this); 2128 2129 if (!isNaN(timeoutDelay)) { 2130 setTimeout(function(){ 2131 $element.addClass('hide').slideUp(500,function(){ 2132 $(this).removeClass('hide'); 2133 }); 2134 }, timeoutDelay); 2135 } 2136 }); 2137 2138 //submit form 2139 $('.dialog [data-type="submit"]').click(function(){ 2140 $(this).parents('form').submit(); 2141 }); 2142 2143 2144 2145 2146/*** 2147* _____ _ _ ______ 2148* / ____| | | | | | ____| 2149* | | ___ _ __ | |_ __ _ ___| |_ | |__ ___ _ __ _ __ ___ 2150* | | / _ \| '_ \| __/ _` |/ __| __| | __/ _ \| '__| '_ ` _ \ 2151* | |___| (_) | | | | || (_| | (__| |_ | | | (_) | | | | | | | | 2152* \_____\___/|_| |_|\__\__,_|\___|\__| |_| \___/|_| |_| |_| |_| 2153* 2154* Ajax Contact Form 2155*/ 2156 2157 $('#contact-form, [data-ajax-form]').each(function(index, element) { 2158 $(element).ajaxForm(function() { 2159 var $ajaxForm = $(element), 2160 $ajaxFormButton = $(element).find('[type="submit"]'), 2161 ajaxFormButtonIsInput = $ajaxFormButton.is('input') ? true : false, 2162 successText = $ajaxFormButton.data('success-text') ? $ajaxFormButton.data('success-text') : "Done!", 2163 successClass = $ajaxFormButton.data('success-class') ? $ajaxFormButton.data('success-class') : "green", 2164 defaultText = ajaxFormButtonIsInput ? $ajaxFormButton.val() : $ajaxFormButton.html(), 2165 defaultClasses = $ajaxFormButton.attr('class'); 2166 2167 if (ajaxFormButtonIsInput) { 2168 $ajaxFormButton.val(successText); 2169 } else { 2170 $ajaxFormButton.text(successText) 2171 } 2172 $ajaxFormButton.addClass(successClass); 2173 2174 setTimeout(function(){ 2175 if (ajaxFormButtonIsInput) { 2176 $ajaxFormButton.val(defaultText); 2177 } else { 2178 $ajaxFormButton.html(defaultText); 2179 } 2180 $ajaxFormButton.attr('class', defaultClasses); 2181 $ajaxForm[0].reset(); 2182 },4000); 2183 }); 2184 }); 2185 2186 2187 2188 2189 2190 2191 2192/*** 2193* _____ _ 2194* / ____| | | 2195* | (___ ___ _ _ _ __ __| | 2196* \___ \ / _ \| | | | '_ \ / _` | 2197* ____) | (_) | |_| | | | | (_| | 2198* |_____/ \___/ \__,_|_| |_|\__,_| 2199* 2200* Music and Sound 2201*/ 2202 2203 $('audio[data-sound-id]').each(function(event, element){ 2204 var $element = $(element), 2205 musicID = $element.data('sound-id'), 2206 audio = $element[0], 2207 $soundButton = $('.soundTrigger[data-sound-id="'+musicID+'"]'); 2208 2209 if (audio.autoplay){ 2210 $soundButton.addClass('playing'); 2211 } else { 2212 $soundButton.removeClass('playing'); 2213 } 2214 }); 2215 2216 $('.soundTrigger').click(function(){ 2217 var musicID = $(this).data('sound-id'), 2218 $audio = $('audio[data-sound-id="'+musicID+'"]'), 2219 action = $audio.data('sound-action') ? $audio.data('sound-action') : "toggle", 2220 fade = (parseInt($audio.data('sound-fade')) >= 0 || $audio.data('sound-fade')) ? parseInt($audio.data('sound-fade')) : 500; 2221 2222 if ($audio[0].paused && ( action === "toggle" || action === "play")){ 2223 $audio[0].play(); 2224 $audio.animate({volume: 1}, fade); 2225 $(this).addClass('playing'); 2226 } else if (action === "toggle" || action === "pause"){ 2227 $audio.animate({volume: 0}, fade, function(){ 2228 $audio[0].pause(); 2229 }); 2230 2231 $(this).removeClass('playing'); 2232 } 2233 }); 2234 2235// end on dom ready 2236}); 2237 2238 2239 2240 2241/*** 2242* _ 2243* /\ | | 2244* / \ _ __ __ _| |_ _ _______ 2245* / /\ \ | '_ \ / _` | | | | |_ / _ \ 2246* / ____ \| | | | (_| | | |_| |/ / __/ 2247* /_/ \_\_| |_|\__,_|_|\__, /___\___| 2248* __/ | 2249* |___/ 2250* 2251* Analyze Devices and Browsers 2252*/ 2253 2254 2255window.isMobile = false;
2256if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { window.isMobile = true; } 2257 2258//Detect Browser 2259window.isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; 2260window.isSafari = /^((?!chrome).)*safari/i.test(navigator.userAgent); 2261window.isChrome = /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); 2262window.isChromeiOS = navigator.userAgent.match('CriOS'); 2263window.isMSIE = navigator.userAgent.match('MSIE'); 2264window.isEdge = navigator.userAgent.match('Edge'); 2265window.isAndroid = navigator.userAgent.toLowerCase().indexOf("android") > -1; 2266window.isiPad = navigator.userAgent.match(/iPad/i) !== null; 2267 2268//Detect OS 2269window.isWindows = navigator.platform.toUpperCase().indexOf('WIN')!==-1; 2270window.isOSX = navigator.platform.toUpperCase().indexOf('MAC')!==-1; 2271window.isLinux = navigator.platform.toUpperCase().indexOf('LINUX')!==-1; 2272 2273//iOS13+ Devices with "Request Desktop Website" setting 2274if (window.isOSX && navigator.maxTouchPoints) window.isMobile = true; 2275 2276//Prepare for CSS Fixes 2277if (window.isSafari){$html.addClass('safari');} 2278if (window.isFirefox){$html.addClass('firefox');} 2279if (window.isChrome){$html.addClass('chrome');} 2280if (window.isMSIE){$html.addClass('msie');} 2281if (window.isEdge){$html.addClass('edge');} 2282if (window.isAndroid){$html.addClass('android');} 2283if (window.isWindows){$html.addClass('windows');} 2284if (window.isOSX){$html.addClass('osx');} 2285if (window.isLinux){$html.addClass('linux');} 2286 2287//Detect Mobile 2288if(window.isMobile){$html.addClass('mobile');}else{$html.addClass('desktop');} 2289 2290//Retina 2291window.isRetina = ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)').matches)) || (window.devicePixelRatio && window.devicePixelRatio > 1.3)); 2292if (window.isRetina) { 2293 $html.addClass('retina'); 2294}
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.