1// adding this here because it is coming from a plugin and it has no hooks or filters. 2jQuery(document).ready(function () { 3 $ = jQuery; 4 const parentSelector = $('.navbar-brand'); 5 if (parentSelector.length > 0) { 6 const LogoSelector = parentSelector.find('img'); 7 if (LogoSelector.length > 0) { 8 LogoSelector.each(function () { 9 $(this).attr({width: '300px', height: '150px'}); 10 }) 11 } 12 } 13 14 $('.search-icon').on('click', function () { 15 $('.fresh-search-form-wrapper').toggleClass('fresh-search-form-wrapper__show') 16 $(".close-search").toggleClass("show"); 17 $(".search-box .search-field").focus(); 18 }); 19 20 21 // remove focus from search input 22 23 $('.sfm-sidebar-close').on('tap', function () { 24 $('.fresh-mobile-search-wrapper .fresh-search-form__search-input').val('').focusout(); 25 $('#sfm-sidebar').trigger('click') 26 $('#sfm-sidebar').css({position: '', top: ''}) 27 }); 28 29 var mobileNavContainer = $('.fresh-mobile-search-wrapper .search-field.fresh-search-form__search-input') 30 mobileNavContainer.focusin(function () { 31 $('.sfm-nav').addClass('fresh-search-open') 32 }); 33 34 mobileNavContainer.focusout(function () { 35 $('.sfm-nav').removeClass('fresh-search-open') 36 }); 37 38 $('.fresh-search-form__search-input').on('input', function () { 39 if ($(this).val() !== '' && $(this).val() !== null) { 40 $('.fresh-search-close-wrapper').addClass('show'); 41 } else { 42 $('.fresh-search-close-wrapper').removeClass('show'); 43 44 } 45 }) 46 47 $('.fresh-close').on('click', function () { 48 $('.fresh-search-form__search-input').val(''); 49 $(this).parent().removeClass('show') 50 }) 51 52 const fresh_dropdown = (callback) => { 53 const filterDropdown = $('.filter-dropdown'); 54 55 if (filterDropdown.length) { 56 const dropdownToggleButtons = filterDropdown.find('.filter-dropdown__button'); 57 const dropdownFilterButtons = filterDropdown.find('.filter-dropdown__dropdown-item-button'); 58 59 window.addEventListener('click', event => { 60 if (event.target.closest('.filter-dropdown') === null) { 61 62 filterDropdown.removeClass('active'); 63 filterDropdown.find('.filter-dropdown__dropdown-wrapper').each(function () { 64 $(this).removeClass('is-visible'); 65 }) 66 } 67 }) 68 69 dropdownToggleButtons.on('click', function () { 70 const dropdownContainer = $(this).closest('.filter-dropdown'); 71 const dropdownWrapper = dropdownContainer.find('.filter-dropdown__dropdown-wrapper'); 72 const dropdown = dropdownWrapper.find('.filter-dropdown__dropdown'); 73 74 // Container 75 filterDropdown.each(function () { 76 if ($(this).is(dropdownContainer)) { 77 dropdownContainer.toggleClass('active'); 78 } else { 79 $(this).removeClass('active'); 80 } 81 }) 82 83 // Wrapper 84 filterDropdown.find('.filter-dropdown__dropdown-wrapper').each(function () { 85 if ($(this).is(dropdownWrapper)) { 86 dropdownWrapper.toggleClass('is-visible'); 87 } else { 88 $(this).removeClass('is-visible'); 89 } 90 }) 91 92 // If auto/flexible apply side appropriate class 93 if (dropdown.hasClass('filter-dropdown__dropdown--auto') || dropdown.hasClass('filter-dropdown__dropdown--flexible')) { 94 dropdown.removeClass('filter-dropdown__dropdown--left'); 95 dropdown.removeClass('filter-dropdown__dropdown--right'); 96 97 if ($(this)[0].getBoundingClientRect().x + dropdown.outerWidth() + 16 > window.innerWidth) { // Calculate from left size of dropdown, add 16px so it always has a little breathing room 98 dropdown.addClass('filter-dropdown__dropdown--left'); 99 } else { 100 dropdown.addClass('filter-dropdown__dropdown--right'); 101 } 102 } 103 }) 104 105 dropdownFilterButtons.on('click', function () { 106 const dropdownContainer = $(this).closest('.filter-dropdown'); 107 const dropdownWrapper = dropdownContainer.find('.filter-dropdown__dropdown-wrapper'); 108 const toggleButtonText = dropdownContainer.find('.filter-dropdown__button-text'); 109 const allButtons = dropdownContainer.find('.filter-dropdown__dropdown-item-button'); 110 111 const buttonValue = $(this).val(); 112 const buttonText = $(this).text(); 113 114 allButtons.each(function () { 115 $(this).removeClass('active'); 116 }) 117 118 $(this).addClass('active'); 119 toggleButtonText.text(buttonText); 120 if (callback) { 121 callback(buttonValue); 122 } 123 dropdownContainer.removeClass('active'); 124 dropdownWrapper.removeClass('is-visible'); 125 }) 126 } 127 } 128 fresh_dropdown((value) => { 129 window.location.href = value; 130 }); 131 $('#show-more-cats').on('click', function (e) { 132 e.preventDefault(); 133 $('.filter-dropdown__hide').toggleClass('filter-dropdown__hide--show'); 134 if ($(this).hasClass('showing-more')) { 135 $(this).removeClass('showing-more'); 136 $(this).text('Show More') 137 } else { 138 $(this).addClass('showing-more'); 139 $(this).text('Show Less') 140 } 141 }) 142 if ($('.filter-dropdown__show-more').hasClass('trigger-click')) { 143 $('#show-more-cats').trigger('click'); 144 145 } 146 147 $('.fresh-home-slide').css('height', $(window).height() + 'px'); 148 $('.fresh-home-slider').slick({ 149 slidesToShow: 1, 150 slidesToScroll: 1, 151 arrows: true, 152 dots: true, 153 }).on('setPosition', function (event, slick) { 154 slick.$slides.css('height', slick.$slideTrack.height() + 'px'); 155 }); 156 157 $('.row--slick-slider').slick({ 158 infinite: true, 159 slidesToShow: 3, 160 slidesToScroll: 1, 161 responsive: [ 162 { 163 breakpoint: 992, 164 settings: { 165 slidesToShow: 2, 166 slidesToScroll: 1, 167 168 } 169 }, 170 { 171 breakpoint: 600, 172 settings: { 173 slidesToShow: 1, 174 slidesToScroll: 1, 175 176 } 177 }, 178 ] 179 }) 180 181}); 182 183/**FacetWP REFRESH*/ 184jQuery(document).on('facetwp-refresh', function () { 185 $ = jQuery; 186 $('.facetwp-template').animate({opacity: 0.2,}, 0); 187 const headerHeight = document.querySelector('header.header').offsetHeight; 188 const scrollToEl = $('.fresh-filter-wrapper'); 189 if (scrollToEl.length > 0) { 190 // add the data-scroll as a flag so that the page does not scroll for initial load of the page 191 const scrollTiming = scrollToEl.data('scroll'); 192 if (scrollTiming !== 0) { 193 $('html, body').animate({ 194 scrollTop: scrollToEl.offset().top - headerHeight, 195 }, 1000); 196 } 197 //updating the value to 1 so that the it can scroll once the user clicks on the pagination 198 scrollToEl.data('scroll', 1); 199 return false;
200 } 201}); 202 203/**FacetWP Loaded*/ 204jQuery(document).on('facetwp-loaded', function () { 205 $ = jQuery; 206 /** 207 The lazy load code was pulled from wp-content/themes/ave/assets/js/theme.js 208 * This is fix the issue where, once a facet Filter loads was loaded it would not show images. 209 * Note: The original code has been trimmed down to work only on the search page 210 */ 211 if ($('body').hasClass('lazyload-enabled') && $('body').hasClass('search')) { 212 window.liquidLazyload = new LazyLoad({ 213 elements_selector: '.ld-lazyload', 214 threshold: 700, 215 callback_loaded: function callback_loaded(el) { 216 var $element = $(el); 217 $element.parent().not('#wrap, #content').addClass('loaded'); 218 219 } 220 }); 221 } 222 223 $('.facetwp-template').animate({opacity: 1,}, 0); 224 225}); 226 227jQuery(window).load(function () { 228 var $ = jQuery; 229 $('#nf-field-13').on('click', function () { 230 $('#nf-form-6-cont').find('input:checkbox').each(function () { 231 $(this).not('#nf-field-13').trigger('click'); 232 }); 233 }); 234 235 /*Banner close and set cookie*/ 236 237 $('.book-banner__close').on('click', (e) => { 238 e.preventDefault() 239 $('#book-banner').slideToggle() 240 Cookies.set('podcast-popup', 'shown', {expires: 30}); 241 }) 242 243 if ($('.book-banner').length > 0) { 244 if (!Cookies.get('podcast-popup')) { 245 $('.book-banner').slideToggle() 246 } 247 } 248 249 $('.fresh-audio-excerpt-holder__audio-player').on('click', function () { 250 var audioplayer = document.getElementById("fresh-excerpt-audio"); 251 if (audioplayer.paused) { 252 audioplayer.play(); 253 } else { 254 audioplayer.pause(); 255 } 256 $(this).toggleClass('fresh-audio-excerpt-holder__audio-player--playing'); 257 258 259 }); 260 if (jQuery(".fg-filtering-container.fg-custom").length > 0) { 261 var back_link = "<a class='fresh-back-to-album' href=" + URL.home_url + "/events-gallery> Back to Albums</a>" 262 jQuery(".fg-filtering-container.fg-custom").prepend(back_link) 263 } 264 265 /*Create mobile filter*/ 266 function create_mobile_filters() { 267 let mainFilterContainer = $('.fg-filtering-container'); 268 let mobileFilterContainer = $('.mobile-filter-wrapper'); 269 if (mainFilterContainer.length === 0 && mobileFilterContainer.length === 0) { 270 return; 271 } 272 let totalFilterItems = mainFilterContainer.find('ul.fg-tag-list li.fg-tag-item'); 273 totalFilterItems.each(function (index, el) { 274 let myDropDownValue = $(this).find('a').attr('href'); 275 let myDropDownText = $(this).find('span').text(); 276 let myOptionBuild = "<option value='" + myDropDownValue + "'>" + myDropDownText + "</option>" 277 mobileFilterContainer.find('#toggle-gallery-filter').append(myOptionBuild) 278 }); 279 $('#toggle-gallery-filter').on('change', function () { 280 let changedValue = $(this).val(); 281 mainFilterContainer.find('a[href="' + changedValue + '"]').trigger('click'); 282 }) 283 284 285 } 286 287 create_mobile_filters(); 288 289}); 290 291/* Custom live search options */ 292jQuery(document).ready(function () { 293 294 jQuery('.sfm-search-form, .fresh-filter-wrapper .fresh-search-form').append('<div class="fresh-live-search-holder"></div>'); 295 296 // WordPress.com REST API powered search https://developer.wordpress.com/elasticsearch-post-doc-schema-v2/ 297 // Setup initial variables. 298 var $apiBase = 'https://public-api.wordpress.com/rest/v1.3/sites/', 299 $blogID = wpcomSearch.blog_id, 300 $endpoint = '/search', 301 $dropdownWrapper = jQuery('.fresh-live-search-holder'), 302 $debounce = null, 303 $size = 6, 304 $fields = '&fields[0]=permalink.url.raw&fields[1]=title.default&fields[2]=excerpt.default', 305 $tag = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><rect x="0" fill="none" width="20" height="20"/><g><path d="M11 2h7v7L8 19l-7-7zm3 6c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"/></g></svg>'; 306 307 function handle_rest_search($query) { 308 // Build the API request URL. 309 let $apiURL = $apiBase + $blogID + $endpoint + '?query=' + $query + '&size=' + $size + $fields; 310 311 $dropdownWrapper.empty().append('<div class="searchwp-live-search-result" role="option" id="" aria-selected="false"><p><a href="#">Loading...</a></p></div>'); 312 313 // Make the API request. 314 jQuery.getJSON($apiURL, function (data) { 315 // Clear the existing results. 316 $dropdownWrapper.empty(); 317 318 // If there are no results, display a message. 319 if (0 === data.results.length) { 320 $dropdownWrapper.append('<div class="searchwp-live-search-result" role="option" id="" aria-selected="false"><p><a href="#">No results found.</a></p></div>'); 321 return; 322 } 323 324 // Loop through the results. 325 jQuery.each(data.results, function (i, post) { 326 // Build the result item. 327 let $result = '<div class="searchwp-live-search-result" role="option" id="" aria-selected="false">' + 328 '<p><a class="fresh-search-item" href="https://' + post.fields['permalink.url.raw'] + '">' + 329 post.fields['title.default'].replace(new RegExp($query, "i"), '<mark>$&</mark>') + ' »' + 330 '</a></p></div>'; 331 332 // Add the result item to the results list. 333 $dropdownWrapper.append($result); 334 }); 335 336 $dropdownWrapper.append('<div class="fresh-more-option"><p>
336<a class="fresh-main-search" href="/?s=' + $query + '"> See all results for <strong>' + $query + '</strong> ></a></p></div>'); 337 }); 338 } 339 340 // Handle search input change. 341 jQuery('.header-search-form [name="s"], .sfm-search-form [name="s"], .fresh-filter-wrapper .fresh-search-form [name="s"]').on('input', function () { 342 343 let $this = jQuery(this), 344 $query = $this.val(); 345 346 // Clear timer if one is set (Avoid excess queries whilst typing). 347 if (null !== $debounce) { 348 clearTimeout($debounce); 349 } 350 351 // Fire up the query after 500ms. 352 $debounce = setTimeout(function () { 353 handle_rest_search($query); 354 }, 1); 355 356 // Exit if we just removed everything from the input 357 if ($query.length === 0) { 358 clearTimeout($debounce); 359 $dropdownWrapper.empty().removeClass('searchwp-live-search-results-showing'); 360 return; 361 } 362 363 // Show the input dropdown. 364 $dropdownWrapper.addClass('searchwp-live-search-results-showing'); 365 366 }); 367 368 // Watch for clicks on search items. 369 jQuery('body').on('click', '.fresh-search-item', function () { 370 let $searchKeywords = jQuery(this).parents('.fresh-live-search-holder').prev().find('[name="s"]'), 371 $clickedText = jQuery(this).text(), 372 $clickedURL = jQuery(this).attr('href'); 373 374 if ($searchKeywords.length > 0) { 375 dataLayer.push({ 376 'event': 'LiveSearchListClicks', 377 'keyword': $searchKeywords.val(), 378 'clicked_text': $clickedText, 379 'clicked_url': $clickedURL, 380 }); 381 } 382 }); 383 384 385 jQuery('.fresh-show-pop-up').on('click', function () { 386 let modalSrc = $(this).parent().parent().clone(); 387 jQuery.magnificPopup.open({ 388 items: { 389 src: modalSrc, // Dynamically created element 390 }, 391 type: 'inline' 392 }); 393 }) 394 jQuery('.fresh-summit-program').on('click', function () { 395 let modalSrc = $(this).find('.fresh-summit-program__popup-content').clone(); 396 jQuery.magnificPopup.open({ 397 items: { 398 src: modalSrc, // Dynamically created element 399 }, 400 type: 'inline' 401 }); 402 }) 403 //enable isotope grid 404 var $grid = jQuery('.fresh-programs-filter-grid').isotope({ 405 itemSelector: '.fresh-programs-filter-grid__items', 406 layoutMode: 'fitRows', 407 filter: '.group-sessions' 408 }); 409 var $gridTwo = jQuery('.fresh-filter-grid-two').isotope({ 410 itemSelector: '.fresh-filter-grid-two__items', 411 filter: '.group-sessions' 412 }); 413 // filter functions 414 var filterFns = { 415 // show if number is greater than 50 416 numberGreaterThan50: function () { 417 var number = $(this).find('.number').text(); 418 return parseInt(number, 10) > 50; 419 }, 420 // show if name ends with -ium 421 ium: function () { 422 var name = $(this).find('.name').text(); 423 return name.match(/ium$/); 424 } 425 }; 426 427 jQuery('.fresh-program-filters').on('click', 'button', function () { 428 var filterValue = $(this).attr('data-filter'); 429 // use filterFn if matches value 430 filterValue = filterFns[filterValue] || filterValue; 431 $grid.isotope({filter: filterValue}); 432 $gridTwo.isotope({filter: filterValue}); 433 }) 434 $('.fresh-program-filters').each(function (i, buttonGroup) { 435 var $buttonGroup = $(buttonGroup); 436 $buttonGroup.on('click', 'button', function () { 437 $buttonGroup.find('.active').removeClass('active'); 438 $(this).addClass('active'); 439 }); 440 }); 441 // Handle Dropdown Changes 442 jQuery('#filter-select').on('#filter-select').on('change', function () { 443 var filterValue = $(this).val(); 444 $grid.isotope({filter: filterValue}); 445 $gridTwo.isotope({filter: filterValue}); 446 }); 447 448 // Collect all popup items 449 var popupItems = []; 450 var $realItems = $('.fresh-speaker-popup').filter(function () { 451 return !$(this).closest('.slick-slide').hasClass('slick-cloned'); 452 }); 453 $realItems.each(function () { 454 var postId = $(this).data('post-id'); 455 popupItems.push({ 456 src: ajax_params.ajax_url + '?action=load_popup_content&post_id=' + postId, 457 type: 'ajax' 458 }); 459 }); 460 // Open popup on click 461 $('.fresh-speaker-popup').on('click', function (e) { 462 e.preventDefault(); 463 464 // Ignore cloned slides 465 if ($(this).parent('.slick-slide').hasClass('slick-cloned')) { 466 return; 467 } 468 469 var clickedIndex = $realItems.index(this); 470 471 jQuery.magnificPopup.open({ 472 items: popupItems, 473 gallery: { 474 enabled: true 475 }, 476 type: 'ajax', 477 callbacks: { 478 change: function () { 479 480 var popupIndex = this.index; 481 482 // Get the real (non-cloned) target item 483 var $targetItem = $realItems.eq(popupIndex); 484 var $targetSlide = $targetItem.closest('.slick-slide'); 485 var slickTargetIndex = $targetSlide.data('slick-index'); 486 487 var slick = $('.fresh-swiper-container').slick('getSlick'); 488 var currentCenterIndex = slick.currentSlide; 489 var slidesToShow = slick.options.slidesToShow; 490 491 // Calculate the visible range in centerMode 492 var half = Math.floor(slidesToShow / 2)-1; 493 var visibleStart = currentCenterIndex - half; 494 var visibleEnd = currentCenterIndex + half; 495 496 if (slickTargetIndex < visibleStart || slickTargetIndex > visibleEnd) { 497 // Force it to scroll even in infinite+centerMode 498 $('.fresh-swiper-container').slick('slickGoTo', slickTargetIndex); 499 } 500 } 501 }, 502 }, clickedIndex); 503 }); 504 var speakerSlider = jQuery('.fresh-swiper-container'); 505 506 if (speakerSlider.length > 0) { 507 speakerSlider.slick({ 508 slidesToShow: 6, 509 slidesToScroll: 1, 510 infinite: true, 511 centerMode: true, 512 513 responsive: [ 514 { 515 breakpoint: 1800, 516 settings: { 517 slidesToShow: 5, 518 slidesToScroll: 1, 519 } 520 }, 521 { 522 breakpoint: 1440, 523 settings: { 524 slidesToShow: 5, 525 slidesToScroll: 1, 526 } 527 }, 528 { 529 breakpoint: 1350, 530 settings: { 531 slidesToShow: 3, 532 slidesToScroll: 1, 533 534 } 535 }, 536 { 537 breakpoint: 992, 538 settings: { 539 slidesToShow: 2, 540 slidesToScroll: 1, 541 542 } 543 }, 544 { 545 breakpoint: 600, 546 settings: { 547 slidesToShow: 1, 548 slidesToScroll: 1, 549 550 } 551 }, 552 ] 553 554 }); 555 } 556 557 jQuery('.fresh-key-note-speaker__link').magnificPopup({ 558 type: 'ajax', 559 callbacks: { 560 elementParse: function (item) { 561 var postId = $(item.el).data('post-id'); 562 item.src = ajax_params.ajax_url + '?action=key_note_load_popup_content_callback&post_id=' + postId; 563 } 564 } 565 }); 566 567 568});
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.