1'use strict'; 2 3// const AJAX_URL = '/wp-admin/admin-ajax.php' 4 5jQuery(document).foundation(); 6jQuery(document).ready(function ($) { 7 joints_wp_fixes(); 8 // AOS.init() //Enable if loading AOS 9 10 // Menu class 11 $('.is-accordion-submenu-parent').on('click', function () { 12 $(this).toggleClass('is-active'); 13 }); 14 15 //Smooth Scroll 16 $('a[href*="#"]:not([role="tab"])').on('click', function () { 17 if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { 18 var target = $(this.hash); 19 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 20 if (target.length) { 21 $('html, body').animate({ 22 scrollTop: target.offset().top - 125 23 }, 1000); 24 return false; 25 } 26 } 27 }); 28 29 if ($("form").length > 0) { 30 $('input:not([type="checkbox"]), textarea').focus(function () { 31 $(this).parents('.gfield').addClass('focused'); 32 }); 33 34 if ($('#input_4_7').length > 0) { 35 $('#input_4_7').parents('.gfield').addClass('focused'); 36 $('#input_4_7').prop("readonly", true); 37 } 38 39 if ($('input[type="file"]').length > 0) { 40 41 $('input[type="file"]').each(function () { 42 var $input = $(this); 43 44 $input.on('change', function (e) { 45 var fileName = ''; 46 47 if (this.files && this.files.length > 1) fileName = (this.getAttribute('data-multiple-caption') || '').replace('{count}', this.files.length);else if (e.target.value) fileName = e.target.value.split('\\').pop(); 48 49 if (fileName) { 50 $(this).attr('data-filename', fileName); 51 } 52 }); 53 54 // Firefox bug fix 55 // $input 56 // .on( 'focus', function(){ $input.addClass( 'has-focus' ); }) 57 // .on( 'blur', function(){ $input.removeClass( 'has-focus' ); }); 58 }); 59 } 60 61 $('input:not([type="checkbox"]), textarea').blur(function () { 62 var inputValue = $(this).val(); 63 if (inputValue == "") { 64 // $(this).removeClass('filled'); 65 $(this).parents('.gfield').removeClass('focused'); 66 } 67 // else { 68 // $(this).addClass('filled'); 69 // } 70 }); 71 } 72 73 if ($('.page-template-template-11_Resources')) { 74 $('.ginput_quantity_label').before("<br />"); 75 } 76 77 $('.hamburger').on('click', function () { 78 setTimeout(function () { 79 $('.close-button').focus(); 80 }, 500); 81 }); 82 83 // Counts up the percentages 84 // function countUp() { 85 // $(".stat-wrapper .stat").each(function() { 86 // var $this = $(this); 87 // var countTo = $this.attr("data-count"); 88 89 // $({ countNum: $this.text() }).animate( 90 // { countNum: countTo }, 91 // { 92 // duration: 1000, 93 // easing: "linear", 94 // step: function() { 95 // $this.text(Math.floor(this.countNum)); 96 // }, 97 // complete: function() { 98 // $this.text(this.countNum); 99 // } 100 // } 101 // ); 102 // }); 103 // } 104 // // Initializes the starting of the countUp function 105 // $(".stat-wrapper").appear(); 106 // $(".stat-wrapper").on("appear", function() { 107 // countUp(); 108 // }); 109 110 // Toast Options - https://github.com/CodeSeven/toastr 111 // Creator - https://codeseven.github.io/toastr/demo.html 112 // Check footer.php for imports 113 114 // toastr.options = { 115 // "closeButton": false, 116 // "debug": false, 117 // "newestOnTop": true, 118 // "progressBar": false, 119 // "positionClass": "toast-top-right", 120 // "preventDuplicates": true, 121 // "onclick": null, 122 // "showDuration": "500", 123 // "hideDuration": "1000", 124 // "timeOut": "2500", 125 // "extendedTimeOut": "1000", 126 // "showEasing": "swing", 127 // "hideEasing": "linear", 128 // "showMethod": "fadeIn", 129 // "hideMethod": "fadeOut" 130 // } 131 132 var showMenus = function () { 133 var executed = false; 134 return function () { 135 if (!executed) { 136 // executed = true; 137 $('#menu-top-menu > li').each(function (index) { 138 $(this).delay(200 * index).queue(function () { 139 $(this).addClass('shown').dequeue(); 140 }); 141 }); 142 } 143 }; 144 }(); 145 146 $(".off-canvas").on("opened.zf.offcanvas", function (e) { 147 $(".hamburger").toggleClass("is-active"); 148 showMenus(); 149 }); 150 $(".off-canvas").on("closed.zf.offcanvas", function (e) { 151 $(".hamburger").toggleClass("is-active"); 152 $('#menu-top-menu li').each(function () { 153 $(this).removeClass('shown'); 154 }); 155 }); 156 157 // $(".card.news").hover( 158 // function () { 159 // $(".card.news").addClass("blur"), $(this).removeClass("blur"); 160 // }, 161 // function () { 162 // $(".card.news").removeClass("blur"); 163 // } 164 // ); 165 166 // //Find a Broker 167 // if ($(".page-template-template-11_Find-Broker").length > 0) { 168 169 // toastr.options = { 170 // "closeButton": false, 171 // "debug": false, 172 // "newestOnTop": true, 173 // "progressBar": false, 174 // "positionClass": "toast-top-right", 175 // "preventDuplicates": true, 176 // "onclick": null, 177 // "showDuration": "500", 178 // "hideDuration": "1000", 179 // "timeOut": "2500", 180 // "extendedTimeOut": "1000", 181 // "showEasing": "swing", 182 // "hideEasing": "linear", 183 // "showMethod": "fadeIn", 184 // "hideMethod": "fadeOut" 185 // } 186 187 // if(navigator.geolocation) { 188 189 // var options = {
190 // enableHighAccuracy: false, 191 // timeout: 10000, 192 // maximumAge: 0, 193 // }; 194 195 // function success(position) { 196 // // console.table(position); 197 // var lat = position.coords.latitude; 198 // var long = position.coords.longitude; 199 // var point = new google.maps.LatLng(lat, long); 200 // new google.maps.Geocoder().geocode( 201 // {'latLng': point}, 202 // function (res, status) { 203 // var address = res[0].address_components; 204 // const zip = address.filter(component => component.types[0] === 'postal_code')[0].long_name; 205 // $("#input_2_1").val(zip); 206 // } 207 // ); 208 // } 209 210 // function error(err) { 211 // // console.warn(`ERROR(${err.code}): ${err.message}`); 212 // // toastr.error("An error has occured while retrieving your location", "GeoLocation Error") 213 // ipLookUp(); 214 // } 215 216 // navigator.geolocation.getCurrentPosition(success, error, options); 217 218 // } else { 219 // toastr.error("Geolocation is not supported by this browser", "GeoLocation
219Error") 220 // } 221 // } 222 // //http://ip-api.com/docs/api:json 223 // function ipLookUp () { 224 // fetch('https://api.ipdata.co?api-key=03908d9a2c6382cecd1d1b4c2cd5ce4e2bc78a651c406050f5bdc23f') 225 // .then(response => response.json()) 226 // .then(data => { 227 // $("#input_2_1").val(`${data.city} ${data.postal} ${data.region}`) 228 // }) 229 // .catch(error => toastr.error("An error has occured while retrieving your location", "GeoLocation Error")) 230 // } 231 232 // $('#input_2_1').keypress(function(e) { 233 // if (e.keyCode == '13') { 234 // e.preventDefault(); 235 // //your code here 236 // findBrokers(); 237 // } 238 // }); 239 240 // $('#find-a-broker-go-button').on('click', function () { 241 // findBrokers(); 242 // }); 243 244 // function findBrokers() { 245 // // dataLayer.push({'Quote Form': 'Search - start'}); 246 // console.group('New search'); 247 // var postalCode = $("#input_2_1").val(); 248 // console.log(postalCode) 249 // if(!postalCode) { 250 // $('#search-success-message').fadeOut('fast'); 251 // $("#brokerCards").html(""); 252 // toastr.warning("Please enter your postal code", "No Postal Code") 253 // return; 254 // } 255 256 // if ($('#search-success-message').is(':visible')) { 257 // $('#search-success-message').fadeOut('fast'); 258 // } 259 // if ($('#search-failure-message').is(':visible')) { 260 // $('#search-failure-message').fadeOut('fast'); 261 // } 262 263 // $('#search-pending-message').fadeIn('slow'); 264 265 // // $('#get-a-quote-wrapper').show('slow'); 266 267 // var radius = $("#rangeSlider").val() ? $("#rangeSlider").val() : 25; 268 // var radiusMax = 50; 269 // var radiusMin = 1; 270 271 // console.log('Current radius ', radius) 272 273 // $("#brokerCards").html(""); 274 275 // console.log('Looking up', postalCode); 276 277 // var geocoder = new google.maps.Geocoder(); 278 279 // let geo_data = { address: postalCode }; 280 281 // console.log('Checking geo data', geo_data); 282 283 // geocoder.geocode( geo_data, function(results, status) { 284 // if (status == google.maps.GeocoderStatus.OK) { 285 286 // console.log('Geocode results', results) 287 288 // var args = { 289 // latitude: results[0].geometry.location.lat(), 290 // longitude: results[0].geometry.location.lng(), 291 // radius: radius, 292 // } 293 294 // console.log('Broker Search Args', args) 295 // console.groupEnd(); 296 // jQuery.ajax({ 297 // url: '/wp-admin/admin-ajax.php', 298 // data:{ 299 // 'action':'do_ajax', 300 // 'fn':'get_brokers', 301 // 'latitude': args.latitude, 302 // 'longitude': args.longitude, 303 // 'radius': args.radius, 304 // }, 305 // dataType: 'JSON', 306 // success:function(data){ 307 // // console.log('distances from lookup point..'); 308 // let brokers = data.brokers; 309 // // brokers = brokers.filter(function (el) { 310 // // return el.should_broker_receive_leads_flag === '1'; 311 // // }); 312 313 // $('#search-pending-message').fadeOut('fast'); 314 // // if(($('#farm').hasClass('is-active') && !$('#auto').hasClass('is-active') && !$('#commercial').hasClass('is-active') && !$('#residential').hasClass('is-active')) || !$('.lines-of-business-select a').hasClass('is-active')) { 315 // // for (var i = brokers.length - 1; i >= 0; --i) { 316 // // if (brokers[i].is_rofi == 0) { 317 // // brokers.splice(i,1); 318 // // } 319 // // } 320 // // } 321 // if (brokers.length > 0) { 322 // $('#search-success-message').fadeIn('slow'); 323 // } else { 324 // $('#search-failure-message').fadeIn('slow'); 325 // } 326 // // console.log('data', data.brokers); 327 // $.each(brokers, function(idx,broker) { 328 // console.log('broker', broker) 329 // addBrokerCard(broker); 330 // }); 331 332 // }, 333 // error: function(errorThrown) { 334 // $('#search-pending-message').fadeOut('fast'); 335 // $('#search-failure-message').fadeIn('slow'); 336 // // dataLayer.push({'Quote Form': 'Search - failure: ' + errorThrown}); 337 // console.log(errorThrown); 338 // } 339 // }); 340 // console.groupEnd(); 341 // } else { 342 // alert('Geocode was not successful for the following reason: ' + status); 343 // } 344 // }); 345 // } 346 347 // function addBrokerCard(broker) { 348 // let html = '<div class="broker card"';
349 350 // html += ' data-broker-id="' + broker.ID + '" data-broker-email="' + broker.email + '" data-broker-name="' + broker.post_title + '">'; 351 352 // html += '<p>'; 353 // html += '<h4>'+broker.post_title+'</h4>'; 354 // html += '</p>'; 355 356 // if (broker.services > 0) { 357 // let services = '<div class="service-wrapper">'; 358 // if(broker.services_0_service) 359 // services += '<div class="service">'+broker.services_0_service+'</div>'; 360 // if(broker.services_1_service) 361 // services += '<div class="service">'+broker.services_1_service+'</div>'; 362 // if(broker.services_2_service) 363 // services += '<div class="service">'+broker.services_2_service+'</div>'; 364 // services += '</div>' 365 // html += services 366 // } 367 // html += '<p>'; 368 // if(broker.address) 369 // html += 'Address: '+broker.address+'<br />'; 370 // if(broker.phone) 371 // var phoneSlug = slugify(broker.phone); 372 // html += 'Phone: <a href="tel:'+phoneSlug+'">'+broker.phone+'</a><br />'; 373 // // if(broker.website) 374 // // html += 'Website: <a href="' + broker.website + '" target="new">'+broker.website+'</a><br />'; 375 // if(broker.email) 376 // html += 'Email: <a href="mailto:'+broker.email+'">'+broker.email+'</a>'; 377 378 // html += '</p>'; 379 // if(broker.distance) { 380 // let distance = parseFloat(broker.distance).toFixed(2); 381 // html += '<div class="distance">~'+distance+' KM</div>'; 382 // } 383 // html += '</div>'; 384 385 // $("#brokerCards").append(html); 386 // } 387 388 389 //Scroll Progress 390 var $prog2 = $('.progress-indicator-2'); 391 function updateProgress(perc) { 392 $prog2.css({ width: perc * 100 + '%' }); 393 } 394 395 (function () { 396 var $w = $(window); 397 var $circ = $('.animated-circle'); 398 var $progCount = $('.progress-count'); 399 var $prog = $('.progress-indicator'); 400 var $prog2 = $('.progress-indicator-2'); 401 var h = $('#main-content article.post').height(); 402 var n = $('#top-bar-menu').height(); 403 var a = $('#wpadminbar').height(); 404 var hero = $('.hero').height(); 405 // console.log('#top-bar-menu', n) 406 // console.log('#main-content article.post', h) 407 // console.log('.hero', hero) 408 var sHeight = h + hero + n - a; 409 $w.on('scroll', function () { 410 // console.log('scroll top', $w.scrollTop()) 411 // console.log('article height', sHeight) 412 var perc = Math.max(0, Math.min(1, $w.scrollTop() / sHeight)); 413 updateProgress(perc); 414 if ($w.scrollTop() < 100 || perc >= 1) { 415 $prog.css('opacity', 0); 416 } else { 417 $prog.css('opacity', 1); 418 } 419 }); 420 421 function updateProgress(perc) { 422 var circle_offset = 126 * perc; 423 $circ.css({ 424 "stroke-dashoffset": 126 - circle_offset 425 }); 426 $progCount.html(Math.round(perc * 100) + "%"); 427 428 $prog2.css({ width: perc * 100 + '%' }); 429 } 430 })(); 431 432 //Slugify function 433 function slugify(string) { 434 var a = 'à áäâãåÄæçèéëêǵḧìÃïîḿÅǹñòóöôÅá¹ÅÃÅÈÈùúüûÇáºáºÃ¿ÅºÂ·/_,:;'; 435 var b = 'aaaaaaaaceeeeghiiiimnnnoooooprssstuuuuuwxyz------'; 436 var p = new RegExp(a.split('').join('|'), 'g'); 437 return string.toString().toLowerCase().replace(/\s+/g, '-') // Replace spaces with - 438 .replace(p, function (c) { 439 return b.charAt(a.indexOf(c)); 440 }) // Replace special characters 441 .replace(/&/g, '-and-') // Replace & with âandâ 442 .replace(/[^\w\-]+/g, '') // Remove all non-word characters 443 .replace(/\-\-+/g, '-') // Replace multiple - with single - 444 .replace(/^-+/, '') // Trim - from start of text 445 .replace(/-+$/, ''); // Trim - from end of text 446 } 447}); 448//# sourceMappingURL=site.js.map
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.