| @@ -891,12 +891,9 @@ | ||
| 891 | 891 | let lp_rest_url; |
| 892 | 892 | if ('undefined' !== typeof lpDataAdmin) { |
| 893 | 893 | lp_rest_url = lpDataAdmin.lp_rest_url; |
| 894 | 894 | lplistAPI.admin = { |
| 895 | - apiAdminNotice: lp_rest_url + 'lp/v1/admin/tools/admin-notices', | |
| 896 | - apiAddons: lp_rest_url + 'lp/v1/addon/all', | |
| 897 | - apiAddonAction: lp_rest_url + 'lp/v1/addon/action-n', | |
| 898 | - apiAddonsPurchase: lp_rest_url + 'lp/v1/addon/info-addons-purchase', | |
| 895 | + // apiAdminNotice: lp_rest_url + 'lp/v1/admin/tools/admin-notices', | |
| 899 | 896 | apiSearchCourses: lp_rest_url + 'lp/v1/admin/tools/search-course', |
| 900 | 897 | apiSearchUsers: lp_rest_url + 'lp/v1/admin/tools/search-user', |
| 901 | 898 | apiAssignUserCourse: lp_rest_url + 'lp/v1/admin/tools/assign-user-course', |
| 902 | 899 | apiUnAssignUserCourse: lp_rest_url + 'lp/v1/admin/tools/unassign-user-course' |
| @@ -986,8 +983,9 @@ | ||
| 986 | 983 | __webpack_require__.r(__webpack_exports__); |
| 987 | 984 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 988 | 985 | /* harmony export */ debounce: () => (/* binding */ debounce), |
| 989 | 986 | /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers), |
| 987 | +/* harmony export */ fullScreenView: () => (/* binding */ fullScreenView), | |
| 990 | 988 | /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm), |
| 991 | 989 | /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm), |
| 992 | 990 | /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated), |
| 993 | 991 | /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed), |
| @@ -999,9 +997,10 @@ | ||
| 999 | 997 | /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady), |
| 1000 | 998 | /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl), |
| 1001 | 999 | /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl), |
| 1002 | 1000 | /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm), |
| 1003 | -/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse) | |
| 1001 | +/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse), | |
| 1002 | +/* harmony export */ toggleEnable: () => (/* binding */ toggleEnable) | |
| 1004 | 1003 | /* harmony export */ }); |
| 1005 | 1004 | /** |
| 1006 | 1005 | * Utils functions |
| 1007 | 1006 | * |
| @@ -1008,9 +1007,9 @@ | ||
| 1008 | 1007 | * @param url |
| 1009 | 1008 | * @param data |
| 1010 | 1009 | * @param functions |
| 1011 | 1010 | * @since 4.2.5.1 |
| 1012 | - * @version 1.0.6 | |
| 1011 | + * @version 1.0.7 | |
| 1013 | 1012 | */ |
| 1014 | 1013 | const lpClassName = { |
| 1015 | 1014 | hidden: 'lp-hidden', |
| 1016 | 1015 | loading: 'loading', |
| @@ -1015,9 +1014,12 @@ | ||
| 1015 | 1014 | hidden: 'lp-hidden', |
| 1016 | 1015 | loading: 'loading', |
| 1017 | 1016 | elCollapse: 'lp-collapse', |
| 1018 | 1017 | elSectionToggle: '.lp-section-toggle', |
| 1019 | - elTriggerToggle: '.lp-trigger-toggle' | |
| 1018 | + elTriggerToggle: '.lp-trigger-toggle', | |
| 1019 | + elBtnFullScreen: '.lp-btn-full-screen-view', | |
| 1020 | + elFullScreen: 'lp-full-screen-view', | |
| 1021 | + elBtnFullScreenClose: 'lp-full-screen-view__close' | |
| 1020 | 1022 | }; |
| 1021 | 1023 | const lpFetchAPI = (url, data = {}, functions = {}) => { |
| 1022 | 1024 | if ('function' === typeof functions.before) { |
| 1023 | 1025 | functions.before(); |
| @@ -1335,8 +1337,141 @@ | ||
| 1335 | 1337 | timer = setTimeout(() => func(args), wait); |
| 1336 | 1338 | }; |
| 1337 | 1339 | }; |
| 1338 | 1340 | |
| 1341 | +/** | |
| 1342 | + * Initialize lp-toggle-enable components. | |
| 1343 | + * | |
| 1344 | + * Finds all `.lp-toggle-enable` elements and wires up toggle behavior. | |
| 1345 | + * Reads initial state from `data-enabled` attribute ("true"/"false"). | |
| 1346 | + * Calls `data-on-toggle` callback (if provided via options) on state change. | |
| 1347 | + * | |
| 1348 | + * HTML structure: | |
| 1349 | + * <label class="lp-toggle-enable" data-enabled="true"> | |
| 1350 | + * <input type="checkbox" class="lp-toggle-enable__input" /> | |
| 1351 | + * <span class="lp-toggle-enable__track"></span> | |
| 1352 | + * </label> | |
| 1353 | + * | |
| 1354 | + * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable') | |
| 1355 | + * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change | |
| 1356 | + * @since 4.4.5 | |
| 1357 | + * @version 1.0.0 | |
| 1358 | + */ | |
| 1359 | +window.lpToggleEnableInit = 0; | |
| 1360 | +const toggleEnable = (onToggle = null) => { | |
| 1361 | + if (window.lpToggleEnableInit) { | |
| 1362 | + return; | |
| 1363 | + } | |
| 1364 | + window.lpToggleEnableInit = 1; | |
| 1365 | + const selector = '.lp-toggle-enable'; | |
| 1366 | + const updateUI = (toggle, isEnabled) => { | |
| 1367 | + toggle.classList.toggle('is-enabled', isEnabled); | |
| 1368 | + const input = toggle.querySelector('.lp-toggle-enable__input'); | |
| 1369 | + if (input) { | |
| 1370 | + input.checked = isEnabled; | |
| 1371 | + input.value = isEnabled ? '1' : '0'; | |
| 1372 | + } | |
| 1373 | + }; | |
| 1374 | + | |
| 1375 | + // Delegate click handling via eventHandlers. | |
| 1376 | + eventHandlers('click', [{ | |
| 1377 | + selector, | |
| 1378 | + callBack: args => { | |
| 1379 | + const { | |
| 1380 | + e, | |
| 1381 | + target | |
| 1382 | + } = args; | |
| 1383 | + const toggle = target.closest(selector); | |
| 1384 | + if (!toggle || toggle.classList.contains('is-disabled')) { | |
| 1385 | + return; | |
| 1386 | + } | |
| 1387 | + e.preventDefault(); | |
| 1388 | + const isEnabled = !toggle.classList.contains('is-enabled'); | |
| 1389 | + updateUI(toggle, isEnabled); | |
| 1390 | + if ('function' === typeof onToggle) { | |
| 1391 | + onToggle(toggle, isEnabled); | |
| 1392 | + } | |
| 1393 | + } | |
| 1394 | + }]); | |
| 1395 | +}; | |
| 1396 | + | |
| 1397 | +/** | |
| 1398 | + * Initialize custom fullscreen view buttons. | |
| 1399 | + * | |
| 1400 | + * Delegates clicks on `.lp-btn-full-screen-view` buttons to | |
| 1401 | + * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the | |
| 1402 | + * target element. Falls back to the button's parent element when | |
| 1403 | + * `data-target` is not provided. | |
| 1404 | + * | |
| 1405 | + * @since 4.4.5 | |
| 1406 | + * @version 1.0.0 | |
| 1407 | + */ | |
| 1408 | +window.lpFullScreenViewInit = 0; | |
| 1409 | +const fullScreenView = () => { | |
| 1410 | + if (window.lpFullScreenViewInit) { | |
| 1411 | + return; | |
| 1412 | + } | |
| 1413 | + window.lpFullScreenViewInit = 1; | |
| 1414 | + let lastScrollY = 0; | |
| 1415 | + const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => { | |
| 1416 | + const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen); | |
| 1417 | + if (isFullscreen) { | |
| 1418 | + elTarget.classList.remove(lpClassName.elFullScreen); | |
| 1419 | + document.documentElement.classList.remove('lp-full-screen-active'); | |
| 1420 | + window.scrollTo(0, lastScrollY); | |
| 1421 | + } else { | |
| 1422 | + lastScrollY = window.scrollY; | |
| 1423 | + elTarget.classList.add(lpClassName.elFullScreen); | |
| 1424 | + document.documentElement.classList.add('lp-full-screen-active'); | |
| 1425 | + } | |
| 1426 | + if (!isFullscreen) { | |
| 1427 | + if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) { | |
| 1428 | + const closeButton = document.createElement('button'); | |
| 1429 | + closeButton.type = 'button'; | |
| 1430 | + closeButton.className = lpClassName.elBtnFullScreenClose; | |
| 1431 | + closeButton.setAttribute('aria-label', 'Close'); | |
| 1432 | + closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close ×'; | |
| 1433 | + closeButton.addEventListener('click', e => { | |
| 1434 | + e.preventDefault(); | |
| 1435 | + lpToggleFullscreenView(elTarget); | |
| 1436 | + }); | |
| 1437 | + elTarget.appendChild(closeButton); | |
| 1438 | + } | |
| 1439 | + } else { | |
| 1440 | + const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`); | |
| 1441 | + if (closeButton) { | |
| 1442 | + closeButton.remove(); | |
| 1443 | + } | |
| 1444 | + } | |
| 1445 | + }; | |
| 1446 | + eventHandlers('click', [{ | |
| 1447 | + selector: lpClassName.elBtnFullScreen, | |
| 1448 | + callBack: args => { | |
| 1449 | + const { | |
| 1450 | + e, | |
| 1451 | + target | |
| 1452 | + } = args; | |
| 1453 | + const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen); | |
| 1454 | + if (!elBtnFullScreen) { | |
| 1455 | + console.log('No full screen button found'); | |
| 1456 | + return; | |
| 1457 | + } | |
| 1458 | + e.preventDefault(); | |
| 1459 | + let elTarget = null; | |
| 1460 | + const targetSelector = elBtnFullScreen.dataset.targetFullscreen; | |
| 1461 | + console.log(targetSelector); | |
| 1462 | + if (targetSelector) { | |
| 1463 | + elTarget = document.querySelector(targetSelector); | |
| 1464 | + } | |
| 1465 | + if (!elTarget) { | |
| 1466 | + console.log('No target element found'); | |
| 1467 | + return; | |
| 1468 | + } | |
| 1469 | + lpToggleFullscreenView(elTarget, elBtnFullScreen); | |
| 1470 | + } | |
| 1471 | + }]); | |
| 1472 | +}; | |
| 1473 | + | |
| 1339 | 1474 | /***/ }, |
| 1340 | 1475 | |
| 1341 | 1476 | /***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css" |
| 1342 | 1477 | /*!*****************************************************************************************!*\ |
| @@ -13392,19 +13527,19 @@ | ||
| 13392 | 13527 | |
| 13393 | 13528 | /******/ }); |
| 13394 | 13529 | /************************************************************************/ |
| 13395 | 13530 | /******/ // The module cache |
| 13396 | -/******/ const __webpack_module_cache__ = {}; | |
| 13531 | +/******/ var __webpack_module_cache__ = {}; | |
| 13397 | 13532 | /******/ |
| 13398 | 13533 | /******/ // The require function |
| 13399 | 13534 | /******/ function __webpack_require__(moduleId) { |
| 13400 | 13535 | /******/ // Check if module is in cache |
| 13401 | -/******/ const cachedModule = __webpack_module_cache__[moduleId]; | |
| 13536 | +/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 13402 | 13537 | /******/ if (cachedModule !== undefined) { |
| 13403 | 13538 | /******/ return cachedModule.exports; |
| 13404 | 13539 | /******/ } |
| 13405 | 13540 | /******/ // Create a new module (and put it into the cache) |
| 13406 | -/******/ const module = __webpack_module_cache__[moduleId] = { | |
| 13541 | +/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 13407 | 13542 | /******/ id: moduleId, |
| 13408 | 13543 | /******/ // no module.loaded needed |
| 13409 | 13544 | /******/ exports: {} |
| 13410 | 13545 | /******/ }; |
| @@ -13411,9 +13546,9 @@ | ||
| 13411 | 13546 | /******/ |
| 13412 | 13547 | /******/ // Execute the module function |
| 13413 | 13548 | /******/ if (!(moduleId in __webpack_modules__)) { |
| 13414 | 13549 | /******/ delete __webpack_module_cache__[moduleId]; |
| 13415 | -/******/ const e = new Error("Cannot find module '" + moduleId + "'"); | |
| 13550 | +/******/ var e = new Error("Cannot find module '" + moduleId + "'"); | |
| 13416 | 13551 | /******/ e.code = 'MODULE_NOT_FOUND'; |
| 13417 | 13552 | /******/ throw e; |
| 13418 | 13553 | /******/ } |
| 13419 | 13554 | /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
| @@ -13426,9 +13561,9 @@ | ||
| 13426 | 13561 | /******/ /* webpack/runtime/compat get default export */ |
| 13427 | 13562 | /******/ (() => { |
| 13428 | 13563 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| 13429 | 13564 | /******/ __webpack_require__.n = (module) => { |
| 13430 | -/******/ const getter = module && module.__esModule ? | |
| 13565 | +/******/ var getter = module && module.__esModule ? | |
| 13431 | 13566 | /******/ () => (module['default']) : |
| 13432 | 13567 | /******/ () => (module); |
| 13433 | 13568 | /******/ __webpack_require__.d(getter, { a: getter }); |
| 13434 | 13569 | /******/ return getter; |
| @@ -13436,29 +13571,14 @@ | ||
| 13436 | 13571 | /******/ })(); |
| 13437 | 13572 | /******/ |
| 13438 | 13573 | /******/ /* webpack/runtime/define property getters */ |
| 13439 | 13574 | /******/ (() => { |
| 13440 | -/******/ // define getter/value functions for harmony exports | |
| 13575 | +/******/ // define getter functions for harmony exports | |
| 13441 | 13576 | /******/ __webpack_require__.d = (exports, definition) => { |
| 13442 | -/******/ if(Array.isArray(definition)) { | |
| 13443 | -/******/ var i = 0; | |
| 13444 | -/******/ while(i < definition.length) { | |
| 13445 | -/******/ var key = definition[i++]; | |
| 13446 | -/******/ var binding = definition[i++]; | |
| 13447 | -/******/ if(!__webpack_require__.o(exports, key)) { | |
| 13448 | -/******/ if(binding === 0) { | |
| 13449 | -/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); | |
| 13450 | -/******/ } else { | |
| 13451 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); | |
| 13452 | -/******/ } | |
| 13453 | -/******/ } else if(binding === 0) { i++; } | |
| 13577 | +/******/ for(var key in definition) { | |
| 13578 | +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 13579 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 13454 | 13580 | /******/ } |
| 13455 | -/******/ } else { | |
| 13456 | -/******/ for(var key in definition) { | |
| 13457 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 13458 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 13459 | -/******/ } | |
| 13460 | -/******/ } | |
| 13461 | 13581 | /******/ } |
| 13462 | 13582 | /******/ }; |
| 13463 | 13583 | /******/ })(); |
| 13464 | 13584 | /******/ |
| @@ -13463,9 +13583,9 @@ | ||
| 13463 | 13583 | /******/ })(); |
| 13464 | 13584 | /******/ |
| 13465 | 13585 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 13466 | 13586 | /******/ (() => { |
| 13467 | -/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop)) | |
| 13587 | +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | |
| 13468 | 13588 | /******/ })(); |
| 13469 | 13589 | /******/ |
| 13470 | 13590 | /******/ /* webpack/runtime/make namespace object */ |
| 13471 | 13591 | /******/ (() => { |
| @@ -13470,9 +13590,9 @@ | ||
| 13470 | 13590 | /******/ /* webpack/runtime/make namespace object */ |
| 13471 | 13591 | /******/ (() => { |
| 13472 | 13592 | /******/ // define __esModule on exports |
| 13473 | 13593 | /******/ __webpack_require__.r = (exports) => { |
| 13474 | -/******/ if(Symbol.toStringTag) { | |
| 13594 | +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 13475 | 13595 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 13476 | 13596 | /******/ } |
| 13477 | 13597 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 13478 | 13598 | /******/ }; |
| @@ -13483,9 +13603,9 @@ | ||
| 13483 | 13603 | /******/ __webpack_require__.nc = undefined; |
| 13484 | 13604 | /******/ })(); |
| 13485 | 13605 | /******/ |
| 13486 | 13606 | /************************************************************************/ |
| 13487 | -let __webpack_exports__ = {}; | |
| 13607 | +var __webpack_exports__ = {}; | |
| 13488 | 13608 | // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. |
| 13489 | 13609 | (() => { |
| 13490 | 13610 | "use strict"; |
| 13491 | 13611 | /*!********************************************!*\ |