vendor: 111 bytes, lines 1-5
1/******/ (() => { // webpackBootstrap 2/******/ "use strict"; 3/******/ var __webpack_modules__ = ({ 4 5/***/ "./
5assets/src/js/api.js": 6/*!******************************!*\ 7 !*** ./assets/src/js/api.js ***! 8 \******************************/ 9/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10 11__webpack_require__.r(__webpack_exports__); 12/* harmony export */ __webpack_require__.d(__webpack_exports__, { 13/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 14/* harmony export */ }); 15/** 16 * List API on backend 17 */ 18 19const lplistAPI = {}; 20if ('undefined' !== typeof lpDataAdmin) { 21 lplistAPI.admin = { 22 apiAdminNotice: lpDataAdmin.lp_rest_url + 'lp/v1/admin/tools/admin-notices', 23 apiAdminOrderStatic: lpDataAdmin.lp_rest_url + 'lp/v1/orders/statistic', 24 apiAddons: lpDataAdmin.lp_rest_url + 'lp/v1/addon/all', 25 apiAddonAction: lpDataAdmin.lp_rest_url + 'lp/v1/addon/action', 26 apiSearchCourses: lpDataAdmin.lp_rest_url + 'lp/v1/admin/tools/search-course', 27 apiSearchUsers: lpDataAdmin.lp_rest_url + 'lp/v1/admin/tools/search-user', 28 apiAssignUserCourse: lpDataAdmin.lp_rest_url + 'lp/v1/admin/tools/assign-user-course', 29 apiUnAssignUserCourse: lpDataAdmin.lp_rest_url + 'lp/v1/admin/tools/unassign-user-course' 30 }; 31} 32if ('undefined' !== typeof lpData) { 33 lplistAPI.frontend = { 34 apiWidgets: lpData.lp_rest_url + 'lp/v1/widgets/api', 35 apiCourses: lpData.lp_rest_url + 'lp/v1/courses/archive-course', 36 apiAJAX: lpData.lp_rest_url + 'lp/v1/load_content_via_ajax/' 37 }; 38} 39/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (lplistAPI); 40 41/***/ }), 42
43/***/ "./assets/src/js/utils.js": 44/*!********************************!*\ 45 !*** ./assets/src/js/utils.js ***! 46 \********************************/ 47/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 48 49__webpack_require__.r(__webpack_exports__); 50/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51/* harmony export */ lpAddQueryArgs: () => (/* binding */ lpAddQueryArgs), 52/* harmony export */ lpFetchAPI: () => (/* binding */ lpFetchAPI), 53/* harmony export */ lpGetCurrentURLNoParam: () => (/* binding */ lpGetCurrentURLNoParam) 54/* harmony export */ }); 55const lpFetchAPI = (url, data = {}, functions = {}) => { 56 if ('function' === typeof functions.before) { 57 functions.before(); 58 } 59 fetch(url, { 60 method: 'GET', 61 ...data 62 }).then(response => response.json()).then(response => { 63 if ('function' === typeof functions.success) { 64 functions.success(response); 65 } 66 }).catch(err => { 67 if ('function' === typeof functions.error) { 68 functions.error(err); 69 } 70 }).finally(() => { 71 if ('function' === typeof functions.completed) { 72 functions.completed(); 73 } 74 }); 75}; 76const lpGetCurrentURLNoParam = () => { 77 let currentUrl = window.location.href; 78 const hasParams = currentUrl.includes('?'); 79 if (hasParams) { 80 currentUrl = currentUrl.split('?')[0]; 81 } 82 return currentUrl; 83}; 84const lpAddQueryArgs = (endpoint, args) => { 85 const url = new URL(endpoint); 86 Object.keys(args).forEach(arg => { 87 url.searchParams.set(arg, args[arg]); 88 }); 89 return url; 90}; 91 92 93/***/ })
93 94 95/******/ }); 96/************************************************************************/ 97/******/ // The module cache 98/******/ var __webpack_module_cache__ = {}; 99/******/ 100/******/ // The require function 101/******/ function __webpack_require__(moduleId) { 102/******/ // Check if module is in cache 103/******/ var cachedModule = __webpack_module_cache__[moduleId]; 104/******/ if (cachedModule !== undefined) { 105/******/ return cachedModule.exports; 106/******/ } 107/******/ // Create a new module (and put it into the cache) 108/******/ var module = __webpack_module_cache__[moduleId] = { 109/******/ // no module.id needed 110/******/ // no module.loaded needed 111/******/ exports: {} 112/******/ }; 113/******/ 114/******/ // Execute the module function 115/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 116/******/ 117/******/ // Return the exports of the module 118/******/ return module.exports; 119/******/ } 120/******/ 121/************************************************************************/ 122/******/ /* webpack/runtime/define property getters */ 123/******/ (() => { 124/******/ // define getter functions for harmony exports 125/******/ __webpack_require__.d = (exports, definition) => { 126/******/ for(var key in definition) { 127/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 128/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 129/******/ } 130/******/ } 131/******/ }; 132/******/ })(); 133/******/ 134/******/ /* webpack/runtime/hasOwnProperty shorthand */ 135/******/ (() => { 136/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 137/******/ })(); 138/******/ 139/******/ /* webpack/runtime/make namespace object */ 140/******/ (() => { 141/******/ // define __esModule on exports 142/******/ __webpack_require__.r = (exports) => { 143/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 144/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 145/******/ } 146/******/ Object.defineProperty(exports, '__esModule', { value: true }); 147/******/ }; 148/******/ })(); 149/******/ 150/************************************************************************/ 151var __webpack_exports__ = {}; 152// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 153(() => { 154/*!***********************************!*\ 155 !*** ./assets/src/js/loadAJAX.js ***! 156 \***********************************/ 157__webpack_require__.r(__webpack_exports__); 158/* harmony export */ __webpack_require__.d(__webpack_exports__, { 159/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 160/* harmony export */ }); 161/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./assets/src/js/utils.js"); 162/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./api */ "./assets/src/js/api.js"); 163/** 164 * Load all you need via AJAX 165 * 166 * @since 4.2.5.7 167 */ 168 169 170 171const lpAJAX = () => { 172 return { 173 autoLoadAPIs: () => { 174 console.log('autoLoadAPIs'); 175 }, 176 fetchAPI: (url, params, callBack) => { 177 const option = { 178 headers: {} 179 }; 180 if (0 !== parseInt(lpData.user_id)) { 181 option.headers['X-WP-Nonce'] = lpData.nonce; 182 } 183 if ('undefined' !== typeof params.args.method_request) { 184 option.method = params.args.method_request; 185 } else { 186 option.method = 'POST'; 187 } 188 params.args = { 189 ...params.args,
190 ...lpData.urlParams 191 }; 192 if ('POST' === option.method) { 193 option.body = JSON.stringify(params); 194 option.headers['Content-Type'] = 'application/json'; 195 } else { 196 params.args = JSON.stringify(params.args); 197 params.callback = JSON.stringify(params.callback); 198 url = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.lpAddQueryArgs)(url, params); 199 } 200 (0,_utils__WEBPACK_IMPORTED_MODULE_0__.lpFetchAPI)(url, option, callBack); 201 }, 202 getElements: () => { 203 // Finds all elements with the class '.lp-load-ajax-element' 204 const elements = document.querySelectorAll('.lp-load-ajax-element'); 205 if (elements.length) { 206 elements.forEach(element => { 207 const url = _api__WEBPACK_IMPORTED_MODULE_1__["default"].frontend.apiAJAX; 208 const dataObj = JSON.parse(element.dataset.send); 209 const dataSend = { 210 ...dataObj 211 }; 212 const elLoadingFirst = element.querySelector('.loading-first'); 213 const callBack = { 214 success: response => { 215 const { 216 status, 217 message, 218 data 219 } = response; 220 const args = dataObj.args; 221 const elTarget = element.querySelector(args.el_target || ''); 222 if (!elTarget) { 223 console.log('elTarget load ajax content not found'); 224 return; 225 } 226 if ('success' === status) { 227 elTarget.innerHTML = data.content; 228 } else if ('error' === status) { 229 elTarget.innerHTML = message; 230 } 231 }, 232 error: error => { 233 console.log(error); 234 }, 235 completed: () => { 236 console.log('completed'); 237 if (elLoadingFirst) { 238 elLoadingFirst.remove(); 239 } 240 } 241 }; 242 window.lpAJAXG.fetchAPI(url, dataSend, callBack); 243 }); 244 } 245 } 246 }; 247}; 248if ('undefined' === typeof window.lpAJAXG) { 249 window.lpAJAXG = lpAJAX(); 250 window.lpAJAXG.getElements(); 251} 252/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (lpAJAX); 253})(); 254 255/******/ })() 256; 257//# sourceMappingURL=loadAJAX.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.