1// the semi-colon before the function invocation is a safety 2// net against concatenated scripts and/or other plugins 3// that are not closed properly. 4;(function ( $, window, document, undefined ) { 5 'use strict'; 6 7 var ROUTE = window.ROUTE || {}; 8 9 var $cs_body, $cs_html, $cs_main, $cs_masthead, $cs_window, $cs_document, 10 cs_is_device, cs_is_sticky, cs_is_transparent, cs_is_small, cs_has_admin_bar, 11 cs_is_blank, cs_no_mobile_anim, cs_sticky_height, cs_admin_bar_height, cs_header_height, cs_header_top, cs_is_mobile; 12 13 ROUTE.staticVariables = function() { 14 15 $cs_html = $('html'); 16 $cs_body = $('body'); 17 $cs_masthead = $('#masthead'); 18 $cs_main = $('#main'); 19 $cs_window = $(window); 20 $cs_document = $(document); 21 22 cs_is_device = ( navigator.userAgent.toLowerCase().match(/(android|webos|blackberry|ipod|iphone|ipad|opera mini|iemobile|windows phone|windows mobile)/) ) ? true : false; 23 cs_is_mobile = ( parseInt( cs_ajax.is_mobile ) ) ? true : false; 24 cs_is_sticky = ( parseInt( cs_ajax.sticky ) ) ? true : false; 25 cs_is_transparent = ( $cs_body.hasClass('cs-header-transparent') ) ? true : false; 26 cs_is_blank = ( $cs_body.hasClass('cs-blank') ) ? true : false; 27 cs_has_admin_bar = ( $cs_body.hasClass('admin-bar') ) ? true : false; 28 cs_no_mobile_anim = ( $cs_body.hasClass('cs-no-mobile-animations') ) ? true : false; 29 cs_sticky_height = ( parseInt( cs_ajax.header ) ) ? parseInt( cs_ajax.header ) : 50; 30 cs_admin_bar_height = ( cs_has_admin_bar ) ? 32 : 0; 31 cs_header_height = ( $cs_masthead ) ? $cs_masthead.outerHeight() : 0; 32 cs_header_top = ( $cs_masthead && $cs_masthead.offset() ) ? $cs_masthead.offset().top : 0; 33 34 }; 35 36 ROUTE.dynamicVariables = function() { 37 cs_is_small = ( window.innerWidth < parseInt( cs_ajax.viewport ) ) ? true : false; 38 }; 39 40 ROUTE.stickyHeader = function() { 41 42 if( cs_is_sticky && !cs_is_device && !cs_is_transparent && !cs_is_blank ) { 43 44 var _header_top = ( cs_has_admin_bar ) ? parseInt( cs_header_top-cs_admin_bar_height ) : cs_header_top, 45 _header_height, 46 _scroll_top; 47 48 $cs_window.scroll(function() { 49 50 if( !cs_is_small ) { 51 52 _header_height = cs_header_height; 53 _scroll_top = $(this).scrollTop(); 54 55 if( _scroll_top > _header_top ) { 56 $cs_masthead.trigger('close-modals').addClass('is-sticky'); 57 $cs_main.css('padding-top', _header_height); 58 } else { 59 $cs_masthead.removeClass('is-sticky'); 60 $cs_main.removeAttr('style'); 61 } 62 63 if( _scroll_top > ( _header_height + _header_top ) ) { 64 $cs_masthead.addClass('is-compact'); 65 } else { 66 $cs_masthead.removeClass('is-compact'); 67 } 68 69 } 70 71 }); 72 73 } 74 75 }; 76 77 ROUTE.transparentHeader = function() { 78 79 if( cs_is_sticky && cs_is_transparent ) { 80 81 var $logo = $('#site-logo'), 82 $logo1x = $logo.find('.cs-logo'), 83 $logo2x = $logo.find('.cs-logo2x'), 84 $logo1x_src = $logo1x.attr('src'), 85 $logo2x_src = $logo2x.attr('src'), 86 $logo1x_alt = $logo1x.data('alternative') || $logo1x_src, 87 $logo2x_alt = $logo2x.data('alternative') || $logo2x_src, 88 $page_header = $('#page-header'), 89 $container = $page_header.find('.container'), 90 _header_height, 91 _scroll_top; 92 93 $cs_masthead.addClass('is-sticky'); 94 95 $cs_window.scroll(function() { 96 97 if( !cs_is_small ) { 98 99 _header_height = parseInt( $page_header.outerHeight() / 2 ); 100 _scroll_top = $(this).scrollTop(); 101 102 $container.css( 'opacity', 1-(_scroll_top/_header_height) ); 103 104 if( _scroll_top > 0 ) { 105 106 $cs_body.removeClass('is-transparent'); 107 $cs_masthead.addClass('is-sticky is-compact'); 108 109 $logo1x.attr( 'src', $logo1x_alt ); 110 $logo2x.attr( 'src', $logo2x_alt ); 111 112 } else { 113 114 $cs_body.addClass('is-transparent'); 115 $cs_masthead.removeClass('is-compact'); 116 117 $logo1x.attr( 'src', $logo1x_src ); 118 $logo2x.attr( 'src', $logo2x_src ); 119 120 } 121 122 } else { 123 124 $logo1x.attr( 'src', $logo1x_src ); 125 $logo2x.attr( 'src', $logo2x_src ); 126 127 } 128 129 }); 130 } 131 132 }; 133 134 ROUTE.fixSticky = function() { 135 136 if( cs_is_sticky && cs_is_small ) { 137 138 $cs_masthead.removeClass( 'is-sticky is-compact' ); 139 $cs_main.removeAttr('style'); 140 141 if( cs_is_transparent ) { 142 $cs_body.addClass( 'is-transparent cs-is-small' ); 143 $cs_window.scroll(); 144 } 145 146 } else { 147 148 $cs_body.removeClass( 'cs-is-small' ); 149 150 if( cs_is_transparent ) { 151 $cs_window.scroll(); 152 } 153 154 } 155 156 }; 157 158 ROUTE.mainNavigation = function(){ 159 $('.main-navigation').superfish({ 160 delay: 200, 161 animation: { 162 opacity: 'show', 163 }, 164 speed: 'fast', 165 speedOut: 'fast',
166 cssArrows: false, 167 }); 168 }; 169 170 ROUTE.mobileNavigation = function(){ 171 172 $('#cs-mobile-icon').on('click', function( e ){ 173 174 e.preventDefault(); 175 $(this).toggleClass('cs-collapse'); 176 $('#navigation-mobile').slideToggle(500, 'easeInOutExpo'); 177 178 }); 179 180 $('#navigation-mobile li:has(ul) > .cs-dropdown-plus').on('click', function( e ){ 181 182 e.preventDefault(); 183 184 $(this).toggleClass('cs-times'); 185 $(this).parent().find('> ul').slideToggle(500, 'easeInOutExpo'); 186 187 }); 188 189 $('#navigation-mobile li:has(ul) > a').on('click', function( e ){ 190 191 if ( $(this).attr('href') === '#' ) { 192 193 e.preventDefault(); 194 195 var $parent = $(this).parent(); 196 197 $parent.find('> .cs-dropdown-plus').toggleClass('cs-times'); 198 $parent.find('> ul').slideToggle(500, 'easeInOutExpo'); 199 200 } 201 202 }); 203 204 }; 205 206 ROUTE.topModals = function(){ 207 208 $('.cs-top-modal-hover').each(function() { 209 210 var $this = $(this), 211 $content = $this.find('.cs-modal-content-hover'); 212 213 $this.mouseover(function() { 214 $content.stop().fadeIn('fast'); 215 }).mouseout(function() { 216 $content.stop().fadeOut('fast'); 217 }); 218 219 }); 220 221 $('.cs-top-modal').each(function() { 222 223 var $this = $(this), 224 $open = $this.find('.cs-open-modal'), 225 $content = $this.find('.cs-modal-content'); 226 227 $open.on('click', function( e ) { 228 229 e.preventDefault(); 230 e.stopPropagation(); 231 232 if( $content.hasClass('cs-opened') ) { 233 $content.removeClass('cs-opened').fadeOut('fast'); 234 } else { 235 $content.trigger('close-modals').addClass('cs-opened').fadeIn('fast'); 236 $content.find('input').focus(); 237 } 238 239 }); 240 241 $content.on('click', function ( event ) { 242 243 if (event.stopPropagation) { 244 event.stopPropagation(); 245 } else if ( window.event ) { 246 window.event.cancelBubble = true; 247 } 248 249 }); 250 251 }); 252 253 $(document.body).on('click close-modals', function () { 254 $('.cs-modal-content').removeClass('cs-opened').fadeOut('fast'); 255 }); 256 257 }; 258 259 ROUTE.animationElements = function(){ 260 261 if( cs_no_mobile_anim && cs_is_device ) { 262 return; 263 } 264 265 $('.cs-animation').waypoint( function () { 266 var $this = $(this), 267 _delay = $this.data('delay'), 268 _duration = $this.data('duration'); 269 270 if( _delay ){ 271 $this.css( 'animation-delay', _delay + 's' ); 272 } 273 274 if( _duration ){ 275 $this.css( 'animation-duration', _duration + 's' ); 276 } 277 278 $this.addClass('cs-start-animation'); 279 280 }, { 281 offset: '95%', 282 triggerOnce: true 283 }); 284 285 }; 286 287 ROUTE.parallaxSection = function(){ 288 289 if( !cs_is_device ) { 290 $('section.parallax').each( function() { 291 var $this = $(this), 292 speedFactor = $this.data('parallax-speed') || 0.4; 293 $this.parallax( '50%', speedFactor ); 294 }); 295 } 296 297 }; 298 299 ROUTE.heightSection = function(){ 300 $('.cs-full-height').each(function(){ 301 302 var $this = $(this), 303 winHeight = $cs_window.outerHeight(), 304 elHeight = $this.outerHeight(), 305 maxHeight = parseInt( $this.data( 'full-height-rate' ) ) || 100; 306 307 $this.css( 'min-height', ( maxHeight * winHeight ) / 100 ); 308 309 }); 310 }; 311 312 ROUTE.videoSection = function(){ 313 314 $('.video-section-wrap').each(function(){ 315 316 var $this = $(this), 317 $video = $this.find('video'); 318 319 if( !$video.length ) { return; } 320 321 var $wrap = $this.find('.video-wrap'), 322 _outW = $this.outerWidth(), 323 _outH = $this.outerHeight(); 324 325 $wrap.css({ width: _outW, height: _outH }); 326 327 $video.mediaelementplayer({ 328 pauseOtherPlayers: false 329 }); 330 331 if ( cs_is_device ) { 332 $wrap.remove(); 333 } 334 335 }); 336 337 }; 338 339 ROUTE.videoSectionResize = function(){ 340 341 $('.video-section-wrap').each(function(){ 342 343 var $this = $(this), 344 $video = $this.find('video, iframe'); 345 346 if( !$video.length ) { return; } 347 348 var $wrap = $this.find('.video-wrap'), 349 _orgW = 1280, 350 _orgH = 720, 351 _outW = $this.outerWidth(), 352 _outH = $this.outerHeight(), 353 _radio = _orgW / _orgH; 354 355 if( _orgH < _outH ) { 356 _orgH = _outH;
357 _orgW = Math.ceil( _orgH * _radio ); 358 } 359 360 if( _orgW < _outW ) { 361 _orgW = _outW; 362 _orgH = Math.ceil( _orgW / _radio ); 363 } 364 365 var _left = ( _outW < _orgW ) ? Math.ceil( ( _outW - _orgW ) / 2 ) : 0, 366 _top = Math.ceil( ( _outH - _orgH ) / 2 ); 367 368 $wrap.css({ width: _outW, height: _outH }); 369 $video.css({ width: _orgW, height: _orgH, marginLeft: _left, marginTop: _top }).addClass('cs-video-loaded'); 370 371 }); 372 373 }; 374 375 ROUTE.videoOnLoad = function(){ 376 377 $('.video-onload').each(function(){ 378 379 var $this = $(this), 380 $data = $this.data(), 381 $poster = ( $data.poster ) ? ' poster="'+ $data.poster +'"' : '', 382 videoStr = ''; 383 384 videoStr = '<video width="1920" height="1080" autoplay muted loop'+ $poster +'>'; 385 386 if( $data.mp4 ) { videoStr += '<source type="video/mp4" src="'+ $data.mp4 +'"></source>'; } 387 if( $data.ogv ) { videoStr += '<source type="video/ogv" src="'+ $data.ogv +'"></source>'; } 388 if( $data.webm ){ videoStr += '<source type="video/webm" src="'+ $data.webm +'"></source>'; } 389 390 videoStr += '</video>'; 391 392 $(videoStr).insertAfter($this); 393 394 $this.remove(); 395 396 ROUTE.videoSection(); 397 ROUTE.videoSectionResize(); 398 399 }); 400 401 }; 402 403 ROUTE.isotopeInitalize = function() { 404 405 $('.isotope-container').each( function(){ 406 var $this = $(this), 407 $iso = $this.find('.isotope-loop'), 408 $iso_loader = $this.find('.isotope-loading'), 409 $iso_wrapper = $this.find('.isotope-wrapper'), 410 $iso_filter = $this.find('.isotope-filter a'), 411 $iso_item = $this.find('.isotope-item'); 412 413 $iso_loader.show(); 414 $iso.imagesLoaded( function() { 415 416 setTimeout( function() { 417 418 $iso_loader.hide(); 419 $iso_wrapper.addClass('isotope-loaded'); 420 $iso_item.waypoint( function () { 421 $(this).addClass( 'in' ); 422 },{ 423 offset: "95%", 424 triggerOnce: false 425 }); 426 427 }, 300 ); 428 429 ROUTE.portfolioWidthHeightFix( $iso_item ); 430 431 $iso.isotope({ 432 animationEngine: 'best-available', 433 layoutMode: $iso.data('layout') || 'masonry', 434 }); 435 436 $cs_window.on('debouncedresize', function() { 437 438 setTimeout( function(){ 439 ROUTE.portfolioWidthHeightFix( $iso_item ); 440 $iso.isotope('reLayout'); 441 $cs_window.resize(); 442 }, 300 ); 443 444 }); 445 446 }); 447 448 $iso_filter.on('click', function( e ){ 449 e.preventDefault(); 450 451 $(this).addClass('active').siblings().removeClass('active'); 452 $iso_item.addClass( 'in' ); 453 454 var selector = $(this).attr('data-filter'); 455 $iso.isotope({ filter: selector }); 456 }); 457 458 $('blockquote.twitter-tweet', $iso).bind("csEventResize", function(){ 459 $iso.isotope('reLayout'); 460 }); 461 462 }); 463 464 }; 465 466 ROUTE.ajaxPagination = function() { 467 468 $('.ajax-load-more').each(function() { 469 470 var $this = $(this), 471 $container = $this.parent().parent().find('.isotope-loop'), 472 token = $this.data('token'), 473 settings = window['cs_load_more_'+token], 474 is_isotope = parseInt( settings.isotope ), 475 paging = 1, 476 flood = false, 477 ajax_data; 478 479 $this.bind('click', function() { 480 481 if( flood === false ) { 482 paging++; 483 flood = true; 484 485 // set ajax data 486 ajax_data = $.extend({}, { action: "ajax-pagination", paged: paging }, settings ); 487 488 $.ajax({ 489 type: "POST", 490 url: cs_ajax.ajaxurl, 491 data: ajax_data, 492 dataType: "html", 493 beforeSend: function() { 494 $this.addClass('more-loading'); 495 }, 496 success: function( html ) { 497 498 var content = $( html ).css('opacity', 0); 499 500 if( is_isotope ) { 501 $container.append( content ); 502 } else { 503 $(content).insertBefore( $this.parent() ); 504 } 505 506 $container.imagesLoaded( function() { 507 508 if ( $.jqexists( 'mediaelementplayer' ) ) { 509 $('video, audio').mediaelementplayer({ 510 pauseOtherPlayers: false 511 }); 512 } 513 514 if ( is_isotope ) { 515 516 $container.isotope('appended', content); 517 $container.isotope('reLayout'); 518 519 $('blockquote.twitter-tweet').bind("csEventResize", function(){ 520 $container.isotope('reLayout'); 521 }); 522 523 ROUTE.portfolioWidthHeightFix( $container ); 524 525 } else { 526 527 content.animate({'opacity': 1}, 250, 'easeInOutExpo'); 528 ROUTE.portfolioWidthHeightFix( $container ); 529 530 } 531 532 // load button affecting after images loaded 533 $this.removeClass('more-loading'); 534 if( parseInt( settings.max_pages ) == paging ){ $this.hide(); } 535 536 }); 537 538 flood = false;
539 540 } 541 }); 542 543 } 544 545 return false; 546 }); 547 548 }); 549 550 }; 551 552 ROUTE.ajaxPortfolio = function(){ 553 554 $('.portfolio-model-ajax').each( function() { 555 var $this = $(this), 556 $loader = $this.find('.cs-loader'), 557 $container = $this.find('.ajax-portfolio-container'), 558 $content = $this.find('.ajax-content'), 559 _current = 0; 560 561 $this.on('click', '.item-ajax-load', function( e ) { 562 e.preventDefault(); 563 564 var $project = $(this), 565 _project_id = $project.data('post-id'), 566 _scrollTop = parseInt( $this.offset().top ) - 130; 567 568 // protected for same project load 569 if( _current == _project_id ) { return; } 570 571 // check if project-opened 572 if( $container.hasClass( 'project-opened' ) ) { 573 $container.removeClass('project-opened'); 574 } 575 576 $.ajax({ 577 type: "POST", 578 url: cs_ajax.ajaxurl, 579 data: { 580 action: 'ajax-portfolio', 581 id: _project_id 582 }, 583 dataType: "html", 584 beforeSend: function() { 585 $loader.show(); 586 $('body,html').animate( { scrollTop: _scrollTop }, 500, 'easeInOutExpo' ); 587 }, 588 success: function( html ) { 589 590 var _obj = $content.html( html ); 591 _obj.imagesLoaded( function() { 592 $loader.hide(); 593 $container.addClass( 'project-opened' ); 594 _current = _project_id; 595 }); 596 597 if ( $.jqexists( 'mediaelementplayer' ) ) { 598 $('video, audio').mediaelementplayer({ 599 pauseOtherPlayers: false 600 }); 601 } 602 603 $content.trigger('ajax-portfolio-loaded'); 604 605 } 606 }); 607 608 }); 609 610 $this.on('click', '.ajax-close', function( e ) { 611 e.preventDefault(); 612 $container.removeAttr( 'data-post-id' ).removeClass('project-opened'); 613 setTimeout( function(){ $content.html(''); }, 1000); 614 _current = 0; 615 }); 616 617 }); 618 619 }; 620 621 ROUTE.portfolioWidthHeightFix = function( container ) { 622 623 $('.portfolio-item-info', container).each( function() { 624 var $this = $(this), 625 $elem = $this.find('.portfolio-item-hover'), 626 el_width = $this.outerWidth( true ), 627 el_height = $this.outerHeight( true ); 628 $elem.css({"height": el_height, "width": el_width}); 629 }); 630 631 }; 632 633 ROUTE.postLove = function(){ 634 635 $cs_body.on('click', '.entry-love-it', function( e ) { 636 e.preventDefault(); 637 638 var $this = $(this), 639 $count = $this.find('.love-count'), 640 _post_id = $this.data('post-id'); 641 642 if( $this.hasClass('entry-loved') ) { 643 alert( cs_ajax.loved ); 644 return false; 645 } else { 646 $count.text( parseInt( $count.text() ) + 1 ); 647 $this.addClass( 'entry-loved' ); 648 } 649 650 $.ajax({ 651 type: 'POST', 652 url: cs_ajax.ajaxurl, 653 data: ( { action: 'post-love', id: _post_id, love_it_nonce: cs_ajax.nonce } ), 654 }); 655 656 }); 657 658 }; 659 660 ROUTE.onePage = function() { 661 662 var _offset = ( !cs_is_small && cs_has_admin_bar ) ? cs_admin_bar_height : 0; 663 664 $('.cs-start').each( function() { 665 $(this).on('click', function( e ) { 666 e.preventDefault(); 667 var _target = $(this).data('target') || 'page'; 668 $.scrollTo( '#'+_target , 1000, { offset:-_offset, easing:'easeInOutExpo' }); 669 }); 670 }); 671 672 $('.cs-scrollto').each( function() { 673 $(this).on('click', function( e ) { 674 e.preventDefault(); 675 $.scrollTo( $(this).attr('href') , 1000, { offset:-_offset, easing:'easeInOutExpo' }); 676 }); 677 }); 678 679 if( $cs_body.hasClass('page-template-page-one-page') ) { 680 681 var _header_height = parseInt( cs_header_height + cs_header_top ), 682 $navigation = $('#site-nav, #navigation-mobile, #cs-fixed-nav'), 683 $fixed_nav = $('#cs-fixed-nav'), 684 _waypoint_offset = _header_height, 685 page_ids = $.makeArray(), 686 header_before = $.exists( '#header-before' ), 687 count = 0; 688 689 $fixed_nav.css('margin-top', - Math.floor( $fixed_nav.outerHeight( true ) / 2 ) ); 690 691 $('#site-logo a').on('click', function( e ) { 692 e.preventDefault(); 693 $.scrollTo( 0, 1000, { easing:'easeInOutExpo', onAfter:function(){ 694 window.location.hash = ''; 695 }}); 696 }); 697 698 $navigation.localScroll({ 699 target: 'body', 700 queue: true, 701 duration: 1000, 702 hash: true, 703 easing: 'easeInOutExpo',
704 onBefore:function( e, anchor, $target ) { 705 706 if( cs_is_small ) { 707 this.offset = 0; 708 } else if( $(anchor).offset().top > _header_height || header_before ) { 709 this.offset = -( cs_sticky_height + cs_admin_bar_height ); 710 } else { 711 this.offset = -_header_height; 712 } 713 714 _waypoint_offset = -this.offset; 715 716 }, 717 }); 718 719 $('.cs-section').each( function() { 720 721 $(this).waypoint( function ( direction ) { 722 723 var $this = $(this), 724 $id = $this.attr('id'); 725 726 if( direction == 'down' ) { 727 count++; 728 page_ids[count] = $id; 729 } else { 730 count--; 731 } 732 733 $navigation.find('li').removeClass('current-menu-item'); 734 $navigation.find('a[href="#'+ page_ids[count] +'"]').parent().addClass('current-menu-item'); 735 736 }, { 737 offset: ( _waypoint_offset + 100 ) 738 }); 739 740 }); 741 742 } 743 744 }; 745 746 ROUTE.smoothLink = function() { 747 748 $('.cs-smooth-link').each( function() { 749 $(this).on('click', function( e ) { 750 751 e.preventDefault(); 752 753 var $this = $(this), 754 $target = $($this.attr('href')); 755 756 if( $target ) { 757 var sticky_height = ( cs_is_sticky ) ? cs_sticky_height : 0; 758 var top = sticky_height + cs_admin_bar_height; 759 $.scrollTo( $target, 1000, { offset: -top, easing: 'easeInOutExpo' }); 760 } 761 762 }); 763 }); 764 765 }; 766 767 ROUTE.smoothScrollLink = function() { 768 769 $('.cs-scroll-link').each( function() { 770 $(this).on('click', function( e ) { 771 772 e.preventDefault(); 773 774 var $this = $(this), 775 $classes = $this.attr('class').split(' '), 776 $target = $('.'+$classes[$classes.length-1].replace('cs-scroll-target-', '')); 777 778 if( $target ) { 779 var sticky_height = ( cs_is_sticky ) ? cs_sticky_height : 0; 780 var top = sticky_height + cs_admin_bar_height; 781 $.scrollTo( $target, 1000, { offset: -top, easing: 'easeInOutExpo' }); 782 } 783 784 }); 785 }); 786 787 }; 788 789 ROUTE.goTop = function() { 790 791 $('#cs-top').each( function() { 792 793 var $this = $(this), 794 innerHeight = parseInt( $cs_window.innerHeight() / 2 ); 795 796 $this.on('click', function( e ) { 797 e.preventDefault(); 798 $.scrollTo( 0 , 1000, { easing:'easeInOutExpo' }); 799 }); 800 801 // window scroll 802 $cs_window.scroll( function() { 803 if( $cs_window.scrollTop() > innerHeight ) { 804 $this.addClass('in'); 805 } else { 806 $this.removeClass('in'); 807 } 808 }); 809 810 }); 811 812 $('.cs-scroll').each( function() { 813 $(this).on('click', function( e ) { 814 e.preventDefault(); 815 var target = $(this).data('target') || 'page'; 816 $.scrollTo( '#'+target , 1000, { easing:'easeInOutExpo' }); 817 }); 818 }); 819 820 }; 821 822 ROUTE.fancybox = function() { 823 824 $('.gallery-fancybox a, .fancybox-thumb').fancybox({ 825 beforeLoad: function() { 826 if( !this.title.length ) { 827 this.title = this.element.find('img').attr('alt'); 828 } 829 }, 830 arrows: true, 831 padding: 7, 832 helpers: { 833 media: {}, 834 buttons: {}, 835 thumbs:{ 836 width: 60, 837 height: 50, 838 source: function( item ) { 839 840 var href, thumb; 841 842 thumb = $(item.element).data('thumbnail'); 843 844 if ( item.element ) { 845 href = $(item.element).find('img').attr('src'); 846 } 847 848 if ( !href && item.type === 'image' && item.href ) { 849 href = item.href; 850 } 851 852 if( thumb ) { 853 href = thumb; 854 } 855 856 return href; 857 858 } 859 } 860 } 861 }); 862 863 $('.fancybox').fancybox({ 864 beforeLoad: function() { 865 if( !this.title.length ) { 866 this.title = this.element.find('img').attr('alt'); 867 } 868 }, 869 padding: 7, 870 helpers: { 871 media: {} 872 } 873 }); 874 875 }; 876 877 ROUTE.csTab = function() { 878 $(document).on('click.bs.tab.data-api', '.bs-tab-nav a', function (e) { 879 e.preventDefault(); 880 $(this).tab('show'); 881 $(document).trigger('gmap-resize'); 882 $(document).trigger('debouncedresize'); 883 }); 884 }; 885 886 ROUTE.csAccordion = function() { 887 888 $('.cs-accordions').each(function() { 889 890 var $this = $(this), 891 $wrap = $this.find('.cs-accordion'); 892 893 $wrap.each( function() { 894 895 var $accordion = $(this), 896 $content = $accordion.find('.cs-accordion-content'); 897 898 $accordion.on('click', '.cs-accordion-title:not(.selected)', function( e ) { 899 e.preventDefault(); 900 901 $wrap.find('.cs-accordion-title').removeClass('selected'); 902 $(this).addClass('selected'); 903 904 $this.find('.cs-accordion-content:visible').slideUp(250, 'easeInOutExpo'); 905 $content.slideDown(250, 'easeInOutExpo'); 906 $(document).trigger('gmap-resize'); 907 908 }); 909 910 }); 911 912 }); 913 914 }; 915 916 ROUTE.csToggle = function() { 917 918 $('.cs-toggle').each(function() { 919 920 var $this = $(this), 921 $content = $this.find('.cs-toggle-content'); 922 923 $this.on('click', '.cs-toggle-title', function( e ) { 924 e.preventDefault(); 925 $content.slideToggle(250, 'easeInOutExpo'); 926 $(this).toggleClass('selected'); 927 $(document).trigger('gmap-resize'); 928 }); 929 930 }); 931 932 }; 933 934 ROUTE.csAlert = function() { 935 936 $('.cs-alert-dismissable').each(function() { 937 var $this = $(this); 938 $this.on('click', '.cs-alert-close', function( e ) { 939 e.preventDefault(); 940 $this.slideUp(250, 'easeInOutExpo'); 941 }); 942 }); 943 944 }; 945 946 ROUTE.csProgressBar = function() { 947 948 $('.cs-progress').each(function() { 949 950 var $this = $(this), 951 $bar = $this.find('.cs-progress-bar'), 952 $number = $this.find('.cs-progress-number span'), 953 _type = $bar.data('type'), 954 _group = $bar.data('group'), 955 _percentage = parseInt( $bar.data('percentage') ), 956 _data; 957 958 if( _type == 'horizontal' ) { 959 _data = { width: _percentage + '%', countNum: _percentage }; 960 } else { 961 _data = { height: _percentage + '%', countNum: _percentage }; 962 } 963 964 if ( _group && _type == 'vertical' ) { 965 966 } else if( _group ) { 967 _data = { width: '100%', countNum: _percentage }; 968 } 969 970 $this.waypoint( function () { 971 972 $bar.animate(_data, { 973 duration: 1500, 974 easing:'easeInOutExpo', 975 step: function() { 976 if( this.countNum === undefined ) { 977 this.countNum = 0; 978 } 979 $number.text( Math.round( this.countNum ) ); 980 }, 981 complete: function() { 982 $number.text( this.countNum ); 983 } 984 }); 985 986 }, { 987 offset: '100%', 988 triggerOnce: false 989 }); 990 991 }); 992 993 }; 994 995 ROUTE.csPieChart = function() { 996 997 $('.cs-piechart').each( function() { 998 999 var $this = $(this), 1000 $counter = $this.find('.cs-piecount'); 1001 1002 $this.waypoint( function () { 1003 1004 $this.easyPieChart({ 1005 barColor: '#555', 1006 trackColor: '#f1f1f1', 1007 scaleColor: '#fff', 1008 scaleLength: 0, 1009 lineCap: 'round', 1010 lineWidth: 2, 1011 size: 120, 1012 rotate: 0, 1013 animate: { 1014 duration: 1300, 1015 enabled: true 1016 }, 1017 onStart: function(from, to) { 1018 $counter.countUp({ 1019 useEasing: false 1020 }); 1021 }, 1022 }); 1023 1024 }, { 1025 offset: '100%', 1026 triggerOnce: false 1027 }); 1028 1029 }); 1030 1031 }; 1032 1033 ROUTE.csProgressIcon = function() { 1034 1035 $('.cs-progress-icon').each( function() { 1036 1037 var $this = $(this), 1038 $icon = $this.find('.count'), 1039 _count = parseInt( $this.data('count') ), 1040 _duration = parseInt( $this.data('duration') ) || 50,
1041 _color = $this.data('active-color') || false; 1042 1043 $this.waypoint( function () { 1044 1045 $icon.each( function( i ) { 1046 1047 if( i < _count ) { 1048 setTimeout( function() { 1049 1050 if( _color ) { 1051 $($icon[i]).css({'color': _color}); 1052 } else { 1053 $($icon[i]).addClass('active'); 1054 } 1055 1056 }, (i + 1) * _duration); 1057 } 1058 1059 }); 1060 1061 }, { 1062 offset: '100%', 1063 triggerOnce: false 1064 }); 1065 1066 }); 1067 1068 }; 1069 1070 ROUTE.csCount = function() { 1071 1072 $('.cs-count').waypoint( function () { 1073 $(this).countUp(); 1074 }, { 1075 offset: '100%', 1076 triggerOnce: true 1077 }); 1078 1079 }; 1080 1081 ROUTE.csTestimonial = function() { 1082 1083 if( $.jqexists('royalSlider') ) { 1084 1085 $('.testimonialSlider').royalSlider({ 1086 autoHeight: true, 1087 arrowsNav: false, 1088 fadeinLoadedSlide: true, 1089 controlNavigation: 'bullets', 1090 imageScaleMode: 'none', 1091 imageAlignCenter: false, 1092 loop: true, 1093 loopRewind: true, 1094 usePreloader: false, 1095 transitionSpeed: 1000, 1096 easeInOut: 'easeInOutExpo', 1097 easeOut: 'easeInOutExpo', 1098 autoPlay: { 1099 enabled: true, 1100 pauseOnHover: true, 1101 delay: 5000, // 5sec 1102 } 1103 }); 1104 1105 } 1106 1107 }; 1108 1109 1110 ROUTE.csFaq = function() { 1111 1112 $('.cs-faq').each(function() { 1113 1114 var $faq = $(this), 1115 $faq_filter = $faq.find('.cs-faq-filter a'), 1116 $faq_iso = $faq.find('.cs-faq-isotope'); 1117 1118 $faq_iso.isotope({ 1119 containerClass: '', 1120 hiddenClass: 'cs-faq-hidden', 1121 animationEngine: 'best-available', 1122 itemClass: 'cs-faq-item', 1123 transformsEnabled: false, 1124 resizesContainer: false, 1125 hiddenStyle: {}, 1126 visibleStyle: {}, 1127 containerStyle: {}, 1128 }); 1129 1130 $faq_filter.on('click', function( e ) { 1131 1132 e.preventDefault(); 1133 1134 var $filter = $(this); 1135 1136 $filter.addClass('active').siblings().removeClass('active'); 1137 $faq_iso.isotope({ filter: $filter.attr('data-filter') }); 1138 1139 }); 1140 1141 }); 1142 1143 }; 1144 1145 ROUTE.csGmap = function() { 1146 1147 $('.cs-gmap').each( function() { 1148 var $this = $(this), 1149 token = $this.data('token'), 1150 gmap = window[token]; 1151 1152 var marker; 1153 var map; 1154 var infowindow; 1155 var iterator = 0; 1156 var mapLocation = new google.maps.LatLng( parseFloat( gmap.lat ), parseFloat( gmap.lng ) ); 1157 var mapOptions = { 1158 center: mapLocation, 1159 zoom: parseInt( gmap.zoom ), 1160 zoomControl: parseInt( gmap.zoom_control ), 1161 mapTypeId: gmap.mapTypeId || 'roadmap', 1162 scrollwheel: gmap.scrollwheel || true, 1163 panControl: true, 1164 mapTypeControl: true, 1165 streetViewControl: true, 1166 }; 1167 1168 map = new google.maps.Map(document.getElementById( token ), mapOptions); 1169 1170 if( gmap.markers !== undefined && gmap.markers.length ) { 1171 1172 google.maps.event.addListenerOnce(map, 'tilesloaded', function(){ 1173 for (var i = 0; i < gmap.markers.length; i++) { 1174 setTimeout(addMarker, i * 500); 1175 } 1176 }); 1177 } else if( gmap.markers === undefined && gmap.icon ) { 1178 1179 new google.maps.Marker({ 1180 map: map, 1181 position: new google.maps.LatLng( parseFloat( gmap.lat ), parseFloat( gmap.lng ) ), 1182 animation: google.maps.Animation.DROP, 1183 icon: gmap.icon, 1184 }); 1185 1186 } 1187 1188 function addMarker() { 1189 1190 marker = new google.maps.Marker({ 1191 map: map, 1192 position: new google.maps.LatLng( parseFloat( gmap.markers[iterator].lat ), parseFloat( gmap.markers[iterator].lng ) ), 1193 animation: google.maps.Animation.DROP, 1194 icon: gmap.icon, 1195 }); 1196 1197 infowindow = new google.maps.InfoWindow({ 1198 maxWidth: 300 1199 }); 1200 1201 google.maps.event.addListener(marker, 'click', (function(marker, i) { 1202 return function() { 1203 map.setCenter(marker.getPosition()); 1204 infowindow.setContent( gmap.markers[i].content ); 1205 infowindow.open(map, marker); 1206 }; 1207 })(marker, iterator)); 1208 1209 iterator++; 1210 1211 } 1212 1213 google.maps.event.addDomListener(window, "resize", function() { 1214 var center = map.getCenter(); 1215 google.maps.event.trigger(map, "resize"); 1216 map.setCenter(center); 1217 }); 1218 1219 $(document).bind('gmap-resize', function () { 1220 var center = map.getCenter(); 1221 google.maps.event.trigger(map, "resize"); 1222 map.setCenter(center); 1223 }); 1224 1225 }); 1226 1227 }; 1228 1229 ROUTE.bsModal = function() { 1230 1231 $('.bs-modal').each( function() { 1232 1233 var $modal = $(this); 1234 $( $modal.data('selector') ).on( 'click', function( e ) { 1235 e.preventDefault(); 1236 $modal.modal(); 1237 }); 1238 1239 }); 1240 1241 function adjustModalMaxHeightAndPosition() { 1242 $('.modal-center').each(function() { 1243 1244 var $this = $(this); 1245 1246 if( $this.hasClass('in') === false ) { 1247 $this.show(); 1248 } 1249 1250 var contentHeight = $cs_window.height() - 60;
1251 var headerHeight = $this.find('.modal-header').outerHeight() || 2; 1252 var footerHeight = $this.find('.modal-footer').outerHeight() || 2; 1253 1254 $this.find('.modal-content').css({ 1255 'max-height': function () { 1256 return contentHeight; 1257 } 1258 }); 1259 1260 $this.find('.modal-body').css({ 1261 'max-height': function () { 1262 return contentHeight - ( headerHeight + footerHeight ); 1263 } 1264 }); 1265 1266 $this.find('.modal-dialog').addClass('modal-dialog-center').css({ 1267 'margin-top': function () { 1268 return -($(this).outerHeight() / 2); 1269 }, 1270 'margin-left': function () { 1271 return -($(this).outerWidth() / 2); 1272 } 1273 }); 1274 1275 if( $this.hasClass('in') === false ) { 1276 $this.hide(); 1277 } 1278 1279 }); 1280 } 1281 1282 if ($cs_window.height() >= 320){ 1283 $cs_window.resize(adjustModalMaxHeightAndPosition).trigger("resize"); 1284 } 1285 }; 1286 1287 ROUTE.bsToolTip = function(){ 1288 1289 $('[data-toggle=tooltip]').tooltip(); 1290 1291 $('.cs-tooltip-trigger').each( function(){ 1292 1293 var $this = $(this); 1294 1295 $( $this.data('selector') ).tooltip({ 1296 title: $this.html(), 1297 placement: $this.data('placement'), 1298 trigger: $this.data('trigger'), 1299 html: true, 1300 container: 'body', 1301 }); 1302 1303 }); 1304 1305 }; 1306 1307 ROUTE.bsPopover = function(){ 1308 1309 $('[data-toggle=popover]').popover(); 1310 1311 $('.cs-popover-trigger').each( function(){ 1312 1313 var $this = $(this); 1314 1315 $( $this.data('selector') ).popover({ 1316 placement: $this.data('placement'), 1317 trigger: $this.data('trigger'), 1318 title: $this.data('title'), 1319 content: $this.html(), 1320 html: true, 1321 container: 'body', 1322 }); 1323 1324 }); 1325 1326 }; 1327 1328 ROUTE.smoothScroll = function(){ 1329 1330 if( parseInt( cs_ajax.no_smoothscroll ) ) { 1331 SmoothScroll.destroy(); 1332 } 1333 1334 }; 1335 1336 ROUTE.youtubePlayer = function(){ 1337 1338 var $videos = $('.cs-youtube-video'); 1339 1340 var defaults = { 1341 autoplay: 1, 1342 loop: 1, 1343 muted: 1, 1344 playerVars: { 1345 controls: 0, 1346 showinfo: 0, 1347 branding: 0, 1348 rel: 0, 1349 autohide: 1, 1350 modestbranding: 1, 1351 iv_load_policy: 3 1352 }, 1353 events: null 1354 }; 1355 1356 var YTQueue = []; 1357 1358 var loadYouTubeIframeAPI = false; 1359 1360 if( $videos.length > 0 && !loadYouTubeIframeAPI ) { 1361 1362 $.getScript('//www.youtube.com/iframe_api', function( data, textStatus, jqxhr ) { 1363 if( textStatus === 'success' ) { 1364 window.onYouTubeIframeAPIReady = function(){ 1365 for(var key in YTQueue){ 1366 if(YTQueue.hasOwnProperty(key)){ 1367 var fnc = YTQueue[key]; 1368 if (typeof fnc == "function"){ 1369 fnc(); 1370 } 1371 } 1372 } 1373 }; 1374 } 1375 }); 1376 1377 loadYouTubeIframeAPI = true; 1378 1379 } 1380 1381 $videos.each( function() { 1382 1383 var base = this; 1384 1385 base.$this = $(this); 1386 1387 defaults.events = { 1388 onReady: function( event ) { 1389 1390 if ( base.options.autoplay ) { 1391 event.target.playVideo(); 1392 ROUTE.videoSectionResize(); 1393 } 1394 1395 if ( base.options.muted ) { 1396 event.target.mute(); 1397 } 1398 1399 }, 1400 onStateChange: function( event ) { 1401 1402 if( event.data === YT.PlayerState.ENDED && base.options.loop ) { 1403 base.player.seekTo(base.options.start); 1404 } 1405 1406 } 1407 }; 1408 1409 base.options = $.extend({}, defaults, base.$this.data()); 1410 1411 base.checkEndTime = function() { 1412 1413 var stateInterval = setInterval( function() { 1414 if( base.player.getCurrentTime() >= base.options.end ) { 1415 if ( base.options.start && base.options.loop ) { 1416 base.player.seekTo(base.options.start); 1417 } else { 1418 base.player.stopVideo(); 1419 clearInterval( stateInterval ); 1420 } 1421 } 1422 }, 100); 1423 1424 }; 1425 1426 base.YTPlayer = function() { 1427 base.player = new YT.Player( base, base.options ); 1428 }; 1429 1430 // initize 1431 if ( typeof YT === 'undefined' || ( YT.hasOwnProperty('loaded') && !YT.loaded ) ) { 1432 YTQueue.push( function() { 1433 base.YTPlayer(); 1434 }); 1435 } else { 1436 base.YTPlayer(); 1437 } 1438 1439 }); 1440 1441 }; 1442 1443 $(document).ready( function(){ 1444 1445 ROUTE.staticVariables(); 1446 ROUTE.dynamicVariables(); 1447 ROUTE.stickyHeader(); 1448 ROUTE.transparentHeader(); 1449 ROUTE.mainNavigation(); 1450 ROUTE.mobileNavigation(); 1451 ROUTE.topModals(); 1452 ROUTE.animationElements(); 1453 ROUTE.parallaxSection(); 1454 ROUTE.videoSection(); 1455 ROUTE.heightSection(); 1456 ROUTE.videoSectionResize(); 1457 ROUTE.isotopeInitalize(); 1458 ROUTE.ajaxPagination(); 1459 ROUTE.ajaxPortfolio(); 1460 ROUTE.postLove(); 1461 ROUTE.smoothLink(); 1462 ROUTE.smoothScrollLink(); 1463 ROUTE.goTop(); 1464 ROUTE.fancybox(); 1465 ROUTE.csTab(); 1466 ROUTE.csAccordion();
1467 ROUTE.csToggle(); 1468 ROUTE.csAlert(); 1469 ROUTE.csProgressBar(); 1470 ROUTE.csPieChart(); 1471 ROUTE.csProgressIcon(); 1472 ROUTE.csCount(); 1473 ROUTE.csTestimonial(); 1474 ROUTE.csFaq(); 1475 ROUTE.bsModal(); 1476 ROUTE.bsToolTip(); 1477 ROUTE.bsPopover(); 1478 ROUTE.smoothScroll(); 1479 ROUTE.onePage(); 1480 ROUTE.youtubePlayer(); 1481 1482 }); 1483 1484 $(window).on('resize', function(){ 1485 1486 ROUTE.staticVariables(); 1487 ROUTE.dynamicVariables(); 1488 ROUTE.fixSticky(); 1489 ROUTE.heightSection(); 1490 ROUTE.videoSectionResize(); 1491 1492 }); 1493 1494 $(window).on('scroll', function(){ 1495 // do stuff 1496 }); 1497 1498 $(window).on('load', function(){ 1499 ROUTE.csGmap(); 1500 ROUTE.videoOnLoad(); 1501 ROUTE.videoSectionResize(); 1502 }); 1503 1504})( jQuery, window, document );
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.