1jQuery( document ).ready( function( $ ) { 2 3 /** 4 * 5 * strict mode 6 * 7 */ 8 9 'use strict'; 10 11 /** 12 * 13 * global variables 14 * 15 */ 16 17 var martanianRenovationCompanyIntervals = []; 18 var martanianRenovationCompanyIsotopes = []; 19 var martanianRenovationCompanyGalleryNeighbors; 20 var martanianRenovationCompanyPageWidth; 21 var martanianRenovationCompanyResponsiveMenuVisible = false; 22 23 /** 24 * 25 * window load functions 26 * 27 */ 28 29 $( window ).load( function() { 30 31 /** 32 * 33 * configure heading slider 34 * 35 */ 36 37 $.martanianRenovationCompanyConfigureHeadingSlider(); 38 39 /** 40 * 41 * configure offers slider 42 * 43 */ 44 45 $.martanianRenovationCompanyConfigureOffersSlider(); 46 47 /** 48 * 49 * configure logos slider 50 * 51 */ 52 53 $.martanianRenovationCompanyConfigureLogosSlider(); 54 55 /** 56 * 57 * configure google maps 58 * 59 */ 60 61 $.martanianRenovationCompanyConfigureGoogleMaps(); 62 63 /** 64 * 65 * configure progress bars 66 * 67 */ 68 69 $.martanianRenovationCompanyConfigureProgressBars(); 70 71 /** 72 * 73 * configure isotope 74 * 75 */ 76 77 $.martanianRenovationCompanyConfigureIsotope(); 78 79 /** 80 * 81 * configure small images sliders 82 * 83 */ 84 85 $.martanianRenovationCompanyConfigureSmallImagesSlider(); 86 87 /** 88 * 89 * configure references 90 * 91 */ 92 93 $.martanianRenovationCompanyConfigureReferences(); 94 95 /** 96 * 97 * configure value sliders 98 * 99 */ 100 101 $.martanianRenovationCompanyConfigureValueSlider(); 102 103 /** 104 * 105 * configure selects 106 * 107 */ 108 109 $.martanianRenovationCompanyConfigureSelects(); 110 111 /** 112 * 113 * configure widget lists 114 * 115 */ 116 117 $.martanianRenovationCompanyConfigureWidgetLists(); 118 119 /** 120 * 121 * configure responsive menu 122 * 123 */ 124 125 $.martanianRenovationCompanyConfigureResponsiveMenu(); 126 127 /** 128 * 129 * remove bottom margins 130 * 131 */ 132 133 $.martanianRenovationCompanyRemoveMarginBottom(); 134 135 /** 136 * 137 * configure dynamic timelines 138 * 139 */ 140 141 $.martanianRenovationCompanyConfigureDynamicTimeline(); 142 143 /** 144 * 145 * configure sidebars for responsive view 146 * 147 */ 148 149 $.martanianRenovationCompanyConfigureSidebarsForResponsiveView(); 150 151 /** 152 * 153 * configure google map width for multiple contacts 154 * 155 */ 156 157 $.martanianRenovationCompanyConfigureMultipleContactsMap(); 158 159 /** 160 * 161 * configure comments visibility 162 * 163 */ 164 165 $.martanianRenovationCompanyConfigureCommentsVisibility(); 166 167 /** 168 * 169 * configure reply forms 170 * 171 */ 172 173 $.martanianRenovationCompanyConfigureReplyForm(); 174 175 /** 176 * 177 * configure search form 178 * 179 */ 180 181 $.martanianRenovationCompanyConfigureSearchForm(); 182 183 /** 184 * 185 * configure content and sidebar height 186 * 187 */ 188 189 $.martanianRenovationCompanyConfigureContentAndSidebarHeight(); 190 191 /** 192 * 193 * configure parallax 194 * 195 */ 196 197 $.martanianRenovationCompanySetParallax(); 198 199 /** 200 * 201 * flying header menu manager 202 * 203 */ 204 205 $.martanianRenovationCompanyFlyingHeaderMenu( 'header.header-main .bottom .center' ); 206 $.martanianRenovationCompanyFlyingHeaderMenu( '.responsive-menu' ); 207 208 /** 209 * 210 * coming-soon section full height 211 * 212 */ 213 214 $.martanianRenovationCompanyComingSoonHeight(); 215 216 /** 217 * 218 * scroll to faq heading if choosed 219 * 220 */ 221 222 $.martanianRenovationCompanyScrollToFAQHeadingOnLoad(); 223 224 /** 225 * 226 * page width 227 * 228 */ 229 230 martanianRenovationCompanyPageWidth = $( 'body' ).width(); 231 232 /** 233 * 234 * delete loader 235 * 236 */ 237 238 $( '#loader' ).animate({ 'opacity': 0 }, 300 ); 239 setTimeout( function() { 240 241 $( '#loader' ).remove(); 242 243 }, 600 ); 244 245 /** 246 * 247 * end of functions 248 * 249 */ 250 251 }); 252 253 /** 254 * 255 * resize functions 256 * 257 */ 258 259 $.martanianRenovationCompanyResizeFunction = function() { 260 261 /** 262 * 263 * page width 264 * 265 */ 266 267 var newPageWidth = $( 'body' ).width(); 268 if( newPageWidth != martanianRenovationCompanyPageWidth ) { 269 270 /** 271 * 272 * configure offers slider 273 * 274 */ 275 276 $.martanianRenovationCompanyConfigureOffersSlider(); 277 278 /** 279 * 280 * configure references 281 * 282 */ 283 284 $.martanianRenovationCompanyConfigureReferences(); 285 286 /** 287 * 288 * configure logos slider 289 * 290 */ 291 292 $.martanianRenovationCompanyConfigureLogosSlider(); 293 294 /** 295 * 296 * configure responsive menu 297 * 298 */ 299 300 $.martanianRenovationCompanyConfigureResponsiveMenu(); 301 302 /** 303 * 304 * refresh timeline heights 305 * 306 */ 307 308 $.martanianRenovationCompanyRefreshDynamicTimelineHeight(); 309 310 /** 311 * 312 * refresh gallery sizes 313 * 314 */ 315 316 $.martanianRenovationCompanyRefreshGallerySizes(); 317 318 /** 319 * 320 * refresh video sizes 321 * 322 */ 323 324 $.martanianRenovationCompanyRefreshVideoSizes(); 325 326 /** 327 * 328 * configure google map width for multiple contacts 329 * 330 */ 331 332 $.martanianRenovationCompanyConfigureMultipleContactsMap(); 333 334 /** 335 * 336 * configure sidebars for responsive view 337 * 338 */ 339 340 $.martanianRenovationCompanyConfigureSidebarsForResponsiveView(); 341 342 /** 343 * 344 * configure content and sidebar height 345 * 346 */ 347 348 $.martanianRenovationCompanyConfigureContentAndSidebarHeight(); 349 350 /** 351 * 352 * configure parallax 353 * 354 */ 355 356 $.martanianRenovationCompanySetParallax(); 357 358 /** 359 * 360 * coming-soon section full height 361 * 362 */ 363 364 $.martanianRenovationCompanyComingSoonHeight(); 365 366 /** 367 * 368 * scroll to faq heading if choosed 369 * 370 */ 371 372 $.martanianRenovationCompanyScrollToFAQHeadingOnLoad(); 373 374 /** 375 * 376 * flying header menu manager 377 * 378 */ 379 380 $.martanianRenovationCompanyFlyingHeaderMenu( 'header.header-main .bottom .center' ); 381 $.martanianRenovationCompanyFlyingHeaderMenu( '.responsive-menu' ); 382 383 /** 384 * 385 * update current page width 386 * 387 */ 388 389 martanianRenovationCompanyPageWidth = newPageWidth; 390 391 /** 392 * 393 * end of functions 394 * 395 */ 396 } 397 398 }; 399 400 /** 401 * 402 * catch resize actions 403 * 404 */ 405 406 $( window ).resize( function() { $.martanianRenovationCompanyResizeFunction(); }); 407 $( window ).bind( 'orientationchange', function() { $.martanianRenovationCompanyResizeFunction(); }); 408 409 /** 410 * 411 * change menu visibility flag 412 * 413 */ 414 415 $.martanianRenovationCompanyChangeResponsiveMenuVisibilityFlag = function( visibility ) { 416 417 martanianRenovationCompanyResponsiveMenuVisible = visibility; 418 419 }; 420 421 /** 422 * 423 * configure offers slider 424 * 425 */ 426 427 $.martanianRenovationCompanyConfigureOffersSlider = function() { 428 429 $( 'section.offer' ).each( function() { 430 431 var section = $( this ); 432 var slider = section.find( '.values-slider' ); 433 var elementsCount = slider.children( '.value-single' ).length; 434 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 435 var elementMargin = contentSize < 1050 ? 30 : 45; 436 var elementsPerScreen = contentSize < 625 ? 1 : ( contentSize <= 1050 ? 2 : 3 ); 437
438 if( contentSize < 625 ) slider.children( '.value-single' ).css({ 'width': contentSize - 62 }); 439 else { 440 441 slider.children( '.value-single' ).css({ 'width': '' }); 442 } 443 444 var elementWidth = slider.children( '.value-single' )[0].getBoundingClientRect().width; 445 446 slider.css({ 'width': ( elementWidth * elementsCount ) + ( elementMargin * elementsCount ) + 1000 }); 447 slider.css({ 'margin-left': 0 }); 448 449 var valueID = 1; 450 slider.children( '.value-single' ).each( function() { 451 452 $( this ).attr( 'data-value-id', valueID ); 453 valueID++; 454 455 }); 456 457 slider.children( '.value-single[data-value-id="'+ ( valueID - 1 ) +'"]' ).addClass( 'value-single-last' ); 458 459 section.find( '.values-prev' ).attr( 'data-near-element-id', '1' ).data( 'near-element-id', '1' ); 460 section.find( '.values-next' ).attr( 'data-near-element-id', elementsCount < elementsPerScreen ? elementsCount : elementsPerScreen ).data( 'near-element-id', elementsCount < elementsPerScreen ? elementsCount : elementsPerScreen ); 461 462 }); 463 464 }; 465 466 /** 467 * 468 * offers slider 469 * 470 */ 471 472 $( 'body' ).on( 'click touchstart', 'section.offer .values-prev, section.offer .values-next', function( event ) { 473 474 event.preventDefault(); 475 476 var element = $( this ); 477 if( !element.hasClass( 'proceed' ) ) { 478 479 element.addClass( 'proceed' ); 480 481 var section = element.parent().parent().parent(); 482 var type = element.hasClass( 'values-prev' ) ? 'prev' : 'next'; 483 var container = element.siblings( '.values-slider-container' ); 484 var prevNearElementID = parseInt( section.find( '.values-prev' ).data( 'near-element-id' ), 10 ); 485 var nextNearElementID = parseInt( section.find( '.values-next' ).data( 'near-element-id' ), 10 ); 486 var elementWidth = container.find( '.value-single' )[0].getBoundingClientRect().width; 487 var elementsCount = container.find( '.value-single' ).length; 488 var position = parseInt( container.children( '.values-slider' ).css( 'margin-left' ), 10 ); 489 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 490 var elementMargin = contentSize < 1050 ? 30 : 45; 491 var elementsPerScreen = contentSize < 625 ? 1 : ( contentSize <= 1050 ? 2 : 3 ); 492 493 if( type == 'next' ) { 494 495 if( nextNearElementID == elementsCount ) { 496 497 position = 0; 498 499 section.find( '.values-prev' ).data( 'near-element-id', '1' ).attr( 'data-near-element-id', 1 ); 500 section.find( '.values-next' ).data( 'near-element-id', elementsCount < elementsPerScreen ? elementsCount : elementsPerScreen ).attr( 'data-near-element-id', elementsCount < elementsPerScreen ? elementsCount : elementsPerScreen ); 501 } 502 503 else { 504 505 position = position - ( elementWidth + elementMargin ); 506 507 section.find( '.values-prev' ).data( 'near-element-id', ( prevNearElementID + 1 ) ).attr( 'data-near-element-id', ( prevNearElementID + 1 ) ); 508 section.find( '.values-next' ).data( 'near-element-id', ( nextNearElementID + 1 ) ).attr( 'data-near-element-id', ( nextNearElementID + 1 ) ); 509 } 510 } 511 512 else { 513 514 if( prevNearElementID == 1 ) { 515 516 position = - ( ( elementWidth * ( elementsCount - elementsPerScreen ) ) + ( ( elementsCount - elementsPerScreen ) * elementMargin ) ); 517 518 section.find( '.values-prev' ).data( 'near-element-id', ( elementsCount - ( elementsPerScreen - 1 ) ) ).attr( 'data-near-element-id', ( elementsCount - ( elementsPerScreen - 1 ) ) ); 519 section.find( '.values-next' ).data( 'near-element-id', ( elementsCount ) ).attr( 'data-near-element-id', ( elementsCount ) ); 520 } 521 522 else { 523 524 position = position + ( elementWidth + elementMargin ); 525 526 section.find( '.values-prev' ).data( 'near-element-id', ( prevNearElementID - 1 ) ).attr( 'data-near-element-id', ( prevNearElementID - 1 ) ); 527 section.find( '.values-next' ).data( 'near-element-id', ( nextNearElementID - 1 ) ).attr( 'data-near-element-id', ( nextNearElementID - 1 ) ); 528 } 529 } 530 531 container.children( '.values-slider' ).animate({ 'margin-left': position +'px' }, 300 ); 532 setTimeout( function() { 533 534 element.removeClass( 'proceed' ); 535 536 }, 300 ); 537 } 538 539 }); 540 541 /** 542 * 543 * configure logos slider 544 * 545 */ 546 547 $.martanianRenovationCompanyConfigureLogosSlider = function() { 548 549 var logosSliderID = 1; 550 $( 'section.logos-slider' ).each( function() { 551 552 var section = $( this ); 553 var navigation = section.find( '.logos-slider-navigation' ); 554 var slider = section.find( '.logos-slider' ); 555 556 navigation.html( '' ); 557 clearInterval( martanianRenovationCompanyIntervals['logos-slider-'+ logosSliderID] ); 558 section.find( '.logos-slider' ).css({ 'margin-left': 0 }); 559 560 if( slider.find( '.single-logo' ).parent().hasClass( 'logos-slider-group' ) ) { 561 562 slider.find( '.single-logo' ).unwrap().removeClass().addClass( 'single-logo' ); 563 } 564 565 var logosCount = slider.children( '.single-logo' ).length; 566 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 567 var perScreen = contentSize < 750 ? 3 : ( contentSize < 1050 ? 4 : ( contentSize < 1300 ? 5 : 6 ) );
568 var screensCount = Math.ceil( logosCount / perScreen ); 569 var intervalTime = section.data( 'interval' ); 570 571 var groupID = 1; 572 var inGroup = 0; 573 574 slider.children( '.single-logo' ).each( function() { 575 576 $( this ).addClass( 'logos-slider-group-'+ groupID ); 577 inGroup++; 578 579 if( inGroup == perScreen ) { 580 581 groupID++; 582 inGroup = 0; 583 } 584 585 }); 586 587 for( var i = 0; i < groupID; i++ ) { 588 589 slider.children( '.logos-slider-group-'+ ( i + 1 ) ).wrapAll( '<div class="logos-slider-group"></div>' ); 590 } 591 592 if( contentSize < 625 ) { 593 594 slider.find( '.logos-slider-group' ).css({ 'width': contentSize + 45 }); 595 } 596 597 if( typeof intervalTime == 'undefined' || intervalTime === null || intervalTime === false ) intervalTime = 6000; 598 section.attr( 'data-logos-slider-id', logosSliderID ); 599 600 for( var i = 0; i < screensCount; i++ ) { 601 602 navigation.append( '<li data-screen-id="'+ ( i + 1 ) +'"><span class="circle '+ ( i == 0 ? 'circle-active' : '' ) +'"></span></li>' ); 603 } 604 605 if( screensCount > 1 && intervalTime !== 0 ) { 606 607 martanianRenovationCompanyIntervals['logos-slider-'+ logosSliderID] = setInterval( function() { 608 609 $.martanianRenovationCompanySwitchLogosSliderScreen( section, screensCount, 'next' ); 610 611 }, parseInt( intervalTime, 10 ) ); 612 } 613 614 logosSliderID++; 615 616 }); 617 618 }; 619 620 /** 621 * 622 * switch logos slider screen automatically 623 * 624 */ 625 626 $.martanianRenovationCompanySwitchLogosSliderScreen = function( section, screensCount, screenID ) { 627 628 var currentScreenID = section.find( '.logos-slider-navigation' ).find( '.circle-active' ).parent().data( 'screen-id' ); 629 var position = 0; 630 var sectionWidth = section.children( '.center' ).width(); 631 632 if( screensCount == 'find' ) screensCount = section.find( '.logos-slider-navigation' ).children( 'li' ).length; 633 if( screenID == 'next' ) screenID = currentScreenID + 1 > screensCount ? 1 : currentScreenID + 1; 634 635 section.find( '.logos-slider-navigation' ).children( 'li[data-screen-id="'+ currentScreenID +'"]' ).children( '.circle' ).removeClass( 'circle-active' ); 636 section.find( '.logos-slider-navigation' ).children( 'li[data-screen-id="'+ screenID +'"]' ).children( '.circle' ).addClass( 'circle-active' ); 637 638 if( screenID == 1 ) { 639 640 position = 0; 641 } 642 643 else { 644 645 position = - ( ( sectionWidth * ( screenID - 1 ) ) + ( 45 * ( screenID - 1 ) ) ); 646 } 647 648 section.find( '.logos-slider' ).animate({ 'margin-left': position +'px' }, 800 ); 649 650 }; 651 652 /** 653 * 654 * switch logos slider screen on click 655 * 656 */ 657 658 $( 'body' ).on( 'click touchstart', 'section.logos-slider .logos-slider-navigation li', function( event ) { 659 660 event.preventDefault(); 661 662 var element = $( this ); 663 var section = element.parent().parent().parent(); 664 var navigation = section.find( '.logos-slider-navigation' ); 665 var screenID = element.data( 'screen-id' ); 666 var logosSliderID = section.data( 'logos-slider-id' ); 667 var intervalTime = section.data( 'interval' ); 668 669 if( typeof intervalTime == 'undefined' || intervalTime === null || intervalTime === false ) intervalTime = 6000; 670 if( !navigation.hasClass( 'proceed' ) ) { 671 672 navigation.addClass( 'proceed' ); 673 674 clearInterval( martanianRenovationCompanyIntervals['logos-slider-'+ logosSliderID] ); 675 $.martanianRenovationCompanySwitchLogosSliderScreen( section, 'find', screenID ); 676 677 setTimeout( function() { 678 679 if( intervalTime !== 0 ) { 680 681 martanianRenovationCompanyIntervals['logos-slider-'+ logosSliderID] = setInterval( function() { 682 683 $.martanianRenovationCompanySwitchLogosSliderScreen( section, 'find', 'next' ); 684 685 }, parseInt( intervalTime, 10 ) ); 686 } 687 688 navigation.removeClass( 'proceed' ); 689 690 }, 800 ); 691 } 692 693 }); 694 695 /** 696 * 697 * play video from image 698 * 699 */ 700 701 $( 'body' ).on( 'click touchstart', '.image-for-video', function( event ) { 702 703 event.preventDefault(); 704 705 var videoURL = $( this ).data( 'video-url' ); 706 if( typeof videoURL == 'undefined' || videoURL == '' ) return; 707 708 var videoID = videoURL.split( '?v=' ); 709 if( typeof videoID[1] == 'undefined' || videoID[1] == '' ) return; 710 711 $( '.wrapper' ).append( '<div id="video-popup"><div class="video-popup-background"></div><div class="video-popup-content"><div class="video-popup-content-close"><span>×</span></div><iframe src="https://www.youtube.com/embed/'+ videoID[1] +'?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe></div></div>' ); 712 713 var videoScale = $( this ).data( 'video-scale' ); 714 if( typeof videoScale != 'undefined' && videoScale == 'yes' ) { 715 716 var videoWidth = $( this ).data( 'video-width' ); 717 var videoHeight = $( this ).data( 'video-height' ); 718 719 if( typeof videoWidth != 'undefined' && videoWidth != '' && typeof videoHeight != 'undefined' && videoHeight != '' ) { 720 721 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 722 var scale = videoWidth / videoHeight; 723 var maxHeight = $( window ).height() - ( contentSize < 625 ? 25 : 150 ); 724 var maxWidth = $( window ).width() - ( contentSize < 625 ? 25 : 150 ); 725 var newWidth = maxWidth; 726 var newHeight = ( newWidth / scale ); 727 728 if( newHeight > maxHeight ) { 729 730 newHeight = maxHeight; 731 newWidth = newHeight * scale; 732 } 733 734 $( '#video-popup .video-popup-content' ).css({ 'width': newWidth +'px', 'height': newHeight +'px', 'margin-left': '-'+ ( newWidth / 2 ) +'px', 'margin-top': '-'+ ( newHeight / 2 ) +'px' }); 735 } 736 } 737 738 $( '#video-popup' ).css({ 'display': 'block' }); 739 740 }); 741 742 /** 743 * 744 * close video 745 * 746 */ 747 748 $( 'body' ).on( 'click touchstart', '#video-popup .video-popup-background, #video-popup .video-popup-content-close', function( event ) { 749 750 event.preventDefault(); 751 $( '#video-popup' ).remove(); 752 753 }); 754 755 /** 756 * 757 * refresh video sizes 758 * 759 */ 760 761 $.martanianRenovationCompanyRefreshVideoSizes = function() { 762 763 var videoWidth = $( '#video-popup .video-popup-content' ).width(); 764 var videoHeight = $( '#video-popup .video-popup-content' ).height(); 765 766 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 767 var scale = videoWidth / videoHeight; 768 var maxHeight = $( window ).height() - ( contentSize < 625 ? 25 : 150 ); 769 var maxWidth = $( window ).width() - ( contentSize < 625 ? 25 : 150 ); 770 var newWidth = maxWidth; 771 var newHeight = ( newWidth / scale ); 772 773 if( newHeight > maxHeight ) { 774 775 newHeight = maxHeight; 776 newWidth = newHeight * scale; 777 } 778 779 $( '#video-popup .video-popup-content' ).css({ 'width': newWidth +'px', 'height': newHeight +'px', 'margin-left': '-'+ ( newWidth / 2 ) +'px', 'margin-top': '-'+ ( newHeight / 2 ) +'px' }); 780 781 }; 782 783 /** 784 * 785 * images slider configuration 786 * 787 */ 788 789 $.martanianRenovationCompanyConfigureHeadingSlider = function() { 790 791 var headingSliderID = 1; 792 $( 'section.heading-slider' ).each( function() { 793 794 var section = $( this ); 795 var intervalTime = section.data( 'interval' ); 796 var imageID = 1; 797 798 if( typeof intervalTime == 'undefined' || intervalTime === null || intervalTime === false ) intervalTime = 6000; 799 section.attr( 'data-heading-slider-id', headingSliderID ); 800 801 section.children( '.heading-slider-images' ).children( '.heading-slider-image' ).each( function() { 802 803 $( this ).attr( 'data-heading-slider-image-id', imageID ); 804 if( imageID != 1 ) $( this ).css({ 'display': 'none' }); 805 806 imageID++; 807 808 }); 809 810 if( ( imageID - 1 ) > 1 ) { 811 812 section.children( '.navigation' ).append( '<div class="center"><ul></ul></div>' ); 813 for( var i = 0; i < ( imageID - 1 ); i++ ) { 814 815 section.children( '.navigation' ).find( 'ul' ).append( '<li data-heading-slider-image-id="'+ ( i + 1 ) +'" '+ ( i == 0 ? 'class="active"' : '' ) +'><span class="circle"></li>' ); 816 } 817 } 818 819 if( imageID - 1 > 1 && intervalTime !== 0 ) { 820 821 martanianRenovationCompanyIntervals['heading-slider-'+ headingSliderID] = setInterval( function() { 822 823 $.martanianRenovationCompanySwitchHeadingSliderImage( section, ( imageID - 1 ), 'next' ); 824 825 }, parseInt( intervalTime, 10 ) ); 826 } 827 828 headingSliderID++; 829 830 }); 831 832 }; 833 834 /** 835 * 836 * switching images slider image 837 * 838 */ 839 840 $.martanianRenovationCompanySwitchHeadingSliderImage = function( section, imagesCount, imageID ) { 841 842 var currentImageID = section.children( '.navigation' ).find( 'ul' ).children( 'li.active' ).data( 'heading-slider-image-id' ); 843 844 if( imagesCount == 'find' ) imagesCount = section.children( '.navigation' ).find( 'ul' ).children( 'li' ).length; 845 if( imageID == 'next' ) imageID = currentImageID + 1 > imagesCount ? 1 : currentImageID + 1; 846 847 section.find( '.heading-slider-image[data-heading-slider-image-id="'+ currentImageID +'"]' ).fadeOut( 300 ); 848 section.find( '.heading-slider-image[data-heading-slider-image-id="'+ imageID +'"]' ).fadeIn( 300 ); 849 850 section.children( '.navigation' ).find( 'ul' ).children( 'li[data-heading-slider-image-id="'+ currentImageID +'"]' ).removeClass( 'active' ); 851 section.children( '.navigation' ).find( 'ul' ).children( 'li[data-heading-slider-image-id="'+ imageID +'"]' ).addClass( 'active' ); 852 853 }; 854 855 /** 856 * 857 * action after click on images slider navigation 858 * 859 */ 860 861 $( 'section.heading-slider' ).on( 'click touchstart', '.navigation li', function( event ) { 862 863 event.preventDefault(); 864 865 var element = $( this ); 866 var section = element.parent().parent().parent().parent(); 867 var navigation = element.parent(); 868 var intervalTime = section.data( 'interval' ); 869 var headingSliderID = section.data( 'heading-slider-id' ); 870 var imageID = element.data( 'heading-slider-image-id' ); 871 var headingSliderImagesCount = section.find( '.navigation' ).find( 'ul' ).children( 'li' ).length; 872 873 if( typeof intervalTime == 'undefined' || intervalTime === null || intervalTime === false ) intervalTime = 6000; 874 if( !navigation.hasClass( 'proceed' ) && !element.hasClass( 'active' ) && headingSliderImagesCount > 1 ) { 875 876 navigation.addClass( 'proceed' ); 877 878 clearInterval( martanianRenovationCompanyIntervals['heading-slider-'+ headingSliderID] ); 879 $.martanianRenovationCompanySwitchHeadingSliderImage( section, 'find', imageID ); 880 881 setTimeout( function() { 882 883 if( intervalTime !== 0 ) { 884 885 martanianRenovationCompanyIntervals['heading-slider-'+ headingSliderID] = setInterval( function() { 886 887 $.martanianRenovationCompanySwitchHeadingSliderImage( section, 'find', 'next' ); 888 889 }, parseInt( intervalTime, 10 ) ); 890 } 891 892 navigation.removeClass( 'proceed' ); 893 894 }, 300 ); 895 } 896 897 }); 898 899 /** 900 * 901 * configure google maps 902 * 903 */ 904 905 $.martanianRenovationCompanyConfigureGoogleMaps = function() { 906 907 var mapID = 1; 908 $( '.google-map' ).each( function() { 909 910 $( this ).html( '<div class="google-map-inner" id="google-map-'+ mapID +'"></div>' ); 911 912 var lat = $( this ).data( 'lat' ); 913 var lng = $( this ).data( 'lng' ); 914 var zoom = $( this ).data( 'zoom-level' ); 915 916 var map = new google.maps.Map( document.getElementById( 'google-map-'+ mapID ), { zoom: zoom, center: new google.maps.LatLng( lat, lng ), mapTypeId: google.maps.MapTypeId.ROADMAP, scrollwheel: false } ); 917 var beachMarker = new google.maps.Marker({ position: new google.maps.LatLng( lat, lng ), map: map, }); 918 919 window.addEventListener('resize', function() { 920 var mapCenter = map.getCenter(); 921 map.setCenter(mapCenter); 922 }); 923 924 mapID++; 925 926 }); 927 928 }; 929 930 /** 931 * 932 * configure progress bars 933 * 934 */ 935 936 $.martanianRenovationCompanyConfigureProgressBars = function() { 937 938 $( '.progress-bars' ).each( function() { 939 940 var progressBarsContainer = $( this ); 941 var progressBarID = 1; 942 943 progressBarsContainer.wrapInner( '<div class="progress-bars-outer"><div class="progress-bars-inner"></div></div>' ); 944 progressBarsContainer.find( '.progress-bar' ).each( function() { 945 946 var progressBar = $( this ); 947 var progressBarTitle = progressBar.html(); 948 var progressBarValue = progressBar.data( 'progress-bar-value' ); 949 950 progressBar.append( '<span class="progress-bar-number">'+ progressBarValue +'%</span>' ); 951 progressBar.append( '<span class="progress-bar-number-highlight">'+ progressBarTitle +'</span>' ); 952 progressBar.append( '<div class="progress-bar-line"><div class="progress-bar-line-value" style="width: 0%;"></div></div>' )
953 progressBar.attr( 'data-progress-bar-id', progressBarID ); 954 955 if( progressBarID == 1 ) { 956 957 setTimeout( function() { 958 959 progressBar.find( '.progress-bar-line-value' ).animate({ 'width': progressBarValue +'%' }, 800 ); 960 961 }, 300 ); 962 } 963 964 progressBarID++; 965 966 }); 967 968 if( ( progressBarID - 1 ) > 1 ) { 969 970 progressBarsContainer.prepend( '<div class="progress-bar-next" data-near-progress-bar-id="2"><i class="fa fa-chevron-right"></i></div>' ); 971 progressBarsContainer.prepend( '<div class="progress-bar-prev" data-near-progress-bar-id="'+ ( progressBarID - 1 ) +'"><i class="fa fa-chevron-left"></i></div>' ); 972 } 973 974 progressBarsContainer.find( '.progress-bars-inner' ).css({ 'width': ( ( progressBarID - 1 ) * 300 ) +'px' }); 975 976 }); 977 978 }; 979 980 /** 981 * 982 * show next / prev progress bar 983 * 984 */ 985 986 $( 'body' ).on( 'click touchstart', '.progress-bar-next, .progress-bar-prev', function( event ) { 987 988 event.preventDefault(); 989 990 var element = $( this ); 991 if( !element.hasClass( 'proceed' ) ) { 992 993 element.addClass( 'proceed' ); 994 995 var progressBars = element.parent(); 996 var inner = progressBars.find( '.progress-bars-inner' ); 997 var type = element.hasClass( 'progress-bar-next' ) ? 'next' : 'prev'; 998 var nearProgressBarID = element.data( 'near-progress-bar-id' ); 999 var nextProgressBarID = progressBars.find( '.progress-bar-next' ).data( 'near-progress-bar-id' ); 1000 var prevProgressBarID = progressBars.find( '.progress-bar-prev' ).data( 'near-progress-bar-id' ); 1001 var progressBarsCount = inner.find( '.progress-bar' ).length; 1002 var position = 0; 1003 1004 if( nearProgressBarID != 1 ) { 1005 1006 position = - ( ( nearProgressBarID - 1 ) * 300 ); 1007 } 1008 1009 if( type == 'next' ) { 1010 1011 nextProgressBarID = nextProgressBarID + 1 > progressBarsCount ? 1 : nextProgressBarID + 1; 1012 prevProgressBarID = prevProgressBarID + 1 > progressBarsCount ? 1 : prevProgressBarID + 1; 1013 } 1014 1015 else { 1016 1017 nextProgressBarID = nextProgressBarID - 1 < 1 ? progressBarsCount : nextProgressBarID - 1; 1018 prevProgressBarID = prevProgressBarID - 1 < 1 ? progressBarsCount : prevProgressBarID - 1; 1019 } 1020 1021 progressBars.find( '.progress-bar-next' ).data( 'near-progress-bar-id', nextProgressBarID ).attr( 'data-near-progress-bar-id', nextProgressBarID ); 1022 progressBars.find( '.progress-bar-prev' ).data( 'near-progress-bar-id', prevProgressBarID ).attr( 'data-near-progress-bar-id', prevProgressBarID ); 1023 1024 inner.animate({ 'marginLeft': position +'px' }, 600 ); 1025 setTimeout( function() { 1026 1027 var progressBarLine = progressBars.find( '.progress-bar[data-progress-bar-id="'+ nearProgressBarID +'"]' ).find( '.progress-bar-line-value' ); 1028 if( progressBarLine.width() == 0 ) { 1029 1030 var progressBarValue = progressBars.find( '.progress-bar[data-progress-bar-id="'+ nearProgressBarID +'"]' ).data( 'progress-bar-value' ); 1031 progressBarLine.animate({ 'width': progressBarValue +'%' }, 800 ); 1032 } 1033 1034 element.removeClass( 'proceed' ); 1035 1036 }, 600 ); 1037 } 1038 1039 }); 1040 1041 /** 1042 * 1043 * open single image 1044 * 1045 */ 1046 1047 $( 'body' ).on( 'click touchstart', '.image, .gallery-short .gallery-image, .presentation-box-single .circle-link-image', function( event ) { 1048 1049 event.preventDefault(); 1050 if( !$( this ).hasClass( 'image-for-video' ) ) { 1051 1052 var image = $( this ).hasClass( 'circle-link-image' ) ? $( this ).parent().parent().parent().parent() : $( this ); 1053 var imageURL = image.css( 'background-image' ); 1054 var resize = image.data( 'image-resize' ); 1055 1056 if( typeof imageURL == 'undefined' || imageURL == '' || imageURL == 'none' ) return; 1057 $.martanianRenovationCompanyShowGalleryImage( imageURL, resize, image ); 1058 } 1059 1060 }); 1061 1062 $( 'body' ).on( 'click touchstart', '.gallery-image', function( event ) { 1063 1064 event.preventDefault(); 1065 1066 var image = $( this ); 1067 var imageURL = image.css( 'background-image' ); 1068 var resize = image.data( 'image-resize' ); 1069 1070 if( typeof imageURL == 'undefined' || imageURL == '' || imageURL == 'none' ) return; 1071 $.martanianRenovationCompanyShowGalleryImage( imageURL, resize, image ); 1072 1073 1074 }); 1075 1076 /** 1077 * 1078 * show gallery image 1079 * 1080 */ 1081 1082 $.martanianRenovationCompanyShowGalleryImage = function( imageURL, resize, element ) { 1083 1084 $( 'body' ).append( '<div class="image-helper"><img src="'+ $.martanianRenovationCompanyGetImageURL( imageURL ) +'" /></div>' ); 1085 $( '.image-helper img' ).load( function() { 1086 1087 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 1088 var sizes = { 'width': $( this ).width(), 'height': $( this ).height() }; 1089 1090 var maxHeight = $( window ).height() - ( contentSize < 625 ? 200 : 150 ); 1091 var maxWidth = $( window ).width() - ( contentSize < 625 ? 25 : 150 ); 1092 1093 $( '.image-helper' ).remove(); 1094 1095 if( $( '#image-popup' ).length == 0 ) $( '.wrapper' ).append( '<div id="image-popup"><div class="image-popup-background"></div><div class="image-popup-content"><div class="image-popup-content-close"><span>×</span></div></div></div>' ); 1096 $( '#image-popup .image-popup-content' ).css({ 'background-image': 'url("'+ $.martanianRenovationCompanyGetImageURL( imageURL ) +'")' }).data( 'original-image-width', sizes.width ).attr( 'data-original-image-width', sizes.width ).data( 'original-image-height', sizes.height ).attr( 'data-original-image-height', sizes.height ); 1097 1098 martanianRenovationCompanyGalleryNeighbors = $.martanianRenovationCompanyGetNeighbors( element ); 1099 if( martanianRenovationCompanyGalleryNeighbors.prev != false && martanianRenovationCompanyGalleryNeighbors.next != false && $( '#image-popup .image-popup-content .image-prev' ).length == 0 && $( '#image-popup .image-popup-content .image-next' ).length == 0 ) { 1100 1101 $( '#image-popup .image-popup-content' ).append( '<div class="image-prev"><i class="fa fa-chevron-left"></i></div><div class="image-next"><i class="fa fa-chevron-right"></i></div>' ); 1102 } 1103 1104 var newWidth = sizes.width; 1105 var newHeight = sizes.height; 1106 1107 if( resize == 'yes' || newHeight > maxHeight || newWidth > maxWidth ) { 1108 1109 var scale = newWidth / newHeight; 1110 1111 newWidth = maxWidth; 1112 newHeight = ( newWidth / scale ); 1113 1114 if( newHeight > maxHeight ) { 1115 1116 newHeight = maxHeight; 1117 newWidth = newHeight * scale; 1118 } 1119 } 1120 1121 $( '#image-popup .image-popup-content' ).css({ 'width': newWidth +'px', 'height': newHeight +'px', 'margin-left': - ( newWidth / 2 ) +'px', 'margin-top': - ( newHeight / 2 ) +'px' }); 1122 $( '#image-popup' ).css({ 'display': 'block' }); 1123 1124 }); 1125 1126 }; 1127 1128 /** 1129 * 1130 * getting image url 1131 * 1132 */ 1133 1134 $.martanianRenovationCompanyGetImageURL = function( imageURL ) { 1135 1136 var url = imageURL.split( 'url(' ); 1137 url = url[1].split( ')' ); 1138 url = url[0]; 1139 1140 if( url.indexOf( '"' ) >= false ) { 1141 1142 url = url.split( '"' ); 1143 url = url[1]; 1144 } 1145 1146 return( url ); 1147 1148 }; 1149 1150 /** 1151 * 1152 * getting image neighbors 1153 * 1154 */ 1155 1156 $.martanianRenovationCompanyGetNeighbors = function( image ) { 1157 1158 if( image.hasClass( 'gallery-image' ) ) { 1159 1160 var prev = image.prev( '.gallery-image' ); 1161 var next = image.next( '.gallery-image' ); 1162 1163 if( prev.length == 0 ) prev = image.siblings( '.gallery-image' ).last(); 1164 if( next.length == 0 ) next = image.siblings( '.gallery-image' ).first(); 1165 } 1166 1167 else if( image.hasClass( 'presentation-box-single' ) ) { 1168 1169 var filter = image.parent().siblings( '.presentation-filter' ); 1170 var filterClass = '*'; 1171 1172 if( filter.length == 1 ) filterClass = filter.find( '.filter-active' ).data( 'filter' ); 1173 if( filterClass == '*' ) { 1174 1175 var prev = image.prev( '.presentation-box-single:not(.presentation-box-call-to-action)' ); 1176 var next = image.next( '.presentation-box-single:not(.presentation-box-call-to-action)' ); 1177 1178 if( prev.length == 0 ) prev = image.siblings( '.presentation-box-single:not(.presentation-box-call-to-action)' ).last(); 1179 if( next.length == 0 ) next = image.siblings( '.presentation-box-single:not(.presentation-box-call-to-action)' ).first(); 1180 } 1181 1182 else { 1183 1184 var prevAll = image.prevAll( '.presentation-box-single'+ filterClass +':not(.presentation-box-call-to-action)' ); 1185 var nextAll = image.nextAll( '.presentation-box-single'+ filterClass +':not(.presentation-box-call-to-action)' ); 1186 1187 var prev = prevAll.length === 0 ? image.siblings( '.presentation-box-single'+ filterClass +':not(.presentation-box-call-to-action)' ).last() : prevAll.first(); 1188 var next = nextAll.length === 0 ? image.siblings( '.presentation-box-single'+ filterClass +':not(.presentation-box-call-to-action)' ).first() : nextAll.first(); 1189 } 1190 } 1191 1192 else if( image.hasClass( 'image' ) ) { 1193 1194 var prev = image.prev( '.image:not(.image-for-video)' ); 1195 var next = image.next( '.image:not(.image-for-video)' ); 1196 1197 if( prev.length == 0 ) prev = image.siblings( '.image' ).last(); 1198 if( next.length == 0 ) next = image.siblings( '.image' ).first(); 1199 } 1200 1201 return( { 'prev': ( prev.length == 0 ? false : prev ), 'next': ( next.length == 0 ? false : next ), 'current': image } ); 1202 1203 }; 1204 1205 /** 1206 * 1207 * next / prev gallery images 1208 * 1209 */ 1210 1211 $( 'body' ).on( 'click touchstart', '#image-popup .image-prev, #image-popup .image-next', function( event ) { 1212 1213 event.preventDefault(); 1214 1215 var image = $( this ).hasClass( 'image-prev' ) ? martanianRenovationCompanyGalleryNeighbors.prev : martanianRenovationCompanyGalleryNeighbors.next; 1216 var imageURL = image.css( 'background-image' ); 1217 var resize = image.data( 'image-resize' ); 1218 1219 if( typeof imageURL == 'undefined' || imageURL == '' || imageURL == 'none' ) return; 1220 $.martanianRenovationCompanyShowGalleryImage( imageURL, resize, image ); 1221 1222 }); 1223 1224 /** 1225 * 1226 * close image 1227 * 1228 */ 1229 1230 $( 'body' ).on( 'click touchstart', '#image-popup .image-popup-background, #image-popup .image-popup-content-close', function( event ) { 1231 1232 event.preventDefault(); 1233 $( '#image-popup' ).remove(); 1234 1235 }); 1236 1237 /** 1238 * 1239 * change gallery popup sizes when responsiveness changed 1240 * 1241 */ 1242 1243 $.martanianRenovationCompanyRefreshGallerySizes = function() { 1244 1245 if( $( '#image-popup' ).length != 0 ) { 1246 1247 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 1248 var maxHeight = $( window ).height() - ( contentSize < 625 ? 200 : 150 ); 1249 var maxWidth = $( window ).width() - ( contentSize < 625 ? 25 : 150 ); 1250 var height = $( '#image-popup .image-popup-content' ).data( 'original-image-height' ); 1251 var width = $( '#image-popup .image-popup-content' ).data( 'original-image-width' ); 1252 1253 if( height > maxHeight || width > maxWidth ) { 1254 1255 var scale = width / height; 1256 1257 width = maxWidth; 1258 height = ( width / scale ); 1259 1260 if( height > maxHeight ) { 1261 1262 height = maxHeight; 1263 width = height * scale; 1264 } 1265 } 1266 1267 $( '#image-popup .image-popup-content' ).css({ 'width': width +'px', 'height': height +'px', 'margin-left': - ( width / 2 ) +'px', 'margin-top': - ( height / 2 ) +'px' }); 1268 } 1269 1270 }; 1271 1272 /** 1273 * 1274 * configure isotope functions 1275 * 1276 */ 1277 1278 $.martanianRenovationCompanyConfigureIsotope = function() { 1279 1280 var isotopeID = 1; 1281 $( '.presentation.presentation-filtered' ).each( function() { 1282 1283 var section = $( this ); 1284 1285 section.data( 'isotope-id', isotopeID ).attr( 'data-isotope-id', isotopeID ); 1286 martanianRenovationCompanyIsotopes[isotopeID] = section.find( '.presentation-box' ).isotope({ itemSelector: '.presentation-box-single' }); 1287 1288 isotopeID++; 1289 1290 }); 1291 1292 }; 1293 1294 /** 1295 * 1296 * filter isotopes 1297 * 1298 */ 1299 1300 $( 'body' ).on( 'click touchstart', '.presentation.presentation-filtered .presentation-filter .filter', function( event ) { 1301 1302 event.preventDefault(); 1303 1304 var element = $( this ); 1305 var section = element.parent().parent().parent(); 1306 var filterValue = element.data( 'filter' ); 1307 1308 var isotopeID = section.data( 'isotope-id' ); 1309 1310 martanianRenovationCompanyIsotopes[isotopeID].isotope({ filter: filterValue }); 1311 1312 section.find( '.presentation-filter' ).children( '.filter' ).removeClass( 'filter-active' ); 1313 element.addClass( 'filter-active' ); 1314 1315 }); 1316 1317 /** 1318 * 1319 * automatically small images slider 1320 * 1321 */ 1322 1323 $.martanianRenovationCompanyConfigureSmallImagesSlider = function() { 1324 1325 var sliderID = 1; 1326 $( '.images' ).each( function() { 1327 1328 var slider = $( this ); 1329 if( slider.children( '.image' ).length > 1 ) { 1330 1331 slider.attr( 'data-small-images-slider-id', sliderID ); 1332 1333 var imageID = 1; 1334 slider.children( '.image' ).each( function() { 1335 1336 $( this ).attr( 'data-image-id', imageID ); 1337 if( imageID != 1 ) $( this ).css({ 'display': 'none' }); 1338 1339 imageID++; 1340 1341 }); 1342 1343 var navigation = ''; 1344 for( var i = 1; i < imageID; i++ ) { 1345 1346 navigation += '<li data-small-images-slider-image-id="'+ i +'" '+ ( i == 1 ? 'class="active"' : '' ) +'><span class="circle"></span></li>'; 1347 } 1348 1349 slider.append( '<ul class="navigation">'+ navigation +'</ul>' ); 1350 1351 var intervalTime = slider.data( 'interval' ); 1352 if( typeof intervalTime == 'undefined' || intervalTime === null || intervalTime === false ) intervalTime = 6000; 1353 1354 if( intervalTime !== 0 ) { 1355 1356 martanianRenovationCompanyIntervals['small-images-slider-'+ sliderID] = setInterval( function() { 1357 1358 $.martanianRenovationCompanySwitchSmallImagesImage( slider, slider.children( '.image' ).length, 'next' ); 1359 1360 }, parseInt( intervalTime, 10 ) ); 1361 } 1362 1363 sliderID++; 1364 } 1365 1366 }); 1367 1368 }; 1369 1370 /** 1371 * 1372 * switch small images slider image 1373 * 1374 */ 1375 1376 $.martanianRenovationCompanySwitchSmallImagesImage = function( slider, imagesCount, imageID ) { 1377 1378 var currentImageID = slider.children( '.navigation' ).children( 'li.active' ).data( 'small-images-slider-image-id' ); 1379 1380 if( imagesCount == 'find' ) imagesCount = slider.children( '.navigation' ).children( 'li' ).length; 1381 if( imageID == 'next' ) imageID = currentImageID + 1 > imagesCount ? 1 : currentImageID + 1; 1382 1383 slider.find( '.image[data-image-id="'+ currentImageID +'"]' ).fadeOut( 300 ); 1384 slider.find( '.image[data-image-id="'+ imageID +'"]' ).fadeIn( 300 ); 1385 1386 slider.children( '.navigation' ).children( 'li[data-small-images-slider-image-id="'+ currentImageID +'"]' ).removeClass( 'active' ); 1387 slider.children( '.navigation' ).children( 'li[data-small-images-slider-image-id="'+ imageID +'"]' ).addClass( 'active' ); 1388 1389 }; 1390 1391 /** 1392 * 1393 * action after click on images slider navigation 1394 * 1395 */ 1396 1397 $( 'body' ).on( 'click touchstart', '.images .navigation li', function( event ) { 1398 1399 event.preventDefault(); 1400 1401 var element = $( this ); 1402 var slider = element.parent().parent(); 1403
1403 var navigation = element.parent(); 1404 var intervalTime = slider.data( 'interval' ); 1405 var sliderID = slider.data( 'small-images-slider-id' ); 1406 var imageID = element.data( 'small-images-slider-image-id' ); 1407 var sliderImagesCount = slider.find( '.navigation' ).children( 'li' ).length; 1408 1409 if( typeof intervalTime == 'undefined' || intervalTime === null || intervalTime === false ) intervalTime = 6000; 1410 if( !navigation.hasClass( 'proceed' ) && !element.hasClass( 'active' ) && ( sliderImagesCount > 1 ) ) { 1411 1412 navigation.addClass( 'proceed' ); 1413 1414 clearInterval( martanianRenovationCompanyIntervals['small-images-slider-'+ sliderID] ); 1415 $.martanianRenovationCompanySwitchSmallImagesImage( slider, 'find', imageID ); 1416 1417 setTimeout( function() { 1418 1419 if( intervalTime !== 0 ) { 1420 1421 martanianRenovationCompanyIntervals['small-images-slider-'+ sliderID] = setInterval( function() { 1422 1423 $.martanianRenovationCompanySwitchSmallImagesImage( slider, 'find', 'next' ); 1424 1425 }, parseInt( intervalTime, 10 ) ); 1426 } 1427 1428 navigation.removeClass( 'proceed' ); 1429 1430 }, 300 ); 1431 } 1432 1433 }); 1434 1435 /** 1436 * 1437 * actions after keyup 1438 * 1439 */ 1440 1441 $( document ).keydown( function( event ) { 1442 1443 var galleryActive = $( '#image-popup' ).length == 1 ? true : false; 1444 var videoActive = $( '#video-popup' ).length == 1 ? true : false; 1445 1446 switch( event.keyCode ) { 1447 1448 case 27: 1449 1450 if( galleryActive == true ) $( '#image-popup' ).remove(); 1451 if( videoActive == true ) $( '#video-popup' ).remove(); 1452 1453 break; 1454 1455 case 37: 1456 1457 if( galleryActive == true ) { 1458 1459 var image = martanianRenovationCompanyGalleryNeighbors.prev; 1460 var imageURL = image.css( 'background-image' ); 1461 var resize = image.data( 'image-resize' ); 1462 1463 if( typeof imageURL == 'undefined' || imageURL == '' || imageURL == 'none' ) return; 1464 $.martanianRenovationCompanyShowGalleryImage( imageURL, resize, image ); 1465 } 1466 1467 break; 1468 1469 case 39: 1470 1471 if( galleryActive == true ) { 1472 1473 var image = martanianRenovationCompanyGalleryNeighbors.next; 1474 var imageURL = image.css( 'background-image' ); 1475 var resize = image.data( 'image-resize' ); 1476 1477 if( typeof imageURL == 'undefined' || imageURL == '' || imageURL == 'none' ) return; 1478 $.martanianRenovationCompanyShowGalleryImage( imageURL, resize, image ); 1479 } 1480 1481 break; 1482 } 1483 1484 }); 1485 1486 /** 1487 * 1488 * configure references 1489 * 1490 */ 1491 1492 $.martanianRenovationCompanyConfigureReferences = function() { 1493 1494 var referencesID = 1; 1495 $( '.references' ).each( function() { 1496 1497 var references = $( this ); 1498 var referencesCount = references.children( '.reference' ).length; 1499 var referenceID = 1; 1500 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 1501 var navigation = references.children( '.navigation' ); 1502 1503 navigation.html( '' ); 1504 clearInterval( martanianRenovationCompanyIntervals['references-'+ referencesID] ); 1505 references.children( '.reference' ).removeAttr( 'data-reference-id' ).data( 'reference-id', '' ).css({ 'display': '' }); 1506 1507 references.children( '.reference' ).each( function() { 1508 1509 var reference = $( this ); 1510 1511 if( referenceID != 1 ) reference.css({ 'display': 'none' }); 1512 else { 1513 1514 references.css({ 'height': reference.height() + ( referencesCount > 1 ? ( contentSize < 750 ? 70 : 40 ) : 0 ) }); 1515 } 1516 1517 if( referencesCount > 1 ) navigation.append( '<li'+ ( referenceID == 1 ? ' class="active"' : '' ) +' data-reference-id="'+ referenceID +'"><span class="circle"></span></li>' ); 1518 1519 reference.attr( 'data-reference-id', referenceID ); 1520 referenceID++; 1521 1522 }); 1523 1524 var intervalTime = references.data( 'interval' ); 1525 if( typeof intervalTime == 'undefined' || intervalTime === null || intervalTime === false ) intervalTime = 6000; 1526 1527 if( intervalTime !== 0 ) { 1528 1529 martanianRenovationCompanyIntervals['references-'+ referencesID] = setInterval( function() { 1530 1531 $.martanianRenovationCompanySwitchReferences( references, referencesCount, 'next' ); 1532 1533 }, parseInt( intervalTime, 10 ) ); 1534 } 1535 1536 references.attr( 'data-references-id', referencesID ); 1537 referencesID++; 1538 1539 }); 1540 1541 }; 1542 1543 /** 1544 * 1545 * switch references 1546 * 1547 */ 1548 1549 $.martanianRenovationCompanySwitchReferences = function( references, referencesCount, referenceID ) { 1550 1551 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 1552 var currentReferenceID = references.children( '.navigation' ).children( 'li.active' ).data( 'reference-id' ); 1553 1554 if( referencesCount == 'find' ) referencesCount = references.children( '.navigation' ).children( 'li' ).length; 1555 if( referenceID == 'next' ) referenceID = currentReferenceID + 1 > referencesCount ? 1 : currentReferenceID + 1; 1556 1557 references.find( '.reference[data-reference-id="'+ currentReferenceID +'"]' ).fadeOut( 300 ); 1558 setTimeout( function() { 1559 1560 references.find( '.reference[data-reference-id="'+ referenceID +'"]' ).fadeIn( 300 ); 1561 references.animate({ 'height': references.find( '.reference[data-reference-id="'+ referenceID +'"]' ).height() + ( referencesCount > 1 ? ( contentSize < 750 ? 70 : 40 ) : 0 ) }, 300 ); 1562 1563 }, 50 ); 1564 1565 references.children( '.navigation' ).children( 'li[data-reference-id="'+ currentReferenceID +'"]' ).removeClass( 'active' ); 1566 references.children( '.navigation' ).children( 'li[data-reference-id="'+ referenceID +'"]' ).addClass( 'active' ); 1567 1568 }; 1569 1570 /** 1571 * 1572 * action after click on references navigation 1573 * 1574 */ 1575 1576 $( 'body' ).on( 'click touchstart', '.references .navigation li', function( event ) { 1577 1578 event.preventDefault(); 1579 1580 var element = $( this ); 1581 var references = element.parent().parent(); 1582 var navigation = element.parent(); 1583 var intervalTime = references.data( 'interval' ); 1584 var referencesID = references.data( 'references-id' ); 1585 var referenceID = element.data( 'reference-id' ); 1586 var referencesCount = references.find( '.navigation' ).children( 'li' ).length; 1587 1588 if( typeof intervalTime == 'undefined' || intervalTime === null || intervalTime === false ) intervalTime = 6000; 1589 if( !navigation.hasClass( 'proceed' ) && !element.hasClass( 'active' ) && ( referencesCount > 1 ) ) { 1590 1591 navigation.addClass( 'proceed' ); 1592 1593 clearInterval( martanianRenovationCompanyIntervals['references-'+ referencesID] ); 1594 $.martanianRenovationCompanySwitchReferences( references, 'find', referenceID ); 1595 1596 setTimeout( function() { 1597 1598 if( intervalTime !== 0 ) { 1599 1600 martanianRenovationCompanyIntervals['references-'+ referencesID] = setInterval( function() { 1601 1602 $.martanianRenovationCompanySwitchReferences( references, 'find', 'next' ); 1603 1604 }, parseInt( intervalTime, 10 ) ); 1605 } 1606 1607 navigation.removeClass( 'proceed' ); 1608 1609 }, 300 ); 1610 } 1611 1612 }); 1613 1614 /** 1615 * 1616 * checkbox field 1617 * 1618 */ 1619 1620 $( 'body' ).on( 'click', '.checkbox', function( event ) { 1621 1622 if( event.target.localName != 'a' ) { 1623 1624 event.preventDefault(); 1625 1626 var checkbox = $( this ); 1627 var checked = checkbox.attr( 'data-checked' ) == 'yes' ? true : false;
1628 1629 if( checked == true ) { 1630 1631 checkbox.attr( 'data-checked', 'no' ); 1632 checkbox.data( 'checked', 'no' ); 1633 1634 checkbox.children( '.checkbox-status' ).html( '<i class="fa fa-times"></i>' ); 1635 } 1636 1637 else { 1638 1639 checkbox.attr( 'data-checked', 'yes' ); 1640 checkbox.data( 'checked', 'yes' ); 1641 1642 checkbox.children( '.checkbox-status' ).html( '<i class="fa fa-check"></i>' ); 1643 } 1644 } 1645 1646 }); 1647 1648 /** 1649 * 1650 * configure value sliders 1651 * 1652 */ 1653 1654 $.martanianRenovationCompanyConfigureValueSlider = function() { 1655 1656 $( '.value-slider' ).each( function() { 1657 1658 var sliderValueMin = parseInt( $( this ).data( 'slider-min' ), 10 ); 1659 var sliderValueMax = parseInt( $( this ).data( 'slider-max' ), 10 ); 1660 var sliderValueStart = parseInt( $( this ).data( 'slider-start' ), 10 ); 1661 var sliderValueStep = parseInt( $( this ).data( 'slider-step' ), 10 ); 1662 var sliderID = $( this ).data( 'slider-id' ); 1663 1664 var slider = document.getElementById( sliderID ); 1665 var result = document.getElementById( sliderID +'-value' ); 1666 1667 noUiSlider.create( slider, { 1668 start: [ sliderValueStart ], 1669 step: sliderValueStep, 1670 range: { 1671 'min': [ sliderValueMin ], 1672 'max': [ sliderValueMax ] 1673 }, 1674 format: wNumb({ 1675 thousand: '.', 1676 decimals: '0' 1677 }) 1678 }); 1679 1680 slider.noUiSlider.on( 'update', function( values, handle ) { 1681 1682 $( result ).children( 'span' ).text( values[handle] ); 1683 1684 }); 1685 1686 }); 1687 1688 }; 1689 1690 /** 1691 * 1692 * configure selects 1693 * 1694 */ 1695 1696 $.martanianRenovationCompanyConfigureSelects = function() { 1697 1698 $( 'select' ).each( function() { 1699 1700 var classes = $( this ).attr( 'class' ); 1701 var parent = $( this ).parent(); 1702 1703 if( typeof classes == 'undefined' || classes == false || classes == null ) classes = ''; 1704 1705 $( this ).wrap( '<span class="select '+ classes +'"></span>' ); 1706 1707 if( parent.hasClass( 'widget' ) ) parent.find( '.select' ).wrap( '<div class="form"></div>' ); 1708 if( parent.is( 'form' ) ) parent.addClass( 'form' ); 1709 1710 }); 1711 1712 }; 1713 1714 /** 1715 * 1716 * configure widget lists 1717 * 1718 */ 1719 1720 $.martanianRenovationCompanyConfigureWidgetLists = function() { 1721 1722 $( 'section.content-with-sidebar .sidebar' ).each( function() { 1723 1724 var sidebar = $( this ); 1725 sidebar.find( '.widget' ).each( function() { 1726 1727 var widget = $( this ); 1728 widget.find( 'li' ).each( function() { 1729 1730 var li = $( this ); 1731 li.wrapInner( '<span class="li-content"></span>' ); 1732 1733 if( li.children( '.li-content' ).children( 'ul.children' ).length != 0 ) { 1734 1735 var ul = li.children( '.li-content' ).children( 'ul.children' ); 1736 ul.appendTo( li ); 1737 } 1738 1739 if( li.children( '.li-content' ).children( 'ul.sub-menu' ).length != 0 ) { 1740 1741 var ul = li.children( '.li-content' ).children( 'ul.sub-menu' ); 1742 ul.appendTo( li ); 1743 } 1744 1745 }); 1746 1747 }); 1748 1749 }); 1750 1751 }; 1752 1753 /** 1754 * 1755 * is form field required? 1756 * 1757 */ 1758 1759 $.martanianRenovationCompanyIsFieldRequired = function( field ) { 1760 1761 var required = field.data( 'required' ); 1762 return( typeof required == 'undefined' || required == false || required == null || required == 'yes' ? true : false ); 1763 1764 }; 1765 1766 /** 1767 * 1768 * send form 1769 * 1770 */ 1771 1772 $( 'body' ).on( 'click', '.form-send', function( event ) { 1773 event.preventDefault(); 1774 1775 ga('send', 'event', 'Konverze', 'Odeslánàformuláře'); 1776 1777 var form = $( this ).parent(); 1778 var fields = []; 1779 var isError = false;
1780 var formOptions = { 1781 'client-name-field': form.data( 'client-name-field' ), 1782 'client-email-field': form.data( 'client-email-field' ), 1783 'title': form.data( 'title' ) 1784 }; 1785 1786 $.ajax({ 1787 url: '/upload.php', 1788 type: 'POST', 1789 data: new FormData(form[0]), 1790 processData: false, 1791 contentType: false 1792 }).done(function(){ 1793 console.log("Success: Files sent!"); // Can I trust this? 1794 }).fail(function(){ 1795 console.log("An error occurred, the files couldn't be sent!"); 1796 }); 1797 // */ 1798 form.find( '.form-element' ).each( function() { 1799 1800 var field = $( this ); 1801 if( !field.hasClass( 'select' ) ) { 1802 1803 var fieldName = field.attr( 'name' ); 1804 var fieldValue = field.val(); 1805 var fieldFile = 0; 1806 var fieldRequired = $.martanianRenovationCompanyIsFieldRequired( field ); 1807 1808 if( typeof fieldName == 'undefined' ) fieldName = field.data( 'field-name' ); 1809 if( ( typeof fieldValue == 'undefined' || fieldValue == null || fieldValue == false || fieldValue == '' ) && !field.is( 'input[type="text"], textarea' ) ) { 1810 1811 if( field.hasClass( 'value-slider-text' ) ) fieldValue = field.text(); 1812 else if( field.hasClass( 'checkbox' ) ) { 1813 1814 var checked = field.data( 'checked' ); 1815 fieldValue = checked == 'yes' ? field.find( '.checkbox-value-checked' ).text() : field.find( '.checkbox-value-unchecked' ).text(); 1816 } 1817 } 1818 1819 if( ( fieldRequired == true && fieldValue != '' ) || fieldRequired == false ) { 1820 if( field.is( 'select' ) ) field.parent().removeClass( 'error' ); 1821 else field.removeClass( 'error' ); 1822 } else { 1823 if( field.is( 'select' ) ) field.parent().addClass( 'error' ); 1824 else field.addClass( 'error' ); 1825 1826 if(!field.hasClass( 'ifile' )) isError = true; 1827 } 1828 1829 if( field.hasClass( 'ifile' ) ) fieldFile = 1; 1830 1831 fields[fields.length] = { 'name': fieldName, 'value': fieldValue, 'file': fieldFile }; 1832 } 1833 1834 }); 1835 1836 if( isError == false ) { 1837 console.log("thankslay error false"); 1838 var thanksLay = form.children( '.thanks-lay' ); 1839 1840 thanksLay.find( '.thanks-lay-content-sending' ).css({ 'display': 'block' }); 1841 thanksLay.fadeIn( 300 ); 1842 1843 $.ajax({ url: martanian_renovation_company_javascript_functions_l10n.template_directory_uri +'/_assets/_php/submit.php', 1844 data: { 'fields': fields, 'options': formOptions }, 1845 type: 'post', 1846 success: function( output ) { 1847 1848 console.log(output); 1849 1850 thanksLay.find( '.thanks-lay-content-sending' ).css({ 'display': 'none' }); 1851 if( output === 'ok' ) { 1852 thanksLay.find( '.thanks-lay-content-sent' ).css({ 'display': 'none' }); 1853 thanksLay.find( '.thanks-lay-content-sent' ).fadeIn( 300 ); 1854 1855 } else { 1856 thanksLay.find( '.thanks-lay-content-not-sent' ).css({ 'display': 'none' }); 1857 thanksLay.find( '.thanks-lay-content-not-sent' ).fadeIn( 300 ); 1858 1859 } 1860 }}); 1861 } 1862 1863 1864 }); 1865 1866 /** 1867 * 1868 * close thanks-lay notice 1869 * 1870 */ 1871 1872 $( 'body' ).on( 'click', '.thanks-lay-close', function( event ) { 1873 1874 event.preventDefault(); 1875 1876 var thanksLay = $( this ).parent().parent().parent(); 1877 1878 thanksLay.fadeOut( 300 ); 1879 thanksLay.find( '.thanks-lay-content-sent' ).css({ 'display': 'none' }); 1880 thanksLay.find( '.thanks-lay-content-not-sent' ).css({ 'display': 'none' }); 1881 1882 }); 1883 1884 /** 1885 * 1886 * configure responsive menu 1887 * 1888 */ 1889 1890 $.martanianRenovationCompanyConfigureResponsiveMenu = function() { 1891 1892 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 1893 var responsiveMenuWidth = contentSize < 625 ? 250 : 300; 1894 1895 $( '.wrapper' ).css({ 'margin-left': '', 'width': '' }).removeClass( 'wrapper-shadow' ); 1896 1897 // $( 'header.header-main .bottom .center' ).css({ 'margin-left': '' }); 1898 $( '.responsive-menu' ).css({ 'margin-left': '' }); 1899 1900 $( '.responsive-menu-content' ).css({ 'display': 'none', 'right': '-'+ responsiveMenuWidth +'px' }); 1901 1902 martanianRenovationCompanyResponsiveMenuVisible = false;
1903 1904 var headerElement = $( 'header.header-main' ); 1905 var header = { 1906 'element': headerElement, 1907 'menu': headerElement.find( 'ul.menu' ), 1908 'calltoaction': headerElement.find( '.call-to-action' ), 1909 'contactElements': headerElement.find( '.contact-element' ) 1910 }; 1911 1912 if( contentSize < 1050 ) { 1913 1914 if( $( 'body' ).find( '.responsive-menu' ).length == 0 ) { 1915 1916 // header.element.find( 'nav' ).parent().append( '<div class="responsive-menu"><i class="fa fa-bars"></i></div>' ); 1917 $( 'body' ).append( '<div class="responsive-menu" data-wrapper="'+ ( $( '.wrapper' ).hasClass( 'wrapper-wide' ) ? 'wide' : 'boxed' ) +'"><i class="fa fa-bars"></i></div>' ); 1918 1919 header.menu.css({ 'display': 'none' }); 1920 header.calltoaction.css({ 'display': 'none' }); 1921 1922 if( $( '.responsive-menu-content' ).length == 0 ) { 1923 1924 $( 'body' ).append( '<div class="responsive-menu-content"></div>' ); 1925 $( '.responsive-menu-content' ).append( '<ul class="menu">'+ header.menu.html() +'</ul>' ); 1926 1927 if( header.contactElements.length !== 0 ) { 1928 1929 $.each( header.contactElements, function() { 1930 1931 $( '.responsive-menu-content' ).append( '<div class="contact-element">'+ $( this ).html() +'</div>' ); 1932 1933 }); 1934 } 1935 1936 if( header.calltoaction.length !== 0 ) { 1937 1938 $( '.responsive-menu-content' ).append( '<div class="call-to-action">'+ header.calltoaction.html() +'</div>' ); 1939 } 1940 } 1941 } 1942 } 1943 1944 else { 1945 1946 $( 'body' ).find( '.responsive-menu' ).remove(); 1947 1948 header.menu.css({ 'display': 'block' }); 1949 header.calltoaction.css({ 'display': 'inline-block' }); 1950 } 1951 1952 $( '.responsive-menu-content' ).css({ 'margin-top': '' }); 1953 if( $( 'body' ).hasClass( 'admin-bar' ) ) { 1954 1955 var wpadminbar = $( '#wpadminbar' ); 1956 if( wpadminbar.css( 'position' ) == 'fixed' ) $( '.responsive-menu-content' ).css({ 'margin-top': wpadminbar.height() }); 1957 } 1958 1959 }; 1960 1961 /** 1962 * 1963 * show responsive menu 1964 * 1965 */ 1966 /**click touchstart**/ 1967 $( 'body' ).on( 'click', '.responsive-menu', function( event ) { 1968 1969 /**event.preventDefault();**/ 1970 1971 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 1972 var responsiveMenuWidth = contentSize < 625 ? 250 : 300; 1973 1974 if( martanianRenovationCompanyResponsiveMenuVisible == false ) { 1975 1976 var wrapper = $( '.wrapper' ); 1977 var wrapperWidth = wrapper.width(); 1978 var header = $( 'header.header-main' ); 1979 1980 if( wrapper.hasClass( 'wrapper-wide' ) ) { 1981 1982 $( '.wrapper' ).animate({ 'margin-left': '-'+ responsiveMenuWidth +'px', 'width': wrapperWidth }, 300 ).addClass( 'wrapper-shadow' ); 1983 1984 var currentHeaderMarginLeft = parseInt( $( '.responsive-menu' ).css( 'margin-left' ), 10 ); 1985 $( '.responsive-menu' ).animate({ 'margin-left': ( currentHeaderMarginLeft - responsiveMenuWidth ) +'px' }, 300 ); 1986 1987 $( '.responsive-menu-content' ).css({ 'display': 'block' }).animate({ 'right': '0' }, 300 ); 1988 } 1989 1990 else if( wrapper.hasClass( 'wrapper-boxed' ) ) { 1991 1992 var percent = wrapperWidth / 96; 1993 1994 $( '.wrapper' ).animate({ 'margin-left': '-'+ ( responsiveMenuWidth - ( percent * 4 ) ) +'px', 'width': wrapperWidth }, 300 ).addClass( 'wrapper-shadow' ); 1995 1996 var currentHeaderMarginLeft = parseInt( $( '.responsive-menu' ).css( 'margin-left' ), 10 ); 1997 $( '.responsive-menu' ).animate({ 'margin-left': ( currentHeaderMarginLeft - responsiveMenuWidth + ( percent * 2 ) ) +'px' }, 300 ); 1998 1999 $( '.responsive-menu-content' ).css({ 'display': 'block' }).animate({ 'right': '0' }, 300 ); 2000 } 2001 2002 martanianRenovationCompanyResponsiveMenuVisible = true; 2003 } 2004 2005 else { 2006 2007 var wrapper = $( '.wrapper' ); 2008 if( wrapper.hasClass( 'wrapper-wide' ) ) { 2009 2010 wrapper.animate({ 'margin-left': '0' }, 300 ); 2011 $( '.responsive-menu-content' ).animate({ 'right': '-'+ responsiveMenuWidth +'px' }, 300 ); 2012 2013 var currentHeaderMarginLeft = parseInt( $( '.responsive-menu' ).css( 'margin-left' ), 10 ); 2014 $( '.responsive-menu' ).animate({ 'margin-left': ( currentHeaderMarginLeft + responsiveMenuWidth ) +'px' }, 300 ); 2015 2016 setTimeout( function() { 2017 2018 $( '.responsive-menu-content' ).css({ 'display': 'none' }); 2019 2020 wrapper.css({ 'margin-left': '', 'width': '' }).removeClass( 'wrapper-shadow' ); 2021 $( '.responsive-menu' ).css({ 'margin-left': '' }); 2022 2023 }, 300 ); 2024 } 2025 2026 else { 2027 2028 wrapper.animate({ 'margin-left': '2%' }, 300 ); 2029 $( '.responsive-menu-content' ).animate({ 'right': '-'+ responsiveMenuWidth +'px' }, 300 ); 2030 2031 var percent = wrapper.width() / 96; 2032 var currentHeaderMarginLeft = parseInt( $( '.responsive-menu' ).css( 'margin-left' ), 10 ); 2033 $( '.responsive-menu' ).animate({ 'margin-left': ( currentHeaderMarginLeft + responsiveMenuWidth - ( percent * 2 ) ) +'px' }, 300 ); 2034 2035 setTimeout( function() { 2036 2037 $( '.responsive-menu-content' ).css({ 'display': 'none' }); 2038 2039 wrapper.css({ 'margin-left': '', 'width': '' }).removeClass( 'wrapper-shadow' ); 2040 $( '.responsive-menu' ).css({ 'margin-left': '' }); 2041 2042 }, 300 ); 2043 } 2044 2045 martanianRenovationCompanyResponsiveMenuVisible = false;
2046 } 2047 2048 }); 2049 2050 /** 2051 * 2052 * flying header menu 2053 * 2054 */ 2055 2056 $( window ).scroll( function() { 2057 2058 $.martanianRenovationCompanyFlyingHeaderMenu( 'header.header-main .bottom .center' ); 2059 $.martanianRenovationCompanyFlyingHeaderMenu( '.responsive-menu' ); 2060 2061 }); 2062 2063 $.martanianRenovationCompanyFlyingHeaderMenu = function( element ) { 2064 2065 element = $( element ); 2066 if( element.length == 0 ) return; 2067 2068 var wrapper = $( '.wrapper' ); 2069 var position = $( window ).scrollTop(); 2070 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 2071 2072 if( !$( 'body' ).hasClass( 'admin-bar' ) ) { 2073 2074 var limit = contentSize <= 750 ? 16 : 104; 2075 if( contentSize <= 750 ) { 2076 2077 if( position < limit ) element.removeClass( 'flying' ).css({ 'top': 16 - position +'px' }); 2078 else element.addClass( 'flying' ).css({ 'top': '0' }); 2079 } 2080 2081 else { 2082 2083 if( position < limit ) element.removeClass( 'flying' ).css({ 'position': '', 'top': '' }); 2084 else element.addClass( 'flying' ).css({ 'position': 'fixed', 'top': '0' }); 2085 } 2086 } 2087 2088 else { 2089 2090 var limit = contentSize <= 750 ? 16 : 104; 2091 var wpadminbar = $( '#wpadminbar' ); 2092 2093 if( contentSize <= 750 ) { 2094 2095 if( wpadminbar.css( 'height' ) == '32px' ) { 2096 2097 if( position < limit ) element.removeClass( 'flying' ).css({ 'top': 48 - position +'px' }); 2098 else element.addClass( 'flying' ).css({ 'top': '32px' }); 2099 } 2100 2101 else { 2102 2103 if( wpadminbar.css( 'position' ) == 'fixed' ) { 2104 2105 if( position < limit ) element.removeClass( 'flying' ).css({ 'top': 62 - position +'px' }); 2106 else element.addClass( 'flying' ).css({ 'top': '46px' }); 2107 } 2108 2109 else { 2110 2111 limit = 62; 2112 2113 if( position < limit ) element.removeClass( 'flying' ).css({ 'top': 62 - position +'px' }); 2114 else element.addClass( 'flying' ).css({ 'top': '0' }); 2115 } 2116 } 2117 } 2118 2119 else { 2120 2121 if( position < limit ) element.removeClass( 'flying' ).css({ 'position': '', 'top': '' }); 2122 else element.addClass( 'flying' ).css({ 'position': 'fixed', 'top': '32px' }); 2123 } 2124 } 2125 2126 }; 2127 2128 /** 2129 * 2130 * configure sidebars for responsiveness 2131 * 2132 */ 2133 2134 $.martanianRenovationCompanyConfigureSidebarsForResponsiveView = function() { 2135 2136 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 2137 if( contentSize < 750 ) { 2138 2139 $( 'section.content-with-sidebar.content-with-sidebar-left' ).each( function() { 2140 2141 var sidebar = $( this ).find( '.sidebar' ); 2142 var sidebarCopy = sidebar; 2143 2144 sidebar.remove(); 2145 $( this ).find( '.content' ).after( sidebarCopy ); 2146 2147 }); 2148 2149 $( 'section.content-with-sidebar.content-with-sidebar-right' ).each( function() { 2150 2151 $( this ).removeClass( 'content-with-sidebar-right' ).addClass( 'content-with-sidebar-left content-with-old-sidebar-right' ); 2152 2153 }); 2154 } 2155 2156 else { 2157 2158 $( 'section.content-with-old-sidebar-right' ).each( function() { 2159 2160 $( this ).removeClass( 'content-with-old-sidebar-right content-with-sidebar-left' ).addClass( 'content-with-sidebar-right' ); 2161 2162 }); 2163 } 2164 2165 }; 2166 2167 /** 2168 * 2169 * touch functions 2170 * 2171 */ 2172 2173 $( 'body' ).on( 'touchstart', '.presentation-box-single', function() { 2174 2175 $( this ).trigger( 'mouseenter' ); 2176 2177 }); 2178 2179 /** 2180 * 2181 * configure dynamic timeline 2182 * 2183 */ 2184 2185 $.martanianRenovationCompanyConfigureDynamicTimeline = function() { 2186 2187 $( '.dynamic-timeline' ).each( function() { 2188 2189 var parent = $( this ); 2190 var timeline = parent.find( '.timeline' ); 2191 var timelineDescriptionID = 1; 2192 var timelineCircleID = 1; 2193 2194 parent.find( '.timeline-description' ).each( function() { 2195 2196 var timelineDescription = $( this ); 2197 2198 timelineDescription.attr( 'data-timeline-element-id', timelineDescriptionID ).data( 'timeline-element-id', timelineDescriptionID ); 2199 timelineDescription.css({ 'display': 'none' }) 2200 2201 timelineDescriptionID++; 2202 2203 }); 2204 2205 timeline.find( '.timeline-element' ).each( function() { 2206 2207 $( this ).attr( 'data-timeline-element-id', timelineCircleID ).data( 'timeline-element-id', timelineCircleID ); 2208 timelineCircleID++; 2209 2210 }); 2211 2212 if( timeline.data( 'active-element' ) == 'first' ) { 2213 2214 var firstTimelineDescriptionElement = parent.find( '.timeline-description[data-timeline-element-id="1"]' ); 2215 var firstTimelineCircleElement = timeline.find( '.timeline-element[data-timeline-element-id="1"]' ); 2216 2217 firstTimelineDescriptionElement.css({ 'display': 'block' }); 2218 firstTimelineDescriptionElement.parent().css({ 'height': firstTimelineDescriptionElement.height() }); 2219 2220 firstTimelineCircleElement.children( '.circle' ).addClass( 'circle-active' ); 2221 } 2222 2223 else { 2224 2225 var lastTimelineDescriptionElement = parent.find( '.timeline-description[data-timeline-element-id="'+ ( timelineDescriptionID - 1 ) +'"]' ); 2226 var lastTimelineCircleElement = timeline.find( '.timeline-element[data-timeline-element-id="'+ ( timelineDescriptionID - 1 ) +'"]' ); 2227 2228 lastTimelineDescriptionElement.css({ 'display': 'block' }); 2229 lastTimelineDescriptionElement.parent().css({ 'height': lastTimelineDescriptionElement.height() }); 2230 2231 lastTimelineCircleElement.children( '.circle' ).addClass( 'circle-active' ); 2232 } 2233 2234 }); 2235 2236 }; 2237 2238 /** 2239 * 2240 * change dynamic timeline element 2241 * 2242 */ 2243 2244 $( 'body' ).on( 'click touchstart', 'section.double-content.dynamic-timeline .timeline-element .circle:not(.circle-active)', function( event ) { 2245 2246 event.preventDefault(); 2247 2248 var section = $( this ).parents( 'section.double-content.dynamic-timeline' ); 2249 var timelineElement = $( this ); 2250 var timelineElementID = $( this ).parent().data( 'timeline-element-id' ); 2251 var newTimelineDescriptionElement = section.find( '.timeline-description[data-timeline-element-id="'+ timelineElementID +'"]' ); 2252 2253 section.find( '.timeline .timeline-element .circle' ).removeClass( 'circle-active' ); 2254 timelineElement.addClass( 'circle-active' ); 2255 2256 section.find( '.timeline-description' ).fadeOut( 300 ); 2257 newTimelineDescriptionElement.fadeIn( 300 ); 2258 2259 newTimelineDescriptionElement.parent().animate({ 'height': newTimelineDescriptionElement.height() }, 300 ); 2260 2261 }); 2262 2263 /** 2264 * 2265 * refresh dynamic timeline height when responsive 2266 * 2267 */ 2268 2269 $.martanianRenovationCompanyRefreshDynamicTimelineHeight = function() { 2270 2271 $( '.dynamic-timeline' ).each( function() { 2272 2273 var section = $( this ); 2274 section.find( '.timeline-description' ).each( function() { 2275 2276 if( $( this ).css( 'display' ) == 'block' ) { 2277 2278 $( this ).parent().css({ 'height': $( this ).height() }); 2279 } 2280 2281 }); 2282 2283 }); 2284 2285 }; 2286 2287 /** 2288 * 2289 * set parallax 2290 * 2291 */ 2292 2293 $.martanianRenovationCompanySetParallax = function() { 2294 2295 var contentSize = parseInt( $( 'footer .center' ).css( 'width' ), 10 ); 2296 var speed = contentSize > 750 ? 0.25 : 0.05; 2297 2298 $( '.with-parallax' ).css({ 'background-position': '' }).parallax( '50%', speed ); 2299 2300 }; 2301 2302 /** 2303 * 2304 * full height of coming-soon section 2305 * 2306 */ 2307 2308 $.martanianRenovationCompanyComingSoonHeight = function() { 2309 2310 $( 'section.coming-soon' ).each( function() { 2311 2312 var section = $( this ); 2313 var windowHeight = $( window ).height(); 2314 2315 section.css({ 'min-height': windowHeight }); 2316 2317 }); 2318 2319 }; 2320 2321 /** 2322 * 2323 * configure maps for multiple contacts 2324 * 2325 */ 2326 2327 $.martanianRenovationCompanyConfigureMultipleContactsMap = function() { 2328 2329 $( 'section.multiple-contacts' ).each( function() { 2330 2331 var section = $( this ); 2332 var map = section.find( '.google-map' ); 2333 var contentSize = parseInt( section.find( '.center' ).css( 'width' ), 10 ); 2334 var martanianRenovationCompanyPageWidth = $( 'body' ).width(); 2335 2336 if( contentSize == 750 ) map.css({ 'width': martanianRenovationCompanyPageWidth - ( ( martanianRenovationCompanyPageWidth - 750 ) / 2 ) +'px' }); 2337 else if( contentSize == 625 ) map.css({ 'width': martanianRenovationCompanyPageWidth - ( ( martanianRenovationCompanyPageWidth - 625 ) / 2 ) +'px' }); 2338 else { 2339 2340 map.css({ 'width': '' }); 2341 } 2342 2343 }); 2344 2345 }; 2346 2347 /** 2348 * 2349 * add "without-margin-bottom" class 2350 * 2351 */ 2352 2353 $.martanianRenovationCompanyRemoveMarginBottom = function() { 2354 2355 $( 'p' ).each( function() { 2356 2357 if( $( this ).html().replace(/\s| /g, '').length == 0 ) $( this ).remove(); 2358 2359 }); 2360 2361 $( 'blockquote' ).each( function() { 2362 2363 var cite = $( this ).find( 'cite' ); 2364 cite.unwrap( '<p></p>' ); 2365 2366 var last = $( this ).children( '*' ).last(); 2367 if( last.is( 'p' ) ) last.addClass( 'without-margin-bottom' ); 2368 2369 }); 2370 2371 $( 'form.post-password-form' ).addClass( 'form' ); 2372 $( 'form.post-password-form input[type="submit"]' ).addClass( 'button' ); 2373 2374 $( 'section.content-with-sidebar .sidebar' ).each( function() { 2375 2376 var sidebar = $( this ); 2377 var last = sidebar.children( '.widget' ).last(); 2378 2379 last.addClass( 'widget-last' ); 2380 2381 }); 2382 2383 $( 'section.not-found' ).each( function() { 2384 2385 var right = $( this ).children( '.center' ).children( '.right' ); 2386 if( right.length != 0 ) { 2387 2388 var last = right.children( '*' ).last(); 2389 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2390 } 2391 2392 }); 2393 2394 $( 'section.image-on-left-side, section.image-on-right-side' ).each( function() { 2395 2396 var content = $( this ).children( '.center' ).children( '.content' ); 2397 if( content.length != 0 ) { 2398 2399 var last = content.children( '*' ).last(); 2400 2401 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2402 else if( last.is( 'div.icon-box' ) ) { 2403 2404 last.children( '.icon-box-content' ).children( 'p' ).last().addClass( 'without-margin-bottom' ); 2405 } 2406 } 2407 2408 }); 2409 2410 $( 'section.double-content' ).each( function() { 2411 2412 var section = $( this ); 2413 var left = section.children( '.center' ).children( '.left' ); 2414 var right = section.children( '.center' ).children( '.right' ); 2415 2416 if( left.length != 0 ) { 2417 2418 var last = left.children( '*' ).last(); 2419 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2420 } 2421 2422 if( right.length != 0 ) { 2423 2424 if( section.hasClass( 'dynamic-timeline' ) ) { 2425 2426 right.children( '.timeline-description' ).each( function() { 2427 2428 var last = $( this ).children( '*' ).last(); 2429 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2430 2431 }); 2432 } 2433 2434 else { 2435 2436 var last = right.children( '*' ).last(); 2437 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2438 } 2439 } 2440 2441 }); 2442 2443 $( 'section.triple-content' ).each( function() { 2444 2445 var section = $( this ); 2446 var left = section.children( '.center' ).children( '.left' ); 2447 var middle = section.children( '.center' ).children( '.middle' ); 2448 var right = section.children( '.center' ).children( '.right' ); 2449 2450 if( left.length != 0 ) { 2451 2452 var last = left.children( '*' ).last(); 2453 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2454 } 2455 2456 if( middle.length != 0 ) { 2457 2458 var last = middle.children( '*' ).last(); 2459 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2460 } 2461 2462 if( right.length != 0 ) { 2463 2464 var last = right.children( '*' ).last(); 2465 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2466 } 2467 2468 }); 2469 2470 $( 'section.offer' ).each( function() { 2471 2472 var section = $( this ); 2473 section.find( '.value-single' ).each( function() { 2474 2475 var last = $( this ).children( '*' ).last(); 2476 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2477 2478 }); 2479 2480 }); 2481 2482 $( 'section.multiple-contacts' ).each( function() { 2483 2484 var section = $( this ); 2485 section.find( '.middle, .content, .author-box' ).each( function() { 2486 2487 var last = $( this ).children( '*' ).last(); 2488 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2489 2490 }); 2491 2492 }); 2493 2494 $( 'section.full-width, section.call-to-action' ).each( function() { 2495 2496 var section = $( this ); 2497 var last = section.children( '.center' ).children( '*' ).last(); 2498 2499 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2500 2501 }); 2502 2503 $( 'section.quick-lead' ).each( function() { 2504 2505 var section = $( this ); 2506 var last = section.find( '.content' ).children( '*' ).last(); 2507 2508 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2509 2510 }); 2511 2512 $( 'section' ).each( function() { 2513 2514 var section = $( this ); 2515 section.find( 'div.double-content' ).each( function() { 2516 2517 var element = $( this ); 2518 var leftLast = element.children( '.left' ).children( '*' ).last(); 2519 var rightLast = element.children( '.right' ).children( '*' ).last(); 2520 2521 if( leftLast.is( 'p' ) || leftLast.is( 'ul.fa-ul' ) ) leftLast.addClass( 'without-margin-bottom' ); 2522 else if( leftLast.is( 'div.icon-box' ) ) { 2523 2524 leftLast.children( '.icon-box-content' ).children( 'p' ).last().addClass( 'without-margin-bottom' ); 2525 } 2526 2527 if( rightLast.is( 'p' ) || rightLast.is( 'ul.fa-ul' ) ) rightLast.addClass( 'without-margin-bottom' ); 2528 else if( rightLast.is( 'div.icon-box' ) ) { 2529 2530 rightLast.children( '.icon-box-content' ).children( 'p' ).last().addClass( 'without-margin-bottom' ); 2531 } 2532 2533 }); 2534 2535 }); 2536 2537 $( 'section.landing-page' ).each( function() { 2538 2539 var section = $( this ); 2540 var last = section.find( '.content' ).children( '*' ).last(); 2541 2542 if( last.is( 'p' ) || last.is( 'ul.fa-ul' ) ) last.addClass( 'without-margin-bottom' ); 2543 2544 }); 2545 2546 }; 2547 2548 /** 2549 * 2550 * configure comments visibility 2551 * 2552 */ 2553 2554 $.martanianRenovationCompanyConfigureCommentsVisibility = function() { 2555 2556 var comments = $( '.comments' ); 2557 comments.find( 'li.comment' ).each( function() { 2558 2559 var comment = $( this ).children( '.comment-body' ); 2560 var author = comment.find( '.comment-author' ).find( 'cite.fn' ); 2561 var reply = comment.find( '.reply' ); 2562 var authorNotice = comment.parent().hasClass( 'bypostauthor' ) ? '
2562<span class="author">'+ comments.data( 'author-text' ) +'</span>' : ''; 2563 2564 reply.children( 'a' ).html( '<i class="fa fa-reply"></i>' ); 2565 2566 if( reply.length == 0 ) comment.find( '.comment-author' ).after( '<div class="comment-author-name">'+ author.html() + authorNotice +'</div>' ); 2567 else comment.find( '.comment-author' ).after( '<div class="comment-author-name">'+ author.html() + authorNotice +' <span class="reply">'+ reply.html() +'</span></div>' ); 2568 2569 author.remove(); 2570 reply.remove(); 2571 comment.find( '.says' ).remove(); 2572 2573 comment.find( '.comment-meta' ).addClass( 'comment-pub-date' ); 2574 comment.find( '.comment-author, .comment-author-name, .comment-pub-date' ).wrapAll( '<div class="comment-data"></div>' ); 2575 comment.children( '*:not(.comment-data)' ).wrapAll( '<div class="comment-content"></div>' ); 2576 2577 comment.parent().find( 'ul.children' ).addClass( 'sub-comments' ); 2578 comment.parent().find( 'ul.children li.comment .comment-body' ).addClass( 'comment-wrapper' ); 2579 2580 if( !comment.parent().hasClass( 'depth-1' ) ) { 2581 2582 comment.find( '.comment-content p' ).last().addClass( 'without-margin-bottom' ); 2583 } 2584 2585 if( comments.find( 'ul.comments-list' ).data( 'translate-comment-dates' ) == 'yes' ) { 2586 2587 var commentID = comment.parent().attr( 'id' ); 2588 $.ajax({ 2589 url: martanian_renovation_company_javascript_functions_l10n.template_directory_uri +'/_assets/_php/ajax.php', 2590 data: { 'do': 'comment-date', 'commentID': commentID }, 2591 type: 'post', 2592 success: function( output ) { comment.find( '.comment-pub-date' ).children( 'a:not(.comment-edit-link)' ).text( output ); } 2593 }); 2594 } 2595 2596 }); 2597 2598 }; 2599 2600 /** 2601 * 2602 * configure reply form 2603 * 2604 */ 2605 2606 $.martanianRenovationCompanyConfigureReplyForm = function() { 2607 2608 $( 'form#commentform' ).each( function() { 2609 2610 var form = $( this ); 2611 var formElements = { 2612 'formNotes': form.find( '.comment-notes' ), 2613 'formComment': form.find( '.comment-form-comment' ), 2614 'formAuthor': form.find( '.comment-form-author' ), 2615 'formEmail': form.find( '.comment-form-email' ), 2616 'formURL': form.find( '.comment-form-url' ), 2617 'formSubmit': form.find( '.form-submit' ) 2618 }; 2619 2620 form.addClass( 'form' ); 2621 if( formElements.formURL.length !== 0 ) { 2622 2623 form.append( formElements.formAuthor.children( 'input' ).addClass( 'one-third-width' ).attr( 'placeholder', formElements.formAuthor.children( 'label' ).text() ) ); 2624 form.append( formElements.formEmail.children( 'input' ).addClass( 'one-third-width' ).attr( 'placeholder', formElements.formEmail.children( 'label' ).text() ) ); 2625 form.append( formElements.formURL.children( 'input' ).addClass( 'one-third-width one-third-width-last' ).attr( 'placeholder', formElements.formURL.children( 'label' ).text() ) ); 2626 2627 formElements.formAuthor.remove(); 2628 formElements.formEmail.remove(); 2629 formElements.formURL.remove(); 2630 } 2631 2632 else { 2633 2634 form.append( formElements.formAuthor.children( 'input' ).addClass( 'half-width half-width-left' ).attr( 'placeholder', formElements.formAuthor.children( 'label' ).text() ) ); 2635 form.append( formElements.formEmail.children( 'input' ).addClass( 'half-width' ).attr( 'placeholder', formElements.formEmail.children( 'label' ).text() ) ); 2636 2637 formElements.formAuthor.remove(); 2638 formElements.formEmail.remove(); 2639 2640 } 2641 2642 form.append( formElements.formComment.children( 'textarea' ).attr( 'placeholder', formElements.formComment.children( 'label' ).text() ) ); 2643 form.append( formElements.formSubmit.children( 'input' ).addClass( 'button' ) ); 2644 2645 formElements.formComment.remove(); 2646 formElements.formSubmit.remove(); 2647 2648 formElements.formNotes.addClass( 'highlight' ); 2649 2650 }); 2651 2652 $( 'h3#reply-title.comment-reply-title' ).each( function() { 2653 2654 var element = $( this ); 2655 element.replaceWith( '<h2 id="'+ element.attr( 'id' ) +'" class="'+ element.attr( 'class' ) +'">'+ element.html() +'</h2>' ); 2656 2657 }); 2658 2659 }; 2660 2661 /** 2662 * 2663 * configure searchform 2664 * 2665 */ 2666 2667 $.martanianRenovationCompanyConfigureSearchForm = function() { 2668 2669 $( 'section.content-with-sidebar' ).each( function() { 2670 2671 var section = $( this ); 2672 section.find( 'form.searchform' ).each( function() { 2673 2674 var form = $( this ); 2675 2676 form.addClass( 'form' );
2677 form.find( 'input[type="submit"]' ).addClass( 'button' ); 2678 2679 }); 2680 2681 }); 2682 2683 }; 2684 2685 /** 2686 * 2687 * configure content and sidebar height 2688 * 2689 */ 2690 2691 $.martanianRenovationCompanyConfigureContentAndSidebarHeight = function() { 2692 2693 $( 'section.content-with-sidebar' ).each( function() { 2694 2695 var section = $( this ); 2696 var contentSize = parseInt( section.children( '.center' ).css( 'width' ), 10 ); 2697 var content = section.children( '.center' ).children( '.content' ); 2698 var sidebar = section.children( '.center' ).children( '.sidebar' ); 2699 2700 content.css({ 'height': '' }); 2701 sidebar.css({ 'height': '' }); 2702 2703 if( contentSize >= 750 ) { 2704 2705 var contentHeight = content.height(); 2706 var sidebarHeight = sidebar.height(); 2707 2708 if( contentHeight > sidebarHeight ) sidebar.css({ 'height': contentHeight }); 2709 if( sidebarHeight > contentHeight ) content.css({ 'height': sidebarHeight }); 2710 } 2711 2712 }); 2713 2714 }; 2715 2716 /** 2717 * 2718 * permalinks to faq headings 2719 * 2720 */ 2721 2722 $( 'h4.faq .faq-permalink' ).click( function( event ) { 2723 2724 event.preventDefault(); 2725 2726 var element = $( this ); 2727 var hash = element.context.hash; 2728 2729 $.martanianRenovationCompanyScrollToFAQHeading( hash ); 2730 2731 }); 2732 2733 $.martanianRenovationCompanyScrollToFAQHeadingOnLoad = function() { 2734 2735 var hash = window.location.hash; 2736 if( hash != '' ) $.martanianRenovationCompanyScrollToFAQHeading( hash ); 2737 2738 }; 2739 2740 $.martanianRenovationCompanyScrollToFAQHeading = function( hash ) { 2741 2742 var space = 100; 2743 var heading = $( 'h4.faq[data-hash="'+ hash.substr( 1 ) +'"]' ); 2744 2745 if( heading.length !== 0 ) { 2746 2747 var offset = heading.offset(); 2748 if( typeof offset != 'undefined' && offset !== false ) { 2749 2750 $( 'html, body' ).animate( { scrollTop : offset.top - space }, 300 ); 2751 window.location.hash = hash; 2752 } 2753 } 2754 2755 }; 2756 2757 2758 /** 2759 * 2760 * end of file 2761 * 2762 */ 2763 2764}); 2765 2766
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.