vendor: 112 bytes, lines 1-5
1/******/ (() => { // webpackBootstrap 2/******/ "use strict"; 3/******/ var __webpack_modules__ = ({ 4 5/***/ "./s
5rc/js/usePagination.js": 6/*!*********************************!*\ 7 !*** ./src/js/usePagination.js ***! 8 \*********************************/ 9/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 10 11__webpack_require__.r(__webpack_exports__); 12/* harmony export */ __webpack_require__.d(__webpack_exports__, { 13/* harmony export */ clearPagination: () => (/* binding */ clearPagination), 14/* harmony export */ resetPagination: () => (/* binding */ resetPagination), 15/* harmony export */ scaffoldPagination: () => (/* binding */ scaffoldPagination) 16/* harmony export */ }); 17function getPaginationRange(start, end) { 18 return Array(end - start + 1).fill().map((v, i) => i + start); 19} 20function getPaginationArray(current, length, delta = 4) { 21 current = parseInt(current); 22 let range = { 23 start: Math.round(current - delta / 2), 24 end: Math.round(current + delta / 2) 25 }; 26 if (range.start - 1 === 1 || range.end + 1 === length) { 27 range.start += 1; 28 range.end += 1; 29 } 30 let pages = ""; 31 if (current > delta) { 32 pages = getPaginationRange(Math.min(range.start, length - delta), Math.min(range.end, length)); 33 } else { 34 pages = getPaginationRange(1, Math.min(length, delta + 1)); 35 } 36 let withDots = (value, pair) => { 37 if (pages.length + 1 !== length) { 38 return pair; 39 } else { 40 return [value]; 41 } 42 }; 43 if (pages[0] !== 1) { 44 pages = withDots(1, [1, "..."]).concat(pages); 45 } 46 if (pages[pages.length - 1] < length) { 47 pages = pages.concat(withDots(length, ["...", length])); 48 } 49 return pages; 50} 51function scaffoldPagination(current_page = 1, max_pages = 1, pagination_element_id = "e8-pagination-element") { 52 if (max_pages <= 1) return false; 53 let pagination_container = jQuery(`<div id="${pagination_element_id}" class="e8-pagination-element" aria-label="Pagination" role=region></div>`); 54 let pagination_arr = getPaginationArray(current_page, max_pages); 55 pagination_arr.unshift("prev-button"); 56 pagination_arr.push("next-button"); 57 pagination_arr.forEach((page_num) => { 58 let page_num_element; 59 if (page_num === "...") { 60 page_num_element = jQuery('<span class="page-num dots" aria-hidden="true">...</span>'); 61 } else if (page_num === "prev-button") { 62 let disabled = ""; 63 if (current_page <= 1) { 64 disabled = "disabled"; 65 } 66 page_num_element = jQuery(`<p data-page="${parseInt(current_page) - 1}" class="${disabled} page-num prev-button" role="button" tabindex="0">Previous</p>`); 67 } else if (page_num === "next-button") { 68 let disabled = ""; 69 if (current_page >= max_pages) { 70 disabled = "disabled"; 71 } 72 page_num_element = jQuery(`<p data-page="${parseInt(current_page) + 1}" class="${disabled} page-num next-button" role="button" tabindex="0">Next</p>`); 73 } else { 74 if (page_num == current_page) { 75 page_num_element = jQuery(`<span class="page-num num current-page" aria-current="page" role="button" tabindex="0">${current_page}</span>`); 76 } else { 77 page_num_element = jQuery(`<p data-page="${page_num}" class="page-num num" role="button" tabindex="0">${page_num.toString()}</p>`); 78 } 79 } 80 pagination_container.append(page_num_element); 81 }); 82 return pagination_container; 83} 84function clearPagination(pagination_element_id = "e8-pagination-element") { 85 if (jQuery(`#${pagination_element_id}`)) { 86 jQuery(`#${pagination_element_id}`).remove(); 87 } 88} 89function resetPagination(current_page = 1, max_pages = 1) { 90 clearPagination(); 91 scaffoldPagination({ current_page, max_pages }); 92} 93 94 95/***/ })
95 96 97/******/ }); 98/************************************************************************/ 99/******/ // The module cache 100/******/ var __webpack_module_cache__ = {}; 101/******/ 102/******/ // The require function 103/******/ function __webpack_require__(moduleId) { 104/******/ // Check if module is in cache 105/******/ var cachedModule = __webpack_module_cache__[moduleId]; 106/******/ if (cachedModule !== undefined) { 107/******/ return cachedModule.exports; 108/******/ } 109/******/ // Create a new module (and put it into the cache) 110/******/ var module = __webpack_module_cache__[moduleId] = { 111/******/ // no module.id needed 112/******/ // no module.loaded needed 113/******/ exports: {} 114/******/ }; 115/******/ 116/******/ // Execute the module function 117/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 118/******/ 119/******/ // Return the exports of the module 120/******/ return module.exports; 121/******/ } 122/******/ 123/************************************************************************/ 124/******/ /* webpack/runtime/define property getters */ 125/******/ (() => { 126/******/ // define getter functions for harmony exports 127/******/ __webpack_require__.d = (exports, definition) => { 128/******/ for(var key in definition) { 129/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 130/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 131/******/ } 132/******/ } 133/******/ }; 134/******/ })(); 135/******/ 136/******/ /* webpack/runtime/hasOwnProperty shorthand */ 137/******/ (() => { 138/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 139/******/ })(); 140/******/ 141/******/ /* webpack/runtime/make namespace object */ 142/******/ (() => { 143/******/ // define __esModule on exports 144/******/ __webpack_require__.r = (exports) => { 145/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 146/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 147/******/ } 148/******/ Object.defineProperty(exports, '__esModule', { value: true }); 149/******/ }; 150/******/ })(); 151/******/ 152/************************************************************************/ 153var __webpack_exports__ = {}; 154// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 155(() => { 156var __webpack_exports__ = {}; 157/*!********************************************************!*\ 158 !*** ./.e8/js/open-outside-links-in-new-tab.public.js ***! 159 \********************************************************/ 160__webpack_require__.r(__webpack_exports__); 161jQuery(($) => { 162 "use strict"; 163 let anchor_links = document.querySelectorAll('a:not([target="_blank"])'); 164 for (let i = 0; i < anchor_links.length; i += 1) { 165 if (anchor_links[i].host !== window.location.hostname) { 166 anchor_links[i].setAttribute("target", "_blank"); 167 anchor_links[i].setAttribute("rel", "nofollow"); 168 } 169 } 170}); 171 172})(); 173 174// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 175(() => { 176var __webpack_exports__ = {}; 177/*!***********************************************************!*\ 178 !*** ./.e8/js/add-scrollbar-width-css-variable.public.js ***! 179 \***********************************************************/ 180__webpack_require__.r(__webpack_exports__); 181jQuery(($) => { 182 "use strict"; 183 let get_scrollbar_width = () => window.innerWidth - document.documentElement.clientWidth; 184 let set_scrollbar_width_global = () => document.documentElement.style.setProperty("--scrollbar-width", get_scrollbar_width() + "px"); 185 let set_scrollbar_width_half_global = () => document.documentElement.style.setProperty("--scrollbar-width-half", get_scrollbar_width() / 2 + "px"); 186 set_scrollbar_width_global(); 187 set_scrollbar_width_half_global(); 188 $(window).on("resize", function() { 189 set_scrollbar_width_global(); 190 set_scrollbar_width_half_global(); 191 }); 192}); 193 194})(); 195 196// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 197(() => { 198var __webpack_exports__ = {};
199/*!*************************************!*\ 200 !*** ./src/js/media-page.public.js ***! 201 \*************************************/ 202__webpack_require__.r(__webpack_exports__); 203jQuery(($) => { 204 "use strict"; 205 if (!$(".media-page-tabs").length) return; 206 let remember_active_tab; 207 function set_current_media_page_tab() { 208 remember_active_tab = $(".media-page-tabs").find(".kt-tab-title-active > a").attr("data-tab"); 209 } 210 function update_active_tab() { 211 setTimeout(function() { 212 $(".media-page-tabs").find(`a[data-tab=${remember_active_tab}]`)[0].click(); 213 }, 0); 214 } 215 $(".media-page-tabs").on("click", function(e) { 216 set_current_media_page_tab(); 217 }); 218 $(".media-page-tabs").on("click", "#contact", function(e) { 219 e.preventDefault(); 220 e.stopPropagation(); 221 e.stopImmediatePropagation(); 222 update_active_tab(); 223 const target = $("#contact-anchor"); 224 if (target.length) { 225 $("html, body").animate({ 226 scrollTop: target.offset().top - 20 227 }, 600); 228 } 229 }); 230 set_current_media_page_tab(); 231}); 232 233})(); 234 235// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 236(() => { 237var __webpack_exports__ = {}; 238/*!***************************************!*\ 239 !*** ./src/js/e8-skip-link.public.js ***! 240 \***************************************/ 241__webpack_require__.r(__webpack_exports__); 242jQuery(($) => { 243 "use strict"; 244 if (!$(".e8-skip-link").length) return; 245 $(".e8-skip-link").on("keydown", function(e) { 246 if (e.key === " " || e.key === "Enter") { 247 $(this).click(); 248 } 249 }); 250}); 251 252})(); 253 254// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 255(() => { 256var __webpack_exports__ = {}; 257/*!**********************************************************!*\ 258 !*** ./src/components/site-header/site-header.public.js ***! 259 \**********************************************************/ 260__webpack_require__.r(__webpack_exports__); 261jQuery(($) => { 262 "use strict"; 263 if (!$(".wp-block-e8-site-header").length) return; 264 let li_item_string = 'li.menu-item-has-children[data-menu-depth="0"]'; 265 let user_has_scrolled = false; 266 let last_known_scroll_position = 0; 267 let ticking = false; 268 function is_desktop_mode() { 269 return $(window).width() >= 1200; 270 } 271 function is_mobile_mode() { 272 return !is_desktop_mode(); 273 } 274 function add_column_count_class_to_sub_menu_containers() { 275 let sub_menu_containers = $("#menu-main-menu .sub-menu-container"); 276 sub_menu_containers.each(function() { 277 let total_sub_menu_items = $(this).find(".sub-menu > li").length; 278 if (total_sub_menu_items >= 4) { 279 $(this).addClass("column-count-4"); 280 } else if (total_sub_menu_items === 3) { 281 $(this).addClass("column-count-3"); 282 } else { 283 $(this).addClass("column-count-2"); 284 } 285 }); 286 } 287 function close_currently_opened_submenus(excluded_menu_item_element = false) { 288 $(`#menu-main-menu ${li_item_string} [aria-expanded="true"]`).each(function() { 289 if (excluded_menu_item_element !== false && (excluded_menu_item_element[0] === $(this)[0] || excluded_menu_item_element.closest(li_item_string)[0] === $(this).closest(li_item_string)[0])) return true; 290 desktop_close_submenu($(this)); 291 }); 292 } 293 function desktop_open_submenu(menu_item_element) { 294 if (menu_item_element.attr("aria-expanded") === "true") return; 295 menu_item_element.next(".sub-menu-container").show().promise().then(() => { 296 menu_item_element.attr("aria-expanded", "true").attr("title", "Click to close submenu"); 297 get_focusable_elements(menu_item_element.next(".sub-menu-container")).each(function() { 298 $(this).attr("tabindex", "0"); 299 }); 300 }); 301 } 302 function desktop_close_submenu(menu_item_element) { 303 if (menu_item_element.attr("aria-expanded") === "false") return; 304 menu_item_element.attr("aria-expanded", "false").attr("title", "Click to open submenu").promise().then(() => { 305 setTimeout(() => { 306 get_focusable_elements(menu_item_element.next(".sub-menu-container")).each(function() { 307 $(this).attr("tabindex", "-1"); 308 });
309 menu_item_element.next(".sub-menu-container").hide(); 310 }, 150); 311 }); 312 } 313 function mobile_open_menu() { 314 $("body").addClass("noscroll"); 315 $(".site-nav-container").addClass("open"); 316 $(".e8-burger-container > button[aria-expanded]").attr("aria-expanded", "true"); 317 $(".e8-burger.e8-burger-squeeze").removeClass("collapsed"); 318 } 319 function mobile_close_menu() { 320 $("body").removeClass("noscroll"); 321 $(".site-nav-container").removeClass("open"); 322 $(".e8-burger-container > button[aria-expanded]").attr("aria-expanded", "false"); 323 $(".e8-burger.e8-burger-squeeze").addClass("collapsed"); 324 } 325 function mobile_toggle_menu() { 326 if ($(".site-nav-container").hasClass("open")) { 327 mobile_close_menu(); 328 } else { 329 mobile_open_menu(); 330 } 331 } 332 function mobile_close_all_submenus() { 333 $(`#menu-main-menu ${li_item_string} .sub-menu-container.open`).each(function() { 334 if ($(this).prev("a").length) { 335 $(this).prev("a").find("span").removeClass("open"); 336 } else if ($(this).prev(".menu-item-column-heading")) { 337 $(this).prev(".menu-item-column-heading").find("span").removeClass("open"); 338 } 339 $(this).removeClass("open").slideUp(); 340 }); 341 } 342 function mobile_toggle_submenu(submenu_element) { 343 if (submenu_element.prev("a").length) { 344 if (submenu_element.prev("a").attr("aria-expanded") === "false") { 345 submenu_element.prev("a").attr("aria-expanded", "true").attr("title", "Click to close submenu").find("span").addClass("open"); 346 } else { 347 submenu_element.prev("a").attr("aria-expanded", "false").attr("title", "Click to open submenu").find("span").removeClass("open"); 348 } 349 } else if (submenu_element.prev(".menu-item-column-heading")) { 350 if (submenu_element.prev(".menu-item-column-heading").attr("aria-expanded") === "false") { 351 submenu_element.prev(".menu-item-column-heading").attr("aria-expanded", "true").attr("title", "Click to close submenu").find("span").addClass("open"); 352 } else { 353 submenu_element.prev(".menu-item-column-heading").attr("aria-expanded", "false").attr("title", "Click to open submenu").find("span").removeClass("open"); 354 } 355 } 356 submenu_element.toggleClass("open").slideToggle(); 357 } 358 function update_user_scrolled(scroll_position) { 359 if (!user_has_scrolled && scroll_position >= 100) { 360 $("body").addClass("user-scrolled-down"); 361 user_has_scrolled = true; 362 } else if (user_has_scrolled && scroll_position < 100) { 363 $("body").removeClass("user-scrolled-down"); 364 user_has_scrolled = false; 365 } 366 } 367 $(window).on("resize", function() { 368 if (is_desktop_mode()) { 369 mobile_close_menu(); 370 return; 371 } 372 mobile_close_all_submenus(); 373 }); 374 $(".e8-burger-container button").on("click", function() { 375 if (is_desktop_mode()) return; 376 mobile_toggle_menu(); 377 }); 378 $(`#menu-main-menu ${li_item_string} > a, #menu-main-menu ${li_item_string} > .menu-item-column-heading`).on({ 379 click: function(e) { 380 if (is_mobile_mode()) return; 381 if (e.currentTarget !== this) return; 382 e.preventDefault(); 383 if ($(this).attr("aria-expanded") === "true") { 384 close_currently_opened_submenus(); 385 } else { 386 close_currently_opened_submenus($(this)); 387 desktop_open_submenu($(this)); 388 } 389 } 390 }); 391 $(`#menu-main-menu ${li_item_string} > .menu-item-column-heading`).on("keydown", function(e) { 392 if (e.key === "Enter") { 393 $(this).click(); 394 } 395 }); 396 $(`#menu-main-menu li > a, #menu-main-menu li > .menu-item-column-heading`).on("focus", function(e) { 397 close_currently_opened_submenus($(this)); 398 }); 399 $(document).on("click", function(e) { 400 if (is_mobile_mode()) return; 401 if ($(e.target).closest(`#menu-main-menu ${li_item_string}`).length === 0) { 402 close_currently_opened_submenus(); 403 } 404 }); 405 $(window).on("scroll", function() { 406 last_known_scroll_position = $(window).scrollTop(); 407 if (!ticking) { 408 window.requestAnimationFrame(function() { 409 update_user_scrolled(last_known_scroll_position); 410 ticking = false;
411 }); 412 ticking = true; 413 } 414 }); 415 add_column_count_class_to_sub_menu_containers(); 416 update_user_scrolled($(window).scrollTop()); 417}); 418 419})(); 420 421// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 422(() => { 423var __webpack_exports__ = {}; 424/*!******************************************************!*\ 425 !*** ./src/components/post-list/post-list.public.js ***! 426 \******************************************************/ 427__webpack_require__.r(__webpack_exports__); 428/* harmony import */ var _js_usePagination_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @js/usePagination.js */ "./src/js/usePagination.js"); 429 430let $ = jQuery; 431class E8_Post_List { 432 post_list_element = null; 433 constructor(post_list_element) { 434 if (post_list_element instanceof jQuery) { 435 this.post_list_element = post_list_element; 436 this.register_events(); 437 let post_list_pagination_element = this.post_list_element.find(".post-list-pagination-container"); 438 if (post_list_pagination_element.length) { 439 let pagination_element = (0,_js_usePagination_js__WEBPACK_IMPORTED_MODULE_0__.scaffoldPagination)( 440 post_list_pagination_element.attr("data-current-page"), 441 post_list_pagination_element.attr("data-total-pages"), 442 this.get_post_list_id() + "-pagination" 443 ); 444 if (pagination_element instanceof jQuery) { 445 this.post_list_element.find(".post-list-pagination-container").append(pagination_element); 446 } 447 } 448 } else { 449 console.error("Could not generate post list."); 450 } 451 } 452 get_post_list_id() { 453 return this.post_list_element.attr("id"); 454 } 455 get_term() { 456 return this.post_list_element.find(".post-list-results").attr("data-term") ?? ""; 457 } 458 get_taxonomy() { 459 return this.post_list_element.find(".post-list-results").attr("data-taxonomy") ?? ""; 460 } 461 get_current_page() { 462 return this.post_list_element.find(".post-list-results").attr("data-current-page") ?? "1"; 463 } 464 reset_current_page() { 465 return this.post_list_element.find(".post-list-results").attr("data-current-page", "1"); 466 } 467 set_current_page(next_page) { 468 this.post_list_element.find(".post-list-results").attr("data-current-page", next_page); 469 } 470 get_fetch_posts_by() { 471 return this.post_list_element.find(".post-list-pagination-container").length ? "pagination" : "load-more"; 472 } 473 get_nonce() { 474 return this.post_list_element.attr("data-nonce"); 475 } 476 show_spinner() { 477 this.post_list_element.find(".post-list-spinner").show(); 478 } 479 hide_spinner() { 480 this.post_list_element.find(".post-list-spinner").hide(); 481 } 482 show_load_more_button() { 483 this.post_list_element.find(".post-list-results-load-more").show(); 484 } 485 hide_load_more_button() { 486 this.post_list_element.find(".post-list-results-load-more").hide(); 487 } 488 show_no_posts_text() { 489 this.post_list_element.find(".post-list-no-results").show(); 490 } 491 hide_no_posts_text() { 492 this.post_list_element.find(".post-list-no-results").hide(); 493 } 494 show_results() { 495 this.post_list_element.find(".post-list-results").show(); 496 } 497 hide_results() { 498 this.post_list_element.find(".post-list-results").hide(); 499 } 500 clear_results() { 501 this.post_list_element.find(".post-list-results").empty(); 502 } 503 render_results(results) { 504 let results_container = this.post_list_element.find(".post-list-results"); 505 let result_template = this.post_list_element.children("template").html(); 506 let result_html = ""; 507 for (let result of results) { 508 let result_item = $(result_template); 509 result_item.attr("aria-label", result.title); 510 result_item.attr("class", result.has_post_thumbnail); 511 result_item.find(".post-title-short").html(result.title_short); 512 result_item.find(".post-title").html(result.title); 513 result_item.find(".post-permalink").attr("href", result.link); 514 result_item.find(".post-featured-image").addClass(result.has_post_thumbnail); 515 result_item.find(".post-featured-image img").attr("src", result.img_src).attr("alt", result.img_alt); 516 result_item.find(".post-date").text(result.date); 517 result_item.find(".post-excerpt").html(result.excerpt); 518 result_html += result_item.prop("outerHTML"); 519 } 520 results_container.append(result_html); 521 } 522 fetch_results() { 523 let self = this; 524 let action = "fetch_post_list_results"; 525 let nonce = this.get_nonce();
526 let current_page = this.get_current_page(); 527 let term = this.get_term(); 528 let taxonomy = this.get_taxonomy(); 529 let post_list_id = this.get_post_list_id(); 530 this.hide_no_posts_text(); 531 this.show_spinner(); 532 $.ajax({ 533 url: localized_vars.ajaxurl, 534 method: "post", 535 dataType: "json", 536 data: { 537 action, 538 nonce, 539 post_list_id, 540 current_page, 541 taxonomy, 542 term 543 } 544 }).always(function() { 545 self.hide_spinner(); 546 self.show_results(); 547 }).error((err) => { 548 console.log("Error:"); 549 console.log(err); 550 }).success((res) => { 551 console.log(res); 552 if (res.hasOwnProperty("status") && res.status === "success") { 553 if (res.results_html === "") { 554 self.hide_results(); 555 self.show_no_posts_text(); 556 this.post_list_element.find(".post-list-results-string").text(""); 557 } else { 558 let results_container = this.post_list_element.find(".post-list-results"); 559 if (self.get_fetch_posts_by() === "load-more") { 560 if (current_page === "1") { 561 self.clear_results(); 562 } 563 results_container.append(res.results_html); 564 if (res.load_more) { 565 self.show_load_more_button(); 566 } else { 567 self.hide_load_more_button(); 568 } 569 } else { 570 (0,_js_usePagination_js__WEBPACK_IMPORTED_MODULE_0__.clearPagination)(`${this.get_post_list_id()}-pagination`); 571 self.clear_results(); 572 results_container.append(res.results_html); 573 this.post_list_element.find(".post-list-pagination-container").attr("data-current-page", res.pagination.current_page); 574 this.post_list_element.find(".post-list-pagination-container").attr("data-total-pages", res.pagination.total_pages); 575 let pagination_element = (0,_js_usePagination_js__WEBPACK_IMPORTED_MODULE_0__.scaffoldPagination)(res.pagination.current_page, res.pagination.total_pages, `${this.get_post_list_id()}-pagination`); 576 if (pagination_element instanceof jQuery) { 577 this.post_list_element.find(".post-list-pagination-container").append(pagination_element); 578 } 579 } 580 console.log("this.post_list_element.find(.post-list-results-string)", this.post_list_element.find(".post-list-results-string")); 581 this.post_list_element.find(".post-list-results-string").text(`Now showing page ${res.pagination.current_page} of ${res.pagination.total_pages} with ${res.pagination.total_results} results.`); 582 if (res.current_page) { 583 self.set_current_page(res.current_page); 584 } 585 } 586 } else { 587 self.hide_results(); 588 } 589 }); 590 } 591 register_events() { 592 let self = this; 593 this.post_list_element.find("button.post-list-results-load-more").on("click", function(e) { 594 e.preventDefault(); 595 let page = self.get_current_page(); 596 self.set_current_page(++page); 597 self.fetch_results(); 598 }); 599 let post_list_taxonomy_element = this.post_list_element.closest(".wp-site-blocks").find(".wp-block-e8-post-list-taxonomy"); 600 if (post_list_taxonomy_element.length) { 601 post_list_taxonomy_element.on("click", "[data-taxonomy]", function() { 602 $(this).closest("li").siblings(".active").each(function() { 603 $(this).removeClass("active").find("button").attr("aria-pressed", "false"); 604 }); 605 $(this).closest("li").addClass("active").find("button").attr("aria-pressed", "true"); 606 let term = $(this).attr("data-term"); 607 let taxonomy = $(this).attr("data-taxonomy"); 608 self.post_list_element.find(".post-list-results").attr("data-term", term); 609 self.post_list_element.find(".post-list-results").attr("data-taxonomy", taxonomy); 610 self.reset_current_page(); 611 self.fetch_results(); 612 }); 613 } 614 let post_list_pagination_element = this.post_list_element.find(".post-list-pagination-container"); 615 if (post_list_pagination_element.length) { 616 post_list_pagination_element.on("click", `.e8-pagination-element .page-num[data-page]:not(.disabled)`, function() { 617 let page = $(this).attr("data-page"); 618 self.set_current_page(page); 619 self.fetch_results(); 620 });
621 post_list_pagination_element.on("keydown", `.e8-pagination-element .page-num[data-page]:not(.disabled)`, function() { 622 $(this).click(); 623 }); 624 } 625 } 626} 627jQuery(($2) => { 628 "use strict"; 629 if (!$2(".wp-block-e8-post-list").length) return; 630 $2(".wp-block-e8-post-list").each(function() { 631 new E8_Post_List($2(this)); 632 }); 633}); 634 635})(); 636 637// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 638(() => { 639var __webpack_exports__ = {}; 640/*!******************************************************!*\ 641 !*** ./src/components/jobs-list/jobs-list.public.js ***! 642 \******************************************************/ 643__webpack_require__.r(__webpack_exports__); 644/* harmony import */ var _js_usePagination_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @js/usePagination.js */ "./src/js/usePagination.js"); 645 646let $ = jQuery; 647class E8_Jobs_List { 648 jobs_list_element = null; 649 constructor(jobs_list_element) { 650 if (jobs_list_element instanceof jQuery) { 651 this.jobs_list_element = jobs_list_element; 652 this.register_events(); 653 let post_list_pagination_element = this.jobs_list_element.find(".jobs-list-pagination-container"); 654 if (post_list_pagination_element.length) { 655 let pagination_element = (0,_js_usePagination_js__WEBPACK_IMPORTED_MODULE_0__.scaffoldPagination)( 656 post_list_pagination_element.attr("data-current-page"), 657 post_list_pagination_element.attr("data-total-pages") 658 ); 659 if (pagination_element instanceof jQuery) { 660 $(".jobs-list-pagination-container").append(pagination_element); 661 } 662 } 663 this.fetch_results(); 664 } else { 665 console.error("Could not generate post list."); 666 } 667 } 668 get_job_category() { 669 return this.jobs_list_element.find(".jobs-list-results").attr("data-term") ?? ""; 670 } 671 get_duration() { 672 let job_list_search_container_element = this.jobs_list_element.closest(".wp-site-blocks").find(".wp-block-e8-job-list-search-bar"); 673 if (job_list_search_container_element.length) { 674 return job_list_search_container_element.find("#job-list-search-time-type").val() ?? null; 675 } 676 return null; 677 } 678 get_search() { 679 let job_list_search_container_element = this.jobs_list_element.closest(".wp-site-blocks").find(".wp-block-e8-job-list-search-bar"); 680 if (job_list_search_container_element.length) { 681 return job_list_search_container_element.find("#job-list-search-input").val() ?? null; 682 } 683 return null; 684 } 685 get_current_page() { 686 return this.jobs_list_element.find(".jobs-list-results").attr("data-current-page") ?? "1"; 687 } 688 reset_current_page() { 689 return this.jobs_list_element.find(".jobs-list-results").attr("data-current-page", "1"); 690 } 691 set_current_page(next_page) { 692 this.jobs_list_element.find(".jobs-list-results").attr("data-current-page", next_page); 693 } 694 get_fetch_posts_by() { 695 return "pagination"; 696 } 697 get_nonce() { 698 return this.jobs_list_element.attr("data-nonce"); 699 } 700 show_spinner() { 701 this.jobs_list_element.find(".jobs-list-spinner").show(); 702 } 703 hide_spinner() { 704 this.jobs_list_element.find(".jobs-list-spinner").hide(); 705 } 706 show_no_posts_text() { 707 this.jobs_list_element.find(".jobs-list-no-results").show(); 708 } 709 hide_no_posts_text() { 710 this.jobs_list_element.find(".jobs-list-no-results").hide(); 711 } 712 show_results() { 713 this.jobs_list_element.find(".jobs-list-results").show(); 714 } 715 hide_results() { 716 this.jobs_list_element.find(".jobs-list-results").hide(); 717 } 718 clear_results() { 719 this.jobs_list_element.find(".jobs-list-results").empty(); 720 } 721 fetch_results() { 722 let self = this; 723 let action = "e8_fetch_jobs_list"; 724 let nonce = this.get_nonce(); 725 let current_page = this.get_current_page(); 726 let job_category = this.get_job_category(); 727 let search = this.get_search(); 728 let duration = this.get_duration(); 729 this.hide_no_posts_text(); 730 this.show_spinner(); 731 $.ajax({ 732 url: localized_vars.ajaxurl, 733 method: "post", 734 dataType: "json", 735 data: { 736 action, 737 nonce, 738 current_page, 739 job_category, 740 duration, 741 search 742 } 743 }).always(function() { 744 self.hide_spinner(); 745 self.show_results(); 746 }).error((err) => { 747 console.log("Error:"); 748 console.log(err); 749 }).success((res) => { 750 if (res.hasOwnProperty("status") && res.status === "success") { 751 if (res.results_html === "") { 752 self.hide_results(); 753 self.show_no_posts_text(); 754 $("#jobs-list-results-string").text(""); 755 } else { 756 (0,_js_usePagination_js__WEBPACK_IMPORTED_MODULE_0__.clearPagination)(); 757 self.clear_results(); 758 let results_container = this.jobs_list_element.find(".jobs-list-results"); 759 results_container.append(res.results_html); 760 $(".jobs-list-pagination-container").attr("data-current-page", res.pagination.current_page); 761 $(".jobs-list-pagination-container").attr("data-total-pages", res.pagination.total_pages); 762 $("#jobs-list-results-string").text(`Now showing page ${res.pagination.current_page} of ${res.pagination.total_pages} with ${res.pagination.total_results} opportunities.`); 763 let pagination_element = (0,_js_usePagination_js__WEBPACK_IMPORTED_MODULE_0__.scaffoldPagination)(res.pagination.current_page, res.pagination.total_pages); 764 if (pagination_element instanceof jQuery) { 765 $(".jobs-list-pagination-container").append(pagination_element); 766 } 767 if (res.current_page) { 768 self.set_current_page(res.current_page); 769 } 770 } 771 } else { 772 self.hide_results(); 773 } 774 }); 775 } 776 register_events() { 777 let self = this; 778 this.jobs_list_element.find("button.jobs-list-results-load-more").on("click", function(e) { 779 e.preventDefault(); 780 let page = self.get_current_page(); 781 self.set_current_page(++page); 782 self.fetch_results(); 783 }); 784 let post_list_taxonomy_element = this.jobs_list_element.closest(".wp-site-blocks").find(".wp-block-e8-post-list-taxonomy"); 785 if (post_list_taxonomy_element.length) { 786 post_list_taxonomy_element.on("click", "[data-taxonomy]", function() { 787 $(this).closest("li").siblings(".active").each(function() { 788 $(this).removeClass("active").find("button").attr("aria-pressed", "false"); 789 }); 790 $(this).closest("li").addClass("active").find("button").attr("aria-pressed", "true"); 791 let term = $(this).attr("data-term"); 792 let taxonomy = $(this).attr("data-taxonomy"); 793 self.jobs_list_element.find(".jobs-list-results").attr("data-term", term); 794 self.jobs_list_element.find(".jobs-list-results").attr("data-taxonomy", taxonomy); 795 self.reset_current_page(); 796 self.fetch_results(); 797 }); 798 } 799 let post_list_pagination_element = this.jobs_list_element.find(".jobs-list-pagination-container"); 800 if (post_list_pagination_element.length) { 801 post_list_pagination_element.on("click", `.e8-pagination-element .page-num[data-page]:not(.disabled)`, function() { 802 let page = $(this).attr("data-page"); 803 self.set_current_page(page); 804 self.fetch_results(); 805 });
806 post_list_pagination_element.on("keydown", `.e8-pagination-element .page-num[data-page]:not(.disabled)`, function() { 807 $(this).click(); 808 }); 809 } 810 let job_list_search_container_element = this.jobs_list_element.closest(".wp-site-blocks").find(".wp-block-e8-job-list-search-bar"); 811 if (job_list_search_container_element.length) { 812 job_list_search_container_element.on("click", "#job-list-search-submit", function() { 813 self.fetch_results(); 814 }); 815 job_list_search_container_element.on("keydown", "#job-list-search-input", function(e) { 816 if (e.key === "Enter") { 817 self.fetch_results(); 818 } 819 }); 820 job_list_search_container_element.on("input", "#job-list-search-time-type", function() { 821 self.fetch_results(); 822 }); 823 } 824 } 825} 826jQuery(($2) => { 827 "use strict"; 828 if (!$2(".wp-block-e8-jobs-list").length) return; 829 $2(".wp-block-e8-jobs-list").each(function() { 830 new E8_Jobs_List($2(this)); 831 }); 832}); 833 834})(); 835 836// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. 837(() => { 838/*!******************************!*\ 839 !*** ./src/scss/public.scss ***! 840 \******************************/ 841__webpack_require__.r(__webpack_exports__); 842// extracted by mini-css-extract-plugin 843 844})(); 845 846/******/ })() 847; 848//# sourceMappingURL=public.min.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.