| @@ -41,9 +41,8 @@ | ||
| 41 | 41 | if (!btn) { |
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__.lpSetLoadingEl(btn, isLoading ? 1 : 0); |
| 45 | - btn.disabled = !!isLoading; | |
| 46 | 45 | } |
| 47 | 46 | init() { |
| 48 | 47 | if (ViewStudentsModal._loadedEvents) { |
| 49 | 48 | return; |
| @@ -79,9 +78,9 @@ | ||
| 79 | 78 | }]); |
| 80 | 79 | } |
| 81 | 80 | handleOpenModal(args) { |
| 82 | 81 | const btn = args?.target?.closest(ViewStudentsModal.selectors.courseTrigger); |
| 83 | - if (!btn || this.isRequesting || btn.classList.contains('loading') || btn.disabled) { | |
| 82 | + if (!btn || this.isRequesting || btn.classList.contains('loading')) { | |
| 84 | 83 | return; |
| 85 | 84 | } |
| 86 | 85 | const courseId = parseInt(btn.dataset.courseId, 10) || 0; |
| 87 | 86 | if (!courseId) { |
| @@ -131,9 +130,9 @@ | ||
| 131 | 130 | } |
| 132 | 131 | if (args?.e) { |
| 133 | 132 | args.e.preventDefault(); |
| 134 | 133 | } |
| 135 | - if (this.isRequesting || btn.classList.contains('loading') || btn.disabled) { | |
| 134 | + if (this.isRequesting || btn.classList.contains('loading')) { | |
| 136 | 135 | return; |
| 137 | 136 | } |
| 138 | 137 | form.reset(); |
| 139 | 138 | this.setButtonLoadingState(btn, true); |
| @@ -294,12 +293,9 @@ | ||
| 294 | 293 | let lp_rest_url; |
| 295 | 294 | if ('undefined' !== typeof lpDataAdmin) { |
| 296 | 295 | lp_rest_url = lpDataAdmin.lp_rest_url; |
| 297 | 296 | lplistAPI.admin = { |
| 298 | - apiAdminNotice: lp_rest_url + 'lp/v1/admin/tools/admin-notices', | |
| 299 | - apiAddons: lp_rest_url + 'lp/v1/addon/all', | |
| 300 | - apiAddonAction: lp_rest_url + 'lp/v1/addon/action-n', | |
| 301 | - apiAddonsPurchase: lp_rest_url + 'lp/v1/addon/info-addons-purchase', | |
| 297 | + // apiAdminNotice: lp_rest_url + 'lp/v1/admin/tools/admin-notices', | |
| 302 | 298 | apiSearchCourses: lp_rest_url + 'lp/v1/admin/tools/search-course', |
| 303 | 299 | apiSearchUsers: lp_rest_url + 'lp/v1/admin/tools/search-user', |
| 304 | 300 | apiAssignUserCourse: lp_rest_url + 'lp/v1/admin/tools/assign-user-course', |
| 305 | 301 | apiUnAssignUserCourse: lp_rest_url + 'lp/v1/admin/tools/unassign-user-course' |
| @@ -1390,8 +1386,9 @@ | ||
| 1390 | 1386 | __webpack_require__.r(__webpack_exports__); |
| 1391 | 1387 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1392 | 1388 | /* harmony export */ debounce: () => (/* binding */ debounce), |
| 1393 | 1389 | /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers), |
| 1390 | +/* harmony export */ fullScreenView: () => (/* binding */ fullScreenView), | |
| 1394 | 1391 | /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm), |
| 1395 | 1392 | /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm), |
| 1396 | 1393 | /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated), |
| 1397 | 1394 | /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed), |
| @@ -1403,9 +1400,10 @@ | ||
| 1403 | 1400 | /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady), |
| 1404 | 1401 | /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl), |
| 1405 | 1402 | /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl), |
| 1406 | 1403 | /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm), |
| 1407 | -/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse) | |
| 1404 | +/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse), | |
| 1405 | +/* harmony export */ toggleEnable: () => (/* binding */ toggleEnable) | |
| 1408 | 1406 | /* harmony export */ }); |
| 1409 | 1407 | /** |
| 1410 | 1408 | * Utils functions |
| 1411 | 1409 | * |
| @@ -1412,9 +1410,9 @@ | ||
| 1412 | 1410 | * @param url |
| 1413 | 1411 | * @param data |
| 1414 | 1412 | * @param functions |
| 1415 | 1413 | * @since 4.2.5.1 |
| 1416 | - * @version 1.0.6 | |
| 1414 | + * @version 1.0.7 | |
| 1417 | 1415 | */ |
| 1418 | 1416 | const lpClassName = { |
| 1419 | 1417 | hidden: 'lp-hidden', |
| 1420 | 1418 | loading: 'loading', |
| @@ -1419,9 +1417,12 @@ | ||
| 1419 | 1417 | hidden: 'lp-hidden', |
| 1420 | 1418 | loading: 'loading', |
| 1421 | 1419 | elCollapse: 'lp-collapse', |
| 1422 | 1420 | elSectionToggle: '.lp-section-toggle', |
| 1423 | - elTriggerToggle: '.lp-trigger-toggle' | |
| 1421 | + elTriggerToggle: '.lp-trigger-toggle', | |
| 1422 | + elBtnFullScreen: '.lp-btn-full-screen-view', | |
| 1423 | + elFullScreen: 'lp-full-screen-view', | |
| 1424 | + elBtnFullScreenClose: 'lp-full-screen-view__close' | |
| 1424 | 1425 | }; |
| 1425 | 1426 | const lpFetchAPI = (url, data = {}, functions = {}) => { |
| 1426 | 1427 | if ('function' === typeof functions.before) { |
| 1427 | 1428 | functions.before(); |
| @@ -1737,8 +1738,141 @@ | ||
| 1737 | 1738 | return args => { |
| 1738 | 1739 | clearTimeout(timer); |
| 1739 | 1740 | timer = setTimeout(() => func(args), wait); |
| 1740 | 1741 | }; |
| 1742 | +}; | |
| 1743 | + | |
| 1744 | +/** | |
| 1745 | + * Initialize lp-toggle-enable components. | |
| 1746 | + * | |
| 1747 | + * Finds all `.lp-toggle-enable` elements and wires up toggle behavior. | |
| 1748 | + * Reads initial state from `data-enabled` attribute ("true"/"false"). | |
| 1749 | + * Calls `data-on-toggle` callback (if provided via options) on state change. | |
| 1750 | + * | |
| 1751 | + * HTML structure: | |
| 1752 | + * <label class="lp-toggle-enable" data-enabled="true"> | |
| 1753 | + * <input type="checkbox" class="lp-toggle-enable__input" /> | |
| 1754 | + * <span class="lp-toggle-enable__track"></span> | |
| 1755 | + * </label> | |
| 1756 | + * | |
| 1757 | + * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable') | |
| 1758 | + * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change | |
| 1759 | + * @since 4.4.5 | |
| 1760 | + * @version 1.0.0 | |
| 1761 | + */ | |
| 1762 | +window.lpToggleEnableInit = 0; | |
| 1763 | +const toggleEnable = (onToggle = null) => { | |
| 1764 | + if (window.lpToggleEnableInit) { | |
| 1765 | + return; | |
| 1766 | + } | |
| 1767 | + window.lpToggleEnableInit = 1; | |
| 1768 | + const selector = '.lp-toggle-enable'; | |
| 1769 | + const updateUI = (toggle, isEnabled) => { | |
| 1770 | + toggle.classList.toggle('is-enabled', isEnabled); | |
| 1771 | + const input = toggle.querySelector('.lp-toggle-enable__input'); | |
| 1772 | + if (input) { | |
| 1773 | + input.checked = isEnabled; | |
| 1774 | + input.value = isEnabled ? '1' : '0'; | |
| 1775 | + } | |
| 1776 | + }; | |
| 1777 | + | |
| 1778 | + // Delegate click handling via eventHandlers. | |
| 1779 | + eventHandlers('click', [{ | |
| 1780 | + selector, | |
| 1781 | + callBack: args => { | |
| 1782 | + const { | |
| 1783 | + e, | |
| 1784 | + target | |
| 1785 | + } = args; | |
| 1786 | + const toggle = target.closest(selector); | |
| 1787 | + if (!toggle || toggle.classList.contains('is-disabled')) { | |
| 1788 | + return; | |
| 1789 | + } | |
| 1790 | + e.preventDefault(); | |
| 1791 | + const isEnabled = !toggle.classList.contains('is-enabled'); | |
| 1792 | + updateUI(toggle, isEnabled); | |
| 1793 | + if ('function' === typeof onToggle) { | |
| 1794 | + onToggle(toggle, isEnabled); | |
| 1795 | + } | |
| 1796 | + } | |
| 1797 | + }]); | |
| 1798 | +}; | |
| 1799 | + | |
| 1800 | +/** | |
| 1801 | + * Initialize custom fullscreen view buttons. | |
| 1802 | + * | |
| 1803 | + * Delegates clicks on `.lp-btn-full-screen-view` buttons to | |
| 1804 | + * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the | |
| 1805 | + * target element. Falls back to the button's parent element when | |
| 1806 | + * `data-target` is not provided. | |
| 1807 | + * | |
| 1808 | + * @since 4.4.5 | |
| 1809 | + * @version 1.0.0 | |
| 1810 | + */ | |
| 1811 | +window.lpFullScreenViewInit = 0; | |
| 1812 | +const fullScreenView = () => { | |
| 1813 | + if (window.lpFullScreenViewInit) { | |
| 1814 | + return; | |
| 1815 | + } | |
| 1816 | + window.lpFullScreenViewInit = 1; | |
| 1817 | + let lastScrollY = 0; | |
| 1818 | + const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => { | |
| 1819 | + const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen); | |
| 1820 | + if (isFullscreen) { | |
| 1821 | + elTarget.classList.remove(lpClassName.elFullScreen); | |
| 1822 | + document.documentElement.classList.remove('lp-full-screen-active'); | |
| 1823 | + window.scrollTo(0, lastScrollY); | |
| 1824 | + } else { | |
| 1825 | + lastScrollY = window.scrollY; | |
| 1826 | + elTarget.classList.add(lpClassName.elFullScreen); | |
| 1827 | + document.documentElement.classList.add('lp-full-screen-active'); | |
| 1828 | + } | |
| 1829 | + if (!isFullscreen) { | |
| 1830 | + if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) { | |
| 1831 | + const closeButton = document.createElement('button'); | |
| 1832 | + closeButton.type = 'button'; | |
| 1833 | + closeButton.className = lpClassName.elBtnFullScreenClose; | |
| 1834 | + closeButton.setAttribute('aria-label', 'Close'); | |
| 1835 | + closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close ×'; | |
| 1836 | + closeButton.addEventListener('click', e => { | |
| 1837 | + e.preventDefault(); | |
| 1838 | + lpToggleFullscreenView(elTarget); | |
| 1839 | + }); | |
| 1840 | + elTarget.appendChild(closeButton); | |
| 1841 | + } | |
| 1842 | + } else { | |
| 1843 | + const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`); | |
| 1844 | + if (closeButton) { | |
| 1845 | + closeButton.remove(); | |
| 1846 | + } | |
| 1847 | + } | |
| 1848 | + }; | |
| 1849 | + eventHandlers('click', [{ | |
| 1850 | + selector: lpClassName.elBtnFullScreen, | |
| 1851 | + callBack: args => { | |
| 1852 | + const { | |
| 1853 | + e, | |
| 1854 | + target | |
| 1855 | + } = args; | |
| 1856 | + const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen); | |
| 1857 | + if (!elBtnFullScreen) { | |
| 1858 | + console.log('No full screen button found'); | |
| 1859 | + return; | |
| 1860 | + } | |
| 1861 | + e.preventDefault(); | |
| 1862 | + let elTarget = null; | |
| 1863 | + const targetSelector = elBtnFullScreen.dataset.targetFullscreen; | |
| 1864 | + console.log(targetSelector); | |
| 1865 | + if (targetSelector) { | |
| 1866 | + elTarget = document.querySelector(targetSelector); | |
| 1867 | + } | |
| 1868 | + if (!elTarget) { | |
| 1869 | + console.log('No target element found'); | |
| 1870 | + return; | |
| 1871 | + } | |
| 1872 | + lpToggleFullscreenView(elTarget, elBtnFullScreen); | |
| 1873 | + } | |
| 1874 | + }]); | |
| 1741 | 1875 | }; |
| 1742 | 1876 | |
| 1743 | 1877 | /***/ }, |
| 1744 | 1878 | |