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/js/dist/frontend/single-course.js +302 -144 4.3.9.1 → 4.4.10 View file →
@@ -1,4 +1,4 @@
1 1 /******/ (() => { // webpackBootstrap
2 2 /******/ var __webpack_modules__ = ({
3 3
4 4 /***/ "./assets/src/apps/js/frontend/material.js"
@@ -161,10 +161,10 @@
161 161 !*** ./assets/src/apps/js/frontend/single-course/store/index.js ***!
162 162 \******************************************************************/
163 163 () {
164 164
165 -/**
166 - * Created by tu on 9/19/19.
165 +/**
166 + * Created by tu on 9/19/19.
167 167 */
168 168
169 169 /***/ },
170 170
@@ -292,38 +292,35 @@
292 292 }
293 293 // End editor by tungnx
294 294
295 295 // Code for old curriculum
296 - /*const $curriculum = $( '#learn-press-course-curriculum' );
297 - $curriculum.find( '.section-desc' ).each( ( i, el ) => {
298 - const a = $( '<span class="show-desc"></span>' ).on( 'click', () => {
299 - b.toggleClass( 'c' );
300 - } );
301 - const b = $( el ).siblings( '.section-title' ).append( a );
296 + /*const $curriculum = $( '#learn-press-course-curriculum' );
297 + $curriculum.find( '.section-desc' ).each( ( i, el ) => {
298 + const a = $( '<span class="show-desc"></span>' ).on( 'click', () => {
299 + b.toggleClass( 'c' );
300 + } );
301 + const b = $( el ).siblings( '.section-title' ).append( a );
302 302 } );*/
303 303
304 304 // Code for old curriculum
305 - /*$( '.section' ).each( function() {
306 - const $section = $( this ),
307 - $toggle = $section.find( '.section-left' );
308 -
309 - $toggle.on( 'click', function() {
310 - const isClose = $section.toggleClass( 'closed' ).hasClass( 'closed' );
311 - const sections = LP.Cookies.get( 'closed-section-' + lpGlobalSettings.post_id ) || [];
312 - const sectionId = parseInt( $section.data( 'section-id' ) );
313 - const at = sections.findIndex( ( id ) => {
314 - return id == sectionId;
315 - } );
316 -
317 - if ( isClose ) {
318 - sections.push( parseInt( $section.data( 'section-id' ) ) );
319 - } else {
320 - sections.splice( at, 1 );
321 - }
322 -
323 - LP.Cookies.remove( 'closed-section-(.*)' );
324 - LP.Cookies.set( 'closed-section-' + lpGlobalSettings.post_id, [ ...new Set( sections ) ] );
325 - } );
305 + /*$( '.section' ).each( function() {
306 + const $section = $( this ),
307 + $toggle = $section.find( '.section-left' );
308 + $toggle.on( 'click', function() {
309 + const isClose = $section.toggleClass( 'closed' ).hasClass( 'closed' );
310 + const sections = LP.Cookies.get( 'closed-section-' + lpGlobalSettings.post_id ) || [];
311 + const sectionId = parseInt( $section.data( 'section-id' ) );
312 + const at = sections.findIndex( ( id ) => {
313 + return id == sectionId;
314 + } );
315 + if ( isClose ) {
316 + sections.push( parseInt( $section.data( 'section-id' ) ) );
317 + } else {
318 + sections.splice( at, 1 );
319 + }
320 + LP.Cookies.remove( 'closed-section-(.*)' );
321 + LP.Cookies.set( 'closed-section-' + lpGlobalSettings.post_id, [ ...new Set( sections ) ] );
322 + } );
326 323 } );*/
327 324
328 325 document.addEventListener('click', e => {
329 326 if (e.target.id === 'sidebar-toggle') {
@@ -945,8 +942,9 @@
945 942 __webpack_require__.r(__webpack_exports__);
946 943 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
947 944 /* harmony export */ debounce: () => (/* binding */ debounce),
948 945 /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers),
946 +/* harmony export */ fullScreenView: () => (/* binding */ fullScreenView),
949 947 /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm),
950 948 /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm),
951 949 /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated),
952 950 /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed),
@@ -958,18 +956,19 @@
958 956 /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady),
959 957 /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl),
960 958 /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl),
961 959 /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm),
962 -/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse)
960 +/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse),
961 +/* harmony export */ toggleEnable: () => (/* binding */ toggleEnable)
963 962 /* harmony export */ });
964 -/**
965 - * Utils functions
966 - *
967 - * @param url
968 - * @param data
969 - * @param functions
970 - * @since 4.2.5.1
971 - * @version 1.0.6
963 +/**
964 + * Utils functions
965 + *
966 + * @param url
967 + * @param data
968 + * @param functions
969 + * @since 4.2.5.1
970 + * @version 1.0.7
972 971 */
973 972 const lpClassName = {
974 973 hidden: 'lp-hidden',
975 974 loading: 'loading',
@@ -974,9 +973,12 @@
974 973 hidden: 'lp-hidden',
975 974 loading: 'loading',
976 975 elCollapse: 'lp-collapse',
977 976 elSectionToggle: '.lp-section-toggle',
978 - elTriggerToggle: '.lp-trigger-toggle'
977 + elTriggerToggle: '.lp-trigger-toggle',
978 + elBtnFullScreen: '.lp-btn-full-screen-view',
979 + elFullScreen: 'lp-full-screen-view',
980 + elBtnFullScreenClose: 'lp-full-screen-view__close'
979 981 };
980 982 const lpFetchAPI = (url, data = {}, functions = {}) => {
981 983 if ('function' === typeof functions.before) {
982 984 functions.before();
@@ -998,12 +1000,12 @@
998 1000 }
999 1001 });
1000 1002 };
1001 1003
1002 -/**
1003 - * Get current URL without params.
1004 - *
1005 - * @since 4.2.5.1
1004 +/**
1005 + * Get current URL without params.
1006 + *
1007 + * @since 4.2.5.1
1006 1008 */
1007 1009 const lpGetCurrentURLNoParam = () => {
1008 1010 let currentUrl = window.location.href;
1009 1011 const hasParams = currentUrl.includes('?');
@@ -1019,14 +1021,14 @@
1019 1021 });
1020 1022 return url;
1021 1023 };
1022 1024
1023 -/**
1024 - * Listen element viewed.
1025 - *
1026 - * @param el
1027 - * @param callback
1028 - * @since 4.2.5.8
1025 +/**
1026 + * Listen element viewed.
1027 + *
1028 + * @param el
1029 + * @param callback
1030 + * @since 4.2.5.8
1029 1031 */
1030 1032 const listenElementViewed = (el, callback) => {
1031 1033 const observerSeeItem = new IntersectionObserver(function (entries) {
1032 1034 for (const entry of entries) {
@@ -1037,13 +1039,13 @@
1037 1039 });
1038 1040 observerSeeItem.observe(el);
1039 1041 };
1040 1042
1041 -/**
1042 - * Listen element created.
1043 - *
1044 - * @param callback
1045 - * @since 4.2.5.8
1043 +/**
1044 + * Listen element created.
1045 + *
1046 + * @param callback
1047 + * @since 4.2.5.8
1046 1048 */
1047 1049 const listenElementCreated = callback => {
1048 1050 const observerCreateItem = new MutationObserver(function (mutations) {
1049 1051 mutations.forEach(function (mutation) {
@@ -1062,14 +1064,14 @@
1062 1064 });
1063 1065 // End.
1064 1066 };
1065 1067
1066 -/**
1067 - * Listen element created.
1068 - *
1069 - * @param selector
1070 - * @param callback
1071 - * @since 4.2.7.1
1068 +/**
1069 + * Listen element created.
1070 + *
1071 + * @param selector
1072 + * @param callback
1073 + * @since 4.2.7.1
1072 1074 */
1073 1075 const lpOnElementReady = (selector, callback) => {
1074 1076 const element = document.querySelector(selector);
1075 1077 if (element) {
@@ -1210,17 +1212,17 @@
1210 1212 };
1211 1213 return dataHandle;
1212 1214 };
1213 1215
1214 -/**
1215 - * Event trigger
1216 - * For each list of event handlers, listen event on document.
1217 - *
1218 - * eventName: 'click', 'change', ...
1219 - * eventHandlers = [ { selector: '.lp-button', callBack: function(){}, class: object } ]
1220 - *
1221 - * @param eventName
1222 - * @param eventHandlers
1216 +/**
1217 + * Event trigger
1218 + * For each list of event handlers, listen event on document.
1219 + *
1220 + * eventName: 'click', 'change', ...
1221 + * eventHandlers = [ { selector: '.lp-button', callBack: function(){}, class: object } ]
1222 + *
1223 + * @param eventName
1224 + * @param eventHandlers
1223 1225 */
1224 1226 const eventHandlers = (eventName, eventHandlers) => {
1225 1227 document.addEventListener(eventName, e => {
1226 1228 const target = e.target;
@@ -1261,32 +1263,32 @@
1261 1263 });
1262 1264 });
1263 1265 };
1264 1266
1265 -/**
1266 - * Debounce - delays function execution until after `wait` ms of inactivity.
1267 - *
1268 - * Each call resets the timer. Only the last call in a burst executes.
1269 - *
1270 - * USE CASES:
1271 - * - Search inputs, form validation, window resize
1272 - * - Multiple elements need independent timers
1273 - * - When you need to call with different arguments
1274 - *
1275 - * EXAMPLES:
1276 - * const debouncedSearch = debounce( (query) => fetchResults(query), 300 );
1277 - * searchInput.addEventListener('input', (e) => debouncedSearch(e.target.value));
1278 - *
1279 - * const debouncedResize = debounce( recalculateLayout, 250 );
1280 - * window.addEventListener('resize', debouncedResize);
1281 - *
1282 - * ⚠️ Create ONCE outside event handlers, not inside.
1283 - *
1284 - * @param {Function} func - Function to debounce (can be anonymous)
1285 - * @param {number} wait - Milliseconds to wait (default: 500)
1286 - * @return {Function} Debounced wrapper function
1287 - * @since 4.3.7
1288 - * @version 1.0.0
1267 +/**
1268 + * Debounce - delays function execution until after `wait` ms of inactivity.
1269 + *
1270 + * Each call resets the timer. Only the last call in a burst executes.
1271 + *
1272 + * USE CASES:
1273 + * - Search inputs, form validation, window resize
1274 + * - Multiple elements need independent timers
1275 + * - When you need to call with different arguments
1276 + *
1277 + * EXAMPLES:
1278 + * const debouncedSearch = debounce( (query) => fetchResults(query), 300 );
1279 + * searchInput.addEventListener('input', (e) => debouncedSearch(e.target.value));
1280 + *
1281 + * const debouncedResize = debounce( recalculateLayout, 250 );
1282 + * window.addEventListener('resize', debouncedResize);
1283 + *
1284 + * ⚠️ Create ONCE outside event handlers, not inside.
1285 + *
1286 + * @param {Function} func - Function to debounce (can be anonymous)
1287 + * @param {number} wait - Milliseconds to wait (default: 500)
1288 + * @return {Function} Debounced wrapper function
1289 + * @since 4.3.7
1290 + * @version 1.0.0
1289 1291 */
1290 1292 const debounce = (func, wait = 500) => {
1291 1293 let timer;
1292 1294 return args => {
@@ -1294,8 +1296,141 @@
1294 1296 timer = setTimeout(() => func(args), wait);
1295 1297 };
1296 1298 };
1297 1299
1300 +/**
1301 + * Initialize lp-toggle-enable components.
1302 + *
1303 + * Finds all `.lp-toggle-enable` elements and wires up toggle behavior.
1304 + * Reads initial state from `data-enabled` attribute ("true"/"false").
1305 + * Calls `data-on-toggle` callback (if provided via options) on state change.
1306 + *
1307 + * HTML structure:
1308 + * <label class="lp-toggle-enable" data-enabled="true">
1309 + * <input type="checkbox" class="lp-toggle-enable__input" />
1310 + * <span class="lp-toggle-enable__track"></span>
1311 + * </label>
1312 + *
1313 + * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable')
1314 + * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change
1315 + * @since 4.4.5
1316 + * @version 1.0.0
1317 + */
1318 +window.lpToggleEnableInit = 0;
1319 +const toggleEnable = (onToggle = null) => {
1320 + if (window.lpToggleEnableInit) {
1321 + return;
1322 + }
1323 + window.lpToggleEnableInit = 1;
1324 + const selector = '.lp-toggle-enable';
1325 + const updateUI = (toggle, isEnabled) => {
1326 + toggle.classList.toggle('is-enabled', isEnabled);
1327 + const input = toggle.querySelector('.lp-toggle-enable__input');
1328 + if (input) {
1329 + input.checked = isEnabled;
1330 + input.value = isEnabled ? '1' : '0';
1331 + }
1332 + };
1333 +
1334 + // Delegate click handling via eventHandlers.
1335 + eventHandlers('click', [{
1336 + selector,
1337 + callBack: args => {
1338 + const {
1339 + e,
1340 + target
1341 + } = args;
1342 + const toggle = target.closest(selector);
1343 + if (!toggle || toggle.classList.contains('is-disabled')) {
1344 + return;
1345 + }
1346 + e.preventDefault();
1347 + const isEnabled = !toggle.classList.contains('is-enabled');
1348 + updateUI(toggle, isEnabled);
1349 + if ('function' === typeof onToggle) {
1350 + onToggle(toggle, isEnabled);
1351 + }
1352 + }
1353 + }]);
1354 +};
1355 +
1356 +/**
1357 + * Initialize custom fullscreen view buttons.
1358 + *
1359 + * Delegates clicks on `.lp-btn-full-screen-view` buttons to
1360 + * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the
1361 + * target element. Falls back to the button's parent element when
1362 + * `data-target` is not provided.
1363 + *
1364 + * @since 4.4.5
1365 + * @version 1.0.0
1366 + */
1367 +window.lpFullScreenViewInit = 0;
1368 +const fullScreenView = () => {
1369 + if (window.lpFullScreenViewInit) {
1370 + return;
1371 + }
1372 + window.lpFullScreenViewInit = 1;
1373 + let lastScrollY = 0;
1374 + const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => {
1375 + const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen);
1376 + if (isFullscreen) {
1377 + elTarget.classList.remove(lpClassName.elFullScreen);
1378 + document.documentElement.classList.remove('lp-full-screen-active');
1379 + window.scrollTo(0, lastScrollY);
1380 + } else {
1381 + lastScrollY = window.scrollY;
1382 + elTarget.classList.add(lpClassName.elFullScreen);
1383 + document.documentElement.classList.add('lp-full-screen-active');
1384 + }
1385 + if (!isFullscreen) {
1386 + if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) {
1387 + const closeButton = document.createElement('button');
1388 + closeButton.type = 'button';
1389 + closeButton.className = lpClassName.elBtnFullScreenClose;
1390 + closeButton.setAttribute('aria-label', 'Close');
1391 + closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close &times;';
1392 + closeButton.addEventListener('click', e => {
1393 + e.preventDefault();
1394 + lpToggleFullscreenView(elTarget);
1395 + });
1396 + elTarget.appendChild(closeButton);
1397 + }
1398 + } else {
1399 + const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`);
1400 + if (closeButton) {
1401 + closeButton.remove();
1402 + }
1403 + }
1404 + };
1405 + eventHandlers('click', [{
1406 + selector: lpClassName.elBtnFullScreen,
1407 + callBack: args => {
1408 + const {
1409 + e,
1410 + target
1411 + } = args;
1412 + const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen);
1413 + if (!elBtnFullScreen) {
1414 + console.log('No full screen button found');
1415 + return;
1416 + }
1417 + e.preventDefault();
1418 + let elTarget = null;
1419 + const targetSelector = elBtnFullScreen.dataset.targetFullscreen;
1420 + console.log(targetSelector);
1421 + if (targetSelector) {
1422 + elTarget = document.querySelector(targetSelector);
1423 + }
1424 + if (!elTarget) {
1425 + console.log('No target element found');
1426 + return;
1427 + }
1428 + lpToggleFullscreenView(elTarget, elBtnFullScreen);
1429 + }
1430 + }]);
1431 +};
1432 +
1298 1433 /***/ },
1299 1434
1300 1435 /***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css"
1301 1436 /*!*****************************************************************************************!*\
@@ -2359,19 +2494,19 @@
2359 2494
2360 2495 /******/ });
2361 2496 /************************************************************************/
2362 2497 /******/ // The module cache
2363 -/******/ var __webpack_module_cache__ = {};
2498 +/******/ const __webpack_module_cache__ = {};
2364 2499 /******/
2365 2500 /******/ // The require function
2366 2501 /******/ function __webpack_require__(moduleId) {
2367 2502 /******/ // Check if module is in cache
2368 -/******/ var cachedModule = __webpack_module_cache__[moduleId];
2503 +/******/ const cachedModule = __webpack_module_cache__[moduleId];
2369 2504 /******/ if (cachedModule !== undefined) {
2370 2505 /******/ return cachedModule.exports;
2371 2506 /******/ }
2372 2507 /******/ // Create a new module (and put it into the cache)
2373 -/******/ var module = __webpack_module_cache__[moduleId] = {
2508 +/******/ const module = __webpack_module_cache__[moduleId] = {
2374 2509 /******/ id: moduleId,
2375 2510 /******/ // no module.loaded needed
2376 2511 /******/ exports: {}
2377 2512 /******/ };
@@ -2378,9 +2513,9 @@
2378 2513 /******/
2379 2514 /******/ // Execute the module function
2380 2515 /******/ if (!(moduleId in __webpack_modules__)) {
2381 2516 /******/ delete __webpack_module_cache__[moduleId];
2382 -/******/ var e = new Error("Cannot find module '" + moduleId + "'");
2517 +/******/ const e = new Error("Cannot find module '" + moduleId + "'");
2383 2518 /******/ e.code = 'MODULE_NOT_FOUND';
2384 2519 /******/ throw e;
2385 2520 /******/ }
2386 2521 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
@@ -2393,9 +2528,9 @@
2393 2528 /******/ /* webpack/runtime/compat get default export */
2394 2529 /******/ (() => {
2395 2530 /******/ // getDefaultExport function for compatibility with non-harmony modules
2396 2531 /******/ __webpack_require__.n = (module) => {
2397 -/******/ var getter = module && module.__esModule ?
2532 +/******/ const getter = module && module.__esModule ?
2398 2533 /******/ () => (module['default']) :
2399 2534 /******/ () => (module);
2400 2535 /******/ __webpack_require__.d(getter, { a: getter });
2401 2536 /******/ return getter;
@@ -2403,14 +2538,29 @@
2403 2538 /******/ })();
2404 2539 /******/
2405 2540 /******/ /* webpack/runtime/define property getters */
2406 2541 /******/ (() => {
2407 -/******/ // define getter functions for harmony exports
2542 +/******/ // define getter/value functions for harmony exports
2408 2543 /******/ __webpack_require__.d = (exports, definition) => {
2409 -/******/ for(var key in definition) {
2410 -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
2411 -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
2544 +/******/ if(Array.isArray(definition)) {
2545 +/******/ var i = 0;
2546 +/******/ while(i < definition.length) {
2547 +/******/ var key = definition[i++];
2548 +/******/ var binding = definition[i++];
2549 +/******/ if(!__webpack_require__.o(exports, key)) {
2550 +/******/ if(binding === 0) {
2551 +/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
2552 +/******/ } else {
2553 +/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
2554 +/******/ }
2555 +/******/ } else if(binding === 0) { i++; }
2412 2556 /******/ }
2557 +/******/ } else {
2558 +/******/ for(var key in definition) {
2559 +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
2560 +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
2561 +/******/ }
2562 +/******/ }
2413 2563 /******/ }
2414 2564 /******/ };
2415 2565 /******/ })();
2416 2566 /******/
@@ -2415,9 +2565,9 @@
2415 2565 /******/ })();
2416 2566 /******/
2417 2567 /******/ /* webpack/runtime/hasOwnProperty shorthand */
2418 2568 /******/ (() => {
2419 -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
2569 +/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop))
2420 2570 /******/ })();
2421 2571 /******/
2422 2572 /******/ /* webpack/runtime/make namespace object */
2423 2573 /******/ (() => {
@@ -2422,9 +2572,9 @@
2422 2572 /******/ /* webpack/runtime/make namespace object */
2423 2573 /******/ (() => {
2424 2574 /******/ // define __esModule on exports
2425 2575 /******/ __webpack_require__.r = (exports) => {
2426 -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
2576 +/******/ if(Symbol.toStringTag) {
2427 2577 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2428 2578 /******/ }
2429 2579 /******/ Object.defineProperty(exports, '__esModule', { value: true });
2430 2580 /******/ };
@@ -2435,9 +2585,9 @@
2435 2585 /******/ __webpack_require__.nc = undefined;
2436 2586 /******/ })();
2437 2587 /******/
2438 2588 /************************************************************************/
2439 -var __webpack_exports__ = {};
2589 +let __webpack_exports__ = {};
2440 2590 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
2441 2591 (() => {
2442 2592 "use strict";
2443 2593 /*!******************************************************!*\
@@ -2741,46 +2891,54 @@
2741 2891 });
2742 2892 };
2743 2893
2744 2894 // Rest API load content course progress - Nhamdv.
2745 -const courseProgress = () => {
2746 - const elements = document.querySelectorAll('.lp-course-progress-wrapper');
2747 - if (!elements.length) {
2748 - return;
2749 - }
2750 - if ('IntersectionObserver' in window) {
2751 - const eleObserver = new IntersectionObserver((entries, observer) => {
2752 - entries.forEach(entry => {
2753 - if (entry.isIntersecting) {
2754 - const ele = entry.target;
2755 - setTimeout(function () {
2756 - getResponse(ele);
2757 - }, 600);
2758 - eleObserver.unobserve(ele);
2759 - }
2760 - });
2761 - });
2762 - [...elements].map(ele => eleObserver.observe(ele));
2763 - }
2764 - const getResponse = async ele => {
2765 - let url = 'lp/v1/lazy-load/course-progress';
2766 - if (lpData.urlParams.hasOwnProperty('lang')) {
2767 - url += '?lang=' + lpData.urlParams.lang;
2768 - }
2769 - const response = await wp.apiFetch({
2770 - path: url,
2771 - method: 'POST',
2772 - data: {
2773 - courseId: lpGlobalSettings.post_id || '',
2774 - userId: lpData.user_id || ''
2775 - }
2776 - });
2777 - const {
2778 - data
2779 - } = response;
2780 - ele.innerHTML = data;
2781 - };
2782 -};
2895 +/*const courseProgress = () => {
2896 + const elements = document.querySelectorAll( '.lp-course-progress-wrapper' );
2897 +
2898 + if ( ! elements.length ) {
2899 + return;
2900 + }
2901 +
2902 + if ( 'IntersectionObserver' in window ) {
2903 + const eleObserver = new IntersectionObserver( ( entries, observer ) => {
2904 + entries.forEach( ( entry ) => {
2905 + if ( entry.isIntersecting ) {
2906 + const ele = entry.target;
2907 +
2908 + setTimeout( function() {
2909 + getResponse( ele );
2910 + }, 600 );
2911 +
2912 + eleObserver.unobserve( ele );
2913 + }
2914 + } );
2915 + } );
2916 +
2917 + [ ...elements ].map( ( ele ) => eleObserver.observe( ele ) );
2918 + }
2919 +
2920 + const getResponse = async ( ele ) => {
2921 + let url = 'lp/v1/lazy-load/course-progress';
2922 + if ( lpData.urlParams.hasOwnProperty( 'lang' ) ) {
2923 + url += '?lang=' + lpData.urlParams.lang;
2924 + }
2925 +
2926 + const response = await wp.apiFetch( {
2927 + path: url,
2928 + method: 'POST',
2929 + data: {
2930 + courseId: lpGlobalSettings.post_id || '',
2931 + userId: lpData.user_id || '',
2932 + },
2933 + } );
2934 +
2935 + const { data } = response;
2936 +
2937 + ele.innerHTML = data;
2938 + };
2939 +};*/
2940 +
2783 2941 const accordionExtraTab = () => {
2784 2942 const elements = document.querySelectorAll('.course-extra-box');
2785 2943 [...elements].map(ele => {
2786 2944 const title = ele.querySelector('.course-extra-box__title');
@@ -2839,9 +2997,9 @@
2839 2997 initCourseSidebar();
2840 2998 enrollCourse();
2841 2999 purchaseCourse();
2842 3000 retakeCourse();
2843 - courseProgress();
3001 + //courseProgress();
2844 3002 courseContinue();
2845 3003 _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_2__["default"].init();
2846 3004 (0,_material__WEBPACK_IMPORTED_MODULE_5__["default"])();
2847 3005 //courseCurriculumSkeleton();