1$(document).ready(function () { 2 const panelCookieTime = 60 * 60 * 24; // 1 day 3 4 // Remember dismissed CTA across pages (inner pages stay minimized until reopened) 5 if (document.cookie.indexOf('ctaClosed=1') === -1) { 6 $("#cta-button").html("X"); 7 $("#cta-box").show(); 8 } else { 9 $("#cta-button").html("+"); 10 $("#cta-box").hide(); 11 } 12 13 $("#cta-button").click(function () { 14 if ($(this).html() === "X") { 15 document.cookie = `ctaClosed=1; max-age=${panelCookieTime}; path=/`; 16 $(this).html("+"); 17 } else { 18 document.cookie = 'ctaClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/'; 19 $(this).html("X"); 20 } 21 $("#cta-box").slideToggle(); 22 }); 23 /* Drop Down Navigation */ 24 (function () { 25 let menuContainer = "#navigation "; 26 27 $(menuContainer + ">div>ul>li.menu-item-has-children").append('<span class="holder"></span>'); 28 29 let span = $(menuContainer + "li.menu-item-has-children>span.holder"); 30 let emptyLink = $(menuContainer + "a[href='#']"); 31 32 emptyLink.removeAttr('href'); 33 emptyLink.attr('role', 'button'); 34 emptyLink.hover(function () { 35 $(this).css('cursor', 'default'); 36 }); 37 38 $(emptyLink).on('click', mobileNav); 39 $(span).on('click', mobileNav); 40 })(); 41 42 function mobileNav() { 43 if ($(window).width() < 992) { 44 let el = $(this).parent('li'); 45 if (el.hasClass('open')) { 46 el.removeClass('open'); 47 el.find('li').removeClass('open'); 48 el.find('ul').slideUp(); 49 } else { 50 el.addClass('open'); 51 el.children('ul').slideDown(); 52 el.siblings('li').children('ul').slideUp(); 53 el.siblings('li').removeClass('open'); 54 } 55 } 56 } 57 58 $("li.menu-item-has-children").on('mouseenter mouseleave', function (e) { 59 if ($('ul', this).length) { 60 let elm = $('ul:first', this); 61 let off = elm.offset(); 62 let l = off.left; 63 let w = elm.width(); 64 let docW = $('body').width(); 65 66 let isEntirelyVisible = (l + w <= docW); 67 68 if (!isEntirelyVisible) { 69 $(this).addClass('edge'); 70 } else { 71 $(this).removeClass('edge'); 72 } 73 } 74 }); 75 76//If anchor tag does not have a title attribute do this 77 $('a:not([title])').each(function () { 78 79 let newTitle; 80 81 if ($(this).attr('target') === '_blank') { 82 newTitle = $(this).text() + ' - Opens in new tab'; 83 if ($(this).attr('rel') == null) { 84 $(this).attr('rel', 'noopener noreferrer'); 85 } 86 if (($(this).is('[href*="facebook"]'))) { 87 newTitle = 'Visit us on Facebook - Opens in new tab'; 88 } 89 if (($(this).is('[href*="twitter"]'))) { 90 newTitle = 'Visit us on Twitter - Opens in new tab'; 91 } 92 if (($(this).is('[href*="youtube"]'))) { 93 newTitle = 'Visit us on YouTube - Opens in new tab'; 94 } 95 if (($(this).is('[href*="instagram"]'))) { 96 newTitle = 'Visit us on Instagram - Opens in new tab'; 97 } 98 if (($(this).is('[href*="linkedin"]'))) { 99 newTitle = 'Visit us on LinkedIn - Opens in new tab'; 100 } 101 if (($(this).has('img').length) && (!$(this).text())) { 102 if ($(this).children('img').attr('alt')) { 103 newTitle = $(this).find('img').attr('alt') + ' - Opens in new tab'; 104 } else { 105 newTitle = $(this).find('img').attr('src') + ' - Opens in new Tab'; 106 } 107 } 108 109 } else if ($(this).is('[href*="tel:"]')) { 110 newTitle = 'Click to call ' + $(this).text(); 111 } else if ($(this).is('[href*="contact"]') || $(this).is('[href*="appointment"]')) { 112 newTitle = 'Click to go to ' + $(this).text() + ' form'; 113 } else if (($(this).is('[href*="blog"]'))) { 114 newTitle = 'Read our Blog'; 115 } else if (($(this).is('[href*="contact"]') || $(this).is('[href*="appointment"]')) && $(this).is(!'[href*="contact-lenses"]')) { 116 newTitle = 'Click to go to ' + $(this).text() + ' form'; 117 } else if (($(this).has('img').length) && (!$(this).text())) { 118 if ($(this).find('img').attr('alt')) { 119 newTitle = $(this).find('img').attr('alt'); 120 } else { 121 newTitle = $(this).find('img').attr('src'); 122 } 123 } else { 124 newTitle = $(this).text(); 125 } 126 127 if (newTitle.length) { 128 newTitle = newTitle.trim().replace(/\s+/g, " "); 129 newTitle = newTitle.replace(/(<([^>]+)>)/gi, ""); 130 $(this).attr('title', newTitle); 131 } 132 133 }); 134 135 if ($(window).width() < 767) { 136 //$('div').hasAttribute('data-w-id').removeAttr('data-w-id').css('opacity', '1'); 137 $('a').removeAttr('data-w-id').css('opacity', '1'); 138 139 let navHeader = $('.blue-wrapper').offset().top; 140 141 $(window).scroll(function () { 142 let body = $('body'); 143 if ($(this).scrollTop() >= navHeader) { 144 body.addClass('fixed-nav'); 145 } else { 146 body.removeClass('fixed-nav'); 147 } 148 }); 149 } 150 151 function removeBodyClass() { 152 let body = $('body'); 153 if (body.hasClass('body-menu-open')) { 154 $(body).removeClass('body-menu-open'); 155 } else { 156 $(body).addClass('body-menu-open'); 157 } 158 } 159 160 $('.menu-button').on('click', function () { 161 removeBodyClass(); 162 let navHeader = $('#lowerNav').outerHeight(); 163 let menuBar = document.getElementById('lowerNav'); 164 let rect = menuBar.getBoundingClientRect(); 165 let fromTop = rect.top; 166 let topPosition = navHeader + fromTop; 167 168 if ($('.blue-wrapper').hasClass('sticky-nav')) { 169 topPosition = $('.navbar_wrapper').outerHeight(); 170 } 171 172 console.log(topPosition); 173 174 $('#navigation').css('top', topPosition); 175 176 }); 177 178 $('.bottom_navbar_wrapper').on('click', function () { 179 if ($('#navigation[data-nav-menu-open]').length) { 180 removeBodyClass(); 181 } 182 }); 183 184 $(document).keyup(function (e) { 185 if (e.key === "Escape") { 186 if ($('#navigation[data-nav-menu-open]').length > 0) { 187 removeBodyClass(); 188 } 189 } 190 }); 191 192 (function () {
193 let lazyBackgrounds = [].slice.call(document.querySelectorAll(".lazy-background")); 194 if ("IntersectionObserver" in window) { 195 let lazyBackgroundObserver = new IntersectionObserver(function (entries, observer) { 196 entries.forEach(function (entry) { 197 if (entry.isIntersecting) { 198 entry.target.classList.add("visible"); 199 lazyBackgroundObserver.unobserve(entry.target); 200 } 201 }); 202 }); 203 lazyBackgrounds.forEach(function (lazyBackground) { 204 lazyBackgroundObserver.observe(lazyBackground); 205 }); 206 } 207 })(); 208 209 // Use this function to load iframes 210 const lazyiframe = (id, src) => { 211 let iframeID = '#' + id; 212 let form = $(iframeID); 213 214 if (form.length > 0) { 215 $(window).one('scroll', function () { 216 form.attr('src', src); 217 }); 218 } 219 } 220 // Uncomment this to use lazy iframe 221 // lazyiframe('contactFooter', 'https://forms.glacial.com/my-contact-form-6084207.html'); 222 223});
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.