1jQuery(function() { 2 3 if(jQuery('#site-loader').length > 0) { 4 // jQuery('#site-loader .lottie-wrapper').css({"opacity":1}); 5 // jQuery(document).on('load', '#site-loader img', function() { 6 setTimeout(function() { 7 jQuery('#site-loader').fadeOut(); 8 }, 2000); 9 // }); 10 } 11 12 // Site nav 13 jQuery('#site-header nav li ul li a').each(function() { 14 jQuery(this).append('<span class="link-arrow"><svg class="arrow-icon" xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28">\ 15 <g fill="none" stroke="#552389" stroke-width="1.5" stroke-linejoin="round" stroke-miterlimit="10">\ 16 <circle class="arrow-icon--circle" cx="14" cy="14" r="13.23"></circle>\ 17 </g>\ 18 </svg>\ 19 <svg class="link-arrow-arrow" width="12px" height="11px" viewBox="0 0 12 11" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\ 20 <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\ 21 <path d="M7.36396103,10.1923882 C6.97343674,10.5829124 6.34027176,10.5829124 5.94974747,10.1923882 C5.58711777,9.82975846 5.56121565,9.25791306 5.87204111,8.86539541 L5.94974747,8.77817459 L8.485,6.242 L-4.70734562e-13,6.24264069 L2.32702746e-13,5.24264069 L2.32702746e-13,5.24264069 C2.26485497e-13,4.73283938 0.615318307,4.19960385 1.57921052,4.24264069 L8.485,4.242 L5.94974747,1.70710678 C5.58711777,1.34447708 5.56121565,0.772631688 5.87204111,0.380114032 L5.94974747,0.292893219 C6.31237717,-0.0697364807 6.88422256,-0.0956386021 7.27674022,0.215186855 L7.36396103,0.292893219 L11.6066017,4.53553391 C11.6483752,4.57730743 11.6856803,4.62185727 11.718517,4.66858947 C11.7302002,4.68536331 11.7415279,4.70259334 11.7523266,4.72018304 C11.7610611,4.73424762 11.7693448,4.74853653 11.7772456,4.76297916 C11.7876028,4.78203976 11.7974549,4.80150978 11.8066765,4.82133246 C11.8137338,4.83645216 11.8203889,4.85179022 11.8266414,4.86725299 C11.8363113,4.89106836 11.8452044,4.91572164 11.8531354,4.94080249 C11.8559668,4.9499964 11.858571,4.95867598 11.8610549,4.96738265 C11.8684711,4.9930007 11.874945,5.01969841 11.8803244,5.04679019 C11.8839273,5.06542639 11.8869894,5.08347529 11.8895549,5.10158103 C11.8916717,5.11599594 11.8934961,5.13137701 11.8949674,5.14686098 C11.8973382,5.1722896 11.8987644,5.19701223 11.8992781,5.22175029 C11.8994201,5.22837495 11.8994949,5.23549907 11.8994949,5.24264069 L11.8991044,5.27067244 C11.8985088,5.29204592 11.8972317,5.31340394 11.8952733,5.33471113 L11.8994949,5.24264069 C11.8994949,5.29516143 11.895446,5.34673649 11.8876433,5.39707078 C11.8852821,5.41180881 11.8826018,5.42682233 11.879577,5.44178004 C11.8750419,5.46463195 11.8697061,5.48695877 11.8636361,5.50898113 C11.8586963,5.52663593 11.8533122,5.54428269 11.8474297,5.56179887 C11.8402774,5.58323566 11.8322285,5.60467683 11.8234794,5.62575404 C11.8187109,5.63727257 11.8136613,5.64884263 11.8083823,5.66033319 C11.7590623,5.76734538 11.6915716,5.86402141 11.6098068,5.94652784 L7.36396103,10.1923882 Z" fill="#552389" fill-rule="nonzero"></path>\ 22 </g>\ 23</svg></span>'); 24 }); 25 26 // Fixed header 27 var lastScrollTop = 0; 28 jQuery(window).scroll(function(e) { 29 if(jQuery('#fixed-site-header-placeholder').length > 0) { 30 if(jQuery(window).scrollTop() > jQuery('#fixed-site-header-placeholder').offset().top) { 31 var st = jQuery(this).scrollTop(); 32 jQuery('body').addClass('fixed-header'); 33 if(st < lastScrollTop){ 34 jQuery('body').addClass('moved-upwards'); 35 } 36 lastScrollTop = st; 37 } else { 38 jQuery('body').removeClass('fixed-header'); 39 jQuery('body').removeClass('moved-upwards'); 40 } 41 } 42 }); 43 44 /*// Parallax banner 45 jQuery('#page-banner').parallaxScroll({ 46 friction: 0.2 47 }); 48 setTimeout(function() { 49 jQuery('#page-banner').css({"opacity":1}); 50 }, 1000); 51 // jQuery('#page-banner').each(function() { 52 // jQuery(this).attr('data-width',jQuery(window).width()); 53 // setTimeout(function() { 54 // jQuery('#page-banner').parallaxScroll({ 55 // friction: 0.5 56 // }); 57 // }, 500); 58 // });*/ 59 60 // Mobile Nav 61 function mobile_nav_align_button_to_bottom() { 62 jQuery('body').removeClass('mobile-nav-fix-bottom'); 63 if(jQuery('#mobile-nav .mobile-nav-measurer').offset().top < (jQuery('#mobile-nav').height() - 100)) { 64 jQuery('body').addClass('mobile-nav-fix-bottom'); 65 } 66 } 67 jQuery(document).on('click', '.toggle-nav', function(e) { 68 e.preventDefault(); 69 jQuery('body').toggleClass('mobile-nav-active'); 70 if(jQuery('body').hasClass('mobile-nav-active')) { 71 jQuery('#site-wrapper').css({"height":jQuery(window).height(), "overflow":"hidden"}); 72 jQuery('#mobile-nav').css({"height":jQuery(window).height()}).show(); 73 jQuery('#site-header .toggle-nav span').text('Close'); 74 jQuery('#site-header .toggle-nav').removeClass('button-bordered'); 75 jQuery('#site-header .toggle-nav').removeClass('button-white-bordered'); 76 jQuery('#site-header .toggle-nav').addClass('button-white-fill'); 77 jQuery('#site-header .toggle-nav').blur(); 78 } else { 79 jQuery('#site-wrapper').removeAttr('style'); 80 jQuery('#mobile-nav').hide(); 81 jQuery('#site-header .toggle-nav span').text('Menu'); 82 jQuery('#site-header .toggle-nav').addClass('button-bordered'); 83 jQuery('#site-header .toggle-nav').addClass('button-white-bordered'); 84 jQuery('#site-header .toggle-nav').removeClass('button-white-fill'); 85 } 86 mobile_nav_align_button_to_bottom(); 87 }); 88 var mobile_nav_position = 1; 89 jQuery(document).on('click', '#mobile-nav nav li.menu-item-has-children a', function(e) { 90 if(jQuery(this).parent('li').find('ul').size() > 0) { 91 e.preventDefault(); 92 mobile_nav_position++; 93 if(mobile_nav_position == 2) { 94 jQuery('.mobile-menu-back').show(); 95 jQuery('#site-header .logo').hide(); 96 jQuery('#mobile-nav nav .menu-position-b').html('<a href="#" class="mobile-menu-back">Back</a><h6><a href="'+jQuery(this).attr('href')+'">'+jQuery(this).html()+'</a></h6><ul>'+jQuery(this).parent('li').find('ul').html()+'</ul>'); 97 jQuery('#mobile-nav .menu-wrapper').animate({"left":"-100%"}); 98 jQuery('#mobile-nav .menu-wrapper').css({"height":jQuery('#mobile-nav nav .menu-position-b').height()}); 99 mobile_nav_align_button_to_bottom(); 100 } else if(mobile_nav_position == 3) { 101 jQuery('#mobile-nav nav .menu-position-c').html('<a href="#" class="mobile-menu-back">Back</a><h6><a href="'+jQuery(this).attr('href')+'">'+jQuery(this).html()+'</a></h6><ul>'+jQuery(this).parent('li').find('ul').html()+'</ul>'); 102 jQuery('#mobile-nav .menu-wrapper').animate({"left":"-200%"}); 103 jQuery('#mobile-nav .menu-wrapper').css({"height":jQuery('#mobile-nav nav .menu-position-c').height()}); 104 mobile_nav_align_button_to_bottom(); 105 } 106 } 107 }); 108 jQuery(document).on('click', '.mobile-menu-back', function(e) { 109 e.preventDefault(); 110 mobile_nav_position = mobile_nav_position - 1; 111 if(mobile_nav_position == 1) { 112 jQuery('.mobile-menu-back').hide(); 113 jQuery('#site-header .logo').show(); 114 jQuery('#mobile-nav .menu-wrapper').animate({"left":"0px"}); 115 jQuery('#mobile-nav .menu-wrapper').css({"height":jQuery('#mobile-nav nav .menu-position-a').height()}); 116 } else if(mobile_nav_position == 2) { 117 jQuery('#mobile-nav .menu-wrapper').animate({"left":"-100%"}); 118 jQuery('#mobile-nav .menu-wrapper').css({"height":jQuery('#mobile-nav nav .menu-position-b').height()}); 119 } 120 mobile_nav_align_button_to_bottom(); 121 }); 122 123 // Article fix 124 jQuery('article').each(function() { 125 jQuery(this).find(':header:first').addClass('first-heading'); 126 }); 127 128 // Services list 129 jQuery(document).on('click', '.show-services-list', function(e) { 130 e.preventDefault(); 131 jQuery('.services-list').toggleClass('active'); 132 }); 133 134 // Fix slider 135 function fix_insights_slider() { 136 jQuery('.insights-slider').each(function() { 137 if(jQuery(this).hasClass('slick-initialized')) { 138 jQuery(this).slick('unslick'); 139 jQuery(this).append('<div class="clearfix"></div>'); 140 } 141 if(jQuery(window).width() > 1023) { 142 jQuery(this).find('section').each(function() { 143 jQuery(this).removeAttr('style'); 144 }); 145 } else { 146 if(jQuery(window).width() > 767) { 147 var insigths_number_of_slides = 2; 148 jQuery(this).find('section').css({"width":(jQuery(window).width()/2) - 36}); 149 } else { 150 var insigths_number_of_slides = 1; 151 jQuery(this).find('section').css({"width":jQuery(window).width() - 36}); 152 } 153 jQuery(this).slick({ 154 slide: 'section', 155 variableWidth: true, 156 infinite: false, 157 centerMode: false, 158 slidesToShow: insigths_number_of_slides, 159 adaptiveHeight: false, 160 dots: true, 161 arrows: true 162 }); 163 } 164 jQuery(this).find('.slick-list').append('<div class="clearfix"></div>'); 165 }); 166 } 167 fix_insights_slider(); 168 jQuery(window).resize(function() { fix_insights_slider(); }); 169 170 /* Projects Filter */ 171 var projects_parent_filter; 172 var projects_sub_filter = '*'; 173 jQuery('#projects-filter .top-level li a').click(function(e) { 174 e.preventDefault(); 175 jQuery('#projects-filter .top-level li').removeClass('active'); 176 jQuery(this).parent('li').addClass('active'); 177 jQuery('#projects-filter .filter-sectors, #projects-filter .filter-services, #projects-filter .filter-statuses').hide(); 178 if(jQuery(this).data('filter') != "all") { 179 jQuery('#projects-filter .filter-'+jQuery(this).data('filter')).show(); 180 } 181 // var projects_filter_width = 0; 182 // jQuery('#projects-filter .filter-services ul li').each(function() { 183 // projects_filter_width = projects_filter_width + jQuery(this).outerWidth() + 40; 184 // jQuery('#projects-filter .filter-services ul').width(projects_filter_width); 185 // }); 186 // var projects_filter_width = 0; 187 // jQuery('#projects-filter .filter-sectors ul li').each(function() { 188 // projects_filter_width = projects_filter_width + jQuery(this).outerWidth() + 40; 189 // jQuery('#projects-filter .filter-sectors ul').width(projects_filter_width); 190 // }); 191 // var projects_filter_width = 0; 192 // jQuery('#projects-filter .filter-statuses ul li').each(function() { 193 // projects_filter_width = projects_filter_width + jQuery(this).outerWidth() + 40; 194 // jQuery('#projects-filter .filter-statuses ul').width(projects_filter_width); 195 // }); 196 if(jQuery(this).data('filter') == "all") { 197 jQuery('.projects-archive li').hide(); 198 jQuery('.projects-archive li').removeClass('passed-filters'); 199 jQuery('.projects-archive li').removeClass('li-visible-0').removeClass('li-visible-1').removeClass('li-visible-2').removeClass('li-visible-3'); 200 jQuery('.projects-archive li').removeClass('li-visible-mb-0').removeClass('li-visible-mb-1').removeClass('li-visible-mb-2').removeClass('li-visible-mb-3'); 201 202 var li_i = 0; var li_mb_i = 0; jQuery('.projects-archive li').each(function() { 203 var this_item = jQuery(this); 204 li_i++; if(li_i == 4) { li_i = 1; } this_item.addClass('li-visible-'+li_i); 205 li_mb_i++; if(li_mb_i == 3) { li_mb_i = 1; } this_item.addClass('li-visible-mb-'+li_mb_i); 206 this_item.addClass('passed-filters').find('.animate').addClass('animated'); 207 }); 208 passed_results_page = 1; 209 show_passed_results(); 210 } 211 }); 212 jQuery('#projects-filter .filter-sectors li a').click(function(e) { 213 e.preventDefault(); 214 var this_filter_id = jQuery(this).data('id'); 215 jQuery('#projects-filter .filter-statuses li').removeClass('active'); 216 jQuery('#projects-filter .filter-sectors li').removeClass('active'); 217 jQuery(this).parent('li').addClass('active'); 218 jQuery('.projects-archive li').hide(); 219 jQuery('.projects-archive li').removeClass('passed-filters'); 220 jQuery('.projects-archive li').removeClass('li-visible-0').removeClass('li-visible-1').removeClass('li-visible-2').removeClass('li-visible-3'); 221 jQuery('.projects-archive li').removeClass('li-visible-mb-0').removeClass('li-visible-mb-1').removeClass('li-visible-mb-2').removeClass('li-visible-mb-3'); 222 var li_i = 0; var li_mb_i = 0; jQuery('.projects-archive li').each(function() { 223 var this_item = jQuery(this); 224 if(this_filter_id == "*") { 225 li_i++; if(li_i == 4) { li_i = 1; } this_item.addClass('li-visible-'+li_i); 226 li_mb_i++; if(li_mb_i == 3) { li_mb_i = 1; } this_item.addClass('li-visible-mb-'+li_mb_i); 227 this_item.addClass('passed-filters').find('.animate').addClass('animated'); 228 } else { 229 var this_filters = jQuery(this).data('filters').split(',');
230 this_filters.forEach(function(id) { 231 console.log(this_filter_id); 232 if(this_filter_id == id) { 233 li_i++; if(li_i == 4) { li_i = 1; } this_item.addClass('li-visible-'+li_i); 234 li_mb_i++; if(li_mb_i == 3) { li_mb_i = 1; } this_item.addClass('li-visible-mb-'+li_mb_i); 235 this_item.addClass('passed-filters').find('.animate').addClass('animated'); 236 } 237 }); 238 } 239 }); 240 passed_results_page = 1; 241 show_passed_results(); 242 projects_sub_filter = jQuery(this).data('id'); 243 }); 244 jQuery('#projects-filter .filter-services li a').click(function(e) { 245 e.preventDefault(); 246 var this_filter_id = jQuery(this).data('id'); 247 jQuery('#projects-filter .filter-statuses li').removeClass('active'); 248 jQuery('#projects-filter .filter-services li').removeClass('active'); 249 jQuery(this).parent('li').addClass('active'); 250 jQuery('.projects-archive li').hide(); 251 jQuery('.projects-archive li').removeClass('passed-filters'); 252 jQuery('.projects-archive li').removeClass('li-visible-0').removeClass('li-visible-1').removeClass('li-visible-2').removeClass('li-visible-3'); 253 jQuery('.projects-archive li').removeClass('li-visible-mb-0').removeClass('li-visible-mb-1').removeClass('li-visible-mb-2').removeClass('li-visible-mb-3'); 254 var li_i = 0; var li_mb_i = 0; jQuery('.projects-archive li').each(function() { 255 var this_item = jQuery(this); 256 if(this_filter_id == "*") { 257 li_i++; if(li_i == 4) { li_i = 1; } this_item.addClass('li-visible-'+li_i); 258 li_mb_i++; if(li_mb_i == 3) { li_mb_i = 1; } this_item.addClass('li-visible-mb-'+li_mb_i); 259 this_item.addClass('passed-filters').find('.animate').addClass('animated'); 260 } else { 261 var this_filters = jQuery(this).data('filters').split(','); 262 this_filters.forEach(function(id) { 263 console.log(this_filter_id); 264 if(this_filter_id == id) { 265 li_i++; if(li_i == 4) { li_i = 1; } this_item.addClass('li-visible-'+li_i); 266 li_mb_i++; if(li_mb_i == 3) { li_mb_i = 1; } this_item.addClass('li-visible-mb-'+li_mb_i); 267 this_item.addClass('passed-filters').find('.animate').addClass('animated'); 268 } 269 }); 270 } 271 }); 272 passed_results_page = 1; 273 show_passed_results(); 274 projects_sub_filter = jQuery(this).data('id'); 275 }); 276 jQuery('#projects-filter .filter-statuses li a').click(function(e) { 277 e.preventDefault(); 278 var this_filter_id = jQuery(this).data('id'); 279 jQuery('#projects-filter .filter-sectors li').removeClass('active'); 280 jQuery('#projects-filter .filter-services li').removeClass('active'); 281 jQuery(this).parent('li').addClass('active'); 282 jQuery('.projects-archive li').hide(); 283 jQuery('.projects-archive li').removeClass('passed-filters'); 284 jQuery('.projects-archive li').removeClass('li-visible-0').removeClass('li-visible-1').removeClass('li-visible-2').removeClass('li-visible-3'); 285 jQuery('.projects-archive li').removeClass('li-visible-mb-0').removeClass('li-visible-mb-1').removeClass('li-visible-mb-2').removeClass('li-visible-mb-3'); 286 var li_i = 0; var li_mb_i = 0; jQuery('.projects-archive li').each(function() { 287 var this_item = jQuery(this); 288 if(this_filter_id == "*") { 289 li_i++; if(li_i == 4) { li_i = 1; } this_item.addClass('li-visible-'+li_i); 290 li_mb_i++; if(li_mb_i == 3) { li_mb_i = 1; } this_item.addClass('li-visible-mb-'+li_mb_i); 291 this_item.addClass('passed-filters').find('.animate').addClass('animated'); 292 } else { 293 var this_filters = jQuery(this).data('filters').split(','); 294 this_filters.forEach(function(id) { 295 console.log(this_filter_id); 296 if(this_filter_id == id) { 297 li_i++; if(li_i == 4) { li_i = 1; } this_item.addClass('li-visible-'+li_i); 298 li_mb_i++; if(li_mb_i == 3) { li_mb_i = 1; } this_item.addClass('li-visible-mb-'+li_mb_i); 299 this_item.addClass('passed-filters').find('.animate').addClass('animated'); 300 } 301 }); 302 } 303 }); 304 passed_results_page = 1; 305 show_passed_results(); 306 projects_sub_filter = jQuery(this).data('id'); 307 }); 308 309 // jQuery('#projects-filter li a').click(function() { 310 // jQuery('.projects-archive li a').each(function() { 311 // jQuery(this).attr({"href":jQuery(this).data('link')+'?parent='+projects_parent_filter+'&sub='+projects_sub_filter}); 312 // }); 313 // }); 314 315 var passed_results_page = 1; 316 function show_passed_results() { 317 var passed_results_max = 6 * passed_results_page; 318 var passed_results_i = -1; 319 jQuery('.passed-filters').each(function() { 320 passed_results_i++; 321 if(passed_results_i < passed_results_max) { 322 jQuery(this).show(); 323 } 324 }); 325 console.log(jQuery('.passed-filters:hidden').length); 326 if(jQuery('.passed-filters:hidden').length == 0) { 327 jQuery('.pagination').hide(); 328 } else { 329 jQuery('.pagination').show(); 330 } 331 } 332 if(jQuery('#projects-filter').length > 0) { 333 show_passed_results(); 334 } 335 jQuery(document).on('click', '.projects-load-more', function(e) { 336 e.preventDefault(); 337 passed_results_page++; 338 show_passed_results(); 339 }); 340 341 // Video link 342 jQuery('.video-link').magnificPopup({ 343 type: 'iframe' 344 }); 345 346 // Slideshow 347 jQuery('.page-block-slideshow').each(function() { 348 jQuery(this).find('.slides').slick({ 349 slide: '.slide', 350 variableWidth: false, 351 infinite: false, 352 centerMode: false, 353 slidesToShow: 1, 354 adaptiveHeight: true, 355 dots: true, 356 arrows: true, 357 prevArrow: '<a href="#" class="slick-arrow slick-prev"><span>Move to previous image</span></a>', 358 nextArrow: '<a href="#" class="slick-arrow slick-next"><span>Move to next image</span></a>' 359 }); 360 // var slide_counter = 0; 361 // jQuery(this).find('.slide').each(function() { 362 // slide_counter++; 363 // jQuery(this).addClass('slide-'+slide_counter); 364 // }); 365 }); 366 // jQuery(window).on('load', function () { 367 // jQuery('.page-block-slideshow').each(function() { 368 // if(jQuery(this).find('.slide:first img').height() < jQuery(window).height()) { 369 // jQuery(this).find('.slides').height(jQuery(this).find('.slide-1 img').height()); 370 // } 371 // }); 372 // }); 373 374 // Animated modal 375 // jQuery('.open-bio-modal').each(function() { 376 // jQuery(this).animatedModal({ 377 // animatedIn: 'bounceInUp', 378 // animatedOut: 'bounceOutDown', 379 // }); 380 // }); 381 382 // Load more 383 jQuery(document).on('click', '.load-more a', function(e) { 384 e.preventDefault(); 385 if(jQuery('.has-another-page a').size() > 0) { 386 jQuery('.next-page-loader').load(jQuery('.has-another-page a').attr('href')+' .page-loader-contents', function() { 387 jQuery('.page-loader-contents:first .has-another-page').remove(); 388 jQuery('.page-loader-contents').append(jQuery('.next-page-loader .page-loader-contents').html()); 389 jQuery('.page-loader-contents .clearfix').remove(); 390 jQuery('.page-loader-contents').append('<div class="clearfix"></div>'); 391 jQuery('.next-page-loader').html(''); 392 if(jQuery('.has-another-page a').size() == 0) { 393 jQuery('.load-more').hide(); 394 } 395 }); 396 } 397 }); 398 if(jQuery('.load-more').size() > 0) { 399 if(jQuery('.has-another-page a').size() == 0) { 400 jQuery('.load-more').remove(); 401 } 402 } 403 404 // Modal 405 jQuery(document).on('click', '.person-card-link', function(e) { 406 e.preventDefault(); 407 jQuery('body').addClass('modal-open'); 408 jQuery('#modal .modal-content').html(jQuery('.content-for-modal'+jQuery(this).attr('href')).html()); 409 jQuery('#modal .modal-content a').each(function() { 410 jQuery(this).removeAttr('tabindex'); 411 }); 412 jQuery('#modal .modal-close').focus(); 413 }); 414 jQuery(document).on('click', '.person-card-arrow-link', function(e) { 415 e.preventDefault(); 416 jQuery('body').addClass('modal-open'); 417 jQuery('#modal .modal-content').html(jQuery('.content-for-modal'+jQuery(this).attr('href')).html()); 418 }); 419 jQuery(document).on('click', '.modal-close', function(e) { 420 e.preventDefault(); 421 jQuery('body').removeClass('modal-open'); 422 setTimeout(function() { 423 jQuery('#modal .modal-content').html(''); 424 }, 400); 425 }); 426 427 // Search 428 jQuery(document).on('click', '.toggle-search', function(e) { 429 e.preventDefault(); 430 jQuery('body').toggleClass('search-active'); 431 jQuery('#search-wrapper input#s').focus(); 432 }); 433 jQuery(document).on('click', '.search-close', function(e) { 434 e.preventDefault(); 435 jQuery('body').removeClass('search-active'); 436 }); 437 // jQuery('#search-wrapper form input[type="text"]').keyup(function() { 438 jQuery('#search-wrapper form .button').click(function(e) { 439 e.preventDefault(); 440 search_site(); 441 }); 442 jQuery('#search-wrapper form').submit(function(e) { 443 e.preventDefault(); 444 search_site(); 445 }); 446 function search_site() { 447 jQuery('#search-wrapper form').addClass('loading'); 448 var data = { 449 'action': 'get_search_ajax', 450 'data': jQuery('#search-wrapper form').serialize() 451 }; 452 jQuery.post(ajaxurl, data, function(response) { 453 jQuery('#search-wrapper form').removeClass('loading'); 454 jQuery('#search-wrapper .search-results').html(''); 455 jQuery('#search-wrapper .search-results').html(response); 456 jQuery('#search-wrapper h5').focus(); 457 }); 458 } 459 jQuery('.page-block-four-oh-four form .button').click(function(e) { 460 e.preventDefault(); 461 search_site_four_oh_four(); 462 }); 463 jQuery('.page-block-four-oh-four form').submit(function(e) { 464 e.preventDefault(); 465 search_site_four_oh_four(); 466 }); 467 function search_site_four_oh_four() { 468 jQuery('.page-block-four-oh-four form').addClass('loading'); 469 var data = { 470 'action': 'get_search_ajax', 471 'data': jQuery('.page-block-four-oh-four form').serialize() 472 }; 473 jQuery.post(ajaxurl, data, function(response) { 474 jQuery('.four-oh-four-content').css({"paddingTop":jQuery('.page-block-four-oh-four .container h1').offset().top}); 475 jQuery('.page-block-four-oh-four').addClass('search-done'); 476 jQuery('.page-block-four-oh-four form').removeClass('loading'); 477 jQuery('.page-block-four-oh-four .search-results').html(''); 478 jQuery('.page-block-four-oh-four .search-results').html(response); 479 jQuery('.page-block-four-oh-four h5').focus(); 480 }); 481 } 482 483 // Stats 484 jQuery.fn.countTo = function(options) { 485 // merge the default plugin settings with the custom options 486 options = jQuery.extend({}, jQuery.fn.countTo.defaults, options || {}); 487 488 // how many times to update the value, and how much to increment the value on each update 489 var loops = Math.ceil(options.speed / options.refreshInterval), 490 increment = (options.to - options.from) / loops; 491 492 return jQuery(this).each(function() { 493 var _this = this, 494 loopCount = 0, 495 value = options.from, 496 interval = setInterval(updateTimer, options.refreshInterval); 497 498 function updateTimer() { 499 value += increment; 500 loopCount++; 501 jQuery(_this).html(value.toFixed(options.decimals)); 502 503 if (typeof(options.onUpdate) == 'function') { 504 options.onUpdate.call(_this, value); 505 } 506 507 if (loopCount >= loops) { 508 clearInterval(interval); 509 value = options.to; 510 511 if (typeof(options.onComplete) == 'function') { 512 options.onComplete.call(_this, value); 513 } 514 } 515 } 516 }); 517 }; 518 519 jQuery.fn.countTo.defaults = { 520 from: 0, // the number the element should start at 521 to: 100, // the number the element should end at 522 speed: 1000, // how long it should take to count between the target numbers 523 refreshInterval: 100, // how often the element should be updated
524 decimals: 0, // the number of decimal places to show 525 onUpdate: null, // callback method for every time the element is updated, 526 onComplete: null, // callback method for when the element finishes updating 527 }; 528 529 /* Animate */ 530 jQuery.fn.isInViewport = function() { 531 var elementTop = jQuery(this).offset().top; 532 var elementBottom = elementTop + jQuery(this).outerHeight(); 533 var viewportTop = jQuery(window).scrollTop(); 534 var viewportBottom = viewportTop + ((jQuery(window).height()/3)*2); 535 return elementBottom > viewportTop && elementTop < viewportBottom; 536 }; 537 jQuery.fn.isInViewportFooter = function() { 538 var elementTop = jQuery(this).offset().top; 539 var elementBottom = elementTop + jQuery(this).outerHeight(); 540 var viewportTop = jQuery(window).scrollTop(); 541 var viewportBottom = viewportTop + ((jQuery(window).height())); 542 return elementBottom > viewportTop && elementTop < viewportBottom; 543 }; 544 var prev_scroll_pos = 0; 545 function on_scroll() { 546 jQuery('.animate').each(function() { 547 var this_el = jQuery(this); 548 if(this_el.isInViewport() && !jQuery(this).hasClass('animated')) { 549 jQuery(this).removeClass('animate').addClass('animated').addClass(this_el.data('animate')); 550 } 551 // if(jQuery(this).parent('#site-footer').length > 0) { 552 if(this_el.isInViewportFooter() && !jQuery(this).hasClass('animated')) { 553 jQuery(this).removeClass('animate').addClass('animated').addClass(this_el.data('animate')); 554 } 555 // } 556 if(jQuery(this).parentsUntil('.page-block-stats').parent('.page-block-stats').length > 0) { 557 jQuery('.stat-number').each(function() { 558 jQuery(this).countTo({ 559 from: jQuery(this).data('countfrom'), 560 to: jQuery(this).data('countto'), 561 speed: 3000, 562 refreshInterval: 50, 563 onComplete: function(value) { 564 console.debug(this); 565 } 566 }); 567 }); 568 } 569 }); 570 prev_scroll_pos = jQuery(window).scrollTop(); 571 jQuery('#site-footer').each(function() { 572 var this_el = jQuery(this); 573 if(this_el.isInViewportFooter() && !jQuery(this).hasClass('in-view')) { 574 this_el.addClass('in-view') 575 } 576 }); 577 } 578 on_scroll(); 579 jQuery(window).scroll(function() { on_scroll(); }); 580 581});
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.