1// Universal fix: prevent inview errors if library is missing 2if (typeof inview === "undefined") { 3 var inview = function() { 4 return { on: function(){} }; 5 }; 6} 7 8// Temporary fix to prevent inview errors 9if (typeof inview === "undefined") { 10 var inview = function() { return { on: function(){} }; }; 11} 12 13/* 14 * This file should contain any js scripts you want to add to the site. 15*/ 16 17 18/* 19 * Get Viewport Dimensions 20 * returns object with viewport dimensions to match css in width and height properties 21 * ( source: http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript ) 22*/ 23function updateViewportDimensions() { 24 var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight; 25 return { width:x,height:y } 26} 27// setting the viewport width 28var viewport = updateViewportDimensions(); 29 30 31/* 32 * Throttle Resize-triggered Events 33 * Wrap your actions in this function to throttle the frequency of firing them off, for better performance, esp. on mobile. 34 * ( source: http://stackoverflow.com/questions/2854407/javascript-jquery-window-resize-how-to-fire-after-the-resize-is-completed ) 35*/ 36var waitForFinalEvent = (function () { 37 var timers = {}; 38 return function (callback, ms, uniqueId) { 39 if (!uniqueId) { uniqueId = "Don't call this twice without a uniqueId"; } 40 if (timers[uniqueId]) { clearTimeout (timers[uniqueId]); } 41 timers[uniqueId] = setTimeout(callback, ms); 42 }; 43})(); 44 45// how long to wait before deciding the resize has stopped, in ms. Around 50-100 should work ok. 46var timeToWaitForLast = 100; 47 48 49/* 50 * Here's an example so you can see how we're using the above function 51 * 52 * This is commented out so it won't work, but you can copy it and 53 * remove the comments. 54 * 55 * 56 * If we want to only do it on a certain page, we can setup checks so we do it 57 * as efficient as possible. 58 * 59 * if( typeof is_home === "undefined" ) var is_home = $('body').hasClass('home'); 60 * 61 * This once checks to see if you're on the home page based on the body class 62 * We can then use that check to perform actions on the home page only 63 * 64 * When the window is resized, we perform this function 65 * $(window).resize(function () { 66 * 67 * // if we're on the home page, we wait the set amount (in function above) then fire the function 68 * if( is_home ) { waitForFinalEvent( function() { 69 * 70 * // if we're above or equal to 768 fire this off 71 * if( viewport.width >= 768 ) { 72 * console.log('On home page and window sized to 768 width or more.'); 73 * } else { 74 * // otherwise, let's do this instead 75 * console.log('Not on home page, or window sized to less than 768.'); 76 * } 77 * 78 * }, timeToWaitForLast, "your-function-identifier-string"); } 79 * }); 80 * 81*/ 82 83/* 84 * We're going to swap out the gravatars. 85 * In the functions.php file, you can see we're not loading the gravatar 86 * images on mobile to save bandwidth. Once we hit an acceptable viewport 87 * then we can swap out those images since they are located in a data attribute. 88*/ 89function loadGravatars() { 90 // set the viewport using the function above 91 viewport = updateViewportDimensions(); 92 // if the viewport is tablet or larger, we load in the gravatars 93 if (viewport.width >= 768) { 94 jQuery('.comment img[data-gravatar]').each(function(){ 95 jQuery(this).attr('src',jQuery(this).attr('data-gravatar')); 96 }); 97 } 98} // end function 99 100 101/* 102 * Put all your regular jQuery in here. 103*/ 104jQuery(document).ready(function($) { 105//some mobile detection we can use later 106 var isMobile = { 107 Android: function() {return navigator.userAgent.match(/Android/i);}, 108 BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i);}, 109 iOS: function() {return navigator.userAgent.match(/iPhone|iPad|iPod/i);}, 110 Opera: function() {return navigator.userAgent.match(/Opera Mini/i);}, 111 Windows: function() {return navigator.userAgent.match(/IEMobile/i);}, 112 any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } 113 }; 114 115 /* usage: 116 if( isMobile.iOS() ) alert('iOS'); 117 if( isMobile.any() ) alert('Mobile'); 118 */ 119 120 121 /* 122 * Let's fire off the gravatar function 123 * You can remove this if you don't need it 124 */ 125 loadGravatars(); 126 //menu hide/show/toggle added by flyte 127 if( !$("html").hasClass("lt-ie9") ) { 128 var wi = $(window).width(); 129 $(window).bind("load resize",function() { 130 var wi = $(window).width(); 131 132 if (wi >= 768){ 133 134 135 136 $('#menu-the-main-menu li.menu-item-has-children').not('.current_page_item, .current_page_ancestor').mouseover(function() { 137 $('#menu-the-main-menu li.current_page_item ul.sub-menu, #menu-the-main-menu li.current_page_ancestor ul.sub-menu').addClass('fades'); 138 }); 139 $('#menu-the-main-menu li.menu-item-has-children').not('.current_page_item, .current_page_ancestor').mouseout(function() { 140 $('#menu-the-main-menu li.current_page_item ul.sub-menu, #menu-the-main-menu li.current_page_ancestor ul.sub-menu').removeClass('fades'); 141 }); 142 143 // If using equalize.js, use force auto to add/remove equalization between mobile and desktop. 144 //$('.flexBlock').removeClass("forceAuto"); 145 //$('.equalize_grid').equalize({reset:true, equalize:'outerHeight'}); 146 $('.stickyClone').css({"display":"flex"}); 147 //inview.enable(); 148 149 } 150 151 if( wi < 768 ){ 152 $('.flexBlock').addClass("forceAuto"); 153 $('.stickyClone').css({"display":"none"}); 154 155 156 157 } 158 //check for mobile to eliminate menu glitch (fix) 159 if( wi < 768 && !isMobile.any() ){$('#menu-main-menu').hide();} 160 //using equalize
161 //$('.blogfeed .equalize').equalize({children: '.blog_post',reset:true, equalize:'outerHeight'}); 162 163 }); 164 }; 165 166 // add handheld class to remove transitions on phones and tablets 167 if( isMobile.any() ){$('#menu-the-main-menu').addClass("handheld");} 168 169 //More Menu Madness 170 171 172 //avoid hover awkwardness 173 $.preloadImages = function() { 174 for (var i = 0; i < arguments.length; i++) {$("<img />").attr("src", arguments[i]);} 175 } 176 //$.preloadImages("/wp-content/themes/petdoc/library/images/submenuBG.png"); 177 178 //set equalize 179 //$('.equalize').equalize(); 180 181 //set heights for photospace gallery 182 //$( window ) .on("load resize", function() { 183 //thumbsHeight = $('ul.thumbs').outerHeight(); 184 //$(".photospace_res").css("padding-bottom", thumbsHeight+20) 185 //}); 186 187 188 //******* header mojo 189 190 setTimeout(function(){ 191 var npix = $('#inner-header').outerHeight(); 192 $(window).scroll(function () { 193 //if you hard code, then use console 194 //.log to determine when you want the 195 //nav bar to stick. 196 //console.log($(window).scrollTop()) 197 198 if ($(window).scrollTop() > npix) { 199 $('.header, .bgimg').addClass('tuck'); 200 201 } 202 if ($(window).scrollTop() < npix) { 203 $('.header, .bgimg').removeClass('tuck'); 204 } 205 }); 206 }, 500); 207 208 209 210 AOS.init({ 211 //easing: 'ease-out-back', 212 //duration: 1000, 213 disable: 'mobile' 214 }); 215 216 $('#gform_submit_button_1, #gform_1 .validation_message').mouseover(function() { 217 $('#gform_1').addClass('exp'); 218 $('#gform_1 .validation_message').hide(); 219 //$('#input_1_1').attr("placeholder", "Your Email"); 220 221 }); 222 223 $(document).bind('gform_post_render', function(){ 224 $('#gform_1 .validation_message').click(function() { 225 $(this).hide('slow'); 226 //alert('hi'); 227 }); 228 }); 229 230 231 232 233 234 235 236 237 238}); /* end of as page load scripts */
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.