1$(document).ready(function () { 2 3 "use strict"; 4 5 6 /* _____________________________________ 7 8 Device Detection 9 _____________________________________ */ 10 11 // Mobile Detect 12 var isMobile = /iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi/i.test(self._navigator && self._navigator.userAgent); 13 var isTouch = !!(('ontouchend' in window) || (self._navigator && self._navigator.maxTouchPoints > 0) || (self._navigator && self._navigator.msMaxTouchPoints > 0)); 14 15 16 /* _____________________________________ 17 18 Preloader 19 _____________________________________ */ 20 21 var loader = $(".loader"); 22 23 if (loader.length) { 24 // show Preloader until the website ist loaded 25 $(window).on("load", function () { 26 loader.addClass('fade-out'); 27 setTimeout(function () { 28 loader.hide(); 29 }, 1000); 30 }); 31 } 32 33/* _____________________________________ 34 35 Count Down 36 _____________________________________ */ 37 38 var time = $('.count-down'); 39 if (time.length) { 40 var endDate = new Date(time.data("end-date")); 41 time.countdown({ 42 date: endDate, 43 render: function (data) { 44 $(this.el).html('<div class="cd-row"><div><h1>' + this.leadingZeros(data.days, 3) 45 + '</h1><p>days</p></div><div><h1>' 46 + this.leadingZeros(data.hours, 2) 47 + '</h1><p>hrs</p></div></div><div class="cd-row"><div><h1>' 48 + this.leadingZeros(data.min, 2) 49 + '</h1><p>min</p></div><div><h1>' 50 + this.leadingZeros(data.sec, 2) 51 + '</h1><p>sec</p></div></div>'); 52 } 53 }); 54 } 55 /* _____________________________________ 56 57 Smooth Scroll 58 _____________________________________ */ 59 60 61 function initScroll(anchor) { 62 $("html, body").stop().animate({ 63 scrollTop: $(anchor).offset().top 64 }, { 65 duration: 1000, 66 specialEasing: { 67 width: "linear", 68 height: "easeInOutCubic" 69 } 70 }); 71 72 } 73 74 $("a.smooth-scroll").on("click", function (event) { 75 var anchor = $(this).attr("href"); 76 initScroll(anchor); 77 event.preventDefault(); 78 }); 79 80 81 /* _____________________________________ 82 83 Scroll Reveal 84 _____________________________________ */ 85 86 var reveal = $(".reveal"); 87 88 if (reveal.length) { 89 window.sr = ScrollReveal(); 90 91 // Add class to <html> if ScrollReveal is supported 92 if (sr.isSupported()) { 93 document.documentElement.classList.add('sr'); 94 } 95 96 sr.reveal('.reveal.scale-in', { 97 origin: 'bottom', 98 distance: '20px', 99 duration: 1500, 100 delay: 400, 101 opacity: 1, 102 scale: 1.1, 103 easing: 'linear', 104 reset: false 105 }); 106 107 108 sr.reveal('.reveal.scale-out', { 109 origin: 'bottom', 110 distance: '20px', 111 duration: 1500, 112 delay: 400, 113 opacity: 1, 114 scale: 0.9, 115 easing: 'linear', 116 reset: false 117 }); 118 } 119 120 /* _____________________________________ 121 122 Navbar Button 123 _____________________________________ */ 124 125 var collapse = $(".collapse"); 126 127 collapse.on('show.bs.collapse', function () { 128 $('.navbar-button').addClass('open'); 129 }); 130 collapse.on('hide.bs.collapse', function () { 131 $('.navbar-button').removeClass('open'); 132 }); 133 134 135 /* _____________________________________ 136 137 Show Content 138 _____________________________________ */ 139 140 var navLinks = $('.navbar-links li'), 141 content = $("body"), 142 navbar = $(".navbar"), 143 col = $(".col-transform"); 144 145 $(".show-info").click(function () { 146 if (window.innerWidth > 990) { 147 if (content.hasClass('show-content')) { 148 col.removeClass('col-md-6').addClass('col-md-12'); 149 content.removeClass('show-content'); 150 setTimeout(function () { 151 navbar.removeClass('navbar-open') 152 }, 900); 153 initTranslateOpacity(navLinks, '100%', '0', 'hidden', 600); 154 } else { 155 col.removeClass('col-md-12').addClass('col-md-6'); 156 content.addClass('show-content'); 157 setTimeout(function () { 158 navbar.addClass('navbar-open') 159 }, 300); 160 initTranslateOpacity(navLinks.get().reverse(), '0', '1', 'visible', 600); 161 } 162 } 163 var anchor = $(this).data("href"); 164 initScroll(anchor); 165 }); 166 167 168 function initTranslateOpacity(selector, translate, opacity, visibility, time) { 169 $(selector).each(function () { 170 var _this = this; 171 window.setTimeout(function () { 172 $(_this).css({
173 '-webkit-transform': 'translate(' + translate + ',0)', 174 'opacity': opacity, 175 'visibility': visibility 176 }); 177 }, time); 178 time += 300; 179 }); 180 } 181 182 183 /* _____________________________________ 184 185 Page Image BG Slider 186 _____________________________________ */ 187 188 var pageSlider = $("#page-slider"); 189 if (pageSlider.length) { 190 pageSlider.owlCarousel({ 191 loop: true, 192 items: 1, 193 autoplay: true, 194 animateOut: 'fadeOut', 195 slideTransition: 'linear', 196 autoplaySpeed: 8000, 197 mouseDrag: false 198 }); 199 } 200 201 202 /* _____________________________________ 203 204 Background Youtube 205 _____________________________________ */ 206 207 // shows Video only for Desktop 208 var pageYoutube = $('#page-youtube'); 209 210 if (pageYoutube.length && !isMobile && !isTouch) { 211 pageYoutube.YTPlayer({ 212 fitToBackground: true, 213 videoId: pageYoutube.data("video-id"), 214 playerVars: { 215 modestbranding: 0, 216 autoplay: 1, 217 controls: 0, 218 showinfo: 0, 219 branding: 0, 220 rel: 0, 221 autohide: 0, 222 start: 0 223 } 224 }); 225 } 226 227 /* _____________________________________ 228 229 Background Video 230 _____________________________________ */ 231 232 // shows Video only for Desktop 233 var pageVideo = $('#page-video'); 234 235 if (pageVideo.length && !isMobile && !isTouch) { 236 new $.backgroundVideo($("body"), { 237 "align": "centerXY", 238 "width": 960, 239 "height": 540, 240 "path": pageVideo.data("path"), 241 "filename": pageVideo.data("file"), 242 "types": ["mp4", "ogg", "webm"] 243 }); 244 } 245 246 /* _____________________________________ 247 248 Background Kenburn 249 _____________________________________ */ 250 251 252 var selectorKenburn = $("#kenburn-slider, body"); 253 if ($('#kenburn-slider').length) { 254 255 selectorKenburn.vegas({ 256 slides: [ 257 {src: "images/page-slide-1.jpg"}, 258 {src: "images/page-slide-2.jpg"}, 259 {src: "images/page-slide-3.jpg"} 260 // further slide definitions 261 ], 262 transition: 'fade', 263 animation: 'random', 264 transitionDuration: 4000, 265 delay: 8000, 266 timer: false 267 }); 268 } 269 270 271 /* _____________________________________ 272 273 Background Particle 274 _____________________________________ */ 275 276 var pageParticle = $('#page-particle'); 277 if (pageParticle.length) { 278 279 pageParticle.particleground({ 280 dotColor: pageParticle.data("dot-color"), 281 lineColor: pageParticle.data("line-color") 282 }); 283 } 284 285 286 /* _____________________________________ 287 288 Background Gradient 289 _____________________________________ */ 290 291 var pageGradient = $('#page-gradient'); 292 if (pageGradient.length) { 293 pageGradient.gradientify({ 294 gradients: [ 295 {start: [35, 72, 200], stop: [192, 33, 114]}, 296 {start: [10, 155, 102], stop: [82, 98, 176]} 297 ], 298 fps: 80 299 }); 300 } 301 302 303 /* _____________________________________ 304 305 Background Rain 306 _____________________________________ */ 307 308 var pageRain = $('#page-rain'); 309 if (pageRain.length && !isMobile && !isTouch) { 310 var image = pageRain[0]; 311 image.onload = function () { 312 var engine = new RainyDay({ 313 image: this, 314 parentElement: $('.section-overlay')[0] 315 }); 316 engine.rain([[1, 2, 4000]]); // add 4000 drops of size from 1 - 2 317 engine.rain( 318 [ 319 [3, 3, 1], [5, 5, 1], [6, 2, 1] 320 ], 321 100); // every 100ms 322 }; 323 image.crossOrigin = 'anonymous'; 324 image.src = pageRain.attr('src'); 325 } 326 327 328 /* _____________________________________ 329 330 Background Amplitude & Sound 331 _____________________________________ */ 332 333 334 var pageAmplitude = $('#page-amplitude'), 335 volume = $('#volume'), 336 playback = $('#playback'); 337 338 339 if (pageAmplitude.length) { 340 341 var wave = new SiriWave({ 342 speed: 0.05, 343 amplitude: 1, 344 container: pageAmplitude[0], 345 autostart: true, 346 frequency: 4, 347 height: 300, 348 style: 'ios9' 349 }); 350 351 if (!isMobile && !isTouch) { 352 var sound = new Howl({ 353 src: ['audio/egotype.webm', 'audio/egotype.mp3'], 354 autoplay: true, 355 loop: true 356 }); 357 358 playback.on('click', function () { 359 if (playback.hasClass('pause')) { 360 playback.addClass('play').removeClass('pause'); 361 playback.find('i').removeClass('icon-music-pause-button').addClass('icon-music-play-button'); 362 sound.pause(); 363 wave.stop(); 364 } else { 365 playback.removeClass('play').addClass('pause'); 366 playback.find('i').removeClass('icon-music-play-button').addClass('icon-music-pause-button'); 367 sound.play(); 368 wave.start(); 369 } 370 }); 371 372 volume.on('click', function () { 373 if (volume.hasClass('vol-1')) { 374 volume.removeClass('vol-1').addClass('vol-0'); 375 volume.find('i').removeClass('icon-music-volume-up').addClass('icon-music-volume-down'); 376 sound.volume(0); 377 } else { 378 volume.addClass('vol-1').removeClass('vol-0'); 379 volume.find('i').removeClass('icon-music-volume-down').addClass('icon-music-volume-up'); 380 sound.volume(1); 381 } 382 }); 383 } else { 384 volume.hide(); 385 playback.hide(); 386 } 387 } 388 389 390 /* _____________________________________ 391
392 Background Particle Waves 393 _____________________________________ */ 394 395 396 var SEPARATION = 100, AMOUNTX = 50, AMOUNTY = 50; 397 398 var container; 399 var camera, scene, renderer; 400 401 var particles, particle, count = 0; 402 403 var mouseX = 0, mouseY = 0; 404 405 var windowHalfX = window.innerWidth / 2; 406 var windowHalfY = window.innerHeight / 2; 407 408 409 function init(waveColor, bgColor) { 410 411 container = $('#particle-waves')[0]; 412 413 camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000); 414 camera.position.z = 1000; 415 416 scene = new THREE.Scene(); 417 418 particles = []; 419 420 var PI2 = Math.PI * 2; 421 var material = new THREE.SpriteCanvasMaterial({ 422 423 color: waveColor, 424 program: function (context) { 425 context.beginPath(); 426 context.arc(0, 0, 0.5, 0, PI2, true); 427 context.fill(); 428 } 429 }); 430 431 var i = 0; 432 433 for (var ix = 0; ix < AMOUNTX; ix++) { 434 for (var iy = 0; iy < AMOUNTY; iy++) { 435 particle = particles[i++] = new THREE.Sprite(material); 436 particle.position.x = ix * SEPARATION - ( ( AMOUNTX * SEPARATION ) / 2 ); 437 particle.position.z = iy * SEPARATION - ( ( AMOUNTY * SEPARATION ) / 2 ); 438 scene.add(particle); 439 } 440 } 441 442 renderer = new THREE.CanvasRenderer(); 443 renderer.setPixelRatio(window.devicePixelRatio); 444 renderer.setSize(window.innerWidth, window.innerHeight); 445 renderer.setClearColor(bgColor, 1); 446 container.appendChild(renderer.domElement); 447 window.addEventListener('resize', onWindowResize, false); 448 449 } 450 451 function onWindowResize() { 452 windowHalfX = window.innerWidth / 2; 453 windowHalfY = window.innerHeight / 2; 454 camera.aspect = window.innerWidth / window.innerHeight; 455 camera.updateProjectionMatrix(); 456 renderer.setSize(window.innerWidth, window.innerHeight); 457 458 } 459 460 function animate() { 461 requestAnimationFrame(animate); 462 render(); 463 464 } 465 466 function render() { 467 camera.position.x += ( mouseX - camera.position.x ) * .05; 468 camera.position.y += ( -mouseY - camera.position.y ) * .05; 469 camera.lookAt(scene.position); 470 471 var i = 0; 472 473 for (var ix = 0; ix < AMOUNTX; ix++) { 474 475 for (var iy = 0; iy < AMOUNTY; iy++) { 476 477 particle = particles[i++]; 478 particle.position.y = ( Math.sin(( ix + count ) * 0.3) * 50 ) + 479 ( Math.sin(( iy + count ) * 0.5) * 50 ); 480 particle.scale.x = particle.scale.y = ( Math.sin(( ix + count ) * 0.3) + 1 ) * 4 + 481 ( Math.sin(( iy + count ) * 0.5) + 1 ) * 4; 482 483 } 484 } 485 486 renderer.render(scene, camera); 487 488 count += 0.1; 489 490 } 491 492 var particleWaves = $('#particle-waves'); 493 if (particleWaves.length) { 494 init(particleWaves.data('wave-color'), particleWaves.data('bg-color')); 495 animate(); 496 } 497 498 499 /* _____________________________________ 500 501 Background Waterpipe 502 _____________________________________ */ 503 504 var waterPipe = $('#waterpipe'); 505 506 if (waterPipe.length) { 507 waterPipe.waterpipe({ 508 gradientStart: '#fa05fa', 509 gradientEnd: '#6b71e3', 510 smokeOpacity: 0.1, 511 numCircles: 1, 512 maxMaxRad: 'auto', 513 minMaxRad: 'auto', 514 minRadFactor: 0, 515 iterations: 8, 516 drawsPerFrame: 10, 517 lineWidth: 2, 518 speed: 20, 519 bgColorInner: "#444444", 520 bgColorOuter: "#000000" 521 }); 522 } 523 524 525 /* _____________________________________ 526 527 Background Ripple 528 _____________________________________ */ 529 530 var ripple = $('#page-ripple'); 531 532 if (ripple.length && !isMobile && !isTouch) { 533 ripple.ripples({ 534 resolution: 512, 535 dropRadius: 10, //px 536 perturbance: 0.04, 537 interactive: false 538 }); 539 540 setInterval(function () { 541 var $el = ripple; 542 var x = Math.random() * $el.outerWidth(); 543 var y = Math.random() * $el.outerHeight(); 544 var dropRadius = 20; 545 var strength = 0.04 + Math.random() * 0.04; 546 547 $el.ripples('drop', x, y, dropRadius, strength); 548 }, 3000); 549 } 550 551 552 /* _____________________________________ 553
554 Background Starfield 555 _____________________________________ */ 556 557 var starfield = $('#page-starfield'); 558 559 if (starfield.length) { 560 starfield.starfield({ 561 speed: 0, 562 quantity: 500, 563 ratio: 200 564 }); 565 } 566 567 568 /* _____________________________________ 569 570 Background A Long Way 571 _____________________________________ */ 572 573 var aLongWay = $('#alongway'); 574 575 if (aLongWay.length) { 576 defaults = { 577 dt: 0.015, 578 time: 0.0 579 }; 580 } 581 582 583 /* _____________________________________ 584 585 Background Raindrop 586 _____________________________________ */ 587 588 let rainDrop = $('#raindrop'); 589 590 if (rainDrop.length) { 591 defaults = { 592 length : 30, 593 speed : 15, 594 // Gradient from top to Bottom 595 startColor : "#00a8ff", 596 middleColor : "#00a8ff", 597 endColor : "white", 598 }; 599 } 600 601 602 /* _____________________________________ 603 604 Background Homing Particles 605 _____________________________________ */ 606 607 var homingParticles = $('#homing-particles'); 608 609 if (homingParticles.length) { 610 defaults = {
611 BASE_PARTICLE_COUNT : 30, 612 WATCH_INTERVAL : 1, 613 THRESHOLD : 30, 614 SPRING_AMOUNT : 0.01, 615 LIMIT_RATE : 0.8, 616 617 BACKGROUND_COLOR_HUE : 0, 618 BACKGROUND_COLOR_SATURATION : 0, 619 BACKGROUND_COLOR_LIGHTNESS : 0, 620 BACKGROUND_COLOR_ALPHA : 0.3, 621 PARTICLE_COLOR_SATURATION : 70, 622 PARTICLE_COLOR_LIGHTNESS : 40 623 }; 624 } 625 626 /* _____________________________________ 627 628 Background Intertwined 629 _____________________________________ */ 630 631 var intertWined = $('#intertwined'); 632 633 if (intertWined.length) { 634 defaults = { 635 dt: 0.005, 636 time: 0.0 637 }; 638 } 639 640 641 /* _____________________________________ 642 643 Background Square 644 _____________________________________ */ 645 646 var square = $('#page-square'); 647 648 if (square.length) { 649 particlesJS("page-square", { 650 "particles": { 651 "number": { 652 "value": 20, 653 "density": {"enable": false, "value_area": 800} 654 }, 655 "color": {"value": square.data('square-color')}, 656 "opacity": { 657 "value": 0.5, 658 "random": false, 659 "anim": {"enable": false, "speed": 1, "opacity_min": 0.1, "sync": false} 660 }, 661 "shape": { 662 "type": "edge", 663 "stroke": { 664 "width": 0, 665 "color": "#000000" 666 }, 667 }, 668 "size": { 669 "value": 58, 670 "random": false, 671 "anim": {"enable": true, "speed": 10, "size_min": 40, "sync": false} 672 }, 673 "line_linked": { 674 "enable": false, 675 "distance": 200, 676 "color": "#ffffff", 677 "opacity": 1, 678 "width": 2 679 }, 680 "move": { 681 "enable": true, 682 "speed": 4, 683 "direction": "right", 684 "random": false, 685 "straight": false, 686 "out_mode": "out", 687 "bounce": false, 688 "attract": {"enable": false, "rotateX": 600, "rotateY": 1200} 689 } 690 }, 691 "interactivity": { 692 "detect_on": "window", 693 "events": { 694 "onhover": {"enable": false, "mode": "grab"}, 695 "onclick": {"enable": false, "mode": "push"}, 696 "resize": true 697 }, 698 "modes": { 699 "grab": {"distance": 400, "line_linked": {"opacity": 1}}, 700 "bubble": {"distance": 400, "size": 40, "duration": 2, "opacity": 8, "speed": 3}, 701 "repulse": {"distance": 200, "duration": 0.4}, 702 "push": {"particles_nb": 4}, 703 "remove": {"particles_nb": 2} 704 } 705 }, 706 "retina_detect": true 707 }); 708 } 709 710 /* _____________________________________ 711 712 Background Bubbles 713 _____________________________________ */ 714 715 var bubbles = $('#page-bubbles'); 716 717 if (bubbles.length) { 718 particlesJS("page-bubbles", { 719 "particles": { 720 "number": { 721 "value": 30, 722 "density": {"enable": true, "value_area": 800} 723 }, 724 "color": {"value": bubbles.data('bubble-color')}, 725 "opacity": { 726 "value": 0.3, 727 "random": true, 728 "anim": {"enable": false, "speed": 1, "opacity_min": 0.1, "sync": false} 729 }, 730 "size": { 731 "value": 58, 732 "random": false, 733 "anim": {"enable": true, "speed": 10, "size_min": 40, "sync": false} 734 }, 735 "line_linked": { 736 "enable": false, 737 "distance": 200, 738 "color": "#ffffff", 739 "opacity": 1, 740 "width": 2 741 }, 742 "move": { 743 "enable": true, 744 "speed": 8, 745 "direction": "none", 746 "random": false, 747 "straight": false, 748 "out_mode": "out", 749 "bounce": false, 750 "attract": {"enable": false, "rotateX": 600, "rotateY": 1200} 751 } 752 }, 753 "interactivity": { 754 "detect_on": "canvas", 755 "events": { 756 "onhover": {"enable": false, "mode": "grab"}, 757 "onclick": {"enable": false, "mode": "push"}, 758 "resize": true 759 }, 760 "modes": { 761 "grab": {"distance": 400, "line_linked": {"opacity": 1}}, 762 "bubble": {"distance": 400, "size": 40, "duration": 2, "opacity": 8, "speed": 3}, 763 "repulse": {"distance": 200, "duration": 0.4}, 764 "push": {"particles_nb": 4}, 765 "remove": {"particles_nb": 2} 766 } 767 }, 768 "retina_detect": true 769 }); 770 } 771 772 773 /* _____________________________________ 774
775 Background Flat Surface Shader 776 _____________________________________ */ 777 778 /* ------------------------------ 779 Options 780 ------------------------------ */ 781 782 var flatSurface = $('#page-fss'); 783 784 if (flatSurface.length) { 785 var MESH = { 786 width: 1.2, 787 height: 1.2, 788 depth: 0, 789 segments: 16, 790 slices: 8, 791 xRange: 0.8, 792 yRange: 0.1, 793 zRange: 1.0, 794 ambient: '#555555', 795 diffuse: '#ffffff', 796 speed: 0.002 797 }; 798 799 var LIGHT = { 800 count: 2, 801 xyScalar: 1, 802 zOffset: 100, 803 ambient: flatSurface.data('ambient-color'), 804 diffuse: flatSurface.data('diffuse-color'), 805 speed: 0.002, 806 gravity: 500, 807 dampening: 0.95, 808 minLimit: 10, 809 maxLimit: null, 810 minDistance: 20, 811 maxDistance: 800, 812 autopilot: true, 813 draw: false, 814 bounds: FSS.Vector3.create(), 815 step: FSS.Vector3.create( 816 Math.randomInRange(0.2, 1.0), 817 Math.randomInRange(0.2, 1.0), 818 Math.randomInRange(0.2, 1.0) 819 ) 820 }; 821 822 823 /* ------------------------------ 824 Render Properties 825 ------------------------------ */ 826 827 var RENDER = { 828 renderer: 'canvas' 829 }; 830 831 var now, start = Date.now(); 832 var center = FSS.Vector3.create(); 833 var attractor = FSS.Vector3.create(); 834 var containerFSS = flatSurface[0]; 835 var output = flatSurface[0]; 836 var rendererFSS, sceneFSS, mesh, geometry, material; 837 var canvasRenderer; 838 839 } 840 841 /* ------------------------------ 842 Methods 843 ------------------------------ */ 844 845 function initialise() { 846 createRenderer(); 847 createScene(); 848 createMesh(); 849 createLights(); 850 addEventListeners(); 851 resize(containerFSS.offsetWidth, containerFSS.offsetHeight); 852 animateFSS(); 853 } 854 855 function createRenderer() { 856 canvasRenderer = new FSS.CanvasRenderer(); 857 setRenderer(RENDER.renderer); 858 } 859 860 function setRenderer() { 861 if (rendererFSS) { 862 output.removeChild(rendererFSS.element); 863 } 864 865 rendererFSS = canvasRenderer; 866 867 rendererFSS.setSize(containerFSS.offsetWidth, containerFSS.offsetHeight); 868 output.appendChild(rendererFSS.element); 869 } 870 871 function createScene() { 872 sceneFSS = new FSS.Scene(); 873 } 874 875 function createMesh() { 876 sceneFSS.remove(mesh); 877 rendererFSS.clear(); 878 geometry = new FSS.Plane(MESH.width * rendererFSS.width, MESH.height * rendererFSS.height, MESH.segments, MESH.slices); 879 material = new FSS.Material(MESH.ambient, MESH.diffuse); 880 mesh = new FSS.Mesh(geometry, material); 881 sceneFSS.add(mesh); 882 883 // Augment vertices for animation 884 var v, vertex; 885 for (v = geometry.vertices.length - 1; v >= 0; v--) { 886 vertex = geometry.vertices[v]; 887 vertex.anchor = FSS.Vector3.clone(vertex.position); 888 vertex.step = FSS.Vector3.create( 889 Math.randomInRange(0.2, 1.0), 890 Math.randomInRange(0.2, 1.0), 891 Math.randomInRange(0.2, 1.0) 892 ); 893 vertex.time = Math.randomInRange(0, Math.PIM2); 894 } 895 } 896 897 function createLights() { 898 var l, light; 899 for (l = sceneFSS.lights.length - 1; l >= 0; l--) { 900 light = sceneFSS.lights[l]; 901 sceneFSS.remove(light); 902 } 903 rendererFSS.clear(); 904 for (l = 0; l < LIGHT.count; l++) { 905 light = new FSS.Light(LIGHT.ambient, LIGHT.diffuse); 906 light.ambientHex = light.ambient.format(); 907 light.diffuseHex = light.diffuse.format(); 908 sceneFSS.add(light); 909 910 // Augment light for animation 911 light.mass = Math.randomInRange(0.5, 1); 912 light.velocity = FSS.Vector3.create(); 913 light.acceleration = FSS.Vector3.create(); 914 light.force = FSS.Vector3.create(); 915 916 // Ring SVG Circle 917 light.ring = document.createElementNS(FSS.SVGNS, 'circle'); 918 light.ring.setAttributeNS(null, 'stroke', light.ambientHex); 919 light.ring.setAttributeNS(null, 'stroke-width', '0.5'); 920 light.ring.setAttributeNS(null, 'fill', 'none'); 921 light.ring.setAttributeNS(null, 'r', '10'); 922 923 // Core SVG Circle
924 light.core = document.createElementNS(FSS.SVGNS, 'circle'); 925 light.core.setAttributeNS(null, 'fill', light.diffuseHex); 926 light.core.setAttributeNS(null, 'r', '4'); 927 } 928 } 929 930 function resize(width, height) { 931 rendererFSS.setSize(width, height); 932 FSS.Vector3.set(center, rendererFSS.halfWidth, rendererFSS.halfHeight); 933 createMesh(); 934 } 935 936 function animateFSS() { 937 now = Date.now() - start; 938 update(); 939 renderFSS(); 940 requestAnimationFrame(animateFSS); 941 } 942 943 function update() { 944 var ox, oy, oz, l, light, v, vertex, offset = MESH.depth / 2; 945 946 // Update Bounds 947 FSS.Vector3.copy(LIGHT.bounds, center); 948 FSS.Vector3.multiplyScalar(LIGHT.bounds, LIGHT.xyScalar); 949 950 // Update Attractor 951 FSS.Vector3.setZ(attractor, LIGHT.zOffset); 952 953 // Overwrite the Attractor position 954 if (LIGHT.autopilot) { 955 ox = Math.sin(LIGHT.step[0] * now * LIGHT.speed); 956 oy = Math.cos(LIGHT.step[1] * now * LIGHT.speed); 957 FSS.Vector3.set(attractor, 958 LIGHT.bounds[0] * ox, 959 LIGHT.bounds[1] * oy, 960 LIGHT.zOffset); 961 } 962 963 // Animate Lights 964 for (l = sceneFSS.lights.length - 1; l >= 0; l--) { 965 light = sceneFSS.lights[l]; 966 967 // Reset the z position of the light 968 FSS.Vector3.setZ(light.position, LIGHT.zOffset); 969 970 // Calculate the force Luke! 971 var D = Math.clamp(FSS.Vector3.distanceSquared(light.position, attractor), LIGHT.minDistance, LIGHT.maxDistance); 972 var F = LIGHT.gravity * light.mass / D; 973 FSS.Vector3.subtractVectors(light.force, attractor, light.position); 974 FSS.Vector3.normalise(light.force); 975 FSS.Vector3.multiplyScalar(light.force, F); 976 977 // Update the light position 978 FSS.Vector3.set(light.acceleration); 979 FSS.Vector3.add(light.acceleration, light.force); 980 FSS.Vector3.add(light.velocity, light.acceleration); 981 FSS.Vector3.multiplyScalar(light.velocity, LIGHT.dampening); 982 FSS.Vector3.limit(light.velocity, LIGHT.minLimit, LIGHT.maxLimit); 983 FSS.Vector3.add(light.position, light.velocity); 984 } 985 986 // Animate Vertices 987 for (v = geometry.vertices.length - 1; v >= 0; v--) { 988 vertex = geometry.vertices[v]; 989 ox = Math.sin(vertex.time + vertex.step[0] * now * MESH.speed); 990 oy = Math.cos(vertex.time + vertex.step[1] * now * MESH.speed); 991 oz = Math.sin(vertex.time + vertex.step[2] * now * MESH.speed); 992 FSS.Vector3.set(vertex.position, 993 MESH.xRange * geometry.segmentWidth * ox, 994 MESH.yRange * geometry.sliceHeight * oy, 995 MESH.zRange * offset * oz - offset); 996 FSS.Vector3.add(vertex.position, vertex.anchor); 997 } 998 999 // Set the Geometry to dirty 1000 geometry.dirty = true; 1001 } 1002 1003 function renderFSS() { 1004 rendererFSS.render(sceneFSS); 1005 1006 // Draw Lights 1007 if (LIGHT.draw) { 1008 var l, lx, ly, light; 1009 for (l = sceneFSS.lights.length - 1; l >= 0; l--) { 1010 light = sceneFSS.lights[l]; 1011 lx = light.position[0]; 1012 ly = light.position[1]; 1013 rendererFSS.context.lineWidth = 0.5; 1014 rendererFSS.context.beginPath(); 1015 rendererFSS.context.arc(lx, ly, 10, 0, Math.PIM2); 1016 rendererFSS.context.strokeStyle = light.ambientHex; 1017 rendererFSS.context.stroke(); 1018 rendererFSS.context.beginPath(); 1019 rendererFSS.context.arc(lx, ly, 4, 0, Math.PIM2); 1020 rendererFSS.context.fillStyle = light.diffuseHex; 1021 rendererFSS.context.fill(); 1022 1023 } 1024 } 1025 } 1026 1027 1028 function addEventListeners() { 1029 window.addEventListener('resize', onWindowResizFSS); 1030 } 1031 1032 /* ------------------------------ 1033 Callbacks 1034 ------------------------------ */ 1035 1036 function onWindowResizFSS() { 1037 resize(containerFSS.offsetWidth, containerFSS.offsetHeight); 1038 renderFSS(); 1039 } 1040 1041 1042 // Init 1043 if (flatSurface.length) { 1044 initialise(); 1045 } 1046 1047 1048 1049 1050 /* _____________________________________ 1051 1052 Gallery Lightbox 1053 _____________________________________ */ 1054 1055 var initPhotoSwipeFromDOM = function (gallerySelector) { 1056 1057 var parseThumbnailElements = function (el) { 1058 var thumbElements = el.childNodes, 1059 numNodes = thumbElements.length, 1060 items = [], 1061 figureEl, 1062 linkEl, 1063 size, 1064 item; 1065 1066 for (var i = 0; i < numNodes; i++) { 1067 1068 figureEl = thumbElements[i]; 1069 1070 if (figureEl.nodeType !== 1) { 1071 continue; 1072 } 1073 1074 linkEl = figureEl.children[0]; 1075 1076 size = linkEl.getAttribute('data-size').split('x'); 1077 1078 1079 // create slide object 1080 item = { 1081 src: linkEl.getAttribute('href'), 1082 w: parseInt(size[0], 10), 1083 h: parseInt(size[1], 10) 1084 }; 1085 1086 1087 if (figureEl.children.length > 1) { 1088 // <figcaption> content 1089 item.title = '<h4>' + figureEl.children[1].innerHTML + '</h4><p>' + figureEl.children[2].innerHTML + '</p>'; 1090 } 1091 1092 if (linkEl.children.length > 0) { 1093 // <img> thumbnail element, retrieving thumbnail url 1094 item.msrc = linkEl.children[0].getAttribute('src'); 1095 } 1096 1097 item.el = figureEl; // save link to element for getThumbBoundsFn 1098 items.push(item); 1099 } 1100 1101 return items; 1102 }; 1103 1104 // find nearest parent element 1105 var closest = function closest(el, fn) { 1106 return el && ( fn(el) ? el : closest(el.parentNode, fn) ); 1107 }; 1108 1109 // triggers when user clicks on thumbnail 1110 var onThumbnailsClick = function (e) { 1111 e = e || window.event; 1112 e.preventDefault ? e.preventDefault() : e.returnValue = false;
1113 1114 var eTarget = e.target || e.srcElement; 1115 1116 // find root element of slide 1117 var clickedListItem = closest(eTarget, function (el) { 1118 return (el.tagName && el.tagName.toUpperCase() === 'FIGURE'); 1119 }); 1120 1121 if (!clickedListItem) { 1122 return; 1123 } 1124 1125 // find index of clicked item by looping through all child nodes 1126 // alternatively, you may define index via data- attribute 1127 var clickedGallery = clickedListItem.parentNode, 1128 childNodes = clickedListItem.parentNode.childNodes, 1129 numChildNodes = childNodes.length, 1130 nodeIndex = 0, 1131 index; 1132 1133 for (var i = 0; i < numChildNodes; i++) { 1134 if (childNodes[i].nodeType !== 1) { 1135 continue; 1136 } 1137 1138 if (childNodes[i] === clickedListItem) { 1139 index = nodeIndex; 1140 break; 1141 } 1142 nodeIndex++; 1143 } 1144 1145 1146 if (index >= 0) { 1147 // open PhotoSwipe if valid index found 1148 openPhotoSwipe(index, clickedGallery); 1149 } 1150 return false; 1151 }; 1152 1153 // parse picture index and gallery index from URL (#&pid=1&gid=2) 1154 var photoswipeParseHash = function () { 1155 var hash = window.location.hash.substring(1), 1156 params = {}; 1157 1158 if (hash.length < 5) { 1159 return params; 1160 } 1161 1162 var vars = hash.split('&'); 1163 for (var i = 0; i < vars.length; i++) { 1164 if (!vars[i]) { 1165 continue; 1166 } 1167 var pair = vars[i].split('='); 1168 if (pair.length < 2) { 1169 continue; 1170 } 1171 params[pair[0]] = pair[1]; 1172 } 1173 1174 if (params.gid) { 1175 params.gid = parseInt(params.gid, 10); 1176 } 1177 1178 return params; 1179 }; 1180 1181 var openPhotoSwipe = function (index, galleryElement, disableAnimation, fromURL) { 1182 var pswpElement = document.querySelectorAll('.pswp')[0], 1183 gallery, 1184 options, 1185 items; 1186 1187 items = parseThumbnailElements(galleryElement); 1188 1189 // options 1190 options = { 1191 barsSize: {top: 64, bottom: 'auto', padding: '10px'}, 1192 bgOpacity: 0.98, 1193 closeEl: true, 1194 captionEl: true, 1195 fullscreenEl: false, 1196 zoomEl: false, 1197 shareEl: false, 1198 counterEl: true, 1199 arrowEl: true, 1200 preloaderEl: true, 1201 galleryUID: galleryElement.getAttribute('data-pswp-uid'), 1202 1203 getThumbBoundsFn: function (index) { 1204 // See Options -> getThumbBoundsFn section of documentation for more info 1205 var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail 1206 pageYScroll = window.pageYOffset || document.documentElement.scrollTop, 1207 rect = thumbnail.getBoundingClientRect(); 1208 1209 return {x: rect.left, y: rect.top + pageYScroll, w: rect.width}; 1210 } 1211 1212 }; 1213 1214 // PhotoSwipe opened from URL 1215 if (fromURL) { 1216 if (options.galleryPIDs) { 1217 // parse real index when custom PIDs are used 1218 // http://photoswipe.com/documentation/faq.html#custom-pid-in-url 1219 for (var j = 0; j < items.length; j++) { 1220 if (items[j].pid == index) { 1221 options.index = j; 1222 break; 1223 } 1224 } 1225 } else { 1226 // in URL indexes start from 1 1227 options.index = parseInt(index, 10) - 1; 1228 } 1229 } else { 1230 options.index = parseInt(index, 10); 1231 } 1232 1233 // exit if index not found 1234 if (isNaN(options.index)) { 1235 return; 1236 } 1237 1238 if (disableAnimation) { 1239 options.showAnimationDuration = 0; 1240 } 1241 1242 // Pass data to PhotoSwipe and initialize it 1243 gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); 1244 gallery.init(); 1245 }; 1246 1247 // loop through all gallery elements and bind events 1248 var galleryElements = document.querySelectorAll(gallerySelector); 1249 1250 for (var i = 0, l = galleryElements.length; i < l; i++) { 1251 galleryElements[i].setAttribute('data-pswp-uid', i + 1); 1252 galleryElements[i].onclick = onThumbnailsClick; 1253 } 1254 1255 // Parse URL and open gallery if it contains #&pid=3&gid=1 1256 var hashData = photoswipeParseHash(); 1257 if (hashData.pid && hashData.gid) { 1258 openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true); 1259 } 1260 }; 1261 1262 1263 $("#photoswipe").load("js/plugins/photoswipe/include/photoswipe.html", function () { 1264 // Initialization .gallery 1265 initPhotoSwipeFromDOM('.gallery'); 1266 // write your init for further galleries here 1267 }); 1268 1269 /* _____________________________________ 1270 1271 Textarea Auto Resize 1272 _____________________________________ */ 1273 1274 var textarea = $('textarea'); 1275 1276 if (textarea.length) { 1277 textarea[0].addEventListener('keydown', autosize); 1278 } 1279 1280 function autosize() { 1281 var el = this; 1282 setTimeout(function () { 1283 el.style.cssText = 'height:50px; padding:15px'; 1284 el.style.cssText = 'height:' + el.scrollHeight + 'px'; 1285 }, 0); 1286 } 1287 1288 /* _____________________________________ 1289 1290 Form Focus 1291 _____________________________________ */ 1292 1293 var formControl = $(".form-control"); 1294 1295 formControl.on('focus', function () { 1296 $(this).parent().addClass('focus') 1297 1298 }); 1299 formControl.on('blur', function () { 1300 $(this).parent().removeClass('focus'); 1301 }); 1302 1303 1304 /* _____________________________________ 1305 1306 Mail Chimp 1307 _____________________________________ */ 1308 1309 var form = $('#mc-form'); 1310 1311 if (form.length) { 1312 form.ajaxChimp({ 1313 callback: mailchimpCallback, 1314 // Replace the URL above with your mailchimp URL (put your URL inside ''). 1315 url: 'https://egotype.us13.list-manage.com/subscribe/post?u=0d5d3b57e890f53491f92e353&id=27fdfeeb31' 1316 }); 1317 } 1318 1319 // callback function when the form submitted, show the notification box 1320 function mailchimpCallback(resp) { 1321 var messageContainer = $('#message-newsletter'); 1322 messageContainer.removeClass('error'); 1323 1324 form.find('.form-group').removeClass('error'); 1325 if (resp.result === 'error') { 1326 form.find('.input-group').addClass('error'); 1327 messageContainer.addClass('error'); 1328 } else { 1329 form.find('.form-control').fadeIn().val(''); 1330 } 1331 1332 messageContainer.slideDown('slow', 'swing'); 1333 1334 setTimeout(function () { 1335 messageContainer.slideUp('slow', 'swing'); 1336 }, 10000); 1337 } 1338 1339 1340 /* _____________________________________ 1341 1342 Map 1343 _____________________________________ */ 1344 1345 function initMap(map) { 1346 1347 // centered map point 1348 var latlng = new google.maps.LatLng(40.72020106, -73.97163391); 1349 1350 // points marker info and coordinates 1351 var points = [ 1352 ['<div class="wrapper"><h4>Kounter Office</h4><h5>Opening Hours</h5><p>Mo â Fr: 08:30 â 20:00</p></div>', 40.7486332, -73.9797129], 1353 ['<div class="wrapper"><h4>Kounter Agency</h4><h5>Opening Hours</h5><p>Mo â Fr: 08:30 â 20:00</p></div>', 40.66810, -73.94480] 1354 ]; 1355 // marker 1356 var iconMarker = 'images/marker.png'; 1357 1358 // marker size 1359 var markerSize = new google.maps.Size(50, 49); 1360 1361 1362 // map options 1363 var options = { 1364 zoom: 11, 1365 center: latlng, 1366 mapTypeId: google.maps.MapTypeId.TERRAIN, 1367 mapTypeControl: false, 1368 streetViewControl: false, 1369 scrollwheel: false, 1370 1371 // styles for monchrome map 1372 styles: [{ 1373 featureType: 'road', 1374 elementType: 'geometry', 1375 stylers: [ 1376 {'visibility': 'simplified'} 1377 ] 1378 }, { 1379 featureType: 'poi', 1380 elementType: 'label', 1381 stylers: [ 1382 {'visibility': 'off'} 1383 ] 1384 }, { 1385 featureType: 'all', 1386 stylers: [ 1387 {saturation: -100}, 1388 {gamma: 0.90} 1389 ] 1390 }] 1391 1392 }; 1393 1394 var setMap = new google.maps.Map(map[0], options); 1395 1396 var info = new google.maps.InfoWindow(); 1397 1398 1399 // custom infoWindow 1400 google.maps.event.addListener(info, 'domready', function () { 1401 1402 // Reference to the DIV that wraps the bottom of infowindow 1403 var iwOuter = $('.gm-style-iw'); 1404
1405 var iwBackground = iwOuter.prev(); 1406 // Removes background shadow DIV 1407 iwBackground.children(':nth-child(2)').css({ 1408 'box-shadow': 'none', 1409 'background-color': 'rgba(0, 0, 0, 0.1)' 1410 }); 1411 1412 // Changes the desired tail shadow color. 1413 iwBackground.children(':nth-child(3)').find('div').children().css({ 1414 'box-shadow': 'none', 1415 'border-top-color': 'rgba(0, 0, 0, 0.1)' 1416 }); 1417 1418 }); 1419 var marker, i; 1420 var image = { 1421 url: iconMarker, 1422 scaledSize: markerSize 1423 }; 1424 1425 for (i = 0; i < points.length; i++) { 1426 var stations = points[i][0]; 1427 marker = new google.maps.Marker({ 1428 position: new google.maps.LatLng(points[i][1], points[i][2]), 1429 map: setMap, 1430 icon: image 1431 }); 1432 google.maps.event.addListener(marker, 'click', (function (stations) { 1433 return function () { 1434 info.setContent(stations); 1435 info.open(setMap, this); 1436 } 1437 })(stations)); 1438 } 1439 } 1440 1441 var map = $('#map'); 1442 1443 if (map.length) { 1444 google.maps.event.addDomListener(window, 'load', initMap(map)); 1445 google.maps.event.addDomListener(window, 'resize', initMap(map)); 1446 } 1447 1448 /* _____________________________________ 1449 1450 Bootstrap Fix: IE10 in Win 8 & Win Phone 8 1451 _____________________________________ */ 1452 1453 1454 if (navigator.userAgent.match(/IEMobile\/10\.0/)) { 1455 var msViewportStyle = document.createElement("style"); 1456 msViewportStyle.appendChild( 1457 document.createTextNode( 1458 "@-ms-viewport{width:auto!important}" 1459 ) 1460 ); 1461 document.querySelector("head").appendChild(msViewportStyle) 1462 } 1463 } 1464) 1465;
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.