| @@ -324,12 +324,9 @@ | ||
| 324 | 324 | let lp_rest_url; |
| 325 | 325 | if ('undefined' !== typeof lpDataAdmin) { |
| 326 | 326 | lp_rest_url = lpDataAdmin.lp_rest_url; |
| 327 | 327 | lplistAPI.admin = { |
| 328 | - apiAdminNotice: lp_rest_url + 'lp/v1/admin/tools/admin-notices', | |
| 329 | - apiAddons: lp_rest_url + 'lp/v1/addon/all', | |
| 330 | - apiAddonAction: lp_rest_url + 'lp/v1/addon/action-n', | |
| 331 | - apiAddonsPurchase: lp_rest_url + 'lp/v1/addon/info-addons-purchase', | |
| 328 | + // apiAdminNotice: lp_rest_url + 'lp/v1/admin/tools/admin-notices', | |
| 332 | 329 | apiSearchCourses: lp_rest_url + 'lp/v1/admin/tools/search-course', |
| 333 | 330 | apiSearchUsers: lp_rest_url + 'lp/v1/admin/tools/search-user', |
| 334 | 331 | apiAssignUserCourse: lp_rest_url + 'lp/v1/admin/tools/assign-user-course', |
| 335 | 332 | apiUnAssignUserCourse: lp_rest_url + 'lp/v1/admin/tools/unassign-user-course' |
| @@ -365,8 +362,9 @@ | ||
| 365 | 362 | __webpack_require__.r(__webpack_exports__); |
| 366 | 363 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 367 | 364 | /* harmony export */ debounce: () => (/* binding */ debounce), |
| 368 | 365 | /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers), |
| 366 | +/* harmony export */ fullScreenView: () => (/* binding */ fullScreenView), | |
| 369 | 367 | /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm), |
| 370 | 368 | /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm), |
| 371 | 369 | /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated), |
| 372 | 370 | /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed), |
| @@ -378,9 +376,10 @@ | ||
| 378 | 376 | /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady), |
| 379 | 377 | /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl), |
| 380 | 378 | /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl), |
| 381 | 379 | /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm), |
| 382 | -/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse) | |
| 380 | +/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse), | |
| 381 | +/* harmony export */ toggleEnable: () => (/* binding */ toggleEnable) | |
| 383 | 382 | /* harmony export */ }); |
| 384 | 383 | /** |
| 385 | 384 | * Utils functions |
| 386 | 385 | * |
| @@ -387,9 +386,9 @@ | ||
| 387 | 386 | * @param url |
| 388 | 387 | * @param data |
| 389 | 388 | * @param functions |
| 390 | 389 | * @since 4.2.5.1 |
| 391 | - * @version 1.0.6 | |
| 390 | + * @version 1.0.7 | |
| 392 | 391 | */ |
| 393 | 392 | const lpClassName = { |
| 394 | 393 | hidden: 'lp-hidden', |
| 395 | 394 | loading: 'loading', |
| @@ -394,9 +393,12 @@ | ||
| 394 | 393 | hidden: 'lp-hidden', |
| 395 | 394 | loading: 'loading', |
| 396 | 395 | elCollapse: 'lp-collapse', |
| 397 | 396 | elSectionToggle: '.lp-section-toggle', |
| 398 | - elTriggerToggle: '.lp-trigger-toggle' | |
| 397 | + elTriggerToggle: '.lp-trigger-toggle', | |
| 398 | + elBtnFullScreen: '.lp-btn-full-screen-view', | |
| 399 | + elFullScreen: 'lp-full-screen-view', | |
| 400 | + elBtnFullScreenClose: 'lp-full-screen-view__close' | |
| 399 | 401 | }; |
| 400 | 402 | const lpFetchAPI = (url, data = {}, functions = {}) => { |
| 401 | 403 | if ('function' === typeof functions.before) { |
| 402 | 404 | functions.before(); |
| @@ -714,8 +716,141 @@ | ||
| 714 | 716 | timer = setTimeout(() => func(args), wait); |
| 715 | 717 | }; |
| 716 | 718 | }; |
| 717 | 719 | |
| 720 | +/** | |
| 721 | + * Initialize lp-toggle-enable components. | |
| 722 | + * | |
| 723 | + * Finds all `.lp-toggle-enable` elements and wires up toggle behavior. | |
| 724 | + * Reads initial state from `data-enabled` attribute ("true"/"false"). | |
| 725 | + * Calls `data-on-toggle` callback (if provided via options) on state change. | |
| 726 | + * | |
| 727 | + * HTML structure: | |
| 728 | + * <label class="lp-toggle-enable" data-enabled="true"> | |
| 729 | + * <input type="checkbox" class="lp-toggle-enable__input" /> | |
| 730 | + * <span class="lp-toggle-enable__track"></span> | |
| 731 | + * </label> | |
| 732 | + * | |
| 733 | + * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable') | |
| 734 | + * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change | |
| 735 | + * @since 4.4.5 | |
| 736 | + * @version 1.0.0 | |
| 737 | + */ | |
| 738 | +window.lpToggleEnableInit = 0; | |
| 739 | +const toggleEnable = (onToggle = null) => { | |
| 740 | + if (window.lpToggleEnableInit) { | |
| 741 | + return; | |
| 742 | + } | |
| 743 | + window.lpToggleEnableInit = 1; | |
| 744 | + const selector = '.lp-toggle-enable'; | |
| 745 | + const updateUI = (toggle, isEnabled) => { | |
| 746 | + toggle.classList.toggle('is-enabled', isEnabled); | |
| 747 | + const input = toggle.querySelector('.lp-toggle-enable__input'); | |
| 748 | + if (input) { | |
| 749 | + input.checked = isEnabled; | |
| 750 | + input.value = isEnabled ? '1' : '0'; | |
| 751 | + } | |
| 752 | + }; | |
| 753 | + | |
| 754 | + // Delegate click handling via eventHandlers. | |
| 755 | + eventHandlers('click', [{ | |
| 756 | + selector, | |
| 757 | + callBack: args => { | |
| 758 | + const { | |
| 759 | + e, | |
| 760 | + target | |
| 761 | + } = args; | |
| 762 | + const toggle = target.closest(selector); | |
| 763 | + if (!toggle || toggle.classList.contains('is-disabled')) { | |
| 764 | + return; | |
| 765 | + } | |
| 766 | + e.preventDefault(); | |
| 767 | + const isEnabled = !toggle.classList.contains('is-enabled'); | |
| 768 | + updateUI(toggle, isEnabled); | |
| 769 | + if ('function' === typeof onToggle) { | |
| 770 | + onToggle(toggle, isEnabled); | |
| 771 | + } | |
| 772 | + } | |
| 773 | + }]); | |
| 774 | +}; | |
| 775 | + | |
| 776 | +/** | |
| 777 | + * Initialize custom fullscreen view buttons. | |
| 778 | + * | |
| 779 | + * Delegates clicks on `.lp-btn-full-screen-view` buttons to | |
| 780 | + * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the | |
| 781 | + * target element. Falls back to the button's parent element when | |
| 782 | + * `data-target` is not provided. | |
| 783 | + * | |
| 784 | + * @since 4.4.5 | |
| 785 | + * @version 1.0.0 | |
| 786 | + */ | |
| 787 | +window.lpFullScreenViewInit = 0; | |
| 788 | +const fullScreenView = () => { | |
| 789 | + if (window.lpFullScreenViewInit) { | |
| 790 | + return; | |
| 791 | + } | |
| 792 | + window.lpFullScreenViewInit = 1; | |
| 793 | + let lastScrollY = 0; | |
| 794 | + const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => { | |
| 795 | + const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen); | |
| 796 | + if (isFullscreen) { | |
| 797 | + elTarget.classList.remove(lpClassName.elFullScreen); | |
| 798 | + document.documentElement.classList.remove('lp-full-screen-active'); | |
| 799 | + window.scrollTo(0, lastScrollY); | |
| 800 | + } else { | |
| 801 | + lastScrollY = window.scrollY; | |
| 802 | + elTarget.classList.add(lpClassName.elFullScreen); | |
| 803 | + document.documentElement.classList.add('lp-full-screen-active'); | |
| 804 | + } | |
| 805 | + if (!isFullscreen) { | |
| 806 | + if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) { | |
| 807 | + const closeButton = document.createElement('button'); | |
| 808 | + closeButton.type = 'button'; | |
| 809 | + closeButton.className = lpClassName.elBtnFullScreenClose; | |
| 810 | + closeButton.setAttribute('aria-label', 'Close'); | |
| 811 | + closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close ×'; | |
| 812 | + closeButton.addEventListener('click', e => { | |
| 813 | + e.preventDefault(); | |
| 814 | + lpToggleFullscreenView(elTarget); | |
| 815 | + }); | |
| 816 | + elTarget.appendChild(closeButton); | |
| 817 | + } | |
| 818 | + } else { | |
| 819 | + const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`); | |
| 820 | + if (closeButton) { | |
| 821 | + closeButton.remove(); | |
| 822 | + } | |
| 823 | + } | |
| 824 | + }; | |
| 825 | + eventHandlers('click', [{ | |
| 826 | + selector: lpClassName.elBtnFullScreen, | |
| 827 | + callBack: args => { | |
| 828 | + const { | |
| 829 | + e, | |
| 830 | + target | |
| 831 | + } = args; | |
| 832 | + const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen); | |
| 833 | + if (!elBtnFullScreen) { | |
| 834 | + console.log('No full screen button found'); | |
| 835 | + return; | |
| 836 | + } | |
| 837 | + e.preventDefault(); | |
| 838 | + let elTarget = null; | |
| 839 | + const targetSelector = elBtnFullScreen.dataset.targetFullscreen; | |
| 840 | + console.log(targetSelector); | |
| 841 | + if (targetSelector) { | |
| 842 | + elTarget = document.querySelector(targetSelector); | |
| 843 | + } | |
| 844 | + if (!elTarget) { | |
| 845 | + console.log('No target element found'); | |
| 846 | + return; | |
| 847 | + } | |
| 848 | + lpToggleFullscreenView(elTarget, elBtnFullScreen); | |
| 849 | + } | |
| 850 | + }]); | |
| 851 | +}; | |
| 852 | + | |
| 718 | 853 | /***/ }, |
| 719 | 854 | |
| 720 | 855 | /***/ "react" |
| 721 | 856 | /*!************************!*\ |
| @@ -894,19 +1029,19 @@ | ||
| 894 | 1029 | |
| 895 | 1030 | /******/ }); |
| 896 | 1031 | /************************************************************************/ |
| 897 | 1032 | /******/ // The module cache |
| 898 | -/******/ var __webpack_module_cache__ = {}; | |
| 1033 | +/******/ const __webpack_module_cache__ = {}; | |
| 899 | 1034 | /******/ |
| 900 | 1035 | /******/ // The require function |
| 901 | 1036 | /******/ function __webpack_require__(moduleId) { |
| 902 | 1037 | /******/ // Check if module is in cache |
| 903 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 1038 | +/******/ const cachedModule = __webpack_module_cache__[moduleId]; | |
| 904 | 1039 | /******/ if (cachedModule !== undefined) { |
| 905 | 1040 | /******/ return cachedModule.exports; |
| 906 | 1041 | /******/ } |
| 907 | 1042 | /******/ // Create a new module (and put it into the cache) |
| 908 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 1043 | +/******/ const module = __webpack_module_cache__[moduleId] = { | |
| 909 | 1044 | /******/ // no module.id needed |
| 910 | 1045 | /******/ // no module.loaded needed |
| 911 | 1046 | /******/ exports: {} |
| 912 | 1047 | /******/ }; |
| @@ -913,9 +1048,9 @@ | ||
| 913 | 1048 | /******/ |
| 914 | 1049 | /******/ // Execute the module function |
| 915 | 1050 | /******/ if (!(moduleId in __webpack_modules__)) { |
| 916 | 1051 | /******/ delete __webpack_module_cache__[moduleId]; |
| 917 | -/******/ var e = new Error("Cannot find module '" + moduleId + "'"); | |
| 1052 | +/******/ const e = new Error("Cannot find module '" + moduleId + "'"); | |
| 918 | 1053 | /******/ e.code = 'MODULE_NOT_FOUND'; |
| 919 | 1054 | /******/ throw e; |
| 920 | 1055 | /******/ } |
| 921 | 1056 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| @@ -928,9 +1063,9 @@ | ||
| 928 | 1063 | /******/ /* webpack/runtime/compat get default export */ |
| 929 | 1064 | /******/ (() => { |
| 930 | 1065 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| 931 | 1066 | /******/ __webpack_require__.n = (module) => { |
| 932 | -/******/ var getter = module && module.__esModule ? | |
| 1067 | +/******/ const getter = module && module.__esModule ? | |
| 933 | 1068 | /******/ () => (module['default']) : |
| 934 | 1069 | /******/ () => (module); |
| 935 | 1070 | /******/ __webpack_require__.d(getter, { a: getter }); |
| 936 | 1071 | /******/ return getter; |
| @@ -938,14 +1073,29 @@ | ||
| 938 | 1073 | /******/ })(); |
| 939 | 1074 | /******/ |
| 940 | 1075 | /******/ /* webpack/runtime/define property getters */ |
| 941 | 1076 | /******/ (() => { |
| 942 | -/******/ // define getter functions for harmony exports | |
| 1077 | +/******/ // define getter/value functions for harmony exports | |
| 943 | 1078 | /******/ __webpack_require__.d = (exports, definition) => { |
| 944 | -/******/ for(var key in definition) { | |
| 945 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 946 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 1079 | +/******/ if(Array.isArray(definition)) { | |
| 1080 | +/******/ var i = 0; | |
| 1081 | +/******/ while(i < definition.length) { | |
| 1082 | +/******/ var key = definition[i++]; | |
| 1083 | +/******/ var binding = definition[i++]; | |
| 1084 | +/******/ if(!__webpack_require__.o(exports, key)) { | |
| 1085 | +/******/ if(binding === 0) { | |
| 1086 | +/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); | |
| 1087 | +/******/ } else { | |
| 1088 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); | |
| 1089 | +/******/ } | |
| 1090 | +/******/ } else if(binding === 0) { i++; } | |
| 947 | 1091 | /******/ } |
| 1092 | +/******/ } else { | |
| 1093 | +/******/ for(var key in definition) { | |
| 1094 | +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 1095 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 1096 | +/******/ } | |
| 1097 | +/******/ } | |
| 948 | 1098 | /******/ } |
| 949 | 1099 | /******/ }; |
| 950 | 1100 | /******/ })(); |
| 951 | 1101 | /******/ |
| @@ -950,9 +1100,9 @@ | ||
| 950 | 1100 | /******/ })(); |
| 951 | 1101 | /******/ |
| 952 | 1102 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 953 | 1103 | /******/ (() => { |
| 954 | -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | |
| 1104 | +/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop)) | |
| 955 | 1105 | /******/ })(); |
| 956 | 1106 | /******/ |
| 957 | 1107 | /******/ /* webpack/runtime/make namespace object */ |
| 958 | 1108 | /******/ (() => { |
| @@ -957,9 +1107,9 @@ | ||
| 957 | 1107 | /******/ /* webpack/runtime/make namespace object */ |
| 958 | 1108 | /******/ (() => { |
| 959 | 1109 | /******/ // define __esModule on exports |
| 960 | 1110 | /******/ __webpack_require__.r = (exports) => { |
| 961 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 1111 | +/******/ if(Symbol.toStringTag) { | |
| 962 | 1112 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 963 | 1113 | /******/ } |
| 964 | 1114 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 965 | 1115 | /******/ }; |
| @@ -965,9 +1115,9 @@ | ||
| 965 | 1115 | /******/ }; |
| 966 | 1116 | /******/ })(); |
| 967 | 1117 | /******/ |
| 968 | 1118 | /************************************************************************/ |
| 969 | -var __webpack_exports__ = {}; | |
| 1119 | +let __webpack_exports__ = {}; | |
| 970 | 1120 | // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. |
| 971 | 1121 | (() => { |
| 972 | 1122 | "use strict"; |
| 973 | 1123 | /*!*************************************************************************!*\ |