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