1function isElementInViewport(elem) { 2 var $elem = $(elem); 3 4 // Get the scroll position of the page. 5 //var scrollElem = ((navigator.userAgent.toLowerCase().indexOf('webkit') != -1) ? 'body' : 'html'); 6 var viewportTop = $(document).scrollTop(); 7 var viewportBottom = viewportTop + $(window).height(); 8 9 // Get the position of the element on the page. 10 var elemTop = Math.round( $elem.offset().top ); 11 var elemBottom = elemTop + $elem.height(); 12 13 //console.log(viewportTop, viewportBottom, elemTop, elemBottom, (elemTop < viewportBottom) && (elemBottom > viewportTop)); 14 15 return ((elemTop < viewportBottom) && (elemBottom > viewportTop)); 16} 17 18function animatePoints() { 19 $("ul.points > li:first-child").css("opacity", 1); 20 $("ul.points > li:first-child").addClass("shown"); 21 $("ul.points > li:first-child").addClass("netaccess-fadein"); 22 $("ul.points > li:first-child").addClass("netaccess-slideup"); 23 var delay = 600; 24 $.each($("ul.points > li"), function () { 25 setTimeout(function(){ 26 $("ul.points > li.shown + li").css("opacity", 1); 27 $("ul.points > li.shown + li").addClass("netaccess-fadein"); 28 $("ul.points > li.shown + li").addClass("netaccess-slideup"); 29 $("ul.points > li.shown + li").addClass("shown"); 30 }, delay); 31 delay += 600; 32 }); 33} 34 35function animateCards() { 36 $(".row.cards > div:first-child > .card").css("opacity", 1); 37 $(".row.cards > div:first-child").addClass("shown"); 38 $(".row.cards > div:first-child > .card").addClass("netaccess-fadein"); 39 $(".row.cards > div:first-child > .card").addClass("netaccess-flip"); 40 var delay = 300; 41 $.each($(".row.cards .card"), function () { 42 setTimeout(function(){ 43 $(".row.cards > div.shown + div .card").css("opacity", 1); 44 $(".row.cards > div.shown + div .card").addClass("netaccess-fadein"); 45 $(".row.cards > div.shown + div .card").addClass("netaccess-flip"); 46 $(".row.cards > div.shown + div").addClass("shown"); 47 }, delay); 48 delay += 300; 49 }); 50} 51 52function animateFrontWidgets() { 53 $(".widgets.front .row > div:first-child > .widget").css("opacity", 1); 54 $(".widgets.front .row > div:first-child").addClass("shown"); 55 $(".widgets.front .row > div:first-child > .widget").addClass("netaccess-fadein"); 56 $(".widgets.front .row > div:first-child > .widget").addClass("netaccess-slideright"); 57 var delay = 1000; 58 var animation = "netaccess-slideleft"; 59 $.each($(".widgets.front .widget"), function () { 60 setTimeout(function(){ 61 $(".widgets.front .row > div.shown + div .widget").css("opacity", 1); 62 $(".widgets.front .row > div.shown + div .widget").addClass("netaccess-fadein"); 63 $(".widgets.front .row > div.shown + div .widget").addClass(animation); 64 $(".widgets.front .row > div.shown + div").addClass("shown"); 65 }, delay); 66 delay += 1000; 67 if(animation == "netaccess-slideleft") { 68 animation = "netaccess-slideright"; 69 } else { 70 animation = "netaccess-slideleft"; 71 } 72 }); 73} 74 75function animateBlogSection() { 76 $(".row.posts > div:first-child > .post-small").css("opacity", 1); 77 $(".row.posts > div:first-child").addClass("shown"); 78 $(".row.posts > div:first-child > .post-small").addClass("netaccess-fadein"); 79 $(".row.posts > div:first-child > .post-small").addClass("netaccess-flip"); 80 var interval = 300; 81 if(($(".row.posts > div").length / $(".row.posts").length) > 4) { 82 interval = 100; 83 } 84 var delay = interval; 85 $.each($(".row.posts .post-small"), function () { 86 setTimeout(function(){ 87 $(".row.posts > div.shown + div .post-small").css("opacity", 1); 88 $(".row.posts > div.shown + div .post-small").addClass("netaccess-fadein"); 89 $(".row.posts > div.shown + div .post-small").addClass("netaccess-flip"); 90 $(".row.posts > div.shown + div").addClass("shown"); 91 }, delay); 92 delay += interval; 93 }); 94} 95 96// Check if it's time to start the animation. 97function checkAnimation() { 98 if($("ul.points").length && isElementInViewport($("ul.points")) && !$("ul.points").hasClass("animated")) { 99 $("ul.points > li").css("opacity", 0); 100 setTimeout(function(){ 101 animatePoints(); 102 }, 500); 103 $("ul.points").addClass("animated"); 104 } 105 if($(".row.cards .card").length && isElementInViewport($(".row.cards")) && !$(".row.cards").hasClass("animated")) { 106 $(".row.cards .card").css("opacity", 0); 107 setTimeout(function(){ 108 animateCards(); 109 }, 500); 110 $(".row.cards").addClass("animated"); 111 } 112 if($(".widgets.front .widget").length && isElementInViewport($(".widgets.front")) && !$(".widgets.front").hasClass("animated") && $(window).width() >= 992) { 113 $(".widgets.front .widget").css("opacity", 0); 114 setTimeout(function(){ 115 animateFrontWidgets(); 116 }, 500); 117 $(".widgets.front").addClass("animated"); 118 } 119 if($(".row.posts .post-small").length && isElementInViewport($(".row.posts")) && !$(".row.posts").hasClass("animated") && $(window).width() >= 992) { 120 $(".row.posts .post-small").css("opacity", 0); 121 setTimeout(function(){ 122 animateBlogSection(); 123 }, 500); 124 $(".row.posts").addClass("animated"); 125 } 126} 127 128function setupMobileMenu() { 129 $(".mobile-menu-button").removeClass("open"); 130 $("nav.mobile").css("left", "100%"); 131 if($("body").hasClass("admin-bar")) { 132 $("nav.mobile").css("top", ($("nav.main").outerHeight()+$("#wpadminbar").outerHeight())); 133 $("nav.mobile").css("height", $(window).height()-($("nav.main").outerHeight()+$("#wpadminbar").outerHeight())); 134 } else { 135 $("nav.mobile").css("top", $("nav.main").outerHeight()); 136 $("nav.mobile").css("height", $(window).height()-$("nav.main").outerHeight()); 137 } 138} 139 140function slickBlog() { 141 var target = "section.blog.short .posts.row, body.page-id-28 .posts.row"; 142 if($(target).length && $(window).width() < 992 && !$(target).hasClass("slick-slider")) { 143 $(target).slick({ 144 dots: true,
145 arrows: false, 146 infinite: true, 147 autoplay: true, 148 slidesToScroll: 1, 149 slidesToShow: 4, 150 centerMode: true, 151 centerPadding: '40px', 152 responsive: [ 153 { 154 breakpoint: 992, 155 settings: { 156 slidesToShow: 3, 157 infinite: true, 158 dots: true 159 } 160 }, 161 { 162 breakpoint: 768, 163 settings: { 164 slidesToShow: 2 165 } 166 }, 167 { 168 breakpoint: 576, 169 settings: { 170 slidesToShow: 1 171 } 172 } 173 ] 174 }); 175 } else if($(target).hasClass("slick-slider") && $(window).width() >= 992) { 176 $(target).slick('unslick'); 177 } 178} 179 180function cleanMarkup() { 181 $(".row.posts > p").remove(); 182} 183 184$(document).ready(function () { 185 cleanMarkup(); 186 setupMobileMenu(); 187 slickBlog(); 188 //checkAnimation(); 189 $(".mobile-menu-button").on("click", function() { 190 $(this).toggleClass("open"); 191 if($(this).hasClass("open")) { 192 $("nav.mobile").animate({left: "0%"}); 193 } else { 194 $("nav.mobile").animate({left: "100%"}); 195 } 196 }); 197 $(".cta .mobile-tap").on("click", function() { 198 console.log($(this).next("div").next("div")); 199 $(this).closest(".cta").parent("div").toggleClass("shown"); 200 $(this).next("div").next("div").find(".btn").toggleClass("btn-primary"); 201 $(this).next("div").next("div").find(".btn").toggleClass("btn-outline-light"); 202 $(this).next("div").next("div").find(".btn").toggleClass("btn-sm"); 203 }); 204 $("nav.mobile > ul.menu > li.menu-item-has-children").on("click", function () { 205 $(this).toggleClass("open"); 206 }); 207 if($(".wpb_testimonials_widget").length) { 208 $('.wpb_testimonials_widget').slick({ 209 dots: false, 210 arrows: false, 211 adaptiveHeight: true, 212 infinite: true, 213 autoplay: true, 214 autoplaySpeed: 5000, 215 speed: 1000 216 }); 217 } 218 if($("li.mega-menu").length) { 219 $("li.mega-menu, li.mega-menu ul > li").hover(function () { 220 $(".mega-cta").removeClass("open"); 221 var cta = false; 222 if($(this).children(".mega-cta").length) { 223 cta = $(this).children(".mega-cta"); 224 } else if($(this).parent("ul").siblings(".mega-cta").length) { 225 cta = $(this).parent("ul").siblings(".mega-cta"); 226 } else if($(this).parent("ul").parent("li").parent("ul").siblings(".mega-cta").length) { 227 cta = $(this).parent("ul").parent("li").parent("ul").siblings(".mega-cta"); 228 } 229 if(cta) { 230 cta.addClass("open"); 231 cta.css("background-image", "linear-gradient( rgba(73, 25, 150, 0.8), rgba(73, 25, 150, 0.8) ), url('"+cta.data("background")+"')"); 232 if(cta.parent("li").hasClass("mega-menu")) { 233 var marginLeft = 25; 234 var offsetLeft = $("li.mega-menu > ul.dropdown-menu").offset().left + $("li.mega-menu > ul.dropdown-menu > li:first-child").width() + marginLeft; 235 var ctaWidth = $("li.mega-menu > ul.dropdown-menu").width() - ($("li.mega-menu > ul.dropdown-menu > li:first-child").width() + (marginLeft * 2)); 236 var ctaHeight = $("li.mega-menu > ul.dropdown-menu").outerHeight(); 237 var offsetTop = $("nav.main").outerHeight(); 238 if(!!$("li.mega-menu ul > li.menu-item-has-children").filter(function() { return $(this).is(":hover"); }).length) { 239 offsetLeft += $("li.mega-menu ul > li > ul").width(); 240 ctaWidth -= $("li.mega-menu ul > li > ul").width(); 241 } 242 cta.css("width", ctaWidth); 243 //cta.css("height", ctaHeight); 244 cta.css("left", offsetLeft); 245 246 //Adjusted to center. 247 offsetTop += 20; 248 cta.css("top", offsetTop); 249 } 250 } 251 }); 252 } 253 if($("form#search").length) { 254 var searchSuggestions = new Bloodhound({ 255 datumTokenizer: Bloodhound.tokenizers.obj.whitespace("name"), 256 queryTokenizer: Bloodhound.tokenizers.whitespace, 257 remote: { 258 url: ajax_url+"?action=get_search_suggestions&query=%QUERY", 259 wildcard: '%QUERY', 260 filter: function (response) { 261 var txt = document.createElement("textarea"); 262 for(var x = 0; x < response.length; x++) { 263 txt.innerHTML = response[x].name; 264 response[x].name = txt.value; 265 } 266 return response; 267 } 268 } 269 }); 270 console.log(searchSuggestions); 271 $('form#search .search.typeahead').typeahead(null, { 272 name: 'search-suggestions', 273 display: 'name', 274 source: searchSuggestions, 275 templates: { 276 empty: [ 277 '<div class="empty-message">', 278 'No valid results match that query.', 279 '</div>' 280 ].join('\n'), 281 suggestion: Handlebars.compile('<div>{{{name}}}</div>') 282 } 283 }); 284 } 285}); 286 287$(window).resize(function () { 288 setupMobileMenu(); 289 slickBlog(); 290}); 291 292// Capture scroll events 293$(window).scroll(function(){ 294 //checkAnimation(); 295});
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.