1(function($){ 2 3 'use strict'; 4 5 function initNavbar () { 6 if (!$('section:first').is('.parallax, #home, .splash')) { 7 $('#topnav').addClass('scroll'); 8 $('body').addClass('top-padding'); 9 } 10 11 if ($('section:first').is('#home') && $('#home').hasClass('bordered')) { 12 $('#topnav').addClass('top-space'); 13 } 14 15 $(window).scroll(function() { 16 17 if($('section:first').is('.parallax, #home, .splash')){ 18 if ($(window).scrollTop() >= 100 ) { 19 $('#topnav').addClass('scroll'); 20 } else{ 21 $('#topnav').removeClass('scroll'); 22 } 23 } 24 25 var filters = $('#filters'); 26 if(filters.length && !filters.hasClass('no-fix')){ 27 if ($(window).scrollTop() >= $('.page-title:first').height() + 30) { 28 filters.addClass('fixed'); 29 } else{ 30 filters.removeClass('fixed'); 31 } 32 } 33 34 }).trigger('scroll'); 35 36 $('.navbar-toggle').on('click', function(event) { 37 $(this).toggleClass('open'); 38 $('#navigation').slideToggle(400); 39 $('.cart, .search').removeClass('open'); 40 }); 41 42 $('.cart').on('click', function(event) { 43 event.preventDefault(); 44 event.stopPropagation(); 45 if ($(window).width() < 768) { 46 if ($('#navigation').is(':visible')) { 47 $('.navbar-toggle').click(); 48 } 49 $('.search').removeClass('open'); 50 $(this).toggleClass('open'); 51 } 52 }); 53 54 $('.search').on('click', function(event) { 55 event.preventDefault(); 56 event.stopPropagation(); 57 if ($(window).width() < 768) { 58 if ($('#navigation').is(':visible')) { 59 $('.navbar-toggle').click(); 60 } 61 $('.cart').removeClass('open'); 62 $(this).toggleClass('open'); 63 } 64 }); 65 66 $('.shopping-cart, .search-form').on('click', function(e) { 67 event.stopPropagation(); 68 }); 69 70 $('body').on('click', function(event) { 71 $('.cart, .search').removeClass('open'); 72 }); 73 74 $('.navigation-menu>li').slice(-2).addClass('last-elements'); 75 76 $('.navigation-menu li.has-submenu a[href="#"]').on('click', function(e) { 77 if ($(window).width() < 992) { 78 e.preventDefault(); 79 $(this).parent('li').toggleClass('open').find('.submenu:first').toggleClass('open'); 80 } 81 }); 82 } 83 84 function initHomeSlider() { 85 86 $('#home-slider img').each(function(index, el) { 87 var slide = $(this).parent('li'); 88 var image = $(this).attr('src'); 89 90 $(slide).prepend($('<div class="slide-image"></div>').css('background-image', 'url('+image+')')); 91 92 if (navigator.userAgent.indexOf("Firefox") != -1 && $('#home').hasClass('bordered')) { 93 $('.slide-image').addClass('ff-fix'); 94 } 95 96 $(this).remove(); 97 }); 98 99 var options = { 100 prevText: '<i class="ti-angle-left"></i>', 101 nextText: '<i class="ti-angle-right"></i>', 102 keyboard: false, 103 }; 104 105 if ($('#home-slider .slides > li').length < 2) { 106 options.directionNav = false 107 } 108 109 if ($('#home-slider').hasClass('kenburn')) { 110 111 options.start = function () { 112 $('#home-slider').find(".slides > li.flex-active-slide > .slide-image").each(function () { 113 var $content = $(this); 114 $content.css({ 115 '-webkit-transform': 'scale(1.2)', 116 '-moz-transform': 'scale(1.2)', 117 'transform': 'scale(1.2)', 118 }); 119 }) 120 } 121 122 options.before = function () { 123 $('#home-slider').find(".slides > li > .slide-image").each(function () { 124 var $content = $(this); 125 $content.css({ 126 '-webkit-transform': 'scale(1)', 127 '-moz-transform': 'scale(1)', 128 'transform': 'scale(1)', 129 }); 130 }) 131 } 132 133 options.after = function () { 134 $('#home-slider').find(".slides > li.flex-active-slide > .slide-image").each(function () { 135 var $content = $(this); 136 $content.css({ 137 '-webkit-transform': 'scale(1.2)', 138 '-moz-transform': 'scale(1.2)', 139 'transform': 'scale(1.2)', 140 }); 141 }) 142 } 143 } 144 145 $('#home-slider').flexslider(options); 146 147 $('#text-rotator').flexslider({ 148 controlNav: false, 149 directionNav: false 150 }) 151 } 152 153 function initCarousels () { 154 $('.owl-carousel').each(function(index, el) { 155 var dataOptions = $(this).data('options') || {}; 156 157 var options = { 158 items: dataOptions.items || 4, 159 loop: dataOptions.loop || true, 160 dots: dataOptions.dots || false, 161 margin: dataOptions.margin || 10, 162 autoplay: dataOptions.autoplay || false, 163 responsiveClass: true, 164 responsive:{ 165 0:{ 166 items: dataOptions.xsItems || 1, 167 margin: 25 168 }, 169 768:{ 170 items: dataOptions.smItems || 2, 171 }, 172 992:{ 173 items:dataOptions.mdItems || 3, 174 }, 175 1200: { 176 items: dataOptions.items || 4 177 } 178 } 179 } 180 181 if (options.autoplay) { 182 options.autoplayTimeout = dataOptions.autoplayTimeout || 2000; 183 options.autoplayHoverPause = true; 184 } 185 186 187 $(el).owlCarousel(options); 188 }); 189 } 190 191 function initSliders () { 192 $('.flexslider').each(function(index, el) { 193 var dataOptions = $(this).data('options') || {}; 194 195 var options = { 196 animation: dataOptions.animation === 'slide' ? 'slide' : 'fade', 197 controlNav: dataOptions.controlNav === true ? true : false, 198 directionNav: dataOptions.directionNav === true ? true : false, 199 prevText: '<i class="ti-arrow-left"></i>', 200 nextText: '<i class="ti-arrow-right"></i>', 201 }; 202 203 $(el).flexslider(options); 204 }); 205 } 206 207 function initMap() { 208 209 var lat = $('#map').data('lat'); 210 var lang = $('#map').data('lang'); 211 212 var myLatlng = new google.maps.LatLng(lat, lang); 213 214 var styles = [{"featureType":"water","elementType":"geometry","stylers":[{"color":"#e9e9e9"},{"lightness":17}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#f5f5f5"},{"lightness":20}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#ffffff"},{"lightness":17}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#ffffff"},{"lightness":29},{"weight":0.2}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#ffffff"},{"lightness":18}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#ffffff"},{"lightness":16}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#f5f5f5"},{"lightness":21}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#dedede"},{"lightness":21}]},{"elementType":"labels.text.stroke","stylers":[{"visibility":"on"},{"color":"#ffffff"},{"lightness":16}]},{"elementType":"labels.text.fill","stylers":[{"saturation":36},{"color":"#333333"},{"lightness":40}]},{"elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#f2f2f2"},{"lightness":19}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#fefefe"},{"lightness":20}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#fefefe"},{"lightness":17},{"weight":1.2}]}]; 215 216 var mapOptions = { 217 zoom: 15, 218 center: myLatlng, 219 mapTypeControl: false, 220 disableDefaultUI: true, 221 zoomControl: false, 222 scrollwheel: false, 223 styles: styles 224 } 225 226 var map = new google.maps.Map(document.getElementById('map'), mapOptions); 227 228 var infowindow = new google.maps.InfoWindow({ 229 content: "<strong>Brixel | Arca Studios</strong><br/>Via Valprato 68, 10144 Torino" 230 }); 231 232 var marker = new google.maps.Marker({ 233 position: myLatlng, 234 map: map, 235 icon: 'https://www.brixel.it/wp-content/themes/brixel/images/marker.svg', 236 title: 'Brixel | Arca Studios, via Valprato 68, Torino' 237 }); 238 239 google.maps.event.addListener(marker, 'click', function() { 240 infowindow.open(map,marker); 241 }); 242 } 243 244 function initCountdowns () { 245 var theDate = $('.countdown').data('date'); 246 $(".countdown").downCount({ 247 date: theDate, 248 offset: 0 249 }); 250 } 251 252 function initAccordions () { 253 $('.accordion-title').on('click', function(event) { 254 var accordion = $(this).parents('.accordion'); 255 256 if (!accordion.data('multiple')) { 257 accordion.find('li').not($(this).parent()).removeClass('active'); 258 accordion.find('li').not($(this).parent()).find('.accordion-content').slideUp(300); 259 } 260 261 $(this).parent('li').toggleClass('active'); 262 $(this).next().slideToggle(300, function () { 263 fixScroll(); 264 }); 265 266 }); 267 } 268 269 function initLoad () { 270 $(window).load(function() { 271 272 $("#loader").delay(500).fadeOut(); 273 $("#mask").delay(1000).fadeOut("slow"); 274 275 var $grid = $('#works').isotope({ 276 masonry: { 277 columnWidth: 0 278 }, 279 itemSelector: '.work-item' 280 }); 281 282 $grid.on('layoutComplete', function(event) { 283 $(window).trigger('resize'); 284 fixScroll(); 285 });; 286 287 $('.blog-masonry').isotope({ 288 masonry: { 289 columnWidth: 0 290 }, 291 itemSelector: '.masonry-post' 292 }); 293 294 $('#filters').on('click', 'li', function() { 295 $('#filters li').removeClass('active'); 296 $(this).addClass('active'); 297 var filterValue = $(this).attr('data-filter'); 298 $('#works').isotope({ filter: filterValue }); 299 $(window).trigger('resize'); 300 }); 301 302 }); 303 } 304 305 function initVideoModal () { 306 $('.play-button').on('click', function(e) { 307 var videoUrl = $(this).data('src'); 308 309 var template = '<div id="gallery-modal">'; 310 template += '<div class="centrize">'; 311 template += '<div class="v-center">'; 312 template += '<div class="gallery-image">'; 313 template += '<div class="media-video">'; 314 template += '<a href="#" id="gallery-close"><i class="ti-close"></i></a>'; 315 template += '<iframe src="'+ videoUrl +'" frameborder="0">'; 316 template += '</div>'; 317 template += '</div>'; 318 template += '</div>'; 319 template += '</div>'; 320 template += '</div>'; 321 322 $('body').append(template); 323 324 $('body').addClass('modal-open'); 325 326 $('#gallery-modal').fadeIn(300); 327 328 }); 329 } 330 331 function initVideoBg(){ 332 333 if ($('.player').length) { 334 $('.player').mb_YTPlayer({ 335 containment: '#video-wrapper', 336 autoPlay: true, 337 mute: true 338 }); 339 340 if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { 341 $('#video-wrapper').append('<div id="fallback-bg"></div>'); 342 $('#fallback-bg').css('background-image', 'url('+$('#video-wrapper').data('fallback-bg')+')'); 343 } 344 } 345 346 var videoEl = $('#video-wrapper video'); 347 348 var setProportion = function () { 349 var proportion = getProportion();
350 videoEl.width(proportion*1280); 351 videoEl.height(proportion*780); 352 353 centerVideo(); 354 } 355 356 var getProportion = function () { 357 var windowWidth = $(window).width(); 358 var windowHeight = $(window).height(); 359 var windowProportion = windowWidth / windowHeight; 360 var origProportion = 1280 / 720; 361 var proportion = windowHeight / 720; 362 363 if (windowProportion >= origProportion) { 364 proportion = windowWidth / 1280; 365 } 366 367 return proportion; 368 } 369 370 var centerVideo = function() { 371 var centerX = (($(window).width() >> 1) - (videoEl.width() >> 1)) | 0; 372 var centerY = (($(window).height() >> 1) - (videoEl.height() >> 1)) | 0; 373 374 videoEl.css({ 'left': centerX, 'top': centerY }); 375 376 } 377 378 if (videoEl.length) { 379 $(window).resize(function() { 380 setProportion(); 381 }).trigger('resize'); 382 } 383 } 384 385 function initPhotoGallery () { 386 387 var imagesArray = []; 388 389 $('.photo-gallery').on('click', '.gallery-item a', function(event) { 390 event.preventDefault(); 391 392 var gallery = $(this).parents('.photo-gallery'); 393 var galleryElements = gallery.find('.gallery-item>a'); 394 395 for (var i = 0; i < galleryElements.length; i++) { 396 imagesArray.push($(galleryElements[i]).attr('href')); 397 }; 398 399 var image = $(this).attr('href'); 400 401 var template = '<div id="gallery-modal">'; 402 template += '<div class="centrize">'; 403 template += '<div class="v-center">'; 404 template += '<div class="gallery-image">'; 405 template += '<a href="#" id="gallery-close"><i class="ti-close"></i></a>'; 406 template += '<a href="#" class="gallery-control gallery-prev"><i class="ti-angle-left"></i></a>'; 407 template += '<img src="'+imagesArray[imagesArray.indexOf(image)]+'" alt="">'; 408 template += '<a href="#" class="gallery-control gallery-next"><i class="ti-angle-right"></i></a>'; 409 template += '</div>'; 410 template += '</div>'; 411 template += '</div>'; 412 template += '</div>'; 413 414 $('body').append(template); 415 $('body').addClass('modal-open'); 416 417 $('#gallery-modal').fadeIn(300); 418 419 }); 420 421 $('body').on('click', '.gallery-control', function(event) { 422 event.preventDefault(); 423 event.stopPropagation(); 424 425 var currentImage = $('.gallery-image').find('img'); 426 427 if ($(this).hasClass('gallery-next')) { 428 if (imagesArray.indexOf(currentImage.attr('src')) >= (imagesArray.length - 1)) { 429 return false; 430 } 431 432 currentImage.fadeOut(300, function() { 433 var nextImage = imagesArray[imagesArray.indexOf(currentImage.attr('src')) + 1] 434 $(currentImage).attr('src', nextImage); 435 }).fadeIn(300); 436 } 437 438 else if ($(this).hasClass('gallery-prev')) { 439 if (imagesArray.indexOf(currentImage.attr('src')) < 1) { 440 return false; 441 } 442 443 currentImage.fadeOut(300, function() { 444 var nextImage = imagesArray[imagesArray.indexOf(currentImage.attr('src')) - 1] 445 $(currentImage).attr('src', nextImage); 446 }).fadeIn(300); 447 448 } 449 450 }); 451 452 $('body').on('click', '#gallery-close', function(event) { 453 event.preventDefault(); 454 $('#gallery-modal').fadeOut(300, function() { 455 $('#gallery-modal').remove(); 456 }); 457 $('body').removeClass('modal-open'); 458 }); 459 460 $('body').on('click', '.gallery-image', function(event) { 461 event.stopPropagation(); 462 }); 463 464 $('body').on('click', '#gallery-modal', function(event) { 465 $('#gallery-close').trigger('click'); 466 }); 467 468 $(document).keyup(function(e) { 469 if (e.keyCode == 27) { 470 $('#gallery-close').trigger('click'); 471 } 472 if (e.keyCode == 37) { 473 $('.gallery-control.gallery-prev').trigger('click'); 474 } 475 if (e.keyCode == 39) { 476 $('.gallery-control.gallery-next').trigger('click'); 477 } 478 }); 479 } 480 481 function initContactForm() { 482 483 var requiredInputs = $('#contact-form').find('input[data-required="true"], textarea[data-required="true"]').toArray(); 484 485 var isValidForm = function() { 486 var toReturn; 487
488 requiredInputs.forEach(function(element, index){ 489 if (!$(element).val()) { 490 toReturn = false; 491 } else{ 492 toReturn = true; 493 } 494 }); 495 496 return toReturn; 497 } 498 499 $('#contact-form').on('submit', function(event) { 500 501 event.preventDefault(); 502 503 requiredInputs.forEach(function(element, index){ 504 if (!$(element).val()) { 505 $(element).parent('.form-group').addClass('has-error'); 506 } else{ 507 $(element).parent('.form-group').removeClass('has-error'); 508 } 509 }); 510 511 if (isValidForm()) { 512 $.ajax({ 513 url: $(this).attr('action'), 514 type: 'POST', 515 data: $(this).serialize(), 516 }) 517 .done(function() { 518 var message = $('#contact-form').data('success-text') || 'Your message has been sent. We will get back to you shortly!'; 519 var succesTemplate = '<div role="alert" class="alert alert-success alert-outline">'+ message +'</div>'; 520 $('#contact-form input, #contact-form textarea, #contact-form button').attr('disabled', 'disabled'); 521 $('#contact-form .alert').fadeOut(300); 522 $(succesTemplate).insertBefore($('#contact-form button')); 523 }) 524 .fail(function() { 525 var message = $('#contact-form').data('error-text') || 'There was an error. Try again later.'; 526 var errorTemplate = '<div role="alert" class="alert alert-danger alert-outline">'+ message +'</div>'; 527 $('#contact-form .alert').fadeOut(300); 528 $(errorTemplate).insertBefore($('#contact-form button')); 529 }) 530 } 531 532 }); 533 534 $('#contact-form input, #contact-form textarea').on('keyup', function(event) { 535 event.preventDefault(); 536 if ($(this).val()) { 537 $(this).parent('.form-group').removeClass('has-error'); 538 } 539 }); 540 } 541 542 function initCounters () { 543 544 $('.counter').appear(function() { 545 var counter = $(this).find('.number-count'); 546 var toCount = counter.data('count'); 547 548 $(counter).countTo({ 549 from: 0, 550 to: toCount, 551 speed: 1000, 552 refreshInterval: 50 553 }) 554 555 }); 556 } 557 558 function fixScroll() { 559 $('#sscr').css('height', 0); 560 $('#sscr').css('height', document.documentElement.scrollHeight + 'px'); 561 } 562 563 function initForms () { 564 565 $('form[data-mailchimp]').each(function(index, el) { 566 $(el).ajaxChimp({ 567 url: 'http://hody.us12.list-manage.com/subscribe/post?u=d9d1052c1b2ba81576842a9fb&id=c70c5d0c82', 568 callback: function (res) { 569 var template = '<div class="modal fade" id="modal" tabindex="-1" role="dialog">'; 570 template += '<div class="centrize">'; 571 template += '<div class="v-center">'; 572 template += '<div class="modal-dialog">'; 573 template += '<div class="modal-content">'; 574 template += '<div class="modal-header">'; 575 template += '<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="ti-close"></i></span></button>'; 576 if (res.result === 'success') { 577 template += '<h4 class="modal-title">Thank you!</h2>'; 578 } else{ 579 template += '<h4 class="modal-title">There was an error.</h2>'; } 580 581 template += '</div>'; 582 template += '<div class="modal-body">'; 583 template += '<p>' + res.msg + '</p>'; 584 template += '</div>'; 585 template += '</div>'; 586 template += '</div>'; 587 template += '</div>'; 588 template += '</div>'; 589 template += '</div>'; 590 591 $(template).modal().on('hidden.bs.modal', function () { 592 $(this).remove(); 593 }); 594 } 595 }); 596 }); 597 } 598 599 function initGeneral () { 600 601 $("a[href='#top']").on('click', function() { 602 $("html, body").animate({ scrollTop: 0 }, 1000); 603 return false; 604 }); 605 606 $('a[data-scroll="true"]').on('click', function() { 607 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 608 var target = $(this.hash); 609 target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 610 if (target.length) { 611 $('html,body').animate({ 612 scrollTop: target.offset().top 613 }, 1000); 614 return false;
615 } 616 } 617 }); 618 619 if ($('#navigation').data('onepage')) { 620 $('body').scrollspy({ 621 target: '#navigation' 622 }); 623 } 624 625 $('.bg-img, .thumb-placeholder').each(function(index, el) { 626 var image = $(el).attr('src'); 627 $(el).parent().css('background-image', 'url(' + image + ')'); 628 $(el).remove(); 629 }); 630 631 $('.alert').on('closed.bs.alert', function () { 632 fixScroll(); 633 }); 634 635 $('body').on('click', '.alert', function() { 636 $(this).on('closed.bs.alert', function() { 637 fixScroll(); 638 }); 639 }); 640 641 var parallaxZIndex = -100; 642 643 if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("MSIE ") != -1 || navigator.userAgent.match(/Trident.*rv\:11\./) != null){ 644 parallaxZIndex = 11; 645 $('section.parallax').css('z-index', 20); 646 } 647 648 $('.parallax-bg').parallax({ 649 speed: 0.5, 650 zIndex: parallaxZIndex 651 }); 652 653 $('#login-tabs a:first').tab('show'); 654 655 $('#login-content .tab-pane:first').addClass('fade in'); 656 657 $('#login-tabs li a').on('click', function (e) { 658 e.preventDefault(); 659 $(this).tab('show'); 660 }); 661 662 $('a[data-toggle=tab]').on('click', function(event) { 663 $(window).trigger('resize'); 664 }).on('shown.bs.tab', function(e) { 665 var container = $($(this).attr('href')); 666 667 if (container.find('.progress-bar').length) { 668 container.find('.progress-bar').each(function(index, el) { 669 $(el).css('width', $(this).data('progress') + '%'); 670 $(el).parents('.skill').find('.skill-perc').css('right', 100 - $(el).data('progress') + '%'); 671 }); 672 } 673 674 });; 675 676 $('.particles-bg').particleground({ 677 dotColor: '#EF2D56', 678 particleRadius: 5 679 }); 680 681 $('.boxes [data-bg-color]').each(function(index, el) { 682 $(el).css('background-color', $(el).data('bg-color')); 683 }); 684 685 $('.progress-bar').appear(function() { 686 $(this).css('width', $(this).data('progress') + '%'); 687 $(this).parents('.skill').find('.skill-perc').css('right', 100 - $(this).data('progress') + '%'); 688 }); 689 690 $('[data-animated=true]').addClass('invisible'); 691 692 $('[data-animated=true]').appear(function(){ 693 var el = $(this); 694 if (el.data('delay')) { 695 setTimeout(function(){ 696 el.removeClass('invisible').addClass('fade-in-top'); 697 }, parseInt(el.data('delay'))); 698 } else{ 699 $(this).removeClass('invisible').addClass('fade-in-top'); 700 } 701 }, {accX: 0, accY: 0}); 702 703 $('.client-image').hover(function() { 704 $(this).removeClass('fade-in-top') 705 }, function() { 706 // 707 }); 708 } 709 710 function initCustom () { 711 // Your custom code here. 712 } 713 714 function init () { 715 initNavbar(); 716 initHomeSlider(); 717 initCarousels(); 718 initSliders(); 719 initAccordions(); 720 initLoad(); 721 initVideoBg(); 722 initVideoModal(); 723 initPhotoGallery(); 724 initContactForm(); 725 //initCounters(); 726 //initForms(); 727 initGeneral(); 728 initCustom(); 729 730 /* if ($('#map').length) { 731 google.maps.event.addDomListener(window, 'load', initMap); 732 $('#map').css('position', 'absolute'); 733 } */ 734 735 /* if ($('.countdown').length) { 736 initCountdowns(); 737 } */ 738 } 739 740 init(); 741 742})(jQuery)
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.