PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.10
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.10
4.4.10 4.4.9.1 4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 All 142 releases
← All changes | assets/dist/js/admin/lp-themes.js +128 -11 4.4.9 → 4.4.10 View file →
@@ -503,19 +503,19 @@
503 503
504 504 /******/ });
505 505 /************************************************************************/
506 506 /******/ // The module cache
507 -/******/ var __webpack_module_cache__ = {};
507 +/******/ const __webpack_module_cache__ = {};
508 508 /******/
509 509 /******/ // The require function
510 510 /******/ function __webpack_require__(moduleId) {
511 511 /******/ // Check if module is in cache
512 -/******/ var cachedModule = __webpack_module_cache__[moduleId];
512 +/******/ const cachedModule = __webpack_module_cache__[moduleId];
513 513 /******/ if (cachedModule !== undefined) {
514 514 /******/ return cachedModule.exports;
515 515 /******/ }
516 516 /******/ // Create a new module (and put it into the cache)
517 -/******/ var module = __webpack_module_cache__[moduleId] = {
517 +/******/ const module = __webpack_module_cache__[moduleId] = {
518 518 /******/ // no module.id needed
519 519 /******/ // no module.loaded needed
520 520 /******/ exports: {}
521 521 /******/ };
@@ -522,9 +522,9 @@
522 522 /******/
523 523 /******/ // Execute the module function
524 524 /******/ if (!(moduleId in __webpack_modules__)) {
525 525 /******/ delete __webpack_module_cache__[moduleId];
526 -/******/ var e = new Error("Cannot find module '" + moduleId + "'");
526 +/******/ const e = new Error("Cannot find module '" + moduleId + "'");
527 527 /******/ e.code = 'MODULE_NOT_FOUND';
528 528 /******/ throw e;
529 529 /******/ }
530 530 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
@@ -535,14 +535,29 @@
535 535 /******/
536 536 /************************************************************************/
537 537 /******/ /* webpack/runtime/define property getters */
538 538 /******/ (() => {
539 -/******/ // define getter functions for harmony exports
539 +/******/ // define getter/value functions for harmony exports
540 540 /******/ __webpack_require__.d = (exports, definition) => {
541 -/******/ for(var key in definition) {
542 -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
543 -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
541 +/******/ if(Array.isArray(definition)) {
542 +/******/ var i = 0;
543 +/******/ while(i < definition.length) {
544 +/******/ var key = definition[i++];
545 +/******/ var binding = definition[i++];
546 +/******/ if(!__webpack_require__.o(exports, key)) {
547 +/******/ if(binding === 0) {
548 +/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
549 +/******/ } else {
550 +/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
551 +/******/ }
552 +/******/ } else if(binding === 0) { i++; }
544 553 /******/ }
554 +/******/ } else {
555 +/******/ for(var key in definition) {
556 +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
557 +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
558 +/******/ }
559 +/******/ }
545 560 /******/ }
546 561 /******/ };
547 562 /******/ })();
548 563 /******/
@@ -547,9 +562,9 @@
547 562 /******/ })();
548 563 /******/
549 564 /******/ /* webpack/runtime/hasOwnProperty shorthand */
550 565 /******/ (() => {
551 -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
566 +/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop))
552 567 /******/ })();
553 568 /******/
554 569 /******/ /* webpack/runtime/make namespace object */
555 570 /******/ (() => {
@@ -554,9 +569,9 @@
554 569 /******/ /* webpack/runtime/make namespace object */
555 570 /******/ (() => {
556 571 /******/ // define __esModule on exports
557 572 /******/ __webpack_require__.r = (exports) => {
558 -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
573 +/******/ if(Symbol.toStringTag) {
559 574 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
560 575 /******/ }
561 576 /******/ Object.defineProperty(exports, '__esModule', { value: true });
562 577 /******/ };
@@ -562,9 +577,9 @@
562 577 /******/ };
563 578 /******/ })();
564 579 /******/
565 580 /************************************************************************/
566 -var __webpack_exports__ = {};
581 +let __webpack_exports__ = {};
567 582 // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
568 583 (() => {
569 584 /*!******************************************!*\
570 585 !*** ./assets/src/js/admin/lp-themes.js ***!
@@ -589,10 +604,15 @@
589 604 static selectors = {
590 605 container: '.learn-press-themes',
591 606 elListThemes: '.lp-themes-grid',
592 607 filter: '.lp-themes-filter__item',
608 + filterToggle: '.lp-themes-filter__toggle',
593 609 count: '.lp-themes-filter__count',
594 610 search: '.lp-themes-search__input',
611 + searchContainer: '.lp-themes-search',
612 + searchButton: '.lp-themes-search__btn',
613 + searchClear: '.lp-themes-search__btn-clear',
614 + searchClose: '.lp-themes-search__close',
595 615 card: '.lp-theme-card',
596 616 title: '.lp-theme-card__title',
597 617 description: '.lp-theme-card__description'
598 618 };
@@ -625,10 +645,105 @@
625 645 selector: LPThemes.selectors.search,
626 646 callBack: this.filterThemes.name,
627 647 class: this
628 648 }]);
649 + lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('click', [{
650 + selector: LPThemes.selectors.searchButton,
651 + callBack: this.openSearch.name,
652 + class: this
653 + }, {
654 + selector: LPThemes.selectors.searchClear,
655 + callBack: this.clearSearch.name,
656 + class: this
657 + }, {
658 + selector: LPThemes.selectors.searchClose,
659 + callBack: this.closeSearch.name,
660 + class: this
661 + }, {
662 + selector: LPThemes.selectors.filterToggle,
663 + callBack: this.toggleFilterMenu.name,
664 + class: this
665 + }]);
666 + document.addEventListener('click', event => {
667 + const toolbar = this.container?.querySelector('.lp-themes-toolbar');
668 + if (toolbar?.classList.contains('is-filter-open') && !toolbar.contains(event.target)) {
669 + this.toggleFilterMenu(false);
670 + }
671 + });
672 + document.addEventListener('keydown', event => {
673 + if ('Escape' === event.key) {
674 + this.closeSearch();
675 + this.toggleFilterMenu(false);
676 + }
677 + });
629 678 }
630 679
680 + /** Toggle the tablet and mobile category menu. */
681 + toggleFilterMenu(open) {
682 + const toolbar = this.container.querySelector('.lp-themes-toolbar');
683 + const button = this.container.querySelector(LPThemes.selectors.filterToggle);
684 + if (!toolbar || !button) {
685 + return;
686 + }
687 + const shouldOpen = typeof open === 'boolean' ? open : !toolbar.classList.contains('is-filter-open');
688 + toolbar.classList.toggle('is-filter-open', shouldOpen);
689 + button.setAttribute('aria-expanded', shouldOpen ? 'true' : 'false');
690 + }
691 +
692 + /** Open the compact search field. */
693 + openSearch() {
694 + const search = this.container.querySelector(LPThemes.selectors.searchContainer);
695 + if (!search) {
696 + return;
697 + }
698 + this.toggleFilterMenu(false);
699 + search.classList.add('is-open');
700 + search.querySelector(LPThemes.selectors.searchButton)?.setAttribute('aria-expanded', 'true');
701 + this.updateSearchClearBtnState();
702 + search.querySelector(LPThemes.selectors.search)?.focus();
703 + }
704 +
705 + /** Close the compact search field. */
706 + closeSearch() {
707 + if (!this.container) {
708 + return;
709 + }
710 + const search = this.container.querySelector(LPThemes.selectors.searchContainer);
711 + if (!search) {
712 + return;
713 + }
714 + if (!search.classList.contains('is-open')) {
715 + return;
716 + }
717 + search.classList.remove('is-open');
718 + search.querySelector(LPThemes.selectors.searchButton)?.setAttribute('aria-expanded', 'false');
719 + this.updateSearchClearBtnState();
720 + search.querySelector(LPThemes.selectors.searchButton)?.focus();
721 + }
722 +
723 + /** Clear the search input field and re-filter themes. */
724 + clearSearch(args) {
725 + if (args?.e) {
726 + args.e.preventDefault();
727 + }
728 + const search = this.container?.querySelector(LPThemes.selectors.search);
729 + if (search) {
730 + search.value = '';
731 + this.updateSearchClearBtnState();
732 + this.filterThemes();
733 + search.focus();
734 + }
735 + }
736 +
737 + /** Update disabled state of clear search button. */
738 + updateSearchClearBtnState() {
739 + const search = this.container?.querySelector(LPThemes.selectors.search);
740 + const clearBtn = this.container?.querySelector(LPThemes.selectors.searchClear);
741 + if (clearBtn && search) {
742 + clearBtn.disabled = !search.value.trim();
743 + }
744 + }
745 +
631 746 /**
632 747 * Count themes and update each category count.
633 748 */
634 749 countThemes() {
@@ -666,8 +781,9 @@
666 781 if (!container) {
667 782 return;
668 783 }
669 784 e.preventDefault();
785 + this.toggleFilterMenu(false);
670 786 container.querySelectorAll(LPThemes.selectors.filter).forEach(item => {
671 787 const isActive = item === filter;
672 788 item.classList.toggle('active', isActive);
673 789 item.setAttribute('aria-pressed', isActive ? 'true' : 'false');
@@ -680,8 +796,9 @@
680 796 */
681 797 filterThemes() {
682 798 const container = this.container;
683 799 const search = container.querySelector(LPThemes.selectors.search);
800 + this.updateSearchClearBtnState();
684 801 const query = search ? search.value.trim().toLowerCase() : '';
685 802 const searchTerms = query.split(/\s+/).filter(Boolean);
686 803 const active = container.querySelector(`${LPThemes.selectors.filter}.active`);
687 804 const category = active ? active.getAttribute('data-category') : 'all';