1"use strict"; 2/** 3 * General Custom JS Functions 4 * 5 * @author Themovation <[email protected]> 6 * @copyright 2014 Themovation INC. 7 * @license http://themeforest.net/licenses/regular 8 * @version 1.1.1 9*/ 10 11/* 12 # Helper Functions 13 # On Window Resize 14 # On Window Load 15*/ 16 17//====================================================================== 18// Helper Functions 19//====================================================================== 20 21 22//----------------------------------------------------- 23// NAVIGATION - Adds support for Mobile Navigation 24// Detect screen size, add / subtract data-toggle 25// for mobile dropdown menu. 26//----------------------------------------------------- 27function themo_support_mobile_navigation(){ 28 29 // If mobile navigation is active, add data attributes for mobile touch / toggle 30 if (Modernizr.mq('(max-width: 767px)')) { 31 //console.log('Adding data-toggle, data-target'); 32 jQuery("li.dropdown .dropdown-toggle").attr("data-toggle", "dropdown"); 33 jQuery("li.dropdown .dropdown-toggle").attr("data-target", "#"); 34 } 35 36 // If mobile navigation is NOT active, remove data attributes for mobile touch / toggle 37 if (Modernizr.mq('(min-width:768px)')) { 38 //console.log('Removing data-toggle, data-target'); 39 jQuery("li.dropdown .dropdown-toggle").removeAttr("data-toggle", "dropdown"); 40 jQuery("li.dropdown .dropdown-toggle").removeAttr("data-target", "#"); 41 } 42 43 /* 44 Support for Old Browsers | OLD IE | Might need this after testing. 45 var windowWidth = jQuery( window ).width(); 46 if(windowWidth > 767){ 47 console.log('Remove data-toggle'); 48 jQuery("li.dropdown .dropdown-toggle").removeAttr("data-toggle", "dropdown"); 49 jQuery("li.dropdown .dropdown-toggle").removeAttr("data-target", "#"); 50 }else { 51 if(windowWidth < 767){ 52 console.log('Adding data-toggle'); 53 jQuery("li.dropdown .dropdown-toggle").attr("data-toggle", "dropdown"); 54 jQuery("li.dropdown .dropdown-toggle").attr("data-target", "#"); 55 } 56 }*/ 57} 58 59 60 61//----------------------------------------------------- 62// ANIMATION - Adds support for CS3 Animations 63// Check if element is visible after scrolling 64//----------------------------------------------------- 65function themo_animate_scrolled_into_view(elem,animation,time_to_delay){ 66 67 // If elem does not exist, break. 68 if(!jQuery(elem).length){ 69 return false; 70 } 71 72 // If an anmiated class has already beed added, then skip it. 73 if (jQuery(elem).is('.slideUp, .slideDown, .slideLeft, .slideRight, .fadeIn')) { 74 //console.log('skip'); 75 }else{ 76 77 var offset = 0; // Off set from bottom of screen 78 var offset_large = jQuery(window).height() - 700; // Offset for tall images. 79 //console.log('Window Height '+jQuery(window).height()) 80 81 var docViewTop = jQuery(window).scrollTop(); // top of window position 82 //console.log('Window Top '+docViewTop) 83 84 var docViewBottom = docViewTop + jQuery(window).height(); // bottom of window position 85 //console.log('Window Bottom '+docViewBottom) 86 87 var elemTop = jQuery(elem).offset().top; // Top of element position 88 //console.log(elem.selector + ' Top '+elemTop) 89 90 var elemBottom = elemTop + jQuery(elem).height(); // bottom of element position 91 //console.log(elem.selector + ' Height '+jQuery(elem).height()) 92 //console.log(elem.selector + ' Bottom '+elemBottom) 93 94 //console.log("----------------------------"); 95 96 /* 97 Caveat: We are working with a numbered positions so if X has highter numbered pos (100) than Y does(50), it actually has a lower phyisial position on the screen. 98 If the top of the windows position is 100 is X has a position of 150, it means that X is lower on the page than the top of the window. 99 100 1) IF the bottom of element is physically lower than the top of the Window. 101 > e.g. Bottom elem = 100 and the top of window is 50, means bottom of elem has a lower physical position than the top of window 102 > This could happen when the element bottom enters from the top of the window. 103 104 2) IF the top of element is physically higher than the bottom of (the Window + offset). 105 > e.g. Top elem = 100 and the bottom of window is 150, means top of elem is above the bottom of the window 106 > This could happen when the element top enteres from the bottom of the window. 107 108 #3 and #4 ensure that the entire element is inside the window so the animation won't kick in until the whole thing is visible and between the top and bottom of the window. 109 110 3) IF the bottom of the element is above the bottom of the screen. 111 > e.g. bottom of elem = 100 and bottom of window = 150, means bottom of elem is above the bottom of the window 112 > This could happen when the element bottom enteres from the bottom of the window. 113 114 4) IF the top of the element is lower than the top of the window. 115 > e.g. top of elem = 100 and top of window = 50, means top of elem is lower than the top of the window 116 > This could happen when the element top enteres from the top of the window. 117 118 #5 & #6 For the edge case where the elem is taller than the window, so at one point the top is above the window and bottom is below. 119 To resovle this we use offset, to prompt the elme to animate once we know its top or bottom is into the screen deep enough to be animated. 120 121 5) IF top of elem is above (bottom of window - large offset) 122 123 6) If bottom of elem is below (top of window + large offest) */ 124 125 126 if(((elemBottom >= docViewTop) && (elemTop <= docViewBottom-offset) && (elemBottom <= docViewBottom-offset) && (elemTop >= docViewTop)) || 127 ((elemTop <= docViewBottom-offset_large) && (elemBottom >= docViewTop+offset_large))){ 128 129 setTimeout( 130 function() 131 { 132 //console.log(elem.selector) 133 jQuery(elem).addClass(animation); 134 }, time_to_delay); 135 136 } 137 } 138 139}; 140 141 142 143//----------------------------------------------------- 144// VERTICAL ALIGN TOUR Meta Copy - Adds support for 145// vertical alignment by detecting height of tour boxes 146// and setting container box height 147//----------------------------------------------------- 148 149function themo_vertical_align_tour(){ 150 151 // Loop through all .float-block's 152 jQuery( ".float-block" ).each(function() { 153 154 //grab #parentID 155 var parentID = jQuery( this ).closest("section").attr("id"); 156 //console.log("Parent ID is: "+parentID); 157 158 jQuery("#"+parentID).css('height','auto'); 159 160 // Get height of #parentID .container 161 var containerHeight = jQuery("#"+parentID+' .container').height(); 162 //console.log("Parent container height is: "+containerHeight); 163 164 // Set #parentID height from .container 165 jQuery("#"+parentID).height(containerHeight+'px'); 166 //console.log("Parent ID height is set at : "+containerHeight); 167 168 //console.log("----------------------------"); 169 170 }); 171} 172 173//----------------------------------------------------- 174// VERTICAL ALIGN PORTFOLIO Meta Copy - Adds support for 175// vertical alignment by detecting height of project boxes 176// and setting container box height 177//----------------------------------------------------- 178 179function themo_vertical_align_project_thumb(){ 180 181 // Loop through all .float-block's 182 jQuery( ".portfolio-item" ).each(function() { 183 184 //grab #parentID 185 var parentID = jQuery( this ).closest("div").attr("id"); 186 //console.log("Parent ID is: "+parentID); 187 188 jQuery("#"+parentID).css('height','auto'); 189 190 // Get height of #parentID .container 191 var containerHeight = jQuery("#"+parentID+' .port-wrap').height(); 192 //console.log("Parent container height is: "+containerHeight); 193 194 // Set #parentID height from .container 195 jQuery("#"+parentID).height(containerHeight+'px'); 196 //console.log("Parent ID height is set at : "+containerHeight); 197 198 //console.log("----------------------------"); 199 200 }); 201
202 jQuery(".port-center").css('visibility','visible'); 203} 204 205 206//----------------------------------------------------- 207// Adjust Padding for Transparent Header 208// Need to adjust padding if transparent header is enabled, 209// since we'll be using position: absolute and that will cause 210// padding issues with the first page header or slider. 211//----------------------------------------------------- 212 213function themo_adjust_padding_transparent_header(elem){ 214 215 // Check if Transparency is enabled. 216 if(jQuery('body').find('header.banner[data-transparent-header="true"]').length > 0) { 217 218 // Get the height of the navigation header 219 var headerHeight = parseInt(jQuery("header.banner").height()); 220 //console.log('DIGGITY DOG!'); 221 //console.log('Header Height '+headerHeight); 222 223 // Adjust Padding for all sliders and page headers. 224 225 226 227 //jQuery( "#main-flex-slider .themo_slider_0, section#themo_page_header_1" ).each(function() { 228 jQuery( elem ).each(function() { 229 // Get current padding 230 var currentPadding = parseInt(jQuery(this).css("padding-top").replace(/[^-\d\.]/g, '')); 231 //console.log('Current Padding '+currentPadding); 232 233 // Calculate 234 var newPadding = currentPadding+headerHeight; 235 //console.log('New Padding '+newPadding); 236 237 // Adjust and set new padding. 238 jQuery(this).css({ 239 "padding-top":newPadding+"px" 240 }); 241 242 //console.log("----------------------------"); 243 244 }); 245 246 }; 247 248} 249 250//----------------------------------------------------- 251// Detect if touch device via modernizr, return true 252//----------------------------------------------------- 253function themo_is_touch_device(checkScreenSize){ 254 255 if (typeof checkScreenSize === "undefined" || checkScreenSize === null) { 256 checkScreenSize = true; 257 } 258 259 var deviceAgent = navigator.userAgent.toLowerCase(); 260 261 var isTouch = Modernizr.touch || 262 (deviceAgent.match(/(iphone|ipod|ipad)/) || 263 deviceAgent.match(/(android)/) || 264 deviceAgent.match(/iphone/i) || 265 deviceAgent.match(/ipad/i) || 266 deviceAgent.match(/ipod/i) || 267 deviceAgent.match(/blackberry/i)); 268 269 if(checkScreenSize){ 270 var isMobileSize = Modernizr.mq('(max-width:767px)'); 271 }else{ 272 var isMobileSize = false; 273 } 274 275 if(isTouch || isMobileSize ){ 276 return true; 277 } 278 279 return false; 280} 281 282//----------------------------------------------------- 283// Initiate PARALLAX 284//----------------------------------------------------- 285function themo_start_parallax(isTouch){ 286 287 var $body = jQuery(".parallax-bg").parents(".preloader"); 288 289 //----------------------------------------------------- 290 // Select all parallax elemnts and start stellar script 291 // Don't start stellar if viewer is a touch device 292 // Use imagesLoaded to detect when images are loaded, until 293 // then use a preloader gif 294 //----------------------------------------------------- 295 var posts = document.querySelectorAll('.parallax-bg'); 296 imagesLoaded( posts, function() { // Detect when images have been loaded (preloader) 297 // Do not use if a touch device! 298 if(!isTouch){ 299 themo_startStellar(); 300 } 301 $body.removeClass('loading').addClass('loaded'); // once images are loaded, remove preloader animation 302 }); 303} 304 305 306//----------------------------------------------------- 307// Disable Transparent Header for Mobile 308//----------------------------------------------------- 309function themo_no_transparent_header_for_mobile(isTouch){ 310 311 if (jQuery(".navbar[data-transparent-header]").length) { 312 if(isTouch){ 313 jQuery('.navbar').attr("data-transparent-header", "false"); 314 } 315 else{ 316 jQuery('.navbar').attr("data-transparent-header", "true"); 317 } 318 } 319} 320 321//----------------------------------------------------- 322// Initiate Steller (PARALLAX library) 323//----------------------------------------------------- 324function themo_startStellar(){ 325 jQuery.stellar({ 326 horizontalScrolling: false, 327 //verticalOffset: 145 328 }); 329} 330 331//----------------------------------------------------- 332// Initiate Masonry 333//----------------------------------------------------- 334function themo_start_masonry(){ 335 // If masonry elements exist, start using script. 336 if (jQuery('.mas-blog').length > 0) { // it exists 337 var container = document.querySelector('.mas-blog'); 338 var msnry = new Masonry( container, { 339 // options 340 columnWidth: '.mas-blog-post', 341 itemSelector: '.mas-blog-post' 342 }); 343 } 344} 345 346//----------------------------------------------------- 347// Active Lightbox 348//----------------------------------------------------- 349function themo_active_lightbox(){ 350 // delegate calls to data-toggle="lightbox" 351 jQuery(document).delegate('*[data-toggle="lightbox"]', 'click', function(event) { 352 event.preventDefault(); 353 return jQuery(this).ekkoLightbox({ 354 always_show_close: true, 355 gallery_parent_selector: '.gallery', 356 right_arrow_class: '.flex-next', 357 left_arrow_class: '.flex-prev' 358 }); 359 }); 360} 361 362//----------------------------------------------------- 363// Adjust Pricing Table Height 364//----------------------------------------------------- 365 366function themo_adjust_pricing_table_height(){ 367 368 var $tallestCol; 369 370 // For each pricing-table element 371 jQuery('.pricing-table').each(function(){ 372 $tallestCol = 0; 373 374 // Find the plan name 375 jQuery(this).find('> div .pricing-title').each(function(){ 376 (jQuery(this).height() > $tallestCol) ? $tallestCol = jQuery(this).height() : $tallestCol = $tallestCol; 377 }); 378 379 // Safety net increase pricing tables height couldn't be determined 380 if($tallestCol == 0) $tallestCol = 'auto'; 381 382 // set even height 383 jQuery(this).find('> div .pricing-title').css('height',$tallestCol); 384 385 // FEATURES UL 386 jQuery(this).find('> div .features').each(function(){ 387 (jQuery(this).height() > $tallestCol) ? $tallestCol = jQuery(this).height() : $tallestCol = $tallestCol; 388 }); 389 390 // Safety net incase pricing tables height couldn't be determined 391 if($tallestCol == 0) $tallestCol = 'auto'; 392 393 // Set even height 394 jQuery(this).find('> div .features').css('height',$tallestCol); 395 396 // END FEATURES UL 397 398 }); 399} 400 401//----------------------------------------------------- 402// Initiate Thumbnail Slider (flexslider) 403//----------------------------------------------------- 404 405function themo_start_thumb_slider(id) { 406 jQuery(id).flexslider({ 407 animation: "slide", 408 controlNav: false, 409 animationLoop: true, 410 slideshow: false, 411 itemWidth: 255, 412 itemMargin: 40, 413 maxItems: 4, 414 prevText: '', 415 nextText: '', 416 start: function(){ 417 jQuery('.thumb-flex-slider .slides img').show(); 418 419 }
420 //controlsContainer: '.flex-container' 421 //useCSS: false 422 }); 423} 424 425//----------------------------------------------------- 426// Initiate Slider (flexslider) 427//----------------------------------------------------- 428function themo_start_flex_slider(flex_selector,themo_flex_animation, themo_flex_easing, 429 themo_flex_animationloop, themo_flex_smoothheight, themo_flex_slideshowspeed, themo_flex_animationspeed, 430 themo_flex_randomize, themo_flex_pauseonhover, themo_flex_touch, themo_flex_directionnav,themo_flex_controlNav){ 431 // SETUP FLEXSLIDER OPTIONS 432 // Remove ajax_loader.gif from Formidable Plugin 433 jQuery("img.frm_ajax_loading").remove(); 434 jQuery(flex_selector).flexslider({ 435 animation: themo_flex_animation, 436 smoothHeight: themo_flex_smoothheight, 437 easing: themo_flex_easing, 438 animationLoop: themo_flex_animationloop, 439 slideshowSpeed: themo_flex_slideshowspeed, 440 animationSpeed: themo_flex_animationspeed, 441 randomize: themo_flex_randomize, 442 pauseOnHover: themo_flex_pauseonhover, 443 touch: themo_flex_touch, 444 directionNav: themo_flex_directionnav, 445 controlNav: themo_flex_controlNav, 446 //directionNav: false, 447 prevText: '', 448 nextText: '', 449 start: function (slider) { 450 //slider.removeClass( "flexpreloader"); 451 jQuery('body').addClass('loaded'); 452 }, 453 after: function (slider) { 454 }, 455 before: function () { 456 } 457 }); 458} 459 460//----------------------------------------------------- 461// Scroll Up 462//----------------------------------------------------- 463function themo_start_scrollup() { 464 465 jQuery.scrollUp({ 466 animationSpeed: 200, 467 animation: 'fade', 468 scrollSpeed: 500, 469 scrollImg: { active: true, type: 'background', src: '../../images/top.png' } 470 }); 471}; 472 473 474 475function themo_disable_animation_for_mobile() { 476 477 //console.log('Disable touch for mobile'); 478 // Detect and set isTouch for touch screens 479 var isTouchAnimation = themo_is_touch_device(false); 480 481 if(isTouchAnimation){ 482 jQuery(".hide-animation").removeClass("hide-animation"); 483 //jQuery.each.removeClass("hide-animation"); 484 } 485}; 486 487 488function themo_init_one_page_scroll(){ 489 490 /* When page loads, set first link to active. */ 491 if(jQuery('nav ul.navbar-nav .th-anchor').hasClass( "active" )){ 492 jQuery('nav ul.navbar-nav .th-anchor').removeClass('active'); 493 jQuery('nav ul.navbar-nav .th-anchor-top').addClass('active'); 494 } 495 496 497 /* Cache some variables */ 498 var slide = jQuery('section').parent('div') ; 499 var mywindow = jQuery(window); 500 var htmlbody = jQuery('html,body'); 501 var isTouch = themo_is_touch_device(false); 502 503 /* Smooth Scroll */ 504 jQuery(document) 505 .on('click', 'a[href*="#"]', function(e) { 506 507 /* If click originates from Accordion Toggle, exit. */ 508 var isAccordion = jQuery( this ).hasClass( "accordion-toggle" ); 509 510 var isTab = jQuery( this ).attr('data-toggle'); 511 512 if (isAccordion || isTab) { 513 //console.log('abort, exit completely out of click handler'); 514 return; 515 } 516 517 if ( this.hash && this.pathname === location.pathname && this.host === location.host) { 518 var slashedHash = '#/' + this.hash.slice(1); 519 if ( this.hash ) { 520 if ( slashedHash === location.hash ) { 521 522 // There are a few offsets that need to be calculated 523 var smoothScroll_offset = 0; 524 var navbar_collapse_offset = 0; 525 if (jQuery("header").hasClass("headhesive--clone")) { 526 smoothScroll_offset = jQuery(".headhesive--clone").height() ; 527 if(jQuery("header nav.navbar-collapse").hasClass("in")){ 528 navbar_collapse_offset = jQuery("header nav.navbar-collapse.in").height() ; 529 smoothScroll_offset = smoothScroll_offset - navbar_collapse_offset; 530 } 531 532 } 533 534 jQuery.smoothScroll({offset: -smoothScroll_offset, scrollTarget: this.hash, 535 beforeScroll: function() { // Close Mobile Menu 536 var bsNav = jQuery('header .navbar-collapse'); 537 538 if (bsNav.hasClass("collapse in")) { 539 bsNav.removeClass("in"); 540 //mainNav.removeClass("open"); 541 } 542 }, 543 afterScroll: function() { // Update Active Links, but not for mobile / touch 544 if(!isTouch){ 545 var links = jQuery('nav ul.navbar-nav').find('li.th-anchor a'); 546 547 jQuery(links).each(function() { 548 var hashtag = jQuery(this).attr('href').split('#')[1]; 549 if(hashtag === this.hash){ 550 jQuery(this).parent('li').addClass('active'); 551 }else{ 552 jQuery(this).parent('li').removeClass('active'); 553 } 554 }); 555 } 556 } 557 558 }); 559 } else {
560 jQuery.bbq.pushState(slashedHash); 561 } 562 return false; 563 } 564 } 565 }) 566 .ready(function() { 567 jQuery(window).bind('hashchange', function(event) { 568 var tgt = location.hash.replace(/^#\/?/,''); 569 570 if ( document.getElementById(tgt) ) { 571 572 // There are a few offsets that need to be calculated 573 var smoothScroll_offset = 0; 574 var navbar_collapse_offset = 0; 575 if (jQuery("header").hasClass("headhesive--clone")) { 576 smoothScroll_offset = jQuery(".headhesive--clone").height() ; 577 if(jQuery("header nav.navbar-collapse").hasClass("in")){ 578 navbar_collapse_offset = jQuery("header nav.navbar-collapse.in").height() ; 579 smoothScroll_offset = smoothScroll_offset - navbar_collapse_offset; 580 } 581 } 582 583 584 585 jQuery.smoothScroll({offset: -smoothScroll_offset, scrollTarget: '#' + tgt, 586 beforeScroll: function() { // Close Mobile Menu 587 var bsNav = jQuery('header .navbar-collapse'); 588 589 if (bsNav.hasClass("collapse in")) { 590 bsNav.removeClass("in"); 591 //mainNav.removeClass("open"); 592 } 593 }, 594 afterScroll: function() { // Update Active Links, but not for mobile / touch 595 if(!isTouch){ 596 var links = jQuery('nav ul.navbar-nav').find('li.th-anchor a'); 597 598 jQuery(links).each(function() { 599 var hashtag = jQuery(this).attr('href').split('#')[1]; 600 if(hashtag === tgt){ 601 jQuery(this).parent('li').addClass('active'); 602 }else{ 603 jQuery(this).parent('li').removeClass('active'); 604 } 605 }); 606 } 607 } 608 609 }); 610 } 611 }); 612 jQuery(window).trigger('hashchange'); 613 }); 614 615 616 if(!isTouch){ 617 //Setup waypoints plugin 618 slide.waypoint(function (direction) { 619 620 var links = jQuery('nav ul.navbar-nav').find('li.th-anchor a'); 621 //cache the variable of the data-slide attribute associated with each slide 622 var dataslide = jQuery(this).attr('id'); 623 if(typeof dataslide != 'undefined'){ 624 625 jQuery(links).each(function() { 626 var hashtag = jQuery(this).attr('href').split('#')[1]; 627 if(hashtag === dataslide){ 628 //console.log('Add Class to '+ hashtag); 629 jQuery(this).parent('li').addClass('active'); 630 }else{ 631 //console.log('Remove Class from '+ hashtag); 632 jQuery(this).parent('li').removeClass('active'); 633 } 634 }); 635 } 636 }, { 637 offset: function() { 638 if (jQuery("header").hasClass("headhesive--clone")) { 639 return jQuery(".headhesive--clone").height() ; 640 }else{ 641 return 0; 642 } 643 } 644 645 }); 646 } 647 648 //waypoints doesnt detect the first slide when user scrolls back up to the top so we add this little bit of code, that removes the class 649 //from navigation link slide 2 and adds it to navigation link slide 1. 650 if(!isTouch){ 651 mywindow.scroll(function () { 652 if (mywindow.scrollTop() == 0) { 653 if(jQuery('nav ul.navbar-nav .th-anchor').hasClass('active')){ 654 jQuery('nav ul.navbar-nav .th-anchor').removeClass('active'); 655 jQuery('nav ul.navbar-nav .th-anchor-top').addClass('active'); 656 } 657 } 658 }); 659 } 660 661}; 662 663function themo_init_isotope() { 664 // filter items on click handler 665 jQuery('.portfolio-filters').on( 'click', 'a', function(e) { 666 667 e.preventDefault(); 668 669 // Get Data-filter value 670 var filterValue = jQuery(this).attr('data-filter'); 671 672 // Get Parent Class 673 if (filterValue == '*') { 674 console.log('NOTHING') 675 var parent_class = jQuery(this).closest('section').attr("id"); 676 } else { 677 var parent_class = jQuery(filterValue).closest('section').attr("id"); 678 } 679 680 // Remove .current class from all a links inside .portfolio-filters 681 jQuery('#'+parent_class+' .portfolio-filters a').removeClass( "current" ); 682 683 // Add .current class to current filter link. 684 jQuery(this).addClass( "current" ); 685 686 //console.log(filterValue); 687 //console.log(parent_class); 688 689 // Get the container element to initialize isotope. 690 var $container = jQuery('#'+parent_class+' .portfolio-row'); 691 // init 692 $container.isotope({ 693 // options 694 itemSelector: '.portfolio-item', 695 layoutMode: 'fitRows', 696 }); 697 698 $container.isotope({ filter: filterValue }); 699 700 }); 701} 702 703var nice = false;
704 705/** 706 * Protect window.console method calls, e.g. console is not defined on IE 707 * unless dev tools are open, and IE doesn't define console.debug 708 */ 709(function() { 710 if (!window.console) { 711 window.console = {}; 712 } 713 // union of Chrome, FF, IE, and Safari console methods 714 var m = [ 715 "log", "info", "warn", "error", "debug", "trace", "dir", "group", 716 "groupCollapsed", "groupEnd", "time", "timeEnd", "profile", "profileEnd", 717 "dirxml", "assert", "count", "markTimeline", "timeStamp", "clear" 718 ]; 719 // define undefined methods as noops to prevent errors 720 for (var i = 0; i < m.length; i++) { 721 if (!window.console[m[i]]) { 722 window.console[m[i]] = function() {}; 723 } 724 } 725})(); 726 727//====================================================================== 728// Executes when HTML-Document is loaded and DOM is ready 729//====================================================================== 730jQuery(document).ready(function($) { 731 "use strict"; 732 733 // If flex slider loading then wait a max of 5 seconds. 734 // else check if images are loaded 735 if (jQuery("#main-flex-slider")[0]){ 736 // Do nothing / flex will figure it out. 737 //console.log('Let Flex Take Care of It'); 738 setTimeout(function(){ 739 console.log('Took too long, timeout and clear preloader'); 740 jQuery('body').addClass('loaded'); 741 }, 10000); 742 }else{ 743 jQuery('body').addClass('loaded'); 744 } 745 746 747 748 // Add support for mobile navigation 749 themo_support_mobile_navigation($); 750 751 752 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { 753 console.log('Smooth Scroll Off (Safari).'); 754 }else{ 755 try 756 { 757 // Initialise with options 758 nice = jQuery("html").niceScroll({ 759 zindex:20000, 760 scrollspeed:60, 761 mousescrollstep:60, 762 cursorborderradius: '10px', // Scroll cursor radius 763 cursorborder: '1px solid rgba(255, 255, 255, 0.4)', 764 cursorcolor: 'rgba(0, 0, 0, 0.6)', // Scroll cursor color 765 //autohidemode: 'true', // Do not hide scrollbar when mouse out 766 cursorwidth: '10px', // Scroll cursor width 767 768 }); 769 } 770 catch (err) { 771 console.log('Smooth Scroll Off.'); 772 } 773 } 774 775}); 776 777 778//====================================================================== 779// On Window Load - executes when complete page is fully loaded, including all frames, objects and images 780//====================================================================== 781 jQuery(window).load(function($) { 782 "use strict"; 783 784 // Disable animation for mobile. 785 themo_disable_animation_for_mobile(); 786 787 // Vertically Align Tour Copy 788 themo_vertical_align_tour(); 789 790 // Vertically Align Project Thumb 791 themo_vertical_align_project_thumb(); 792 793 // Adjust padding for transparent header 794 themo_adjust_padding_transparent_header('section#themo_page_header_1'); 795 796 // Preloader for background images. 797 var $header_preloader = jQuery(".full-header-img").parents(".preloader"); 798 799 //----------------------------------------------------- 800 // Select all full header img classes and wait until images are loaded 801 // before updating loading class to loaded 802 //----------------------------------------------------- 803 var full_header_imgs = document.querySelectorAll('.full-header-img'); 804 imagesLoaded( full_header_imgs, function() { // Detect when images have been loaded (preloader) 805 $header_preloader.removeClass('loading').addClass('loaded'); // once images are loaded, remove preloader animation 806 }); 807 808 // Detect and set isTouch for touch screens 809 var isTouch = themo_is_touch_device(); 810 811 // Initiate Parallax Script 812 themo_start_parallax(isTouch); 813 814 // Disable Transparent Header for Mobile / touch 815 themo_no_transparent_header_for_mobile(isTouch); 816 817 // Initiate Masonry Script 818 themo_start_masonry(); 819 820 // Initiate Lightbox 821 themo_active_lightbox(); 822 823 // Adjust Pricing Table Height 824 themo_adjust_pricing_table_height(); 825 826 // Start Scroll Up 827 themo_start_scrollup(); 828 829 830 // Headhesive 831 //var header = new Headhesive('.navbar-static-top'); 832 833 // Set options 834 if(!isTouch){ 835 var options = { 836 // Scroll offset. Accepts Number or "String" (for class/ID) 837 offset: 125, // OR â offset: '.classToActivateAt', 838 839 classes: { 840 clone: 'headhesive--clone', 841 stick: 'headhesive--stick', 842 unstick: 'headhesive--unstick' 843 } 844 }; 845 846 try 847 { 848 // Initialise with options 849 var banner = new Headhesive('.banner', options); 850 jQuery('body').addClass('headhesive'); 851 } 852 catch (err) { 853 console.log('Sticky Header Off.'); 854 } 855 }else{ 856 console.log('Sticky Header Off.'); 857 } 858 859 860 // setup one page scrolling 861 themo_init_one_page_scroll(); 862 863 // Headhesive destroy 864 // banner.destroy(); 865 866 // start isotope 867 themo_init_isotope(); 868 869}); 870 871//====================================================================== 872// On Window Resize 873//====================================================================== 874 jQuery(window).resize(function($){ 875 "use strict"; 876 // Detect and set isTouch for touch screens 877 var isTouch = themo_is_touch_device(); 878 879 880 // Add support for mobile navigation 881 themo_support_mobile_navigation(); 882 883 // Vertically Align Tour Copy 884 themo_vertical_align_tour(); 885 886 // Vertically Align Project Thumb 887 themo_vertical_align_project_thumb(); 888 889 // Disable Transparent Header for Mobile / touch 890 themo_no_transparent_header_for_mobile(isTouch); 891}); 892 893
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.