PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
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 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | assets/js/dist/loadAJAX.js +52 -48 4.4.7 → 4.4.9 View file →
@@ -503,19 +503,19 @@
503 503
504 504 /******/ });
505 505 /************************************************************************/
506 506 /******/ // The module cache
507 -/******/ const __webpack_module_cache__ = {};
507 +/******/ var __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 -/******/ const cachedModule = __webpack_module_cache__[moduleId];
512 +/******/ var 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 -/******/ const module = __webpack_module_cache__[moduleId] = {
517 +/******/ var 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 -/******/ const e = new Error("Cannot find module '" + moduleId + "'");
526 +/******/ var 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,29 +535,14 @@
535 535 /******/
536 536 /************************************************************************/
537 537 /******/ /* webpack/runtime/define property getters */
538 538 /******/ (() => {
539 -/******/ // define getter/value functions for harmony exports
539 +/******/ // define getter functions for harmony exports
540 540 /******/ __webpack_require__.d = (exports, definition) => {
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++; }
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] });
553 544 /******/ }
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 -/******/ }
560 545 /******/ }
561 546 /******/ };
562 547 /******/ })();
563 548 /******/
@@ -562,9 +547,9 @@
562 547 /******/ })();
563 548 /******/
564 549 /******/ /* webpack/runtime/hasOwnProperty shorthand */
565 550 /******/ (() => {
566 -/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop))
551 +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
567 552 /******/ })();
568 553 /******/
569 554 /******/ /* webpack/runtime/make namespace object */
570 555 /******/ (() => {
@@ -569,9 +554,9 @@
569 554 /******/ /* webpack/runtime/make namespace object */
570 555 /******/ (() => {
571 556 /******/ // define __esModule on exports
572 557 /******/ __webpack_require__.r = (exports) => {
573 -/******/ if(Symbol.toStringTag) {
558 +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
574 559 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
575 560 /******/ }
576 561 /******/ Object.defineProperty(exports, '__esModule', { value: true });
577 562 /******/ };
@@ -577,9 +562,9 @@
577 562 /******/ };
578 563 /******/ })();
579 564 /******/
580 565 /************************************************************************/
581 -let __webpack_exports__ = {};
566 +var __webpack_exports__ = {};
582 567 // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
583 568 (() => {
584 569 /*!***********************************!*\
585 570 !*** ./assets/src/js/loadAJAX.js ***!
@@ -587,14 +572,14 @@
587 572 __webpack_require__.r(__webpack_exports__);
588 573 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
589 574 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
590 575 /* harmony export */ });
591 -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ "./assets/src/js/utils.js");
576 +/* harmony import */ var lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lpAssetsJsPath/utils.js */ "./assets/src/js/utils.js");
592 577 /**
593 578 * Load all you need via AJAX
594 579 *
595 580 * @since 4.2.5.7
596 - * @version 1.1.0
581 + * @version 1.1.1
597 582 */
598 583
599 584
600 585
@@ -608,9 +593,9 @@
608 593 // End Handle general parameter in the Frontend and Backend
609 594
610 595 const lpAJAX = () => {
611 596 const classLPTarget = '.lp-target';
612 - const urlCurrent = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpGetCurrentURLNoParam)();
597 + const urlCurrent = lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpGetCurrentURLNoParam();
613 598 return {
614 599 autoLoadAPIs: () => {
615 600 console.log('autoLoadAPIs');
616 601 },
@@ -634,11 +619,11 @@
634 619 option.headers['Content-Type'] = 'application/json';
635 620 } else {
636 621 params.args = JSON.stringify(params.args);
637 622 params.callback = JSON.stringify(params.callback);
638 - url = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs)(url, params);
623 + url = lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs(url, params);
639 624 }
640 - ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpFetchAPI)(url, option, callBack);
625 + lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpFetchAPI(url, option, callBack);
641 626 },
642 627 fetchAJAX: (params, callBack) => {
643 628 let urlAjax = lpSettings.lpAjaxUrl;
644 629
@@ -643,36 +628,55 @@
643 628 let urlAjax = lpSettings.lpAjaxUrl;
644 629
645 630 // Set param id_url for identify.
646 631 if (params.hasOwnProperty('args') && params.args.hasOwnProperty('id_url')) {
647 - urlAjax = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs)(urlAjax, {
632 + urlAjax = lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs(urlAjax, {
648 633 id_url: params.args.id_url
649 634 });
650 635 } else if (params.hasOwnProperty('id_url')) {
651 - urlAjax = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs)(urlAjax, {
636 + urlAjax = lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs(urlAjax, {
652 637 id_url: params.id_url
653 638 });
654 639 }
655 640 // Set param lang here if exits, for detect translate
656 641 if (lpSettings.urlParams.hasOwnProperty('lang')) {
657 - urlAjax = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs)(urlAjax, {
642 + urlAjax = lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs(urlAjax, {
658 643 lang: lpSettings.urlParams.lang
659 644 });
660 645 }
661 - const formData = new FormData();
662 646 const action = params.hasOwnProperty('action') ? params.action : 'load_content_via_ajax';
663 - formData.append('nonce', lpSettings.nonce);
664 - formData.append('lp-load-ajax', action);
665 - formData.append('data', JSON.stringify(params));
666 - const dataSend = {
667 - method: 'POST',
668 - headers: {},
669 - body: formData
670 - };
647 + const isGet = params.hasOwnProperty('method_request') && 'GET' === String(params.method_request).toUpperCase();
648 + let dataSend;
649 + if (isGet) {
650 + // Don't send method_request back to server; keep URL shorter.
651 + const paramsForSend = {
652 + ...params
653 + };
654 + delete paramsForSend.method_request;
655 + urlAjax = lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs(urlAjax, {
656 + nonce: lpSettings.nonce,
657 + 'lp-load-ajax': action,
658 + data: JSON.stringify(paramsForSend)
659 + });
660 + dataSend = {
661 + method: 'GET',
662 + headers: {}
663 + };
664 + } else {
665 + const formData = new FormData();
666 + formData.append('nonce', lpSettings.nonce);
667 + formData.append('lp-load-ajax', action);
668 + formData.append('data', JSON.stringify(params));
669 + dataSend = {
670 + method: 'POST',
671 + headers: {},
672 + body: formData
673 + };
674 + }
671 675 if (0 !== parseInt(lpSettings.user_id)) {
672 676 dataSend.headers['X-WP-Nonce'] = lpSettings.nonce;
673 677 }
674 - ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpFetchAPI)(urlAjax, dataSend, callBack);
678 + lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpFetchAPI(urlAjax, dataSend, callBack);
675 679 },
676 680 getElements: () => {
677 681 // Finds all elements with the class '.lp-load-ajax-element'
678 682 const elements = document.querySelectorAll('.lp-load-ajax-element:not(.loaded)');
@@ -760,9 +764,9 @@
760 764
761 765 // Set url params to reload page.
762 766 if (!dataSend.args.hasOwnProperty('enableUpdateParamsUrl') || dataSend.args.enableUpdateParamsUrl) {
763 767 lpSettings.urlParams.paged = dataSend.args.paged;
764 - window.history.pushState({}, '', (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs)(urlCurrent, lpSettings.urlParams));
768 + window.history.pushState({}, '', lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs(urlCurrent, lpSettings.urlParams));
765 769 }
766 770 // End.
767 771
768 772 // Show loading
@@ -804,9 +808,9 @@
804 808 },
805 809 showHideLoading: (elLPTarget, status) => {
806 810 const elLoading = elLPTarget.nextElementSibling?.querySelector('.lp-loading-change');
807 811 if (elLoading) {
808 - (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl)(elLoading, status);
812 + lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(elLoading, status);
809 813 }
810 814 }
811 815 };
812 816 };
@@ -819,9 +823,9 @@
819 823 window.lpAJAXG.clickNumberPage(e, target);
820 824 });
821 825
822 826 // Listen element created
823 -(0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.listenElementCreated)(node => {
827 +lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.listenElementCreated(node => {
824 828 if (node.classList.contains('lp-load-ajax-element')) {
825 829 //console.log( 'Element created', node );
826 830 window.lpAJAXG.getElements();
827 831 }
@@ -827,9 +831,9 @@
827 831 }
828 832 });
829 833
830 834 // Listen element ready
831 -(0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpOnElementReady)('.lp-load-ajax-element', element => {
835 +lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpOnElementReady('.lp-load-ajax-element', element => {
832 836 //console.log( 'Element ready', element );
833 837 window.lpAJAXG.getElements();
834 838 });
835 839