| @@ -1,33 +1,86 @@ | ||
| 1 | -/******/ (function() { // webpackBootstrap | |
| 1 | +/******/ (() => { // webpackBootstrap | |
| 2 | 2 | /******/ var __webpack_modules__ = ({ |
| 3 | 3 | |
| 4 | -/***/ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js": | |
| 4 | +/***/ "./assets/src/apps/js/frontend/material.js" | |
| 5 | +/*!*************************************************!*\ | |
| 6 | + !*** ./assets/src/apps/js/frontend/material.js ***! | |
| 7 | + \*************************************************/ | |
| 8 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 9 | + | |
| 10 | +"use strict"; | |
| 11 | +__webpack_require__.r(__webpack_exports__); | |
| 12 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 13 | +/* harmony export */ "default": () => (/* binding */ lpMaterialsLoad) | |
| 14 | +/* harmony export */ }); | |
| 15 | +/* harmony import */ var _js_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../js/utils.js */ "./assets/src/js/utils.js"); | |
| 16 | + | |
| 17 | +function lpMaterialsLoad() { | |
| 18 | + document.addEventListener('click', function (e) { | |
| 19 | + const target = e.target; | |
| 20 | + if (target.classList.contains('lp-loadmore-material')) { | |
| 21 | + const loadMoreButton = target; | |
| 22 | + const lpTarget = target.closest('.lp-target'); | |
| 23 | + const dataSend = window.lpAJAXG.getDataSetCurrent(lpTarget); | |
| 24 | + dataSend.args.paged++; | |
| 25 | + _js_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(loadMoreButton, 1); | |
| 26 | + const callBack = { | |
| 27 | + success: response => { | |
| 28 | + const { | |
| 29 | + status, | |
| 30 | + message, | |
| 31 | + data | |
| 32 | + } = response; | |
| 33 | + if (status === 'success') { | |
| 34 | + const tableBody = lpTarget.querySelector('table.course-material-table tbody'); | |
| 35 | + tableBody.insertAdjacentHTML('beforeend', data.content); | |
| 36 | + if (data.paged === data.total_pages) { | |
| 37 | + loadMoreButton.remove(); | |
| 38 | + } | |
| 39 | + window.lpAJAXG.setDataSetCurrent(lpTarget, dataSend); | |
| 40 | + } else { | |
| 41 | + console.error(message); | |
| 42 | + } | |
| 43 | + }, | |
| 44 | + error: error => { | |
| 45 | + console.error(error); | |
| 46 | + }, | |
| 47 | + completed: () => { | |
| 48 | + _js_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(loadMoreButton, 0); | |
| 49 | + } | |
| 50 | + }; | |
| 51 | + window.lpAJAXG.fetchAJAX(dataSend, callBack); | |
| 52 | + } | |
| 53 | + }); | |
| 54 | +} | |
| 55 | + | |
| 56 | +/***/ }, | |
| 57 | + | |
| 58 | +/***/ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js" | |
| 5 | 59 | /*!**********************************************************************!*\ |
| 6 | 60 | !*** ./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js ***! |
| 7 | 61 | \**********************************************************************/ |
| 8 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 62 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 9 | 63 | |
| 10 | 64 | "use strict"; |
| 11 | 65 | __webpack_require__.r(__webpack_exports__); |
| 66 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 67 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 68 | +/* harmony export */ }); | |
| 12 | 69 | /* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js"); |
| 13 | 70 | |
| 14 | 71 | const lpModalOverlayCompleteItem = { |
| 15 | 72 | elBtnFinishCourse: null, |
| 16 | 73 | elBtnCompleteItem: null, |
| 17 | - | |
| 18 | 74 | init() { |
| 19 | 75 | if (!_utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].init()) { |
| 20 | 76 | return; |
| 21 | 77 | } |
| 22 | - | |
| 23 | 78 | if (undefined === lpGlobalSettings || 'yes' !== lpGlobalSettings.option_enable_popup_confirm_finish) { |
| 24 | 79 | return; |
| 25 | 80 | } |
| 26 | - | |
| 27 | 81 | this.elBtnFinishCourse = document.querySelectorAll('.lp-btn-finish-course'); |
| 28 | 82 | this.elBtnCompleteItem = document.querySelector('.lp-btn-complete-item'); |
| 29 | - | |
| 30 | 83 | if (this.elBtnCompleteItem) { |
| 31 | 84 | this.elBtnCompleteItem.addEventListener('click', e => { |
| 32 | 85 | e.preventDefault(); |
| 33 | 86 | const form = e.target.closest('form'); |
| @@ -32,16 +85,19 @@ | ||
| 32 | 85 | e.preventDefault(); |
| 33 | 86 | const form = e.target.closest('form'); |
| 34 | 87 | _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elLPOverlay.show(); |
| 35 | 88 | _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setTitleModal(form.dataset.title); |
| 36 | - _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal('<div class="pd-2em">' + form.dataset.confirm + '</div>'); | |
| 37 | - | |
| 89 | + // ESC html | |
| 90 | + const div = document.createElement('div'); | |
| 91 | + div.appendChild(document.createTextNode(form.dataset.confirm)); | |
| 92 | + const contentModal = div.innerHTML; | |
| 93 | + // End ESC html | |
| 94 | + _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal('<div class="pd-2em">' + contentModal + '</div>'); | |
| 38 | 95 | _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = () => { |
| 39 | 96 | form.submit(); |
| 40 | 97 | }; |
| 41 | 98 | }); |
| 42 | 99 | } |
| 43 | - | |
| 44 | 100 | if (this.elBtnFinishCourse) { |
| 45 | 101 | this.elBtnFinishCourse.forEach(element => element.addEventListener('click', e => { |
| 46 | 102 | e.preventDefault(); |
| 47 | 103 | const form = e.target.closest('form'); |
| @@ -47,9 +103,8 @@ | ||
| 47 | 103 | const form = e.target.closest('form'); |
| 48 | 104 | _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].elLPOverlay.show(); |
| 49 | 105 | _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setTitleModal(form.dataset.title); |
| 50 | 106 | _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].setContentModal('<div class="pd-2em">' + form.dataset.confirm + '</div>'); |
| 51 | - | |
| 52 | 107 | _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__["default"].callBackYes = () => { |
| 53 | 108 | form.submit(); |
| 54 | 109 | }; |
| 55 | 110 | })); |
| @@ -54,29 +109,33 @@ | ||
| 54 | 109 | }; |
| 55 | 110 | })); |
| 56 | 111 | } |
| 57 | 112 | } |
| 58 | - | |
| 59 | 113 | }; |
| 60 | -/* harmony default export */ __webpack_exports__["default"] = (lpModalOverlayCompleteItem); | |
| 114 | +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (lpModalOverlayCompleteItem); | |
| 61 | 115 | |
| 62 | -/***/ }), | |
| 116 | +/***/ }, | |
| 63 | 117 | |
| 64 | -/***/ "./assets/src/apps/js/frontend/single-course/index.js": | |
| 118 | +/***/ "./assets/src/apps/js/frontend/single-course/index.js" | |
| 65 | 119 | /*!************************************************************!*\ |
| 66 | 120 | !*** ./assets/src/apps/js/frontend/single-course/index.js ***! |
| 67 | 121 | \************************************************************/ |
| 68 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 122 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 69 | 123 | |
| 70 | 124 | "use strict"; |
| 71 | 125 | __webpack_require__.r(__webpack_exports__); |
| 72 | -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); | |
| 73 | -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); | |
| 74 | -/* harmony import */ var _learnpress_quiz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @learnpress/quiz */ "@learnpress/quiz"); | |
| 75 | -/* harmony import */ var _learnpress_quiz__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_learnpress_quiz__WEBPACK_IMPORTED_MODULE_1__); | |
| 76 | -/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./store */ "./assets/src/apps/js/frontend/single-course/store/index.js"); | |
| 77 | -/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_store__WEBPACK_IMPORTED_MODULE_2__); | |
| 78 | -/* harmony import */ var _single_curriculum_components_sidebar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../single-curriculum/components/sidebar */ "./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js"); | |
| 126 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 127 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 128 | +/* harmony export */ }); | |
| 129 | +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 130 | +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 131 | +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); | |
| 132 | +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); | |
| 133 | +/* harmony import */ var _learnpress_quiz__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @learnpress/quiz */ "@learnpress/quiz"); | |
| 134 | +/* harmony import */ var _learnpress_quiz__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_learnpress_quiz__WEBPACK_IMPORTED_MODULE_2__); | |
| 135 | +/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store */ "./assets/src/apps/js/frontend/single-course/store/index.js"); | |
| 136 | +/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_store__WEBPACK_IMPORTED_MODULE_3__); | |
| 137 | +/* harmony import */ var _single_curriculum_components_sidebar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../single-curriculum/components/sidebar */ "./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js"); | |
| 79 | 138 | |
| 80 | 139 | |
| 81 | 140 | |
| 82 | 141 | |
| @@ -81,63 +140,56 @@ | ||
| 81 | 140 | |
| 82 | 141 | |
| 83 | 142 | // Use toggle in Curriculum tab. |
| 84 | 143 | |
| 85 | -class SingleCourse extends _wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Component { | |
| 144 | +class SingleCourse extends _wordpress_element__WEBPACK_IMPORTED_MODULE_1__.Component { | |
| 86 | 145 | render() { |
| 87 | - return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.Fragment, null); | |
| 146 | + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null); | |
| 88 | 147 | } |
| 89 | - | |
| 90 | 148 | } |
| 91 | - | |
| 92 | -/* harmony default export */ __webpack_exports__["default"] = (SingleCourse); | |
| 93 | - | |
| 149 | +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SingleCourse); | |
| 94 | 150 | function run() { |
| 95 | - (0,_single_curriculum_components_sidebar__WEBPACK_IMPORTED_MODULE_3__.Sidebar)(); | |
| 151 | + (0,_single_curriculum_components_sidebar__WEBPACK_IMPORTED_MODULE_4__.Sidebar)(); | |
| 96 | 152 | } |
| 97 | - | |
| 98 | 153 | document.addEventListener('DOMContentLoaded', () => { |
| 99 | 154 | run(); |
| 100 | 155 | }); |
| 101 | 156 | |
| 102 | -/***/ }), | |
| 157 | +/***/ }, | |
| 103 | 158 | |
| 104 | -/***/ "./assets/src/apps/js/frontend/single-course/store/index.js": | |
| 159 | +/***/ "./assets/src/apps/js/frontend/single-course/store/index.js" | |
| 105 | 160 | /*!******************************************************************!*\ |
| 106 | 161 | !*** ./assets/src/apps/js/frontend/single-course/store/index.js ***! |
| 107 | 162 | \******************************************************************/ |
| 108 | -/***/ (function() { | |
| 163 | +() { | |
| 109 | 164 | |
| 110 | 165 | /** |
| 111 | 166 | * Created by tu on 9/19/19. |
| 112 | 167 | */ |
| 113 | 168 | |
| 114 | -/***/ }), | |
| 169 | +/***/ }, | |
| 115 | 170 | |
| 116 | -/***/ "./assets/src/apps/js/frontend/single-curriculum/components/search.js": | |
| 171 | +/***/ "./assets/src/apps/js/frontend/single-curriculum/components/search.js" | |
| 117 | 172 | /*!****************************************************************************!*\ |
| 118 | 173 | !*** ./assets/src/apps/js/frontend/single-curriculum/components/search.js ***! |
| 119 | 174 | \****************************************************************************/ |
| 120 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 175 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 121 | 176 | |
| 122 | 177 | "use strict"; |
| 123 | 178 | __webpack_require__.r(__webpack_exports__); |
| 124 | 179 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 125 | -/* harmony export */ "searchCourseContent": function() { return /* binding */ searchCourseContent; } | |
| 180 | +/* harmony export */ searchCourseContent: () => (/* binding */ searchCourseContent) | |
| 126 | 181 | /* harmony export */ }); |
| 127 | 182 | const searchCourseContent = () => { |
| 128 | 183 | const popup = document.querySelector('#popup-course'); |
| 129 | 184 | const list = document.querySelector('#learn-press-course-curriculum'); |
| 130 | - | |
| 131 | 185 | if (popup && list) { |
| 132 | 186 | const items = list.querySelector('.curriculum-sections'); |
| 133 | 187 | const form = popup.querySelector('.search-course'); |
| 134 | 188 | const search = popup.querySelector('.search-course input[type="text"]'); |
| 135 | - | |
| 136 | 189 | if (!search || !items || !form) { |
| 137 | 190 | return; |
| 138 | 191 | } |
| 139 | - | |
| 140 | 192 | const sections = items.querySelectorAll('li.section'); |
| 141 | 193 | const dataItems = items.querySelectorAll('li.course-item'); |
| 142 | 194 | const dataSearch = []; |
| 143 | 195 | dataItems.forEach(item => { |
| @@ -147,18 +199,15 @@ | ||
| 147 | 199 | id: itemID, |
| 148 | 200 | name: name ? name.textContent.toLowerCase() : '' |
| 149 | 201 | }); |
| 150 | 202 | }); |
| 151 | - | |
| 152 | 203 | const submit = event => { |
| 153 | 204 | event.preventDefault(); |
| 154 | 205 | const inputVal = search.value; |
| 155 | 206 | form.classList.add('searching'); |
| 156 | - | |
| 157 | 207 | if (!inputVal) { |
| 158 | 208 | form.classList.remove('searching'); |
| 159 | 209 | } |
| 160 | - | |
| 161 | 210 | const outputs = []; |
| 162 | 211 | dataSearch.forEach(i => { |
| 163 | 212 | if (!inputVal || i.name.match(inputVal.toLowerCase())) { |
| 164 | 213 | outputs.push(i.id); |
| @@ -178,9 +227,8 @@ | ||
| 178 | 227 | if (outputs.includes(a.dataset.id)) { |
| 179 | 228 | isTrue.push(a.dataset.id); |
| 180 | 229 | } |
| 181 | 230 | }); |
| 182 | - | |
| 183 | 231 | if (isTrue.length === 0) { |
| 184 | 232 | section.classList.add('hide-if-js'); |
| 185 | 233 | } else { |
| 186 | 234 | section.classList.remove('hide-if-js'); |
| @@ -186,11 +234,9 @@ | ||
| 186 | 234 | section.classList.remove('hide-if-js'); |
| 187 | 235 | } |
| 188 | 236 | }); |
| 189 | 237 | }; |
| 190 | - | |
| 191 | 238 | const clear = form.querySelector('.clear'); |
| 192 | - | |
| 193 | 239 | if (clear) { |
| 194 | 240 | clear.addEventListener('click', e => { |
| 195 | 241 | e.preventDefault(); |
| 196 | 242 | search.value = ''; |
| @@ -196,26 +242,25 @@ | ||
| 196 | 242 | search.value = ''; |
| 197 | 243 | submit(e); |
| 198 | 244 | }); |
| 199 | 245 | } |
| 200 | - | |
| 201 | 246 | form.addEventListener('submit', submit); |
| 202 | 247 | search.addEventListener('keyup', submit); |
| 203 | 248 | } |
| 204 | 249 | }; |
| 205 | 250 | |
| 206 | -/***/ }), | |
| 251 | +/***/ }, | |
| 207 | 252 | |
| 208 | -/***/ "./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js": | |
| 253 | +/***/ "./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js" | |
| 209 | 254 | /*!*****************************************************************************!*\ |
| 210 | 255 | !*** ./assets/src/apps/js/frontend/single-curriculum/components/sidebar.js ***! |
| 211 | 256 | \*****************************************************************************/ |
| 212 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 257 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 213 | 258 | |
| 214 | 259 | "use strict"; |
| 215 | 260 | __webpack_require__.r(__webpack_exports__); |
| 216 | 261 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 217 | -/* harmony export */ "Sidebar": function() { return /* binding */ Sidebar; } | |
| 262 | +/* harmony export */ Sidebar: () => (/* binding */ Sidebar) | |
| 218 | 263 | /* harmony export */ }); |
| 219 | 264 | const $ = jQuery; |
| 220 | 265 | const { |
| 221 | 266 | throttle |
| @@ -221,22 +266,22 @@ | ||
| 221 | 266 | throttle |
| 222 | 267 | } = lodash; |
| 223 | 268 | const Sidebar = () => { |
| 224 | 269 | // Tungnx - Show/hide sidebar curriculumn |
| 225 | - const elSidebarToggle = document.querySelector('#sidebar-toggle'); // For style of theme | |
| 270 | + const elSidebarToggle = document.querySelector('#sidebar-toggle'); | |
| 226 | 271 | |
| 272 | + // For style of theme | |
| 227 | 273 | const toggleSidebar = toggle => { |
| 228 | 274 | $('body').removeClass('lp-sidebar-toggle__open'); |
| 229 | 275 | $('body').removeClass('lp-sidebar-toggle__close'); |
| 230 | - | |
| 231 | 276 | if (toggle) { |
| 232 | 277 | $('body').addClass('lp-sidebar-toggle__close'); |
| 233 | 278 | } else { |
| 234 | 279 | $('body').addClass('lp-sidebar-toggle__open'); |
| 235 | 280 | } |
| 236 | - }; // For lp and theme | |
| 281 | + }; | |
| 237 | 282 | |
| 238 | - | |
| 283 | + // For lp and theme | |
| 239 | 284 | if (elSidebarToggle) { |
| 240 | 285 | if ($(window).innerWidth() <= 768) { |
| 241 | 286 | elSidebarToggle.setAttribute('checked', 'checked'); |
| 242 | 287 | } else if (LP.Cookies.get('sidebar-toggle')) { |
| @@ -243,58 +288,62 @@ | ||
| 243 | 288 | elSidebarToggle.setAttribute('checked', 'checked'); |
| 244 | 289 | } else { |
| 245 | 290 | elSidebarToggle.removeAttribute('checked'); |
| 246 | 291 | } |
| 292 | + } | |
| 293 | + // End editor by tungnx | |
| 247 | 294 | |
| 248 | - document.querySelector('#popup-course').addEventListener('click', e => { | |
| 249 | - if (e.target.id === 'sidebar-toggle') { | |
| 250 | - LP.Cookies.set('sidebar-toggle', e.target.checked ? true : false); | |
| 251 | - toggleSidebar(LP.Cookies.get('sidebar-toggle')); | |
| 252 | - } | |
| 253 | - }); | |
| 254 | - } // End editor by tungnx | |
| 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 ); | |
| 302 | + } );*/ | |
| 255 | 303 | |
| 304 | + // Code for old curriculum | |
| 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 | + } ); | |
| 323 | + } );*/ | |
| 256 | 324 | |
| 257 | - const $curriculum = $('#learn-press-course-curriculum'); | |
| 258 | - $curriculum.find('.section-desc').each((i, el) => { | |
| 259 | - const a = $('<span class="show-desc"></span>').on('click', () => { | |
| 260 | - b.toggleClass('c'); | |
| 261 | - }); | |
| 262 | - const b = $(el).siblings('.section-title').append(a); | |
| 325 | + document.addEventListener('click', e => { | |
| 326 | + if (e.target.id === 'sidebar-toggle') { | |
| 327 | + LP.Cookies.set('sidebar-toggle', e.target.checked ? true : false); | |
| 328 | + toggleSidebar(LP.Cookies.get('sidebar-toggle')); | |
| 329 | + } | |
| 263 | 330 | }); |
| 264 | - $('.section').each(function () { | |
| 265 | - const $section = $(this), | |
| 266 | - $toggle = $section.find('.section-left'); | |
| 267 | - $toggle.on('click', function () { | |
| 268 | - const isClose = $section.toggleClass('closed').hasClass('closed'); | |
| 269 | - const sections = LP.Cookies.get('closed-section-' + lpGlobalSettings.post_id) || []; | |
| 270 | - const sectionId = parseInt($section.data('section-id')); | |
| 271 | - const at = sections.findIndex(id => { | |
| 272 | - return id == sectionId; | |
| 273 | - }); | |
| 274 | - | |
| 275 | - if (isClose) { | |
| 276 | - sections.push(parseInt($section.data('section-id'))); | |
| 277 | - } else { | |
| 278 | - sections.splice(at, 1); | |
| 279 | - } | |
| 280 | - | |
| 281 | - LP.Cookies.remove('closed-section-(.*)'); | |
| 282 | - LP.Cookies.set('closed-section-' + lpGlobalSettings.post_id, [...new Set(sections)]); | |
| 283 | - }); | |
| 284 | - }); | |
| 285 | 331 | }; |
| 286 | 332 | |
| 287 | -/***/ }), | |
| 333 | +/***/ }, | |
| 288 | 334 | |
| 289 | -/***/ "./assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js": | |
| 335 | +/***/ "./assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js" | |
| 290 | 336 | /*!***********************************************************************!*\ |
| 291 | 337 | !*** ./assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js ***! |
| 292 | 338 | \***********************************************************************/ |
| 293 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 339 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 294 | 340 | |
| 295 | 341 | "use strict"; |
| 296 | 342 | __webpack_require__.r(__webpack_exports__); |
| 343 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 344 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 345 | +/* harmony export */ }); | |
| 297 | 346 | /* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js"); |
| 298 | 347 | |
| 299 | 348 | const $ = jQuery; |
| 300 | 349 | const scrollToItemCurrent = { |
| @@ -300,9 +349,8 @@ | ||
| 300 | 349 | const scrollToItemCurrent = { |
| 301 | 350 | init() { |
| 302 | 351 | this.scrollToItemViewing = function () { |
| 303 | 352 | const elItemViewing = $('.viewing-course-item'); |
| 304 | - | |
| 305 | 353 | if (elItemViewing.length) { |
| 306 | 354 | const elCourseCurriculumn = $('#learn-press-course-curriculum'); |
| 307 | 355 | const heightCourseItemContentHeader = $('#popup-sidebar').outerHeight(); |
| 308 | 356 | const heightSectionTitle = $('.section-title').outerHeight(); |
| @@ -312,20 +360,18 @@ | ||
| 312 | 360 | const classArr = classList.split(/\s+/); |
| 313 | 361 | let idItem = 0; |
| 314 | 362 | $.each(classArr, function (i, className) { |
| 315 | 363 | const compare = regex.exec(className); |
| 316 | - | |
| 317 | 364 | if (compare) { |
| 318 | 365 | idItem = compare[1]; |
| 319 | 366 | return false; |
| 320 | 367 | } |
| 321 | 368 | }); |
| 322 | - | |
| 323 | 369 | if (0 === idItem) { |
| 324 | 370 | return; |
| 325 | 371 | } |
| 326 | - | |
| 327 | 372 | const elItemCurrent = $('.course-item-' + idItem); |
| 373 | + elItemCurrent.addClass('current'); | |
| 328 | 374 | const offSetTop = elItemCurrent.offset().top; |
| 329 | 375 | const offset = elItemCurrent.offset().top - elCourseCurriculumn.offset().top + elCourseCurriculumn.scrollTop(); |
| 330 | 376 | elCourseCurriculumn.animate({ |
| 331 | 377 | scrollTop: LP.Hook.applyFilters('scroll-item-current', offset - heightSectionHeader) |
| @@ -331,92 +377,97 @@ | ||
| 331 | 377 | scrollTop: LP.Hook.applyFilters('scroll-item-current', offset - heightSectionHeader) |
| 332 | 378 | }, 800); |
| 333 | 379 | } |
| 334 | 380 | }; |
| 335 | - | |
| 336 | 381 | this.scrollToItemViewing(); |
| 337 | 382 | } |
| 338 | - | |
| 339 | 383 | }; |
| 340 | -/* harmony default export */ __webpack_exports__["default"] = (scrollToItemCurrent); | |
| 384 | +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (scrollToItemCurrent); | |
| 341 | 385 | |
| 342 | -/***/ }), | |
| 386 | +/***/ }, | |
| 343 | 387 | |
| 344 | -/***/ "./assets/src/apps/js/frontend/single-curriculum/skeleton.js": | |
| 388 | +/***/ "./assets/src/apps/js/frontend/single-curriculum/skeleton.js" | |
| 345 | 389 | /*!*******************************************************************!*\ |
| 346 | 390 | !*** ./assets/src/apps/js/frontend/single-curriculum/skeleton.js ***! |
| 347 | 391 | \*******************************************************************/ |
| 348 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 392 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 349 | 393 | |
| 350 | 394 | "use strict"; |
| 351 | 395 | __webpack_require__.r(__webpack_exports__); |
| 352 | 396 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 353 | -/* harmony export */ "default": function() { return /* binding */ courseCurriculumSkeleton; } | |
| 397 | +/* harmony export */ "default": () => (/* binding */ courseCurriculumSkeleton) | |
| 354 | 398 | /* harmony export */ }); |
| 355 | 399 | /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); |
| 356 | 400 | /* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_0__); |
| 357 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); | |
| 358 | -/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1__); | |
| 359 | -/* harmony import */ var _scrolltoitem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./scrolltoitem */ "./assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js"); | |
| 360 | -/* harmony import */ var _components_search__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/search */ "./assets/src/apps/js/frontend/single-curriculum/components/search.js"); | |
| 401 | +/* harmony import */ var _scrolltoitem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scrolltoitem */ "./assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js"); | |
| 402 | +/* harmony import */ var _components_search__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/search */ "./assets/src/apps/js/frontend/single-curriculum/components/search.js"); | |
| 361 | 403 | // Rest API load content in Tab Curriculum - Nhamdv. |
| 362 | 404 | |
| 405 | +//import apiFetch from '@wordpress/api-fetch'; | |
| 363 | 406 | |
| 364 | 407 | |
| 365 | - | |
| 366 | -function courseCurriculumSkeleton() { | |
| 367 | - let courseID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; | |
| 408 | +function courseCurriculumSkeleton(courseID = '') { | |
| 409 | + let idItemViewing = 0; | |
| 410 | + const elItemViewing = document.querySelector('.viewing-course-item'); | |
| 411 | + if (elItemViewing) { | |
| 412 | + const regex = new RegExp('^viewing-course-item-([0-9].*)'); | |
| 413 | + const classList = elItemViewing.classList; | |
| 414 | + classList.forEach(function (className) { | |
| 415 | + const compare = regex.exec(className); | |
| 416 | + if (compare) { | |
| 417 | + idItemViewing = compare[1]; | |
| 418 | + return false; | |
| 419 | + } | |
| 420 | + }); | |
| 421 | + } | |
| 368 | 422 | let isLoadingItems = false; |
| 369 | 423 | let isLoadingSections = false; |
| 370 | - | |
| 371 | 424 | const Sekeleton = () => { |
| 372 | 425 | const elementCurriculum = document.querySelector('.learnpress-course-curriculum'); |
| 373 | - | |
| 374 | 426 | if (!elementCurriculum) { |
| 375 | 427 | return; |
| 376 | 428 | } |
| 377 | - | |
| 378 | 429 | getResponse(elementCurriculum); |
| 379 | 430 | }; |
| 380 | - | |
| 381 | 431 | const getResponse = async ele => { |
| 382 | 432 | const skeleton = ele.querySelector('.lp-skeleton-animation'); |
| 383 | 433 | const itemID = ele.dataset.id; |
| 384 | 434 | const sectionID = ele.dataset.section; |
| 385 | - | |
| 386 | 435 | try { |
| 387 | 436 | const page = 1; |
| 388 | - const response = await _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ | |
| 389 | - path: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)('lp/v1/lazy-load/course-curriculum', { | |
| 390 | - courseId: courseID || lpGlobalSettings.post_id || '', | |
| 391 | - page, | |
| 392 | - sectionID: sectionID || '' | |
| 393 | - }), | |
| 394 | - method: 'GET' | |
| 437 | + let url = lpData.lp_rest_url + 'lp/v1/lazy-load/course-curriculum/'; | |
| 438 | + url = (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)(url, { | |
| 439 | + courseId: courseID || lpGlobalSettings.post_id || '', | |
| 440 | + page, | |
| 441 | + sectionID: sectionID || '', | |
| 442 | + idItemViewing | |
| 395 | 443 | }); |
| 444 | + let paramsFetch = {}; | |
| 445 | + if (0 !== parseInt(lpData.user_id)) { | |
| 446 | + paramsFetch = { | |
| 447 | + headers: { | |
| 448 | + 'X-WP-Nonce': lpData.nonce | |
| 449 | + } | |
| 450 | + }; | |
| 451 | + } | |
| 452 | + let response = await fetch(url, { | |
| 453 | + method: 'GET', | |
| 454 | + ...paramsFetch | |
| 455 | + }); | |
| 456 | + response = await response.json(); | |
| 396 | 457 | const { |
| 397 | 458 | data, |
| 398 | 459 | status, |
| 399 | 460 | message |
| 400 | 461 | } = response; |
| 401 | - let section_ids = data.section_ids; | |
| 402 | - | |
| 462 | + const section_ids = data.section_ids; | |
| 403 | 463 | if (status === 'error') { |
| 404 | 464 | throw new Error(message || 'Error'); |
| 405 | 465 | } |
| 406 | - | |
| 407 | - let returnData = data.content; | |
| 408 | - | |
| 409 | - if (undefined === returnData) { | |
| 410 | - // For old Eduma <= 4.6.0 | |
| 411 | - returnData = data; | |
| 412 | - section_ids = response.section_ids; | |
| 413 | - } | |
| 414 | - | |
| 466 | + const returnData = data.content; | |
| 415 | 467 | if (sectionID) { |
| 416 | 468 | if (section_ids && !section_ids.includes(sectionID)) { |
| 417 | 469 | const response2 = await getResponsive('', page + 1, sectionID); |
| 418 | - | |
| 419 | 470 | if (response2) { |
| 420 | 471 | const { |
| 421 | 472 | data2, |
| 422 | 473 | pages2, |
| @@ -445,30 +496,25 @@ | ||
| 445 | 496 | } |
| 446 | 497 | } catch (error) { |
| 447 | 498 | ele.insertAdjacentHTML('beforeend', `<div class="lp-ajax-message error" style="display:block">${error.message || 'Error: Query lp/v1/lazy-load/course-curriculum'}</div>`); |
| 448 | 499 | } |
| 449 | - | |
| 450 | 500 | skeleton && skeleton.remove(); |
| 451 | - (0,_components_search__WEBPACK_IMPORTED_MODULE_3__.searchCourseContent)(); | |
| 501 | + (0,_components_search__WEBPACK_IMPORTED_MODULE_2__.searchCourseContent)(); | |
| 452 | 502 | }; |
| 453 | - | |
| 454 | - const parseContentItems = async _ref => { | |
| 455 | - let { | |
| 456 | - ele, | |
| 457 | - returnData, | |
| 458 | - sectionID, | |
| 459 | - itemID, | |
| 460 | - data2, | |
| 461 | - pages2, | |
| 462 | - page2 | |
| 463 | - } = _ref; | |
| 503 | + const parseContentItems = async ({ | |
| 504 | + ele, | |
| 505 | + returnData, | |
| 506 | + sectionID, | |
| 507 | + itemID, | |
| 508 | + data2, | |
| 509 | + pages2, | |
| 510 | + page2 | |
| 511 | + }) => { | |
| 464 | 512 | const parser = new DOMParser(); |
| 465 | 513 | const doc = parser.parseFromString(returnData, 'text/html'); |
| 466 | - | |
| 467 | 514 | if (data2) { |
| 468 | 515 | const sections = doc.querySelector('.curriculum-sections'); |
| 469 | 516 | const loadMoreBtn = doc.querySelector('.curriculum-more__button'); |
| 470 | - | |
| 471 | 517 | if (loadMoreBtn) { |
| 472 | 518 | if (pages2 <= page2) { |
| 473 | 519 | loadMoreBtn.remove(); |
| 474 | 520 | } else { |
| @@ -474,20 +520,16 @@ | ||
| 474 | 520 | } else { |
| 475 | 521 | loadMoreBtn.dataset.page = page2; |
| 476 | 522 | } |
| 477 | 523 | } |
| 478 | - | |
| 479 | 524 | sections.insertAdjacentHTML('beforeend', data2); |
| 480 | 525 | } |
| 481 | - | |
| 482 | 526 | const section = doc.querySelector(`[data-section-id="${sectionID}"]`); |
| 483 | - | |
| 484 | 527 | if (section) { |
| 485 | 528 | const items = section.querySelectorAll('.course-item'); |
| 486 | 529 | const item_ids = [...items].map(item => item.dataset.id); |
| 487 | 530 | const sectionContent = section.querySelector('.section-content'); |
| 488 | 531 | const itemLoadMore = section.querySelector('.section-item__loadmore'); |
| 489 | - | |
| 490 | 532 | if (itemID && !item_ids.includes(itemID)) { |
| 491 | 533 | const responseItem = await getResponsiveItem('', 2, sectionID, itemID); |
| 492 | 534 | const { |
| 493 | 535 | data3, |
| @@ -494,33 +536,40 @@ | ||
| 494 | 536 | pages3, |
| 495 | 537 | paged3, |
| 496 | 538 | page |
| 497 | 539 | } = responseItem; |
| 498 | - | |
| 499 | 540 | if (pages3 <= paged3 || pages3 <= page) { |
| 500 | 541 | itemLoadMore.remove(); |
| 501 | 542 | } else { |
| 502 | 543 | itemLoadMore.dataset.page = page; |
| 503 | 544 | } |
| 504 | - | |
| 505 | 545 | if (data3 && sectionContent) { |
| 506 | 546 | sectionContent.insertAdjacentHTML('beforeend', data3); |
| 507 | 547 | } |
| 508 | 548 | } |
| 509 | 549 | } |
| 510 | - | |
| 511 | 550 | ele.insertAdjacentHTML('beforeend', doc.body.innerHTML); |
| 512 | - _scrolltoitem__WEBPACK_IMPORTED_MODULE_2__["default"].init(); | |
| 551 | + _scrolltoitem__WEBPACK_IMPORTED_MODULE_1__["default"].init(); | |
| 513 | 552 | }; |
| 514 | - | |
| 515 | 553 | const getResponsiveItem = async (returnData, paged, sectionID, itemID) => { |
| 516 | - const response = await _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ | |
| 517 | - path: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)('lp/v1/lazy-load/course-curriculum-items', { | |
| 518 | - sectionId: sectionID || '', | |
| 519 | - page: paged | |
| 520 | - }), | |
| 521 | - method: 'GET' | |
| 554 | + let url = lpData.lp_rest_url + 'lp/v1/lazy-load/course-curriculum-items/'; | |
| 555 | + url = (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)(url, { | |
| 556 | + sectionId: sectionID || '', | |
| 557 | + page: paged | |
| 522 | 558 | }); |
| 559 | + let paramsFetch = {}; | |
| 560 | + if (0 !== parseInt(lpData.user_id)) { | |
| 561 | + paramsFetch = { | |
| 562 | + headers: { | |
| 563 | + 'X-WP-Nonce': lpData.nonce | |
| 564 | + } | |
| 565 | + }; | |
| 566 | + } | |
| 567 | + let response = await fetch(url, { | |
| 568 | + method: 'GET', | |
| 569 | + ...paramsFetch | |
| 570 | + }); | |
| 571 | + response = await response.json(); | |
| 523 | 572 | const { |
| 524 | 573 | data, |
| 525 | 574 | status, |
| 526 | 575 | pages, |
| @@ -529,26 +578,16 @@ | ||
| 529 | 578 | const { |
| 530 | 579 | page |
| 531 | 580 | } = data; |
| 532 | 581 | let item_ids; |
| 533 | - | |
| 534 | 582 | if (status === 'success') { |
| 535 | - let dataTmp = data.content; | |
| 583 | + const dataTmp = data.content; | |
| 536 | 584 | item_ids = data.item_ids; |
| 537 | - | |
| 538 | - if (undefined === dataTmp) { | |
| 539 | - // For old Eduma <= 4.6.0 | |
| 540 | - dataTmp = data; | |
| 541 | - item_ids = response.item_ids; | |
| 542 | - } | |
| 543 | - | |
| 544 | 585 | returnData += dataTmp; |
| 545 | - | |
| 546 | 586 | if (sectionID && item_ids && itemID && !item_ids.includes(itemID)) { |
| 547 | 587 | return getResponsiveItem(returnData, paged + 1, sectionID, itemID); |
| 548 | 588 | } |
| 549 | 589 | } |
| 550 | - | |
| 551 | 590 | isLoadingItems = false; |
| 552 | 591 | return { |
| 553 | 592 | data3: returnData, |
| 554 | 593 | pages3: pages || data.pages, |
| @@ -556,43 +595,43 @@ | ||
| 556 | 595 | message3: message, |
| 557 | 596 | page: page || 0 |
| 558 | 597 | }; |
| 559 | 598 | }; |
| 560 | - | |
| 561 | 599 | const getResponsive = async (returnData, page, sectionID) => { |
| 562 | - const response = await _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_1___default()({ | |
| 563 | - path: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)('lp/v1/lazy-load/course-curriculum', { | |
| 564 | - courseId: courseID || lpGlobalSettings.post_id || '', | |
| 565 | - page, | |
| 566 | - sectionID: sectionID || '', | |
| 567 | - loadMore: true | |
| 568 | - }), | |
| 569 | - method: 'GET' | |
| 600 | + let url = lpData.lp_rest_url + 'lp/v1/lazy-load/course-curriculum/'; | |
| 601 | + url = (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_0__.addQueryArgs)(url, { | |
| 602 | + courseId: courseID || lpGlobalSettings.post_id || '', | |
| 603 | + page, | |
| 604 | + sectionID: sectionID || '', | |
| 605 | + loadMore: true | |
| 570 | 606 | }); |
| 607 | + let paramsFetch = {}; | |
| 608 | + if (0 !== parseInt(lpData.user_id)) { | |
| 609 | + paramsFetch = { | |
| 610 | + headers: { | |
| 611 | + 'X-WP-Nonce': lpData.nonce | |
| 612 | + } | |
| 613 | + }; | |
| 614 | + } | |
| 615 | + let response = await fetch(url, { | |
| 616 | + method: 'GET', | |
| 617 | + ...paramsFetch | |
| 618 | + }); | |
| 619 | + response = await response.json(); | |
| 571 | 620 | const { |
| 572 | 621 | data, |
| 573 | 622 | status, |
| 574 | 623 | message |
| 575 | 624 | } = response; |
| 576 | - let returnDataTmp = data.content; | |
| 577 | - let section_ids = data.section_ids; | |
| 578 | - let pages = data.pages; | |
| 579 | - | |
| 580 | - if (undefined === returnDataTmp) { | |
| 581 | - // For old Eduma <= 4.6.0 | |
| 582 | - returnDataTmp = data; | |
| 583 | - section_ids = response.section_ids; | |
| 584 | - pages = response.pages; | |
| 585 | - } | |
| 586 | - | |
| 625 | + const returnDataTmp = data.content; | |
| 626 | + const section_ids = data.section_ids; | |
| 627 | + const pages = data.pages; | |
| 587 | 628 | if (status === 'success') { |
| 588 | 629 | returnData += returnDataTmp; |
| 589 | - | |
| 590 | 630 | if (sectionID && section_ids && section_ids.length > 0 && !section_ids.includes(sectionID)) { |
| 591 | 631 | return getResponsive(returnData, page + 1, sectionID); |
| 592 | 632 | } |
| 593 | 633 | } |
| 594 | - | |
| 595 | 634 | isLoadingSections = false; |
| 596 | 635 | return { |
| 597 | 636 | data2: returnData, |
| 598 | 637 | pages2: pages || data.pages, |
| @@ -600,9 +639,8 @@ | ||
| 600 | 639 | status2: status, |
| 601 | 640 | message2: message |
| 602 | 641 | }; |
| 603 | 642 | }; |
| 604 | - | |
| 605 | 643 | Sekeleton(); |
| 606 | 644 | document.addEventListener('click', e => { |
| 607 | 645 | const sectionBtns = document.querySelectorAll('.section-item__loadmore'); |
| 608 | 646 | [...sectionBtns].map(async sectionBtn => { |
| @@ -612,9 +650,8 @@ | ||
| 612 | 650 | const sectionId = sectionItem.getAttribute('data-section-id'); |
| 613 | 651 | const sectionContent = sectionItem.querySelector('.section-content'); |
| 614 | 652 | const paged = parseInt(sectionBtn.dataset.page); |
| 615 | 653 | sectionBtn.classList.add('loading'); |
| 616 | - | |
| 617 | 654 | try { |
| 618 | 655 | const response = await getResponsiveItem('', paged + 1, sectionId, ''); |
| 619 | 656 | const { |
| 620 | 657 | data3, |
| @@ -621,29 +658,26 @@ | ||
| 621 | 658 | pages3, |
| 622 | 659 | status3, |
| 623 | 660 | message3 |
| 624 | 661 | } = response; |
| 625 | - | |
| 626 | 662 | if (status3 === 'error') { |
| 627 | 663 | throw new Error(message3 || 'Error'); |
| 628 | 664 | } |
| 629 | - | |
| 630 | 665 | if (pages3 <= paged + 1) { |
| 631 | 666 | sectionBtn.remove(); |
| 632 | 667 | } else { |
| 633 | 668 | sectionBtn.dataset.page = paged + 1; |
| 634 | 669 | } |
| 635 | - | |
| 636 | 670 | sectionContent.insertAdjacentHTML('beforeend', data3); |
| 637 | 671 | } catch (e) { |
| 638 | 672 | sectionContent.insertAdjacentHTML('beforeend', `<div class="lp-ajax-message error" style="display:block">${e.message || 'Error: Query lp/v1/lazy-load/course-curriculum'}</div>`); |
| 639 | 673 | } |
| 640 | - | |
| 641 | 674 | sectionBtn.classList.remove('loading'); |
| 642 | - (0,_components_search__WEBPACK_IMPORTED_MODULE_3__.searchCourseContent)(); | |
| 675 | + (0,_components_search__WEBPACK_IMPORTED_MODULE_2__.searchCourseContent)(); | |
| 643 | 676 | } |
| 644 | - }); // Load more Sections | |
| 677 | + }); | |
| 645 | 678 | |
| 679 | + // Load more Sections | |
| 646 | 680 | const moreSections = document.querySelectorAll('.curriculum-more__button'); |
| 647 | 681 | [...moreSections].map(async moreSection => { |
| 648 | 682 | if (moreSection.contains(e.target) && !isLoadingSections) { |
| 649 | 683 | isLoadingSections = true; |
| @@ -648,12 +682,10 @@ | ||
| 648 | 682 | if (moreSection.contains(e.target) && !isLoadingSections) { |
| 649 | 683 | isLoadingSections = true; |
| 650 | 684 | const paged = parseInt(moreSection.dataset.page); |
| 651 | 685 | const sections = moreSection.parentNode.parentNode.querySelector('.curriculum-sections'); |
| 652 | - | |
| 653 | 686 | if (paged && sections) { |
| 654 | 687 | moreSection.classList.add('loading'); |
| 655 | - | |
| 656 | 688 | try { |
| 657 | 689 | const response2 = await getResponsive('', paged + 1, ''); |
| 658 | 690 | const { |
| 659 | 691 | data2, |
| @@ -660,30 +692,27 @@ | ||
| 660 | 692 | pages2, |
| 661 | 693 | status2, |
| 662 | 694 | message2 |
| 663 | 695 | } = response2; |
| 664 | - | |
| 665 | 696 | if (status2 === 'error') { |
| 666 | 697 | throw new Error(message2 || 'Error'); |
| 667 | 698 | } |
| 668 | - | |
| 669 | 699 | if (pages2 <= paged + 1) { |
| 670 | 700 | moreSection.remove(); |
| 671 | 701 | } else { |
| 672 | 702 | moreSection.dataset.page = paged + 1; |
| 673 | 703 | } |
| 674 | - | |
| 675 | 704 | sections.insertAdjacentHTML('beforeend', data2); |
| 676 | 705 | } catch (e) { |
| 677 | 706 | sections.insertAdjacentHTML('beforeend', `<div class="lp-ajax-message error" style="display:block">${e.message || 'Error: Query lp/v1/lazy-load/course-curriculum'}</div>`); |
| 678 | 707 | } |
| 679 | - | |
| 680 | 708 | moreSection.classList.remove('loading'); |
| 681 | - (0,_components_search__WEBPACK_IMPORTED_MODULE_3__.searchCourseContent)(); | |
| 709 | + (0,_components_search__WEBPACK_IMPORTED_MODULE_2__.searchCourseContent)(); | |
| 682 | 710 | } |
| 683 | 711 | } |
| 684 | - }); // Show/Hide accordion | |
| 712 | + }); | |
| 685 | 713 | |
| 714 | + // Show/Hide accordion | |
| 686 | 715 | if (document.querySelector('.learnpress-course-curriculum')) { |
| 687 | 716 | const sections = document.querySelectorAll('.section'); |
| 688 | 717 | [...sections].map(section => { |
| 689 | 718 | if (section.contains(e.target)) { |
| @@ -694,18 +723,73 @@ | ||
| 694 | 723 | } |
| 695 | 724 | }); |
| 696 | 725 | } |
| 697 | 726 | |
| 698 | -/***/ }), | |
| 727 | +/***/ }, | |
| 699 | 728 | |
| 700 | -/***/ "./assets/src/apps/js/utils/lp-modal-overlay.js": | |
| 729 | +/***/ "./assets/src/apps/js/frontend/tabs-scroll.js" | |
| 730 | +/*!****************************************************!*\ | |
| 731 | + !*** ./assets/src/apps/js/frontend/tabs-scroll.js ***! | |
| 732 | + \****************************************************/ | |
| 733 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 734 | + | |
| 735 | +"use strict"; | |
| 736 | +__webpack_require__.r(__webpack_exports__); | |
| 737 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 738 | +/* harmony export */ "default": () => (/* binding */ TabsDragScroll) | |
| 739 | +/* harmony export */ }); | |
| 740 | +function TabsDragScroll() { | |
| 741 | + // Selectors and DOM elements | |
| 742 | + const TabsDragScroll = document.querySelector('.TabsDragScroll'); | |
| 743 | + if (!TabsDragScroll) return; | |
| 744 | + const tabMenu = TabsDragScroll.querySelector('ul'); | |
| 745 | + | |
| 746 | + // Dragging functionality | |
| 747 | + let activeDrag = false; | |
| 748 | + tabMenu.addEventListener('mousemove', event => { | |
| 749 | + if (!activeDrag) return; | |
| 750 | + tabMenu.scrollLeft -= event.movementX; | |
| 751 | + // iconVisibility(); | |
| 752 | + tabMenu.classList.add('dragging'); | |
| 753 | + }); | |
| 754 | + document.addEventListener('mouseup', () => { | |
| 755 | + activeDrag = false; | |
| 756 | + tabMenu.classList.remove('dragging'); | |
| 757 | + }); | |
| 758 | + tabMenu.addEventListener('mousedown', () => { | |
| 759 | + activeDrag = true; | |
| 760 | + }); | |
| 761 | + | |
| 762 | + // Scroll to <li> on click | |
| 763 | + const scrollToLi = li => { | |
| 764 | + const liLeft = li.offsetLeft; | |
| 765 | + const liWidth = li.offsetWidth; | |
| 766 | + const tabCenter = tabMenu.clientWidth / 2 - liWidth / 2; | |
| 767 | + tabMenu.scrollTo({ | |
| 768 | + left: liLeft - tabCenter, | |
| 769 | + behavior: 'smooth' | |
| 770 | + }); | |
| 771 | + }; | |
| 772 | + | |
| 773 | + // Add click event listeners to all <li> elements | |
| 774 | + tabMenu.querySelectorAll('li').forEach(li => { | |
| 775 | + li.addEventListener('click', () => scrollToLi(li)); | |
| 776 | + }); | |
| 777 | +} | |
| 778 | + | |
| 779 | +/***/ }, | |
| 780 | + | |
| 781 | +/***/ "./assets/src/apps/js/utils/lp-modal-overlay.js" | |
| 701 | 782 | /*!******************************************************!*\ |
| 702 | 783 | !*** ./assets/src/apps/js/utils/lp-modal-overlay.js ***! |
| 703 | 784 | \******************************************************/ |
| 704 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 785 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 705 | 786 | |
| 706 | 787 | "use strict"; |
| 707 | 788 | __webpack_require__.r(__webpack_exports__); |
| 789 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 790 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 791 | +/* harmony export */ }); | |
| 708 | 792 | const $ = jQuery; |
| 709 | 793 | let elLPOverlay = null; |
| 710 | 794 | const lpModalOverlay = { |
| 711 | 795 | elLPOverlay: null, |
| @@ -716,20 +800,16 @@ | ||
| 716 | 800 | elFooter: null, |
| 717 | 801 | elCalledModal: null, |
| 718 | 802 | callBackYes: null, |
| 719 | 803 | instance: null, |
| 720 | - | |
| 721 | 804 | init() { |
| 722 | 805 | if (this.instance) { |
| 723 | 806 | return true; |
| 724 | 807 | } |
| 725 | - | |
| 726 | 808 | this.elLPOverlay = $('.lp-overlay'); |
| 727 | - | |
| 728 | 809 | if (!this.elLPOverlay.length) { |
| 729 | 810 | return false; |
| 730 | 811 | } |
| 731 | - | |
| 732 | 812 | elLPOverlay = this.elLPOverlay; |
| 733 | 813 | this.elMainContent = elLPOverlay.find('.main-content'); |
| 734 | 814 | this.elTitle = elLPOverlay.find('.modal-title'); |
| 735 | 815 | this.elBtnYes = elLPOverlay.find('.btn-yes'); |
| @@ -740,81 +820,1678 @@ | ||
| 740 | 820 | }); |
| 741 | 821 | $(document).on('click', '.btn-yes', function (e) { |
| 742 | 822 | e.preventDefault(); |
| 743 | 823 | e.stopPropagation(); |
| 744 | - | |
| 745 | 824 | if ('function' === typeof lpModalOverlay.callBackYes) { |
| 746 | - lpModalOverlay.callBackYes(); | |
| 825 | + lpModalOverlay.callBackYes(e); | |
| 747 | 826 | } |
| 748 | 827 | }); |
| 749 | 828 | this.instance = this; |
| 750 | 829 | return true; |
| 751 | 830 | }, |
| 752 | - | |
| 753 | 831 | setElCalledModal(elCalledModal) { |
| 754 | 832 | this.elCalledModal = elCalledModal; |
| 755 | 833 | }, |
| 756 | - | |
| 757 | 834 | setContentModal(content, event) { |
| 758 | 835 | this.elMainContent.html(content); |
| 759 | - | |
| 760 | 836 | if ('function' === typeof event) { |
| 761 | 837 | event(); |
| 762 | 838 | } |
| 763 | 839 | }, |
| 764 | - | |
| 765 | 840 | setTitleModal(content) { |
| 766 | 841 | this.elTitle.html(content); |
| 767 | 842 | } |
| 843 | +}; | |
| 844 | +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (lpModalOverlay); | |
| 768 | 845 | |
| 846 | +/***/ }, | |
| 847 | + | |
| 848 | +/***/ "./assets/src/js/frontend/copy-to-clipboard.js" | |
| 849 | +/*!*****************************************************!*\ | |
| 850 | + !*** ./assets/src/js/frontend/copy-to-clipboard.js ***! | |
| 851 | + \*****************************************************/ | |
| 852 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 853 | + | |
| 854 | +"use strict"; | |
| 855 | +__webpack_require__.r(__webpack_exports__); | |
| 856 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 857 | +/* harmony export */ "default": () => (/* binding */ CopyToClipboard) | |
| 858 | +/* harmony export */ }); | |
| 859 | +function LPClick(element, iconBtn, inner) { | |
| 860 | + const wrappers = document.querySelectorAll(element); | |
| 861 | + if (!wrappers.length) { | |
| 862 | + return; | |
| 863 | + } | |
| 864 | + wrappers.forEach(wrapper => { | |
| 865 | + const clickBtn = wrapper.querySelector(iconBtn); | |
| 866 | + const class_open = element.replace('.', '') + '__open'; | |
| 867 | + const closeElement = wrapper.querySelector(element + '__close'); | |
| 868 | + const isOpenElement = () => wrapper.classList.contains(class_open); | |
| 869 | + const showElement = () => { | |
| 870 | + if (!isOpenElement()) { | |
| 871 | + wrapper.classList.add(class_open); | |
| 872 | + } | |
| 873 | + }; | |
| 874 | + const hideElement = () => { | |
| 875 | + if (isOpenElement()) { | |
| 876 | + wrapper.classList.remove(class_open); | |
| 877 | + } | |
| 878 | + }; | |
| 879 | + const toggleElement = () => { | |
| 880 | + if (isOpenElement()) { | |
| 881 | + hideElement(); | |
| 882 | + } else { | |
| 883 | + showElement(); | |
| 884 | + } | |
| 885 | + }; | |
| 886 | + const onKeyDown = e => { | |
| 887 | + if (e.keyCode === 27) { | |
| 888 | + hideElement(); | |
| 889 | + } | |
| 890 | + }; | |
| 891 | + if (clickBtn) { | |
| 892 | + clickBtn.onclick = function (e) { | |
| 893 | + e.preventDefault(); | |
| 894 | + toggleElement(); | |
| 895 | + }; | |
| 896 | + } | |
| 897 | + document.addEventListener('click', e => { | |
| 898 | + if (!isOpenElement()) { | |
| 899 | + return; | |
| 900 | + } | |
| 901 | + const target = e.target; | |
| 902 | + if (target.closest(inner) || target.closest(iconBtn)) { | |
| 903 | + return; | |
| 904 | + } | |
| 905 | + hideElement(); | |
| 906 | + }); | |
| 907 | + if (closeElement) { | |
| 908 | + closeElement.addEventListener('click', e => { | |
| 909 | + e.preventDefault(); | |
| 910 | + hideElement(); | |
| 911 | + }); | |
| 912 | + } | |
| 913 | + document.addEventListener('keydown', onKeyDown, false); | |
| 914 | + }); | |
| 915 | +} | |
| 916 | +function CopyToClipboard() { | |
| 917 | + LPClick('.social-share-toggle', '.share-toggle-icon', '.content-widget-social-share'); | |
| 918 | + var copyTextareaBtn = document.querySelector('.btn-clipboard'); | |
| 919 | + if (copyTextareaBtn) { | |
| 920 | + copyTextareaBtn.addEventListener('click', function (event) { | |
| 921 | + var copyTextarea = document.querySelector('.clipboard-value'); | |
| 922 | + copyTextarea.focus(); | |
| 923 | + copyTextarea.select(); | |
| 924 | + try { | |
| 925 | + var successful = document.execCommand('copy'); | |
| 926 | + var msg = copyTextareaBtn.getAttribute('data-copied'); | |
| 927 | + copyTextareaBtn.innerHTML = msg + '<span class="tooltip">' + msg + '</span>'; | |
| 928 | + } catch (err) {} | |
| 929 | + }); | |
| 930 | + } | |
| 931 | +} | |
| 932 | + | |
| 933 | +/***/ }, | |
| 934 | + | |
| 935 | +/***/ "./assets/src/js/utils.js" | |
| 936 | +/*!********************************!*\ | |
| 937 | + !*** ./assets/src/js/utils.js ***! | |
| 938 | + \********************************/ | |
| 939 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 940 | + | |
| 941 | +"use strict"; | |
| 942 | +__webpack_require__.r(__webpack_exports__); | |
| 943 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 944 | +/* harmony export */ debounce: () => (/* binding */ debounce), | |
| 945 | +/* harmony export */ eventHandlers: () => (/* binding */ eventHandlers), | |
| 946 | +/* harmony export */ fullScreenView: () => (/* binding */ fullScreenView), | |
| 947 | +/* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm), | |
| 948 | +/* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm), | |
| 949 | +/* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated), | |
| 950 | +/* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed), | |
| 951 | +/* harmony export */ lpAddQueryArgs: () => (/* binding */ lpAddQueryArgs), | |
| 952 | +/* harmony export */ lpAjaxParseJsonOld: () => (/* binding */ lpAjaxParseJsonOld), | |
| 953 | +/* harmony export */ lpClassName: () => (/* binding */ lpClassName), | |
| 954 | +/* harmony export */ lpFetchAPI: () => (/* binding */ lpFetchAPI), | |
| 955 | +/* harmony export */ lpGetCurrentURLNoParam: () => (/* binding */ lpGetCurrentURLNoParam), | |
| 956 | +/* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady), | |
| 957 | +/* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl), | |
| 958 | +/* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl), | |
| 959 | +/* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm), | |
| 960 | +/* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse), | |
| 961 | +/* harmony export */ toggleEnable: () => (/* binding */ toggleEnable) | |
| 962 | +/* harmony export */ }); | |
| 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 | |
| 971 | + */ | |
| 972 | +const lpClassName = { | |
| 973 | + hidden: 'lp-hidden', | |
| 974 | + loading: 'loading', | |
| 975 | + elCollapse: 'lp-collapse', | |
| 976 | + elSectionToggle: '.lp-section-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' | |
| 769 | 981 | }; |
| 770 | -/* harmony default export */ __webpack_exports__["default"] = (lpModalOverlay); | |
| 982 | +const lpFetchAPI = (url, data = {}, functions = {}) => { | |
| 983 | + if ('function' === typeof functions.before) { | |
| 984 | + functions.before(); | |
| 985 | + } | |
| 986 | + fetch(url, { | |
| 987 | + method: 'GET', | |
| 988 | + ...data | |
| 989 | + }).then(response => response.json()).then(response => { | |
| 990 | + if ('function' === typeof functions.success) { | |
| 991 | + functions.success(response); | |
| 992 | + } | |
| 993 | + }).catch(err => { | |
| 994 | + if ('function' === typeof functions.error) { | |
| 995 | + functions.error(err); | |
| 996 | + } | |
| 997 | + }).finally(() => { | |
| 998 | + if ('function' === typeof functions.completed) { | |
| 999 | + functions.completed(); | |
| 1000 | + } | |
| 1001 | + }); | |
| 1002 | +}; | |
| 771 | 1003 | |
| 772 | -/***/ }), | |
| 1004 | +/** | |
| 1005 | + * Get current URL without params. | |
| 1006 | + * | |
| 1007 | + * @since 4.2.5.1 | |
| 1008 | + */ | |
| 1009 | +const lpGetCurrentURLNoParam = () => { | |
| 1010 | + let currentUrl = window.location.href; | |
| 1011 | + const hasParams = currentUrl.includes('?'); | |
| 1012 | + if (hasParams) { | |
| 1013 | + currentUrl = currentUrl.split('?')[0]; | |
| 1014 | + } | |
| 1015 | + return currentUrl; | |
| 1016 | +}; | |
| 1017 | +const lpAddQueryArgs = (endpoint, args) => { | |
| 1018 | + const url = new URL(endpoint); | |
| 1019 | + Object.keys(args).forEach(arg => { | |
| 1020 | + url.searchParams.set(arg, args[arg]); | |
| 1021 | + }); | |
| 1022 | + return url; | |
| 1023 | +}; | |
| 773 | 1024 | |
| 774 | -/***/ "@learnpress/quiz": | |
| 1025 | +/** | |
| 1026 | + * Listen element viewed. | |
| 1027 | + * | |
| 1028 | + * @param el | |
| 1029 | + * @param callback | |
| 1030 | + * @since 4.2.5.8 | |
| 1031 | + */ | |
| 1032 | +const listenElementViewed = (el, callback) => { | |
| 1033 | + const observerSeeItem = new IntersectionObserver(function (entries) { | |
| 1034 | + for (const entry of entries) { | |
| 1035 | + if (entry.isIntersecting) { | |
| 1036 | + callback(entry); | |
| 1037 | + } | |
| 1038 | + } | |
| 1039 | + }); | |
| 1040 | + observerSeeItem.observe(el); | |
| 1041 | +}; | |
| 1042 | + | |
| 1043 | +/** | |
| 1044 | + * Listen element created. | |
| 1045 | + * | |
| 1046 | + * @param callback | |
| 1047 | + * @since 4.2.5.8 | |
| 1048 | + */ | |
| 1049 | +const listenElementCreated = callback => { | |
| 1050 | + const observerCreateItem = new MutationObserver(function (mutations) { | |
| 1051 | + mutations.forEach(function (mutation) { | |
| 1052 | + if (mutation.addedNodes) { | |
| 1053 | + mutation.addedNodes.forEach(function (node) { | |
| 1054 | + if (node.nodeType === 1) { | |
| 1055 | + callback(node); | |
| 1056 | + } | |
| 1057 | + }); | |
| 1058 | + } | |
| 1059 | + }); | |
| 1060 | + }); | |
| 1061 | + observerCreateItem.observe(document, { | |
| 1062 | + childList: true, | |
| 1063 | + subtree: true | |
| 1064 | + }); | |
| 1065 | + // End. | |
| 1066 | +}; | |
| 1067 | + | |
| 1068 | +/** | |
| 1069 | + * Listen element created. | |
| 1070 | + * | |
| 1071 | + * @param selector | |
| 1072 | + * @param callback | |
| 1073 | + * @since 4.2.7.1 | |
| 1074 | + */ | |
| 1075 | +const lpOnElementReady = (selector, callback) => { | |
| 1076 | + const element = document.querySelector(selector); | |
| 1077 | + if (element) { | |
| 1078 | + callback(element); | |
| 1079 | + return; | |
| 1080 | + } | |
| 1081 | + const observer = new MutationObserver((mutations, obs) => { | |
| 1082 | + const element = document.querySelector(selector); | |
| 1083 | + if (element) { | |
| 1084 | + obs.disconnect(); | |
| 1085 | + callback(element); | |
| 1086 | + } | |
| 1087 | + }); | |
| 1088 | + observer.observe(document.documentElement, { | |
| 1089 | + childList: true, | |
| 1090 | + subtree: true | |
| 1091 | + }); | |
| 1092 | +}; | |
| 1093 | + | |
| 1094 | +// Parse JSON from string with content include LP_AJAX_START. | |
| 1095 | +const lpAjaxParseJsonOld = data => { | |
| 1096 | + if (typeof data !== 'string') { | |
| 1097 | + return data; | |
| 1098 | + } | |
| 1099 | + const m = String.raw({ | |
| 1100 | + raw: data | |
| 1101 | + }).match(/<-- LP_AJAX_START -->(.*)<-- LP_AJAX_END -->/s); | |
| 1102 | + try { | |
| 1103 | + if (m) { | |
| 1104 | + data = JSON.parse(m[1].replace(/(?:\r\n|\r|\n)/g, '')); | |
| 1105 | + } else { | |
| 1106 | + data = JSON.parse(data); | |
| 1107 | + } | |
| 1108 | + } catch (e) { | |
| 1109 | + data = {}; | |
| 1110 | + } | |
| 1111 | + return data; | |
| 1112 | +}; | |
| 1113 | + | |
| 1114 | +// status 0: hide, 1: show | |
| 1115 | +const lpShowHideEl = (el, status = 0) => { | |
| 1116 | + if (!el) { | |
| 1117 | + return; | |
| 1118 | + } | |
| 1119 | + if (!status) { | |
| 1120 | + el.classList.add(lpClassName.hidden); | |
| 1121 | + } else { | |
| 1122 | + el.classList.remove(lpClassName.hidden); | |
| 1123 | + } | |
| 1124 | +}; | |
| 1125 | + | |
| 1126 | +// status 0: hide, 1: show | |
| 1127 | +const lpSetLoadingEl = (el, status) => { | |
| 1128 | + if (!el) { | |
| 1129 | + return; | |
| 1130 | + } | |
| 1131 | + if (!status) { | |
| 1132 | + el.classList.remove(lpClassName.loading); | |
| 1133 | + } else { | |
| 1134 | + el.classList.add(lpClassName.loading); | |
| 1135 | + } | |
| 1136 | +}; | |
| 1137 | + | |
| 1138 | +// Toggle collapse section | |
| 1139 | +const toggleCollapse = (e, target, elTriggerClassName = '', elsExclude = [], callback) => { | |
| 1140 | + if (!elTriggerClassName) { | |
| 1141 | + elTriggerClassName = lpClassName.elTriggerToggle; | |
| 1142 | + } | |
| 1143 | + | |
| 1144 | + // Exclude elements, which should not trigger the collapse toggle | |
| 1145 | + if (elsExclude && elsExclude.length > 0) { | |
| 1146 | + for (const elExclude of elsExclude) { | |
| 1147 | + if (target.closest(elExclude)) { | |
| 1148 | + return; | |
| 1149 | + } | |
| 1150 | + } | |
| 1151 | + } | |
| 1152 | + const elTrigger = target.closest(elTriggerClassName); | |
| 1153 | + if (!elTrigger) { | |
| 1154 | + return; | |
| 1155 | + } | |
| 1156 | + | |
| 1157 | + //console.log( 'elTrigger', elTrigger ); | |
| 1158 | + | |
| 1159 | + const elSectionToggle = elTrigger.closest(`${lpClassName.elSectionToggle}`); | |
| 1160 | + if (!elSectionToggle) { | |
| 1161 | + return; | |
| 1162 | + } | |
| 1163 | + elSectionToggle.classList.toggle(`${lpClassName.elCollapse}`); | |
| 1164 | + if ('function' === typeof callback) { | |
| 1165 | + callback(elSectionToggle); | |
| 1166 | + } | |
| 1167 | +}; | |
| 1168 | + | |
| 1169 | +// Get data of form | |
| 1170 | +const getDataOfForm = form => { | |
| 1171 | + const dataSend = {}; | |
| 1172 | + const formData = new FormData(form); | |
| 1173 | + for (const pair of formData.entries()) { | |
| 1174 | + const key = pair[0]; | |
| 1175 | + const value = formData.getAll(key); | |
| 1176 | + if (!dataSend.hasOwnProperty(key)) { | |
| 1177 | + // Convert value array to string. | |
| 1178 | + dataSend[key] = value.join(','); | |
| 1179 | + } | |
| 1180 | + } | |
| 1181 | + return dataSend; | |
| 1182 | +}; | |
| 1183 | + | |
| 1184 | +// Get field keys of form | |
| 1185 | +const getFieldKeysOfForm = form => { | |
| 1186 | + const keys = []; | |
| 1187 | + const elements = form.elements; | |
| 1188 | + for (let i = 0; i < elements.length; i++) { | |
| 1189 | + const name = elements[i].name; | |
| 1190 | + if (name && !keys.includes(name)) { | |
| 1191 | + keys.push(name); | |
| 1192 | + } | |
| 1193 | + } | |
| 1194 | + return keys; | |
| 1195 | +}; | |
| 1196 | + | |
| 1197 | +// Merge data handle with data form. | |
| 1198 | +const mergeDataWithDatForm = (elForm, dataHandle) => { | |
| 1199 | + const dataForm = getDataOfForm(elForm); | |
| 1200 | + const keys = getFieldKeysOfForm(elForm); | |
| 1201 | + keys.forEach(key => { | |
| 1202 | + if (!dataForm.hasOwnProperty(key)) { | |
| 1203 | + delete dataHandle[key]; | |
| 1204 | + } else if (dataForm[key][0] === '') { | |
| 1205 | + delete dataForm[key]; | |
| 1206 | + delete dataHandle[key]; | |
| 1207 | + } | |
| 1208 | + }); | |
| 1209 | + dataHandle = { | |
| 1210 | + ...dataHandle, | |
| 1211 | + ...dataForm | |
| 1212 | + }; | |
| 1213 | + return dataHandle; | |
| 1214 | +}; | |
| 1215 | + | |
| 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 | |
| 1225 | + */ | |
| 1226 | +const eventHandlers = (eventName, eventHandlers) => { | |
| 1227 | + document.addEventListener(eventName, e => { | |
| 1228 | + const target = e.target; | |
| 1229 | + let args = { | |
| 1230 | + e, | |
| 1231 | + target | |
| 1232 | + }; | |
| 1233 | + eventHandlers.forEach(eventHandler => { | |
| 1234 | + args = { | |
| 1235 | + ...args, | |
| 1236 | + ...eventHandler | |
| 1237 | + }; | |
| 1238 | + | |
| 1239 | + //console.log( args ); | |
| 1240 | + | |
| 1241 | + // Check condition before call back | |
| 1242 | + if (eventHandler.conditionBeforeCallBack) { | |
| 1243 | + if (eventHandler.conditionBeforeCallBack(args) !== true) { | |
| 1244 | + return; | |
| 1245 | + } | |
| 1246 | + } | |
| 1247 | + | |
| 1248 | + // Special check for keydown event with checkIsEventEnter = true | |
| 1249 | + if (eventName === 'keydown' && eventHandler.checkIsEventEnter) { | |
| 1250 | + if (e.key !== 'Enter') { | |
| 1251 | + return; | |
| 1252 | + } | |
| 1253 | + } | |
| 1254 | + if (target.closest(eventHandler.selector)) { | |
| 1255 | + if (eventHandler.class) { | |
| 1256 | + // Call method of class, function callBack will understand exactly {this} is class object. | |
| 1257 | + eventHandler.class[eventHandler.callBack](args); | |
| 1258 | + } else { | |
| 1259 | + // For send args is objected, {this} is eventHandler object, not class object. | |
| 1260 | + eventHandler.callBack(args); | |
| 1261 | + } | |
| 1262 | + } | |
| 1263 | + }); | |
| 1264 | + }); | |
| 1265 | +}; | |
| 1266 | + | |
| 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 | |
| 1291 | + */ | |
| 1292 | +const debounce = (func, wait = 500) => { | |
| 1293 | + let timer; | |
| 1294 | + return args => { | |
| 1295 | + clearTimeout(timer); | |
| 1296 | + timer = setTimeout(() => func(args), wait); | |
| 1297 | + }; | |
| 1298 | +}; | |
| 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 ×'; | |
| 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 | + | |
| 1433 | +/***/ }, | |
| 1434 | + | |
| 1435 | +/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css" | |
| 1436 | +/*!*****************************************************************************************!*\ | |
| 1437 | + !*** ./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css ***! | |
| 1438 | + \*****************************************************************************************/ | |
| 1439 | +(module, __webpack_exports__, __webpack_require__) { | |
| 1440 | + | |
| 1441 | +"use strict"; | |
| 1442 | +__webpack_require__.r(__webpack_exports__); | |
| 1443 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1444 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 1445 | +/* harmony export */ }); | |
| 1446 | +/* harmony import */ var _css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../css-loader/dist/runtime/sourceMaps.js */ "./node_modules/css-loader/dist/runtime/sourceMaps.js"); | |
| 1447 | +/* harmony import */ var _css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); | |
| 1448 | +/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js"); | |
| 1449 | +/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__); | |
| 1450 | +// Imports | |
| 1451 | + | |
| 1452 | + | |
| 1453 | +var ___CSS_LOADER_EXPORT___ = _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default())); | |
| 1454 | +// Module | |
| 1455 | +___CSS_LOADER_EXPORT___.push([module.id, `/*! | |
| 1456 | + * Toastify js 1.12.0 | |
| 1457 | + * https://github.com/apvarun/toastify-js | |
| 1458 | + * @license MIT licensed | |
| 1459 | + * | |
| 1460 | + * Copyright (C) 2018 Varun A P | |
| 1461 | + */ | |
| 1462 | + | |
| 1463 | +.toastify { | |
| 1464 | + padding: 12px 20px; | |
| 1465 | + color: #ffffff; | |
| 1466 | + display: inline-block; | |
| 1467 | + box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3); | |
| 1468 | + background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5); | |
| 1469 | + background: linear-gradient(135deg, #73a5ff, #5477f5); | |
| 1470 | + position: fixed; | |
| 1471 | + opacity: 0; | |
| 1472 | + transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1); | |
| 1473 | + border-radius: 2px; | |
| 1474 | + cursor: pointer; | |
| 1475 | + text-decoration: none; | |
| 1476 | + max-width: calc(50% - 20px); | |
| 1477 | + z-index: 2147483647; | |
| 1478 | +} | |
| 1479 | + | |
| 1480 | +.toastify.on { | |
| 1481 | + opacity: 1; | |
| 1482 | +} | |
| 1483 | + | |
| 1484 | +.toast-close { | |
| 1485 | + background: transparent; | |
| 1486 | + border: 0; | |
| 1487 | + color: white; | |
| 1488 | + cursor: pointer; | |
| 1489 | + font-family: inherit; | |
| 1490 | + font-size: 1em; | |
| 1491 | + opacity: 0.4; | |
| 1492 | + padding: 0 5px; | |
| 1493 | +} | |
| 1494 | + | |
| 1495 | +.toastify-right { | |
| 1496 | + right: 15px; | |
| 1497 | +} | |
| 1498 | + | |
| 1499 | +.toastify-left { | |
| 1500 | + left: 15px; | |
| 1501 | +} | |
| 1502 | + | |
| 1503 | +.toastify-top { | |
| 1504 | + top: -150px; | |
| 1505 | +} | |
| 1506 | + | |
| 1507 | +.toastify-bottom { | |
| 1508 | + bottom: -150px; | |
| 1509 | +} | |
| 1510 | + | |
| 1511 | +.toastify-rounded { | |
| 1512 | + border-radius: 25px; | |
| 1513 | +} | |
| 1514 | + | |
| 1515 | +.toastify-avatar { | |
| 1516 | + width: 1.5em; | |
| 1517 | + height: 1.5em; | |
| 1518 | + margin: -7px 5px; | |
| 1519 | + border-radius: 2px; | |
| 1520 | +} | |
| 1521 | + | |
| 1522 | +.toastify-center { | |
| 1523 | + margin-left: auto; | |
| 1524 | + margin-right: auto; | |
| 1525 | + left: 0; | |
| 1526 | + right: 0; | |
| 1527 | + max-width: fit-content; | |
| 1528 | + max-width: -moz-fit-content; | |
| 1529 | +} | |
| 1530 | + | |
| 1531 | +@media only screen and (max-width: 360px) { | |
| 1532 | + .toastify-right, .toastify-left { | |
| 1533 | + margin-left: auto; | |
| 1534 | + margin-right: auto; | |
| 1535 | + left: 0; | |
| 1536 | + right: 0; | |
| 1537 | + max-width: fit-content; | |
| 1538 | + } | |
| 1539 | +} | |
| 1540 | +`, "",{"version":3,"sources":["webpack://./node_modules/toastify-js/src/toastify.css"],"names":[],"mappings":"AAAA;;;;;;EAME;;AAEF;IACI,kBAAkB;IAClB,cAAc;IACd,qBAAqB;IACrB,uFAAuF;IACvF,6DAA6D;IAC7D,qDAAqD;IACrD,eAAe;IACf,UAAU;IACV,wDAAwD;IACxD,kBAAkB;IAClB,eAAe;IACf,qBAAqB;IACrB,2BAA2B;IAC3B,mBAAmB;AACvB;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,uBAAuB;IACvB,SAAS;IACT,YAAY;IACZ,eAAe;IACf,oBAAoB;IACpB,cAAc;IACd,YAAY;IACZ,cAAc;AAClB;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,cAAc;AAClB;;AAEA;IACI,mBAAmB;AACvB;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,kBAAkB;AACtB;;AAEA;IACI,iBAAiB;IACjB,kBAAkB;IAClB,OAAO;IACP,QAAQ;IACR,sBAAsB;IACtB,2BAA2B;AAC/B;;AAEA;IACI;QACI,iBAAiB;QACjB,kBAAkB;QAClB,OAAO;QACP,QAAQ;QACR,sBAAsB;IAC1B;AACJ","sourcesContent":["/*!\n * Toastify js 1.12.0\n * https://github.com/apvarun/toastify-js\n * @license MIT licensed\n *\n * Copyright (C) 2018 Varun A P\n */\n\n.toastify {\n padding: 12px 20px;\n color: #ffffff;\n display: inline-block;\n box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);\n background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);\n background: linear-gradient(135deg, #73a5ff, #5477f5);\n position: fixed;\n opacity: 0;\n transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);\n border-radius: 2px;\n cursor: pointer;\n text-decoration: none;\n max-width: calc(50% - 20px);\n z-index: 2147483647;\n}\n\n.toastify.on {\n opacity: 1;\n}\n\n.toast-close {\n background: transparent;\n border: 0;\n color: white;\n cursor: pointer;\n font-family: inherit;\n font-size: 1em;\n opacity: 0.4;\n padding: 0 5px;\n}\n\n.toastify-right {\n right: 15px;\n}\n\n.toastify-left {\n left: 15px;\n}\n\n.toastify-top {\n top: -150px;\n}\n\n.toastify-bottom {\n bottom: -150px;\n}\n\n.toastify-rounded {\n border-radius: 25px;\n}\n\n.toastify-avatar {\n width: 1.5em;\n height: 1.5em;\n margin: -7px 5px;\n border-radius: 2px;\n}\n\n.toastify-center {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n max-width: -moz-fit-content;\n}\n\n@media only screen and (max-width: 360px) {\n .toastify-right, .toastify-left {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n }\n}\n"],"sourceRoot":""}]); | |
| 1541 | +// Exports | |
| 1542 | +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); | |
| 1543 | + | |
| 1544 | + | |
| 1545 | +/***/ }, | |
| 1546 | + | |
| 1547 | +/***/ "./node_modules/css-loader/dist/runtime/api.js" | |
| 1548 | +/*!*****************************************************!*\ | |
| 1549 | + !*** ./node_modules/css-loader/dist/runtime/api.js ***! | |
| 1550 | + \*****************************************************/ | |
| 1551 | +(module) { | |
| 1552 | + | |
| 1553 | +"use strict"; | |
| 1554 | + | |
| 1555 | + | |
| 1556 | +/* | |
| 1557 | + MIT License http://www.opensource.org/licenses/mit-license.php | |
| 1558 | + Author Tobias Koppers @sokra | |
| 1559 | +*/ | |
| 1560 | +module.exports = function (cssWithMappingToString) { | |
| 1561 | + var list = []; | |
| 1562 | + | |
| 1563 | + // return the list of modules as css string | |
| 1564 | + list.toString = function toString() { | |
| 1565 | + return this.map(function (item) { | |
| 1566 | + var content = ""; | |
| 1567 | + var needLayer = typeof item[5] !== "undefined"; | |
| 1568 | + if (item[4]) { | |
| 1569 | + content += "@supports (".concat(item[4], ") {"); | |
| 1570 | + } | |
| 1571 | + if (item[2]) { | |
| 1572 | + content += "@media ".concat(item[2], " {"); | |
| 1573 | + } | |
| 1574 | + if (needLayer) { | |
| 1575 | + content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); | |
| 1576 | + } | |
| 1577 | + content += cssWithMappingToString(item); | |
| 1578 | + if (needLayer) { | |
| 1579 | + content += "}"; | |
| 1580 | + } | |
| 1581 | + if (item[2]) { | |
| 1582 | + content += "}"; | |
| 1583 | + } | |
| 1584 | + if (item[4]) { | |
| 1585 | + content += "}"; | |
| 1586 | + } | |
| 1587 | + return content; | |
| 1588 | + }).join(""); | |
| 1589 | + }; | |
| 1590 | + | |
| 1591 | + // import a list of modules into the list | |
| 1592 | + list.i = function i(modules, media, dedupe, supports, layer) { | |
| 1593 | + if (typeof modules === "string") { | |
| 1594 | + modules = [[null, modules, undefined]]; | |
| 1595 | + } | |
| 1596 | + var alreadyImportedModules = {}; | |
| 1597 | + if (dedupe) { | |
| 1598 | + for (var k = 0; k < this.length; k++) { | |
| 1599 | + var id = this[k][0]; | |
| 1600 | + if (id != null) { | |
| 1601 | + alreadyImportedModules[id] = true; | |
| 1602 | + } | |
| 1603 | + } | |
| 1604 | + } | |
| 1605 | + for (var _k = 0; _k < modules.length; _k++) { | |
| 1606 | + var item = [].concat(modules[_k]); | |
| 1607 | + if (dedupe && alreadyImportedModules[item[0]]) { | |
| 1608 | + continue; | |
| 1609 | + } | |
| 1610 | + if (typeof layer !== "undefined") { | |
| 1611 | + if (typeof item[5] === "undefined") { | |
| 1612 | + item[5] = layer; | |
| 1613 | + } else { | |
| 1614 | + item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); | |
| 1615 | + item[5] = layer; | |
| 1616 | + } | |
| 1617 | + } | |
| 1618 | + if (media) { | |
| 1619 | + if (!item[2]) { | |
| 1620 | + item[2] = media; | |
| 1621 | + } else { | |
| 1622 | + item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); | |
| 1623 | + item[2] = media; | |
| 1624 | + } | |
| 1625 | + } | |
| 1626 | + if (supports) { | |
| 1627 | + if (!item[4]) { | |
| 1628 | + item[4] = "".concat(supports); | |
| 1629 | + } else { | |
| 1630 | + item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); | |
| 1631 | + item[4] = supports; | |
| 1632 | + } | |
| 1633 | + } | |
| 1634 | + list.push(item); | |
| 1635 | + } | |
| 1636 | + }; | |
| 1637 | + return list; | |
| 1638 | +}; | |
| 1639 | + | |
| 1640 | +/***/ }, | |
| 1641 | + | |
| 1642 | +/***/ "./node_modules/css-loader/dist/runtime/sourceMaps.js" | |
| 1643 | +/*!************************************************************!*\ | |
| 1644 | + !*** ./node_modules/css-loader/dist/runtime/sourceMaps.js ***! | |
| 1645 | + \************************************************************/ | |
| 1646 | +(module) { | |
| 1647 | + | |
| 1648 | +"use strict"; | |
| 1649 | + | |
| 1650 | + | |
| 1651 | +module.exports = function (item) { | |
| 1652 | + var content = item[1]; | |
| 1653 | + var cssMapping = item[3]; | |
| 1654 | + if (!cssMapping) { | |
| 1655 | + return content; | |
| 1656 | + } | |
| 1657 | + if (typeof btoa === "function") { | |
| 1658 | + var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping)))); | |
| 1659 | + var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64); | |
| 1660 | + var sourceMapping = "/*# ".concat(data, " */"); | |
| 1661 | + return [content].concat([sourceMapping]).join("\n"); | |
| 1662 | + } | |
| 1663 | + return [content].join("\n"); | |
| 1664 | +}; | |
| 1665 | + | |
| 1666 | +/***/ }, | |
| 1667 | + | |
| 1668 | +/***/ "./node_modules/toastify-js/src/toastify.css" | |
| 1669 | +/*!***************************************************!*\ | |
| 1670 | + !*** ./node_modules/toastify-js/src/toastify.css ***! | |
| 1671 | + \***************************************************/ | |
| 1672 | +(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 1673 | + | |
| 1674 | +"use strict"; | |
| 1675 | +__webpack_require__.r(__webpack_exports__); | |
| 1676 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1677 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 1678 | +/* harmony export */ }); | |
| 1679 | +/* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../../style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"); | |
| 1680 | +/* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__); | |
| 1681 | +/* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../../style-loader/dist/runtime/styleDomAPI.js */ "./node_modules/style-loader/dist/runtime/styleDomAPI.js"); | |
| 1682 | +/* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__); | |
| 1683 | +/* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../style-loader/dist/runtime/insertBySelector.js */ "./node_modules/style-loader/dist/runtime/insertBySelector.js"); | |
| 1684 | +/* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__); | |
| 1685 | +/* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../../style-loader/dist/runtime/setAttributesWithoutAttributes.js */ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"); | |
| 1686 | +/* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__); | |
| 1687 | +/* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../../style-loader/dist/runtime/insertStyleElement.js */ "./node_modules/style-loader/dist/runtime/insertStyleElement.js"); | |
| 1688 | +/* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__); | |
| 1689 | +/* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../../style-loader/dist/runtime/styleTagTransform.js */ "./node_modules/style-loader/dist/runtime/styleTagTransform.js"); | |
| 1690 | +/* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__); | |
| 1691 | +/* harmony import */ var _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../../css-loader/dist/cjs.js!./toastify.css */ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css"); | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | +var options = {}; | |
| 1704 | + | |
| 1705 | +options.styleTagTransform = (_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default()); | |
| 1706 | +options.setAttributes = (_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default()); | |
| 1707 | + | |
| 1708 | + options.insert = _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, "head"); | |
| 1709 | + | |
| 1710 | +options.domAPI = (_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default()); | |
| 1711 | +options.insertStyleElement = (_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default()); | |
| 1712 | + | |
| 1713 | +var update = _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"], options); | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"] && _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals ? _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals : undefined); | |
| 1719 | + | |
| 1720 | + | |
| 1721 | +/***/ }, | |
| 1722 | + | |
| 1723 | +/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js" | |
| 1724 | +/*!****************************************************************************!*\ | |
| 1725 | + !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***! | |
| 1726 | + \****************************************************************************/ | |
| 1727 | +(module) { | |
| 1728 | + | |
| 1729 | +"use strict"; | |
| 1730 | + | |
| 1731 | + | |
| 1732 | +var stylesInDOM = []; | |
| 1733 | +function getIndexByIdentifier(identifier) { | |
| 1734 | + var result = -1; | |
| 1735 | + for (var i = 0; i < stylesInDOM.length; i++) { | |
| 1736 | + if (stylesInDOM[i].identifier === identifier) { | |
| 1737 | + result = i; | |
| 1738 | + break; | |
| 1739 | + } | |
| 1740 | + } | |
| 1741 | + return result; | |
| 1742 | +} | |
| 1743 | +function modulesToDom(list, options) { | |
| 1744 | + var idCountMap = {}; | |
| 1745 | + var identifiers = []; | |
| 1746 | + for (var i = 0; i < list.length; i++) { | |
| 1747 | + var item = list[i]; | |
| 1748 | + var id = options.base ? item[0] + options.base : item[0]; | |
| 1749 | + var count = idCountMap[id] || 0; | |
| 1750 | + var identifier = "".concat(id, " ").concat(count); | |
| 1751 | + idCountMap[id] = count + 1; | |
| 1752 | + var indexByIdentifier = getIndexByIdentifier(identifier); | |
| 1753 | + var obj = { | |
| 1754 | + css: item[1], | |
| 1755 | + media: item[2], | |
| 1756 | + sourceMap: item[3], | |
| 1757 | + supports: item[4], | |
| 1758 | + layer: item[5] | |
| 1759 | + }; | |
| 1760 | + if (indexByIdentifier !== -1) { | |
| 1761 | + stylesInDOM[indexByIdentifier].references++; | |
| 1762 | + stylesInDOM[indexByIdentifier].updater(obj); | |
| 1763 | + } else { | |
| 1764 | + var updater = addElementStyle(obj, options); | |
| 1765 | + options.byIndex = i; | |
| 1766 | + stylesInDOM.splice(i, 0, { | |
| 1767 | + identifier: identifier, | |
| 1768 | + updater: updater, | |
| 1769 | + references: 1 | |
| 1770 | + }); | |
| 1771 | + } | |
| 1772 | + identifiers.push(identifier); | |
| 1773 | + } | |
| 1774 | + return identifiers; | |
| 1775 | +} | |
| 1776 | +function addElementStyle(obj, options) { | |
| 1777 | + var api = options.domAPI(options); | |
| 1778 | + api.update(obj); | |
| 1779 | + var updater = function updater(newObj) { | |
| 1780 | + if (newObj) { | |
| 1781 | + if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) { | |
| 1782 | + return; | |
| 1783 | + } | |
| 1784 | + api.update(obj = newObj); | |
| 1785 | + } else { | |
| 1786 | + api.remove(); | |
| 1787 | + } | |
| 1788 | + }; | |
| 1789 | + return updater; | |
| 1790 | +} | |
| 1791 | +module.exports = function (list, options) { | |
| 1792 | + options = options || {}; | |
| 1793 | + list = list || []; | |
| 1794 | + var lastIdentifiers = modulesToDom(list, options); | |
| 1795 | + return function update(newList) { | |
| 1796 | + newList = newList || []; | |
| 1797 | + for (var i = 0; i < lastIdentifiers.length; i++) { | |
| 1798 | + var identifier = lastIdentifiers[i]; | |
| 1799 | + var index = getIndexByIdentifier(identifier); | |
| 1800 | + stylesInDOM[index].references--; | |
| 1801 | + } | |
| 1802 | + var newLastIdentifiers = modulesToDom(newList, options); | |
| 1803 | + for (var _i = 0; _i < lastIdentifiers.length; _i++) { | |
| 1804 | + var _identifier = lastIdentifiers[_i]; | |
| 1805 | + var _index = getIndexByIdentifier(_identifier); | |
| 1806 | + if (stylesInDOM[_index].references === 0) { | |
| 1807 | + stylesInDOM[_index].updater(); | |
| 1808 | + stylesInDOM.splice(_index, 1); | |
| 1809 | + } | |
| 1810 | + } | |
| 1811 | + lastIdentifiers = newLastIdentifiers; | |
| 1812 | + }; | |
| 1813 | +}; | |
| 1814 | + | |
| 1815 | +/***/ }, | |
| 1816 | + | |
| 1817 | +/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js" | |
| 1818 | +/*!********************************************************************!*\ | |
| 1819 | + !*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***! | |
| 1820 | + \********************************************************************/ | |
| 1821 | +(module) { | |
| 1822 | + | |
| 1823 | +"use strict"; | |
| 1824 | + | |
| 1825 | + | |
| 1826 | +var memo = {}; | |
| 1827 | + | |
| 1828 | +/* istanbul ignore next */ | |
| 1829 | +function getTarget(target) { | |
| 1830 | + if (typeof memo[target] === "undefined") { | |
| 1831 | + var styleTarget = document.querySelector(target); | |
| 1832 | + | |
| 1833 | + // Special case to return head of iframe instead of iframe itself | |
| 1834 | + if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { | |
| 1835 | + try { | |
| 1836 | + // This will throw an exception if access to iframe is blocked | |
| 1837 | + // due to cross-origin restrictions | |
| 1838 | + styleTarget = styleTarget.contentDocument.head; | |
| 1839 | + } catch (e) { | |
| 1840 | + // istanbul ignore next | |
| 1841 | + styleTarget = null; | |
| 1842 | + } | |
| 1843 | + } | |
| 1844 | + memo[target] = styleTarget; | |
| 1845 | + } | |
| 1846 | + return memo[target]; | |
| 1847 | +} | |
| 1848 | + | |
| 1849 | +/* istanbul ignore next */ | |
| 1850 | +function insertBySelector(insert, style) { | |
| 1851 | + var target = getTarget(insert); | |
| 1852 | + if (!target) { | |
| 1853 | + throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); | |
| 1854 | + } | |
| 1855 | + target.appendChild(style); | |
| 1856 | +} | |
| 1857 | +module.exports = insertBySelector; | |
| 1858 | + | |
| 1859 | +/***/ }, | |
| 1860 | + | |
| 1861 | +/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js" | |
| 1862 | +/*!**********************************************************************!*\ | |
| 1863 | + !*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***! | |
| 1864 | + \**********************************************************************/ | |
| 1865 | +(module) { | |
| 1866 | + | |
| 1867 | +"use strict"; | |
| 1868 | + | |
| 1869 | + | |
| 1870 | +/* istanbul ignore next */ | |
| 1871 | +function insertStyleElement(options) { | |
| 1872 | + var element = document.createElement("style"); | |
| 1873 | + options.setAttributes(element, options.attributes); | |
| 1874 | + options.insert(element, options.options); | |
| 1875 | + return element; | |
| 1876 | +} | |
| 1877 | +module.exports = insertStyleElement; | |
| 1878 | + | |
| 1879 | +/***/ }, | |
| 1880 | + | |
| 1881 | +/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js" | |
| 1882 | +/*!**********************************************************************************!*\ | |
| 1883 | + !*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***! | |
| 1884 | + \**********************************************************************************/ | |
| 1885 | +(module, __unused_webpack_exports, __webpack_require__) { | |
| 1886 | + | |
| 1887 | +"use strict"; | |
| 1888 | + | |
| 1889 | + | |
| 1890 | +/* istanbul ignore next */ | |
| 1891 | +function setAttributesWithoutAttributes(styleElement) { | |
| 1892 | + var nonce = true ? __webpack_require__.nc : 0; | |
| 1893 | + if (nonce) { | |
| 1894 | + styleElement.setAttribute("nonce", nonce); | |
| 1895 | + } | |
| 1896 | +} | |
| 1897 | +module.exports = setAttributesWithoutAttributes; | |
| 1898 | + | |
| 1899 | +/***/ }, | |
| 1900 | + | |
| 1901 | +/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js" | |
| 1902 | +/*!***************************************************************!*\ | |
| 1903 | + !*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***! | |
| 1904 | + \***************************************************************/ | |
| 1905 | +(module) { | |
| 1906 | + | |
| 1907 | +"use strict"; | |
| 1908 | + | |
| 1909 | + | |
| 1910 | +/* istanbul ignore next */ | |
| 1911 | +function apply(styleElement, options, obj) { | |
| 1912 | + var css = ""; | |
| 1913 | + if (obj.supports) { | |
| 1914 | + css += "@supports (".concat(obj.supports, ") {"); | |
| 1915 | + } | |
| 1916 | + if (obj.media) { | |
| 1917 | + css += "@media ".concat(obj.media, " {"); | |
| 1918 | + } | |
| 1919 | + var needLayer = typeof obj.layer !== "undefined"; | |
| 1920 | + if (needLayer) { | |
| 1921 | + css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); | |
| 1922 | + } | |
| 1923 | + css += obj.css; | |
| 1924 | + if (needLayer) { | |
| 1925 | + css += "}"; | |
| 1926 | + } | |
| 1927 | + if (obj.media) { | |
| 1928 | + css += "}"; | |
| 1929 | + } | |
| 1930 | + if (obj.supports) { | |
| 1931 | + css += "}"; | |
| 1932 | + } | |
| 1933 | + var sourceMap = obj.sourceMap; | |
| 1934 | + if (sourceMap && typeof btoa !== "undefined") { | |
| 1935 | + css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); | |
| 1936 | + } | |
| 1937 | + | |
| 1938 | + // For old IE | |
| 1939 | + /* istanbul ignore if */ | |
| 1940 | + options.styleTagTransform(css, styleElement, options.options); | |
| 1941 | +} | |
| 1942 | +function removeStyleElement(styleElement) { | |
| 1943 | + // istanbul ignore if | |
| 1944 | + if (styleElement.parentNode === null) { | |
| 1945 | + return false; | |
| 1946 | + } | |
| 1947 | + styleElement.parentNode.removeChild(styleElement); | |
| 1948 | +} | |
| 1949 | + | |
| 1950 | +/* istanbul ignore next */ | |
| 1951 | +function domAPI(options) { | |
| 1952 | + if (typeof document === "undefined") { | |
| 1953 | + return { | |
| 1954 | + update: function update() {}, | |
| 1955 | + remove: function remove() {} | |
| 1956 | + }; | |
| 1957 | + } | |
| 1958 | + var styleElement = options.insertStyleElement(options); | |
| 1959 | + return { | |
| 1960 | + update: function update(obj) { | |
| 1961 | + apply(styleElement, options, obj); | |
| 1962 | + }, | |
| 1963 | + remove: function remove() { | |
| 1964 | + removeStyleElement(styleElement); | |
| 1965 | + } | |
| 1966 | + }; | |
| 1967 | +} | |
| 1968 | +module.exports = domAPI; | |
| 1969 | + | |
| 1970 | +/***/ }, | |
| 1971 | + | |
| 1972 | +/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js" | |
| 1973 | +/*!*********************************************************************!*\ | |
| 1974 | + !*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***! | |
| 1975 | + \*********************************************************************/ | |
| 1976 | +(module) { | |
| 1977 | + | |
| 1978 | +"use strict"; | |
| 1979 | + | |
| 1980 | + | |
| 1981 | +/* istanbul ignore next */ | |
| 1982 | +function styleTagTransform(css, styleElement) { | |
| 1983 | + if (styleElement.styleSheet) { | |
| 1984 | + styleElement.styleSheet.cssText = css; | |
| 1985 | + } else { | |
| 1986 | + while (styleElement.firstChild) { | |
| 1987 | + styleElement.removeChild(styleElement.firstChild); | |
| 1988 | + } | |
| 1989 | + styleElement.appendChild(document.createTextNode(css)); | |
| 1990 | + } | |
| 1991 | +} | |
| 1992 | +module.exports = styleTagTransform; | |
| 1993 | + | |
| 1994 | +/***/ }, | |
| 1995 | + | |
| 1996 | +/***/ "./node_modules/toastify-js/src/toastify.js" | |
| 1997 | +/*!**************************************************!*\ | |
| 1998 | + !*** ./node_modules/toastify-js/src/toastify.js ***! | |
| 1999 | + \**************************************************/ | |
| 2000 | +(module) { | |
| 2001 | + | |
| 2002 | +/*! | |
| 2003 | + * Toastify js 1.12.0 | |
| 2004 | + * https://github.com/apvarun/toastify-js | |
| 2005 | + * @license MIT licensed | |
| 2006 | + * | |
| 2007 | + * Copyright (C) 2018 Varun A P | |
| 2008 | + */ | |
| 2009 | +(function(root, factory) { | |
| 2010 | + if ( true && module.exports) { | |
| 2011 | + module.exports = factory(); | |
| 2012 | + } else { | |
| 2013 | + root.Toastify = factory(); | |
| 2014 | + } | |
| 2015 | +})(this, function(global) { | |
| 2016 | + // Object initialization | |
| 2017 | + var Toastify = function(options) { | |
| 2018 | + // Returning a new init object | |
| 2019 | + return new Toastify.lib.init(options); | |
| 2020 | + }, | |
| 2021 | + // Library version | |
| 2022 | + version = "1.12.0"; | |
| 2023 | + | |
| 2024 | + // Set the default global options | |
| 2025 | + Toastify.defaults = { | |
| 2026 | + oldestFirst: true, | |
| 2027 | + text: "Toastify is awesome!", | |
| 2028 | + node: undefined, | |
| 2029 | + duration: 3000, | |
| 2030 | + selector: undefined, | |
| 2031 | + callback: function () { | |
| 2032 | + }, | |
| 2033 | + destination: undefined, | |
| 2034 | + newWindow: false, | |
| 2035 | + close: false, | |
| 2036 | + gravity: "toastify-top", | |
| 2037 | + positionLeft: false, | |
| 2038 | + position: '', | |
| 2039 | + backgroundColor: '', | |
| 2040 | + avatar: "", | |
| 2041 | + className: "", | |
| 2042 | + stopOnFocus: true, | |
| 2043 | + onClick: function () { | |
| 2044 | + }, | |
| 2045 | + offset: {x: 0, y: 0}, | |
| 2046 | + escapeMarkup: true, | |
| 2047 | + ariaLive: 'polite', | |
| 2048 | + style: {background: ''} | |
| 2049 | + }; | |
| 2050 | + | |
| 2051 | + // Defining the prototype of the object | |
| 2052 | + Toastify.lib = Toastify.prototype = { | |
| 2053 | + toastify: version, | |
| 2054 | + | |
| 2055 | + constructor: Toastify, | |
| 2056 | + | |
| 2057 | + // Initializing the object with required parameters | |
| 2058 | + init: function(options) { | |
| 2059 | + // Verifying and validating the input object | |
| 2060 | + if (!options) { | |
| 2061 | + options = {}; | |
| 2062 | + } | |
| 2063 | + | |
| 2064 | + // Creating the options object | |
| 2065 | + this.options = {}; | |
| 2066 | + | |
| 2067 | + this.toastElement = null; | |
| 2068 | + | |
| 2069 | + // Validating the options | |
| 2070 | + this.options.text = options.text || Toastify.defaults.text; // Display message | |
| 2071 | + this.options.node = options.node || Toastify.defaults.node; // Display content as node | |
| 2072 | + this.options.duration = options.duration === 0 ? 0 : options.duration || Toastify.defaults.duration; // Display duration | |
| 2073 | + this.options.selector = options.selector || Toastify.defaults.selector; // Parent selector | |
| 2074 | + this.options.callback = options.callback || Toastify.defaults.callback; // Callback after display | |
| 2075 | + this.options.destination = options.destination || Toastify.defaults.destination; // On-click destination | |
| 2076 | + this.options.newWindow = options.newWindow || Toastify.defaults.newWindow; // Open destination in new window | |
| 2077 | + this.options.close = options.close || Toastify.defaults.close; // Show toast close icon | |
| 2078 | + this.options.gravity = options.gravity === "bottom" ? "toastify-bottom" : Toastify.defaults.gravity; // toast position - top or bottom | |
| 2079 | + this.options.positionLeft = options.positionLeft || Toastify.defaults.positionLeft; // toast position - left or right | |
| 2080 | + this.options.position = options.position || Toastify.defaults.position; // toast position - left or right | |
| 2081 | + this.options.backgroundColor = options.backgroundColor || Toastify.defaults.backgroundColor; // toast background color | |
| 2082 | + this.options.avatar = options.avatar || Toastify.defaults.avatar; // img element src - url or a path | |
| 2083 | + this.options.className = options.className || Toastify.defaults.className; // additional class names for the toast | |
| 2084 | + this.options.stopOnFocus = options.stopOnFocus === undefined ? Toastify.defaults.stopOnFocus : options.stopOnFocus; // stop timeout on focus | |
| 2085 | + this.options.onClick = options.onClick || Toastify.defaults.onClick; // Callback after click | |
| 2086 | + this.options.offset = options.offset || Toastify.defaults.offset; // toast offset | |
| 2087 | + this.options.escapeMarkup = options.escapeMarkup !== undefined ? options.escapeMarkup : Toastify.defaults.escapeMarkup; | |
| 2088 | + this.options.ariaLive = options.ariaLive || Toastify.defaults.ariaLive; | |
| 2089 | + this.options.style = options.style || Toastify.defaults.style; | |
| 2090 | + if(options.backgroundColor) { | |
| 2091 | + this.options.style.background = options.backgroundColor; | |
| 2092 | + } | |
| 2093 | + | |
| 2094 | + // Returning the current object for chaining functions | |
| 2095 | + return this; | |
| 2096 | + }, | |
| 2097 | + | |
| 2098 | + // Building the DOM element | |
| 2099 | + buildToast: function() { | |
| 2100 | + // Validating if the options are defined | |
| 2101 | + if (!this.options) { | |
| 2102 | + throw "Toastify is not initialized"; | |
| 2103 | + } | |
| 2104 | + | |
| 2105 | + // Creating the DOM object | |
| 2106 | + var divElement = document.createElement("div"); | |
| 2107 | + divElement.className = "toastify on " + this.options.className; | |
| 2108 | + | |
| 2109 | + // Positioning toast to left or right or center | |
| 2110 | + if (!!this.options.position) { | |
| 2111 | + divElement.className += " toastify-" + this.options.position; | |
| 2112 | + } else { | |
| 2113 | + // To be depreciated in further versions | |
| 2114 | + if (this.options.positionLeft === true) { | |
| 2115 | + divElement.className += " toastify-left"; | |
| 2116 | + console.warn('Property `positionLeft` will be depreciated in further versions. Please use `position` instead.') | |
| 2117 | + } else { | |
| 2118 | + // Default position | |
| 2119 | + divElement.className += " toastify-right"; | |
| 2120 | + } | |
| 2121 | + } | |
| 2122 | + | |
| 2123 | + // Assigning gravity of element | |
| 2124 | + divElement.className += " " + this.options.gravity; | |
| 2125 | + | |
| 2126 | + if (this.options.backgroundColor) { | |
| 2127 | + // This is being deprecated in favor of using the style HTML DOM property | |
| 2128 | + console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.'); | |
| 2129 | + } | |
| 2130 | + | |
| 2131 | + // Loop through our style object and apply styles to divElement | |
| 2132 | + for (var property in this.options.style) { | |
| 2133 | + divElement.style[property] = this.options.style[property]; | |
| 2134 | + } | |
| 2135 | + | |
| 2136 | + // Announce the toast to screen readers | |
| 2137 | + if (this.options.ariaLive) { | |
| 2138 | + divElement.setAttribute('aria-live', this.options.ariaLive) | |
| 2139 | + } | |
| 2140 | + | |
| 2141 | + // Adding the toast message/node | |
| 2142 | + if (this.options.node && this.options.node.nodeType === Node.ELEMENT_NODE) { | |
| 2143 | + // If we have a valid node, we insert it | |
| 2144 | + divElement.appendChild(this.options.node) | |
| 2145 | + } else { | |
| 2146 | + if (this.options.escapeMarkup) { | |
| 2147 | + divElement.innerText = this.options.text; | |
| 2148 | + } else { | |
| 2149 | + divElement.innerHTML = this.options.text; | |
| 2150 | + } | |
| 2151 | + | |
| 2152 | + if (this.options.avatar !== "") { | |
| 2153 | + var avatarElement = document.createElement("img"); | |
| 2154 | + avatarElement.src = this.options.avatar; | |
| 2155 | + | |
| 2156 | + avatarElement.className = "toastify-avatar"; | |
| 2157 | + | |
| 2158 | + if (this.options.position == "left" || this.options.positionLeft === true) { | |
| 2159 | + // Adding close icon on the left of content | |
| 2160 | + divElement.appendChild(avatarElement); | |
| 2161 | + } else { | |
| 2162 | + // Adding close icon on the right of content | |
| 2163 | + divElement.insertAdjacentElement("afterbegin", avatarElement); | |
| 2164 | + } | |
| 2165 | + } | |
| 2166 | + } | |
| 2167 | + | |
| 2168 | + // Adding a close icon to the toast | |
| 2169 | + if (this.options.close === true) { | |
| 2170 | + // Create a span for close element | |
| 2171 | + var closeElement = document.createElement("button"); | |
| 2172 | + closeElement.type = "button"; | |
| 2173 | + closeElement.setAttribute("aria-label", "Close"); | |
| 2174 | + closeElement.className = "toast-close"; | |
| 2175 | + closeElement.innerHTML = "✖"; | |
| 2176 | + | |
| 2177 | + // Triggering the removal of toast from DOM on close click | |
| 2178 | + closeElement.addEventListener( | |
| 2179 | + "click", | |
| 2180 | + function(event) { | |
| 2181 | + event.stopPropagation(); | |
| 2182 | + this.removeElement(this.toastElement); | |
| 2183 | + window.clearTimeout(this.toastElement.timeOutValue); | |
| 2184 | + }.bind(this) | |
| 2185 | + ); | |
| 2186 | + | |
| 2187 | + //Calculating screen width | |
| 2188 | + var width = window.innerWidth > 0 ? window.innerWidth : screen.width; | |
| 2189 | + | |
| 2190 | + // Adding the close icon to the toast element | |
| 2191 | + // Display on the right if screen width is less than or equal to 360px | |
| 2192 | + if ((this.options.position == "left" || this.options.positionLeft === true) && width > 360) { | |
| 2193 | + // Adding close icon on the left of content | |
| 2194 | + divElement.insertAdjacentElement("afterbegin", closeElement); | |
| 2195 | + } else { | |
| 2196 | + // Adding close icon on the right of content | |
| 2197 | + divElement.appendChild(closeElement); | |
| 2198 | + } | |
| 2199 | + } | |
| 2200 | + | |
| 2201 | + // Clear timeout while toast is focused | |
| 2202 | + if (this.options.stopOnFocus && this.options.duration > 0) { | |
| 2203 | + var self = this; | |
| 2204 | + // stop countdown | |
| 2205 | + divElement.addEventListener( | |
| 2206 | + "mouseover", | |
| 2207 | + function(event) { | |
| 2208 | + window.clearTimeout(divElement.timeOutValue); | |
| 2209 | + } | |
| 2210 | + ) | |
| 2211 | + // add back the timeout | |
| 2212 | + divElement.addEventListener( | |
| 2213 | + "mouseleave", | |
| 2214 | + function() { | |
| 2215 | + divElement.timeOutValue = window.setTimeout( | |
| 2216 | + function() { | |
| 2217 | + // Remove the toast from DOM | |
| 2218 | + self.removeElement(divElement); | |
| 2219 | + }, | |
| 2220 | + self.options.duration | |
| 2221 | + ) | |
| 2222 | + } | |
| 2223 | + ) | |
| 2224 | + } | |
| 2225 | + | |
| 2226 | + // Adding an on-click destination path | |
| 2227 | + if (typeof this.options.destination !== "undefined") { | |
| 2228 | + divElement.addEventListener( | |
| 2229 | + "click", | |
| 2230 | + function(event) { | |
| 2231 | + event.stopPropagation(); | |
| 2232 | + if (this.options.newWindow === true) { | |
| 2233 | + window.open(this.options.destination, "_blank"); | |
| 2234 | + } else { | |
| 2235 | + window.location = this.options.destination; | |
| 2236 | + } | |
| 2237 | + }.bind(this) | |
| 2238 | + ); | |
| 2239 | + } | |
| 2240 | + | |
| 2241 | + if (typeof this.options.onClick === "function" && typeof this.options.destination === "undefined") { | |
| 2242 | + divElement.addEventListener( | |
| 2243 | + "click", | |
| 2244 | + function(event) { | |
| 2245 | + event.stopPropagation(); | |
| 2246 | + this.options.onClick(); | |
| 2247 | + }.bind(this) | |
| 2248 | + ); | |
| 2249 | + } | |
| 2250 | + | |
| 2251 | + // Adding offset | |
| 2252 | + if(typeof this.options.offset === "object") { | |
| 2253 | + | |
| 2254 | + var x = getAxisOffsetAValue("x", this.options); | |
| 2255 | + var y = getAxisOffsetAValue("y", this.options); | |
| 2256 | + | |
| 2257 | + var xOffset = this.options.position == "left" ? x : "-" + x; | |
| 2258 | + var yOffset = this.options.gravity == "toastify-top" ? y : "-" + y; | |
| 2259 | + | |
| 2260 | + divElement.style.transform = "translate(" + xOffset + "," + yOffset + ")"; | |
| 2261 | + | |
| 2262 | + } | |
| 2263 | + | |
| 2264 | + // Returning the generated element | |
| 2265 | + return divElement; | |
| 2266 | + }, | |
| 2267 | + | |
| 2268 | + // Displaying the toast | |
| 2269 | + showToast: function() { | |
| 2270 | + // Creating the DOM object for the toast | |
| 2271 | + this.toastElement = this.buildToast(); | |
| 2272 | + | |
| 2273 | + // Getting the root element to with the toast needs to be added | |
| 2274 | + var rootElement; | |
| 2275 | + if (typeof this.options.selector === "string") { | |
| 2276 | + rootElement = document.getElementById(this.options.selector); | |
| 2277 | + } else if (this.options.selector instanceof HTMLElement || (typeof ShadowRoot !== 'undefined' && this.options.selector instanceof ShadowRoot)) { | |
| 2278 | + rootElement = this.options.selector; | |
| 2279 | + } else { | |
| 2280 | + rootElement = document.body; | |
| 2281 | + } | |
| 2282 | + | |
| 2283 | + // Validating if root element is present in DOM | |
| 2284 | + if (!rootElement) { | |
| 2285 | + throw "Root element is not defined"; | |
| 2286 | + } | |
| 2287 | + | |
| 2288 | + // Adding the DOM element | |
| 2289 | + var elementToInsert = Toastify.defaults.oldestFirst ? rootElement.firstChild : rootElement.lastChild; | |
| 2290 | + rootElement.insertBefore(this.toastElement, elementToInsert); | |
| 2291 | + | |
| 2292 | + // Repositioning the toasts in case multiple toasts are present | |
| 2293 | + Toastify.reposition(); | |
| 2294 | + | |
| 2295 | + if (this.options.duration > 0) { | |
| 2296 | + this.toastElement.timeOutValue = window.setTimeout( | |
| 2297 | + function() { | |
| 2298 | + // Remove the toast from DOM | |
| 2299 | + this.removeElement(this.toastElement); | |
| 2300 | + }.bind(this), | |
| 2301 | + this.options.duration | |
| 2302 | + ); // Binding `this` for function invocation | |
| 2303 | + } | |
| 2304 | + | |
| 2305 | + // Supporting function chaining | |
| 2306 | + return this; | |
| 2307 | + }, | |
| 2308 | + | |
| 2309 | + hideToast: function() { | |
| 2310 | + if (this.toastElement.timeOutValue) { | |
| 2311 | + clearTimeout(this.toastElement.timeOutValue); | |
| 2312 | + } | |
| 2313 | + this.removeElement(this.toastElement); | |
| 2314 | + }, | |
| 2315 | + | |
| 2316 | + // Removing the element from the DOM | |
| 2317 | + removeElement: function(toastElement) { | |
| 2318 | + // Hiding the element | |
| 2319 | + // toastElement.classList.remove("on"); | |
| 2320 | + toastElement.className = toastElement.className.replace(" on", ""); | |
| 2321 | + | |
| 2322 | + // Removing the element from DOM after transition end | |
| 2323 | + window.setTimeout( | |
| 2324 | + function() { | |
| 2325 | + // remove options node if any | |
| 2326 | + if (this.options.node && this.options.node.parentNode) { | |
| 2327 | + this.options.node.parentNode.removeChild(this.options.node); | |
| 2328 | + } | |
| 2329 | + | |
| 2330 | + // Remove the element from the DOM, only when the parent node was not removed before. | |
| 2331 | + if (toastElement.parentNode) { | |
| 2332 | + toastElement.parentNode.removeChild(toastElement); | |
| 2333 | + } | |
| 2334 | + | |
| 2335 | + // Calling the callback function | |
| 2336 | + this.options.callback.call(toastElement); | |
| 2337 | + | |
| 2338 | + // Repositioning the toasts again | |
| 2339 | + Toastify.reposition(); | |
| 2340 | + }.bind(this), | |
| 2341 | + 400 | |
| 2342 | + ); // Binding `this` for function invocation | |
| 2343 | + }, | |
| 2344 | + }; | |
| 2345 | + | |
| 2346 | + // Positioning the toasts on the DOM | |
| 2347 | + Toastify.reposition = function() { | |
| 2348 | + | |
| 2349 | + // Top margins with gravity | |
| 2350 | + var topLeftOffsetSize = { | |
| 2351 | + top: 15, | |
| 2352 | + bottom: 15, | |
| 2353 | + }; | |
| 2354 | + var topRightOffsetSize = { | |
| 2355 | + top: 15, | |
| 2356 | + bottom: 15, | |
| 2357 | + }; | |
| 2358 | + var offsetSize = { | |
| 2359 | + top: 15, | |
| 2360 | + bottom: 15, | |
| 2361 | + }; | |
| 2362 | + | |
| 2363 | + // Get all toast messages on the DOM | |
| 2364 | + var allToasts = document.getElementsByClassName("toastify"); | |
| 2365 | + | |
| 2366 | + var classUsed; | |
| 2367 | + | |
| 2368 | + // Modifying the position of each toast element | |
| 2369 | + for (var i = 0; i < allToasts.length; i++) { | |
| 2370 | + // Getting the applied gravity | |
| 2371 | + if (containsClass(allToasts[i], "toastify-top") === true) { | |
| 2372 | + classUsed = "toastify-top"; | |
| 2373 | + } else { | |
| 2374 | + classUsed = "toastify-bottom"; | |
| 2375 | + } | |
| 2376 | + | |
| 2377 | + var height = allToasts[i].offsetHeight; | |
| 2378 | + classUsed = classUsed.substr(9, classUsed.length-1) | |
| 2379 | + // Spacing between toasts | |
| 2380 | + var offset = 15; | |
| 2381 | + | |
| 2382 | + var width = window.innerWidth > 0 ? window.innerWidth : screen.width; | |
| 2383 | + | |
| 2384 | + // Show toast in center if screen with less than or equal to 360px | |
| 2385 | + if (width <= 360) { | |
| 2386 | + // Setting the position | |
| 2387 | + allToasts[i].style[classUsed] = offsetSize[classUsed] + "px"; | |
| 2388 | + | |
| 2389 | + offsetSize[classUsed] += height + offset; | |
| 2390 | + } else { | |
| 2391 | + if (containsClass(allToasts[i], "toastify-left") === true) { | |
| 2392 | + // Setting the position | |
| 2393 | + allToasts[i].style[classUsed] = topLeftOffsetSize[classUsed] + "px"; | |
| 2394 | + | |
| 2395 | + topLeftOffsetSize[classUsed] += height + offset; | |
| 2396 | + } else { | |
| 2397 | + // Setting the position | |
| 2398 | + allToasts[i].style[classUsed] = topRightOffsetSize[classUsed] + "px"; | |
| 2399 | + | |
| 2400 | + topRightOffsetSize[classUsed] += height + offset; | |
| 2401 | + } | |
| 2402 | + } | |
| 2403 | + } | |
| 2404 | + | |
| 2405 | + // Supporting function chaining | |
| 2406 | + return this; | |
| 2407 | + }; | |
| 2408 | + | |
| 2409 | + // Helper function to get offset. | |
| 2410 | + function getAxisOffsetAValue(axis, options) { | |
| 2411 | + | |
| 2412 | + if(options.offset[axis]) { | |
| 2413 | + if(isNaN(options.offset[axis])) { | |
| 2414 | + return options.offset[axis]; | |
| 2415 | + } | |
| 2416 | + else { | |
| 2417 | + return options.offset[axis] + 'px'; | |
| 2418 | + } | |
| 2419 | + } | |
| 2420 | + | |
| 2421 | + return '0px'; | |
| 2422 | + | |
| 2423 | + } | |
| 2424 | + | |
| 2425 | + function containsClass(elem, yourClass) { | |
| 2426 | + if (!elem || typeof yourClass !== "string") { | |
| 2427 | + return false; | |
| 2428 | + } else if ( | |
| 2429 | + elem.className && | |
| 2430 | + elem.className | |
| 2431 | + .trim() | |
| 2432 | + .split(/\s+/gi) | |
| 2433 | + .indexOf(yourClass) > -1 | |
| 2434 | + ) { | |
| 2435 | + return true; | |
| 2436 | + } else { | |
| 2437 | + return false; | |
| 2438 | + } | |
| 2439 | + } | |
| 2440 | + | |
| 2441 | + // Setting up the prototype for the init object | |
| 2442 | + Toastify.lib.init.prototype = Toastify.lib; | |
| 2443 | + | |
| 2444 | + // Returning the Toastify function to be assigned to the window object/module | |
| 2445 | + return Toastify; | |
| 2446 | +}); | |
| 2447 | + | |
| 2448 | + | |
| 2449 | +/***/ }, | |
| 2450 | + | |
| 2451 | +/***/ "react" | |
| 2452 | +/*!************************!*\ | |
| 2453 | + !*** external "React" ***! | |
| 2454 | + \************************/ | |
| 2455 | +(module) { | |
| 2456 | + | |
| 2457 | +"use strict"; | |
| 2458 | +module.exports = window["React"]; | |
| 2459 | + | |
| 2460 | +/***/ }, | |
| 2461 | + | |
| 2462 | +/***/ "@learnpress/quiz" | |
| 775 | 2463 | /*!******************************!*\ |
| 776 | 2464 | !*** external ["LP","quiz"] ***! |
| 777 | 2465 | \******************************/ |
| 778 | -/***/ (function(module) { | |
| 2466 | +(module) { | |
| 779 | 2467 | |
| 780 | 2468 | "use strict"; |
| 781 | 2469 | module.exports = window["LP"]["quiz"]; |
| 782 | 2470 | |
| 783 | -/***/ }), | |
| 2471 | +/***/ }, | |
| 784 | 2472 | |
| 785 | -/***/ "@wordpress/api-fetch": | |
| 786 | -/*!**********************************!*\ | |
| 787 | - !*** external ["wp","apiFetch"] ***! | |
| 788 | - \**********************************/ | |
| 789 | -/***/ (function(module) { | |
| 790 | - | |
| 791 | -"use strict"; | |
| 792 | -module.exports = window["wp"]["apiFetch"]; | |
| 793 | - | |
| 794 | -/***/ }), | |
| 795 | - | |
| 796 | -/***/ "@wordpress/element": | |
| 2473 | +/***/ "@wordpress/element" | |
| 797 | 2474 | /*!*********************************!*\ |
| 798 | 2475 | !*** external ["wp","element"] ***! |
| 799 | 2476 | \*********************************/ |
| 800 | -/***/ (function(module) { | |
| 2477 | +(module) { | |
| 801 | 2478 | |
| 802 | 2479 | "use strict"; |
| 803 | 2480 | module.exports = window["wp"]["element"]; |
| 804 | 2481 | |
| 805 | -/***/ }), | |
| 2482 | +/***/ }, | |
| 806 | 2483 | |
| 807 | -/***/ "@wordpress/url": | |
| 2484 | +/***/ "@wordpress/url" | |
| 808 | 2485 | /*!*****************************!*\ |
| 809 | 2486 | !*** external ["wp","url"] ***! |
| 810 | 2487 | \*****************************/ |
| 811 | -/***/ (function(module) { | |
| 2488 | +(module) { | |
| 812 | 2489 | |
| 813 | 2490 | "use strict"; |
| 814 | 2491 | module.exports = window["wp"]["url"]; |
| 815 | 2492 | |
| 816 | -/***/ }) | |
| 2493 | +/***/ } | |
| 817 | 2494 | |
| 818 | 2495 | /******/ }); |
| 819 | 2496 | /************************************************************************/ |
| 820 | 2497 | /******/ // The module cache |
| @@ -828,15 +2505,21 @@ | ||
| 828 | 2505 | /******/ return cachedModule.exports; |
| 829 | 2506 | /******/ } |
| 830 | 2507 | /******/ // Create a new module (and put it into the cache) |
| 831 | 2508 | /******/ var module = __webpack_module_cache__[moduleId] = { |
| 832 | -/******/ // no module.id needed | |
| 2509 | +/******/ id: moduleId, | |
| 833 | 2510 | /******/ // no module.loaded needed |
| 834 | 2511 | /******/ exports: {} |
| 835 | 2512 | /******/ }; |
| 836 | 2513 | /******/ |
| 837 | 2514 | /******/ // Execute the module function |
| 838 | -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | |
| 2515 | +/******/ if (!(moduleId in __webpack_modules__)) { | |
| 2516 | +/******/ delete __webpack_module_cache__[moduleId]; | |
| 2517 | +/******/ var e = new Error("Cannot find module '" + moduleId + "'"); | |
| 2518 | +/******/ e.code = 'MODULE_NOT_FOUND'; | |
| 2519 | +/******/ throw e; | |
| 2520 | +/******/ } | |
| 2521 | +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
| 839 | 2522 | /******/ |
| 840 | 2523 | /******/ // Return the exports of the module |
| 841 | 2524 | /******/ return module.exports; |
| 842 | 2525 | /******/ } |
| @@ -842,23 +2525,23 @@ | ||
| 842 | 2525 | /******/ } |
| 843 | 2526 | /******/ |
| 844 | 2527 | /************************************************************************/ |
| 845 | 2528 | /******/ /* webpack/runtime/compat get default export */ |
| 846 | -/******/ !function() { | |
| 2529 | +/******/ (() => { | |
| 847 | 2530 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| 848 | -/******/ __webpack_require__.n = function(module) { | |
| 2531 | +/******/ __webpack_require__.n = (module) => { | |
| 849 | 2532 | /******/ var getter = module && module.__esModule ? |
| 850 | -/******/ function() { return module['default']; } : | |
| 851 | -/******/ function() { return module; }; | |
| 2533 | +/******/ () => (module['default']) : | |
| 2534 | +/******/ () => (module); | |
| 852 | 2535 | /******/ __webpack_require__.d(getter, { a: getter }); |
| 853 | 2536 | /******/ return getter; |
| 854 | 2537 | /******/ }; |
| 855 | -/******/ }(); | |
| 2538 | +/******/ })(); | |
| 856 | 2539 | /******/ |
| 857 | 2540 | /******/ /* webpack/runtime/define property getters */ |
| 858 | -/******/ !function() { | |
| 2541 | +/******/ (() => { | |
| 859 | 2542 | /******/ // define getter functions for harmony exports |
| 860 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 2543 | +/******/ __webpack_require__.d = (exports, definition) => { | |
| 861 | 2544 | /******/ for(var key in definition) { |
| 862 | 2545 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 863 | 2546 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 864 | 2547 | /******/ } |
| @@ -863,30 +2546,35 @@ | ||
| 863 | 2546 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 864 | 2547 | /******/ } |
| 865 | 2548 | /******/ } |
| 866 | 2549 | /******/ }; |
| 867 | -/******/ }(); | |
| 2550 | +/******/ })(); | |
| 868 | 2551 | /******/ |
| 869 | 2552 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 870 | -/******/ !function() { | |
| 871 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 872 | -/******/ }(); | |
| 2553 | +/******/ (() => { | |
| 2554 | +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | |
| 2555 | +/******/ })(); | |
| 873 | 2556 | /******/ |
| 874 | 2557 | /******/ /* webpack/runtime/make namespace object */ |
| 875 | -/******/ !function() { | |
| 2558 | +/******/ (() => { | |
| 876 | 2559 | /******/ // define __esModule on exports |
| 877 | -/******/ __webpack_require__.r = function(exports) { | |
| 2560 | +/******/ __webpack_require__.r = (exports) => { | |
| 878 | 2561 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 879 | 2562 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 880 | 2563 | /******/ } |
| 881 | 2564 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 882 | 2565 | /******/ }; |
| 883 | -/******/ }(); | |
| 2566 | +/******/ })(); | |
| 884 | 2567 | /******/ |
| 2568 | +/******/ /* webpack/runtime/nonce */ | |
| 2569 | +/******/ (() => { | |
| 2570 | +/******/ __webpack_require__.nc = undefined; | |
| 2571 | +/******/ })(); | |
| 2572 | +/******/ | |
| 885 | 2573 | /************************************************************************/ |
| 886 | 2574 | var __webpack_exports__ = {}; |
| 887 | -// This entry need to be wrapped in an IIFE because it need to be in strict mode. | |
| 888 | -!function() { | |
| 2575 | +// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. | |
| 2576 | +(() => { | |
| 889 | 2577 | "use strict"; |
| 890 | 2578 | /*!******************************************************!*\ |
| 891 | 2579 | !*** ./assets/src/apps/js/frontend/single-course.js ***! |
| 892 | 2580 | \******************************************************/ |
| @@ -891,21 +2579,27 @@ | ||
| 891 | 2579 | !*** ./assets/src/apps/js/frontend/single-course.js ***! |
| 892 | 2580 | \******************************************************/ |
| 893 | 2581 | __webpack_require__.r(__webpack_exports__); |
| 894 | 2582 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 895 | -/* harmony export */ "enrollCourse": function() { return /* binding */ enrollCourse; }, | |
| 896 | -/* harmony export */ "init": function() { return /* binding */ init; }, | |
| 897 | -/* harmony export */ "initCourseSidebar": function() { return /* binding */ initCourseSidebar; }, | |
| 898 | -/* harmony export */ "initCourseTabs": function() { return /* binding */ initCourseTabs; } | |
| 2583 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), | |
| 2584 | +/* harmony export */ enrollCourse: () => (/* binding */ enrollCourse), | |
| 2585 | +/* harmony export */ init: () => (/* binding */ init), | |
| 2586 | +/* harmony export */ initCourseSidebar: () => (/* binding */ initCourseSidebar), | |
| 2587 | +/* harmony export */ initCourseTabs: () => (/* binding */ initCourseTabs) | |
| 899 | 2588 | /* harmony export */ }); |
| 900 | -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); | |
| 901 | -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); | |
| 2589 | +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); | |
| 2590 | +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); | |
| 902 | 2591 | /* harmony import */ var _single_course_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./single-course/index */ "./assets/src/apps/js/frontend/single-course/index.js"); |
| 903 | -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); | |
| 904 | -/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_url__WEBPACK_IMPORTED_MODULE_2__); | |
| 905 | -/* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./show-lp-overlay-complete-item */ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js"); | |
| 906 | -/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js"); | |
| 907 | -/* harmony import */ var _single_curriculum_skeleton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./single-curriculum/skeleton */ "./assets/src/apps/js/frontend/single-curriculum/skeleton.js"); | |
| 2592 | +/* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./show-lp-overlay-complete-item */ "./assets/src/apps/js/frontend/show-lp-overlay-complete-item.js"); | |
| 2593 | +/* harmony import */ var _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/lp-modal-overlay */ "./assets/src/apps/js/utils/lp-modal-overlay.js"); | |
| 2594 | +/* harmony import */ var _single_curriculum_skeleton__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./single-curriculum/skeleton */ "./assets/src/apps/js/frontend/single-curriculum/skeleton.js"); | |
| 2595 | +/* harmony import */ var _material__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./material */ "./assets/src/apps/js/frontend/material.js"); | |
| 2596 | +/* harmony import */ var _tabs_scroll__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./tabs-scroll */ "./assets/src/apps/js/frontend/tabs-scroll.js"); | |
| 2597 | +/* harmony import */ var _js_utils_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../js/utils.js */ "./assets/src/js/utils.js"); | |
| 2598 | +/* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! toastify-js */ "./node_modules/toastify-js/src/toastify.js"); | |
| 2599 | +/* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(toastify_js__WEBPACK_IMPORTED_MODULE_8__); | |
| 2600 | +/* harmony import */ var toastify_js_src_toastify_css__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! toastify-js/src/toastify.css */ "./node_modules/toastify-js/src/toastify.css"); | |
| 2601 | +/* harmony import */ var _js_frontend_copy_to_clipboard_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../js/frontend/copy-to-clipboard.js */ "./assets/src/js/frontend/copy-to-clipboard.js"); | |
| 908 | 2602 | |
| 909 | 2603 | |
| 910 | 2604 | |
| 911 | 2605 | |
| @@ -910,14 +2604,18 @@ | ||
| 910 | 2604 | |
| 911 | 2605 | |
| 912 | 2606 | |
| 913 | 2607 | |
| 914 | -/* harmony default export */ __webpack_exports__["default"] = (_single_course_index__WEBPACK_IMPORTED_MODULE_1__["default"]); | |
| 2608 | + | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_single_course_index__WEBPACK_IMPORTED_MODULE_1__["default"]); | |
| 915 | 2614 | const init = () => { |
| 916 | - wp.element.render((0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_single_course_index__WEBPACK_IMPORTED_MODULE_1__["default"], null)); | |
| 2615 | + wp.element.render((0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_single_course_index__WEBPACK_IMPORTED_MODULE_1__["default"], null)); | |
| 917 | 2616 | }; |
| 918 | 2617 | const $ = jQuery; |
| 919 | - | |
| 920 | 2618 | const initCourseTabs = function () { |
| 921 | 2619 | $('#learn-press-course-tabs').on('change', 'input[name="learn-press-course-tab-radio"]', function (e) { |
| 922 | 2620 | const selectedTab = $('input[name="learn-press-course-tab-radio"]:checked').val(); |
| 923 | 2621 | LP.Cookies.set('course-tab', selectedTab); |
| @@ -923,16 +2621,13 @@ | ||
| 923 | 2621 | LP.Cookies.set('course-tab', selectedTab); |
| 924 | 2622 | $('label[for="' + $(e.target).attr('id') + '"]').closest('li').addClass('active').siblings().removeClass('active'); |
| 925 | 2623 | }); |
| 926 | 2624 | }; |
| 927 | - | |
| 928 | 2625 | const initCourseSidebar = function initCourseSidebar() { |
| 929 | 2626 | const $sidebar = $('.course-summary-sidebar'); |
| 930 | - | |
| 931 | 2627 | if (!$sidebar.length) { |
| 932 | 2628 | return; |
| 933 | 2629 | } |
| 934 | - | |
| 935 | 2630 | const $window = $(window); |
| 936 | 2631 | const $scrollable = $sidebar.children(); |
| 937 | 2632 | const offset = $sidebar.offset(); |
| 938 | 2633 | let scrollTop = 0; |
| @@ -940,19 +2635,16 @@ | ||
| 940 | 2635 | const scrollHeight = $scrollable.height(); |
| 941 | 2636 | const options = { |
| 942 | 2637 | offsetTop: 32 |
| 943 | 2638 | }; |
| 944 | - | |
| 945 | 2639 | const onScroll = function () { |
| 946 | 2640 | scrollTop = $window.scrollTop(); |
| 947 | 2641 | const top = scrollTop - offset.top + options.offsetTop; |
| 948 | - | |
| 949 | 2642 | if (top < 0) { |
| 950 | 2643 | $sidebar.removeClass('slide-top slide-down'); |
| 951 | 2644 | $scrollable.css('top', ''); |
| 952 | 2645 | return; |
| 953 | 2646 | } |
| 954 | - | |
| 955 | 2647 | if (top > maxHeight - scrollHeight) { |
| 956 | 2648 | $sidebar.removeClass('slide-down').addClass('slide-top'); |
| 957 | 2649 | $scrollable.css('top', maxHeight - scrollHeight); |
| 958 | 2650 | } else { |
| @@ -959,19 +2651,18 @@ | ||
| 959 | 2651 | $sidebar.removeClass('slide-top').addClass('slide-down'); |
| 960 | 2652 | $scrollable.css('top', options.offsetTop); |
| 961 | 2653 | } |
| 962 | 2654 | }; |
| 963 | - | |
| 964 | 2655 | $window.on('scroll.fixed-course-sidebar', onScroll).trigger('scroll.fixed-course-sidebar'); |
| 965 | -}; // Rest API Enroll course - Nhamdv. | |
| 2656 | +}; | |
| 966 | 2657 | |
| 967 | - | |
| 2658 | +// Rest API Enroll course - Nhamdv. | |
| 968 | 2659 | const enrollCourse = () => { |
| 969 | 2660 | const formEnrolls = document.querySelectorAll('form.enroll-course'); |
| 970 | - | |
| 971 | 2661 | if (formEnrolls.length > 0) { |
| 972 | 2662 | formEnrolls.forEach(formEnroll => { |
| 973 | 2663 | const submit = async (id, btnEnroll) => { |
| 2664 | + const status = 'error'; | |
| 974 | 2665 | try { |
| 975 | 2666 | const response = await wp.apiFetch({ |
| 976 | 2667 | path: 'lp/v1/courses/enroll-course', |
| 977 | 2668 | method: 'POST', |
| @@ -978,10 +2669,8 @@ | ||
| 978 | 2669 | data: { |
| 979 | 2670 | id |
| 980 | 2671 | } |
| 981 | 2672 | }); |
| 982 | - btnEnroll.classList.remove('loading'); | |
| 983 | - btnEnroll.disabled = false; | |
| 984 | 2673 | const { |
| 985 | 2674 | status, |
| 986 | 2675 | data: { |
| 987 | 2676 | redirect |
| @@ -987,89 +2676,92 @@ | ||
| 987 | 2676 | redirect |
| 988 | 2677 | }, |
| 989 | 2678 | message |
| 990 | 2679 | } = response; |
| 991 | - | |
| 2680 | + if (status === 'success') { | |
| 2681 | + btnEnroll.remove(); | |
| 2682 | + } else { | |
| 2683 | + (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btnEnroll, 0); | |
| 2684 | + throw new Error(message); | |
| 2685 | + } | |
| 992 | 2686 | if (message && status) { |
| 993 | - btnEnroll.style.display = 'none'; | |
| 994 | - formEnroll.innerHTML += `<div class="lp-enroll-notice ${status}">${message}</div>`; | |
| 995 | - | |
| 2687 | + formEnroll.innerHTML += `<div class="learn-press-message ${status}">${message}</div>`; | |
| 996 | 2688 | if (redirect) { |
| 997 | 2689 | window.location.href = redirect; |
| 998 | 2690 | } |
| 999 | 2691 | } |
| 1000 | 2692 | } catch (error) { |
| 1001 | - form.innerHTML += `<div class="lp-enroll-notice error">${error.message && error.message}</div>`; | |
| 2693 | + toastify_js__WEBPACK_IMPORTED_MODULE_8___default()({ | |
| 2694 | + text: error.message, | |
| 2695 | + gravity: lpData.toast.gravity, | |
| 2696 | + // `top` or `bottom` | |
| 2697 | + position: lpData.toast.position, | |
| 2698 | + // `left`, `center` or `right` | |
| 2699 | + className: `${lpData.toast.classPrefix} ${status}`, | |
| 2700 | + close: lpData.toast.close == 1, | |
| 2701 | + stopOnFocus: lpData.toast.stopOnFocus == 1, | |
| 2702 | + duration: lpData.toast.duration | |
| 2703 | + }).showToast(); | |
| 1002 | 2704 | } |
| 1003 | 2705 | }; |
| 1004 | - | |
| 1005 | 2706 | formEnroll.addEventListener('submit', event => { |
| 1006 | 2707 | event.preventDefault(); |
| 1007 | 2708 | const id = formEnroll.querySelector('input[name=enroll-course]').value; |
| 1008 | 2709 | const btnEnroll = formEnroll.querySelector('button.button-enroll-course'); |
| 1009 | - btnEnroll.classList.add('loading'); | |
| 1010 | - btnEnroll.disabled = true; | |
| 2710 | + (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btnEnroll, 1); | |
| 1011 | 2711 | submit(id, btnEnroll); |
| 1012 | 2712 | }); |
| 1013 | 2713 | }); |
| 1014 | - } // Reload when press back button in chrome. | |
| 2714 | + } | |
| 1015 | 2715 | |
| 1016 | - | |
| 2716 | + // Reload when press back button in chrome. | |
| 1017 | 2717 | if (document.querySelector('.course-detail-info') !== null) { |
| 1018 | 2718 | window.addEventListener('pageshow', event => { |
| 1019 | 2719 | const hasCache = event.persisted || typeof window.performance != 'undefined' && String(window.performance.getEntriesByType('navigation')[0].type) == 'back_forward'; |
| 1020 | - | |
| 1021 | 2720 | if (hasCache) { |
| 1022 | 2721 | location.reload(); |
| 1023 | 2722 | } |
| 1024 | 2723 | }); |
| 1025 | 2724 | } |
| 1026 | -}; // Rest API purchase course - Nhamdv. | |
| 2725 | +}; | |
| 1027 | 2726 | |
| 1028 | - | |
| 2727 | +// Rest API purchase course - Nhamdv. | |
| 1029 | 2728 | const purchaseCourse = () => { |
| 1030 | 2729 | const forms = document.querySelectorAll('form.purchase-course'); |
| 1031 | - | |
| 1032 | 2730 | if (forms.length > 0) { |
| 1033 | 2731 | forms.forEach(form => { |
| 1034 | 2732 | // Allow Repurchase. |
| 1035 | 2733 | const allowRepurchase = () => { |
| 1036 | - const continueRepurchases = document.querySelectorAll('.lp_allow_repuchase_select'); | |
| 2734 | + const continueRepurchases = document.querySelectorAll('.lp_allow_repurchase_select'); | |
| 1037 | 2735 | continueRepurchases.forEach(repurchase => { |
| 1038 | 2736 | const radios = repurchase.querySelectorAll('[name=_lp_allow_repurchase_type]'); |
| 1039 | - | |
| 1040 | 2737 | for (let i = 0, length = radios.length; i < length; i++) { |
| 1041 | 2738 | if (radios[i].checked) { |
| 1042 | 2739 | const repurchaseType = radios[i].value; |
| 1043 | 2740 | const id = form.querySelector('input[name=purchase-course]').value; |
| 1044 | - const btnBuynow = form.querySelector('button.button-purchase-course'); | |
| 1045 | - btnBuynow.classList.add('loading'); | |
| 1046 | - btnBuynow.disabled = true; | |
| 1047 | - submit(id, btnBuynow, repurchaseType); | |
| 2741 | + const btnBuyNow = form.querySelector('button.button-purchase-course'); | |
| 2742 | + (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btnBuyNow, 1); | |
| 2743 | + submit(id, btnBuyNow, repurchaseType); | |
| 1048 | 2744 | break; |
| 1049 | 2745 | } |
| 1050 | 2746 | } |
| 1051 | 2747 | }); |
| 1052 | 2748 | }; |
| 1053 | - | |
| 1054 | - const submit = async function (id, btn) { | |
| 1055 | - let repurchaseType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | |
| 1056 | - | |
| 2749 | + const submit = async (id, btn, repurchaseType = false) => { | |
| 2750 | + const status = 'error'; | |
| 1057 | 2751 | try { |
| 2752 | + const formData = new FormData(form); | |
| 2753 | + const dataSend = Object.fromEntries(Array.from(formData.keys(), key => { | |
| 2754 | + const val = formData.getAll(key); | |
| 2755 | + return [key, val.length > 1 ? val : val.pop()]; | |
| 2756 | + })); | |
| 2757 | + dataSend.id = id; | |
| 2758 | + dataSend.repurchaseType = repurchaseType; | |
| 1058 | 2759 | const response = await wp.apiFetch({ |
| 1059 | 2760 | path: 'lp/v1/courses/purchase-course', |
| 1060 | 2761 | method: 'POST', |
| 1061 | - data: { | |
| 1062 | - id, | |
| 1063 | - repurchaseType | |
| 1064 | - } | |
| 2762 | + data: dataSend | |
| 1065 | 2763 | }); |
| 1066 | - | |
| 1067 | - if (btn) { | |
| 1068 | - btn.classList.remove('loading'); | |
| 1069 | - btn.disabled = false; | |
| 1070 | - } | |
| 1071 | - | |
| 1072 | 2764 | const { |
| 1073 | 2765 | status, |
| 1074 | 2766 | data: { |
| 1075 | 2767 | redirect, |
| @@ -1078,60 +2770,70 @@ | ||
| 1078 | 2770 | titlePopup |
| 1079 | 2771 | }, |
| 1080 | 2772 | message |
| 1081 | 2773 | } = response; |
| 1082 | - | |
| 2774 | + if (status === 'success') { | |
| 2775 | + if (type === 'allow_repurchase') { | |
| 2776 | + (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btn, 0); | |
| 2777 | + } else { | |
| 2778 | + btn.remove(); | |
| 2779 | + } | |
| 2780 | + } else { | |
| 2781 | + (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btn, 0); | |
| 2782 | + throw new Error(message); | |
| 2783 | + } | |
| 1083 | 2784 | if (type === 'allow_repurchase' && status === 'success') { |
| 1084 | - if (!form.querySelector('.lp_allow_repuchase_select')) { | |
| 1085 | - if (!_utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_4__["default"].init()) { | |
| 2785 | + if (!form.querySelector('.lp_allow_repurchase_select')) { | |
| 2786 | + if (!_utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].init()) { | |
| 1086 | 2787 | return; |
| 1087 | 2788 | } |
| 1088 | - | |
| 1089 | - _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_4__["default"].elLPOverlay.show(); | |
| 1090 | - _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_4__["default"].setTitleModal(titlePopup || ''); | |
| 1091 | - _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_4__["default"].setContentModal(html); | |
| 1092 | - | |
| 1093 | - _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_4__["default"].callBackYes = () => { | |
| 1094 | - _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_4__["default"].elLPOverlay.hide(); | |
| 2789 | + _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].elLPOverlay.show(); | |
| 2790 | + _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].setTitleModal(titlePopup || ''); | |
| 2791 | + _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].setContentModal(html); | |
| 2792 | + _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].callBackYes = () => { | |
| 2793 | + _utils_lp_modal_overlay__WEBPACK_IMPORTED_MODULE_3__["default"].elLPOverlay.hide(); | |
| 1095 | 2794 | allowRepurchase(); |
| 1096 | 2795 | }; |
| 1097 | 2796 | } |
| 1098 | 2797 | } else if (message && status) { |
| 1099 | - form.innerHTML += `<div class="lp-enroll-notice ${status}">${message}</div>`; | |
| 1100 | - | |
| 2798 | + form.innerHTML += `<div class="learn-press-message ${status}">${message}</div>`; | |
| 1101 | 2799 | if ('success' === status && redirect) { |
| 1102 | 2800 | window.location.href = redirect; |
| 1103 | 2801 | } |
| 1104 | 2802 | } |
| 1105 | 2803 | } catch (error) { |
| 1106 | - form.innerHTML += `<div class="lp-enroll-notice error">${error.message && error.message}</div>`; | |
| 2804 | + toastify_js__WEBPACK_IMPORTED_MODULE_8___default()({ | |
| 2805 | + text: error.message, | |
| 2806 | + gravity: lpData.toast.gravity, | |
| 2807 | + // `top` or `bottom` | |
| 2808 | + position: lpData.toast.position, | |
| 2809 | + // `left`, `center` or `right` | |
| 2810 | + className: `${lpData.toast.classPrefix} ${status}`, | |
| 2811 | + close: lpData.toast.close == 1, | |
| 2812 | + stopOnFocus: lpData.toast.stopOnFocus == 1, | |
| 2813 | + duration: lpData.toast.duration | |
| 2814 | + }).showToast(); | |
| 1107 | 2815 | } |
| 1108 | 2816 | }; |
| 1109 | - | |
| 1110 | 2817 | form.addEventListener('submit', event => { |
| 1111 | 2818 | event.preventDefault(); |
| 1112 | 2819 | const id = form.querySelector('input[name=purchase-course]').value; |
| 1113 | 2820 | const btn = form.querySelector('button.button-purchase-course'); |
| 1114 | - btn.classList.add('loading'); | |
| 1115 | - btn.disabled = true; | |
| 2821 | + (0,_js_utils_js__WEBPACK_IMPORTED_MODULE_7__.lpSetLoadingEl)(btn, 1); | |
| 1116 | 2822 | submit(id, btn); |
| 1117 | 2823 | }); |
| 1118 | 2824 | }); |
| 1119 | 2825 | } |
| 1120 | 2826 | }; |
| 1121 | - | |
| 1122 | 2827 | const retakeCourse = () => { |
| 1123 | 2828 | const elFormRetakeCourses = document.querySelectorAll('.lp-form-retake-course'); |
| 1124 | - | |
| 1125 | 2829 | if (!elFormRetakeCourses.length) { |
| 1126 | 2830 | return; |
| 1127 | 2831 | } |
| 1128 | - | |
| 1129 | 2832 | elFormRetakeCourses.forEach(elFormRetakeCourse => { |
| 1130 | 2833 | const elButtonRetakeCourses = elFormRetakeCourse.querySelector('.button-retake-course'); |
| 1131 | 2834 | const elCourseId = elFormRetakeCourse.querySelector('[name=retake-course]').value; |
| 1132 | 2835 | const elAjaxMessage = elFormRetakeCourse.querySelector('.lp-ajax-message'); |
| 1133 | - | |
| 1134 | 2836 | const submit = elButtonRetakeCourse => { |
| 1135 | 2837 | wp.apiFetch({ |
| 1136 | 2838 | path: '/lp/v1/courses/retake-course', |
| 1137 | 2839 | method: 'POST', |
| @@ -1144,9 +2846,8 @@ | ||
| 1144 | 2846 | message, |
| 1145 | 2847 | data |
| 1146 | 2848 | } = res; |
| 1147 | 2849 | elAjaxMessage.innerHTML = message; |
| 1148 | - | |
| 1149 | 2850 | if (undefined != status && status === 'success') { |
| 1150 | 2851 | elButtonRetakeCourse.style.display = 'none'; |
| 1151 | 2852 | setTimeout(() => { |
| 1152 | 2853 | window.location.replace(data.url_redirect); |
| @@ -1162,9 +2863,8 @@ | ||
| 1162 | 2863 | elButtonRetakeCourse.disabled = false; |
| 1163 | 2864 | elAjaxMessage.style.display = 'block'; |
| 1164 | 2865 | }); |
| 1165 | 2866 | }; |
| 1166 | - | |
| 1167 | 2867 | elFormRetakeCourse.addEventListener('submit', e => { |
| 1168 | 2868 | e.preventDefault(); |
| 1169 | 2869 | }); |
| 1170 | 2870 | elButtonRetakeCourses.addEventListener('click', e => { |
| @@ -1173,77 +2873,85 @@ | ||
| 1173 | 2873 | elButtonRetakeCourses.disabled = true; |
| 1174 | 2874 | submit(elButtonRetakeCourses); |
| 1175 | 2875 | }); |
| 1176 | 2876 | }); |
| 1177 | -}; // Rest API load content course progress - Nhamdv. | |
| 2877 | +}; | |
| 1178 | 2878 | |
| 2879 | +// Rest API load content course progress - Nhamdv. | |
| 2880 | +/*const courseProgress = () => { | |
| 2881 | + const elements = document.querySelectorAll( '.lp-course-progress-wrapper' ); | |
| 1179 | 2882 | |
| 1180 | -const courseProgress = () => { | |
| 1181 | - const elements = document.querySelectorAll('.lp-course-progress-wrapper'); | |
| 2883 | + if ( ! elements.length ) { | |
| 2884 | + return; | |
| 2885 | + } | |
| 1182 | 2886 | |
| 1183 | - if (!elements.length) { | |
| 1184 | - return; | |
| 1185 | - } | |
| 2887 | + if ( 'IntersectionObserver' in window ) { | |
| 2888 | + const eleObserver = new IntersectionObserver( ( entries, observer ) => { | |
| 2889 | + entries.forEach( ( entry ) => { | |
| 2890 | + if ( entry.isIntersecting ) { | |
| 2891 | + const ele = entry.target; | |
| 1186 | 2892 | |
| 1187 | - if ('IntersectionObserver' in window) { | |
| 1188 | - const eleObserver = new IntersectionObserver((entries, observer) => { | |
| 1189 | - entries.forEach(entry => { | |
| 1190 | - if (entry.isIntersecting) { | |
| 1191 | - const ele = entry.target; | |
| 1192 | - setTimeout(function () { | |
| 1193 | - getResponse(ele); | |
| 1194 | - }, 600); | |
| 1195 | - eleObserver.unobserve(ele); | |
| 1196 | - } | |
| 1197 | - }); | |
| 1198 | - }); | |
| 1199 | - [...elements].map(ele => eleObserver.observe(ele)); | |
| 1200 | - } | |
| 2893 | + setTimeout( function() { | |
| 2894 | + getResponse( ele ); | |
| 2895 | + }, 600 ); | |
| 1201 | 2896 | |
| 1202 | - const getResponse = async ele => { | |
| 1203 | - const response = await wp.apiFetch({ | |
| 1204 | - path: 'lp/v1/lazy-load/course-progress', | |
| 1205 | - method: 'POST', | |
| 1206 | - data: { | |
| 1207 | - courseId: lpGlobalSettings.post_id || '', | |
| 1208 | - userId: lpGlobalSettings.user_id || '' | |
| 1209 | - } | |
| 1210 | - }); | |
| 1211 | - const { | |
| 1212 | - data | |
| 1213 | - } = response; | |
| 1214 | - ele.innerHTML = data; | |
| 1215 | - }; | |
| 1216 | -}; | |
| 2897 | + eleObserver.unobserve( ele ); | |
| 2898 | + } | |
| 2899 | + } ); | |
| 2900 | + } ); | |
| 1217 | 2901 | |
| 2902 | + [ ...elements ].map( ( ele ) => eleObserver.observe( ele ) ); | |
| 2903 | + } | |
| 2904 | + | |
| 2905 | + const getResponse = async ( ele ) => { | |
| 2906 | + let url = 'lp/v1/lazy-load/course-progress'; | |
| 2907 | + if ( lpData.urlParams.hasOwnProperty( 'lang' ) ) { | |
| 2908 | + url += '?lang=' + lpData.urlParams.lang; | |
| 2909 | + } | |
| 2910 | + | |
| 2911 | + const response = await wp.apiFetch( { | |
| 2912 | + path: url, | |
| 2913 | + method: 'POST', | |
| 2914 | + data: { | |
| 2915 | + courseId: lpGlobalSettings.post_id || '', | |
| 2916 | + userId: lpData.user_id || '', | |
| 2917 | + }, | |
| 2918 | + } ); | |
| 2919 | + | |
| 2920 | + const { data } = response; | |
| 2921 | + | |
| 2922 | + ele.innerHTML = data; | |
| 2923 | + }; | |
| 2924 | +};*/ | |
| 2925 | + | |
| 1218 | 2926 | const accordionExtraTab = () => { |
| 1219 | 2927 | const elements = document.querySelectorAll('.course-extra-box'); |
| 1220 | 2928 | [...elements].map(ele => { |
| 1221 | 2929 | const title = ele.querySelector('.course-extra-box__title'); |
| 2930 | + ele.classList.remove('active'); | |
| 2931 | + const content = ele.querySelector('.course-extra-box__content'); | |
| 2932 | + content.style.height = '0'; | |
| 1222 | 2933 | title.addEventListener('click', () => { |
| 1223 | - const panel = title.nextElementSibling; | |
| 1224 | - const eleActive = document.querySelector('.course-extra-box.active'); | |
| 1225 | - | |
| 1226 | - if (eleActive && !ele.classList.contains('active')) { | |
| 1227 | - eleActive.classList.remove('active'); | |
| 1228 | - eleActive.querySelector('.course-extra-box__content').style.display = 'none'; | |
| 1229 | - } | |
| 1230 | - | |
| 1231 | - if (!ele.classList.contains('active')) { | |
| 2934 | + const isActive = ele.classList.contains('active'); | |
| 2935 | + [...elements].forEach(otherEle => { | |
| 2936 | + if (otherEle !== ele) { | |
| 2937 | + otherEle.classList.remove('active'); | |
| 2938 | + otherEle.querySelector('.course-extra-box__content').style.height = '0'; | |
| 2939 | + } | |
| 2940 | + }); | |
| 2941 | + if (isActive) { | |
| 2942 | + ele.classList.remove('active'); | |
| 2943 | + content.style.height = '0'; | |
| 2944 | + } else { | |
| 1232 | 2945 | ele.classList.add('active'); |
| 1233 | - panel.style.display = 'block'; | |
| 1234 | - } else { | |
| 1235 | - ele.classList.remove('active'); | |
| 1236 | - panel.style.display = 'none'; | |
| 2946 | + content.style.height = content.scrollHeight + 'px'; | |
| 1237 | 2947 | } |
| 1238 | 2948 | }); |
| 1239 | 2949 | }); |
| 1240 | 2950 | }; |
| 1241 | - | |
| 1242 | 2951 | const courseContinue = () => { |
| 1243 | 2952 | const formContinue = document.querySelectorAll('form.continue-course'); |
| 1244 | - | |
| 1245 | - if (formContinue != null && lpGlobalSettings.user_id > 0) { | |
| 2953 | + if (formContinue.length && lpData.user_id > 0) { | |
| 1246 | 2954 | const getResponse = async ele => { |
| 1247 | 2955 | const response = await wp.apiFetch({ |
| 1248 | 2956 | path: 'lp/v1/courses/continue-course', |
| 1249 | 2957 | method: 'POST', |
| @@ -1253,13 +2961,12 @@ | ||
| 1253 | 2961 | } |
| 1254 | 2962 | }); |
| 1255 | 2963 | return response; |
| 1256 | 2964 | }; |
| 1257 | - | |
| 1258 | 2965 | getResponse(formContinue).then(function (result) { |
| 1259 | 2966 | if (result.status === 'success') { |
| 1260 | 2967 | formContinue.forEach(form => { |
| 1261 | - form.style.display = 'block'; | |
| 2968 | + form.style.display = 'inline-block'; | |
| 1262 | 2969 | form.action = result.data; |
| 1263 | 2970 | }); |
| 1264 | 2971 | } |
| 1265 | 2972 | }); |
| @@ -1265,10 +2972,9 @@ | ||
| 1265 | 2972 | }); |
| 1266 | 2973 | } |
| 1267 | 2974 | }; |
| 1268 | 2975 | |
| 1269 | - | |
| 1270 | -$(window).on('load', () => { | |
| 2976 | +document.addEventListener('DOMContentLoaded', function () { | |
| 1271 | 2977 | const $popup = $('#popup-course'); |
| 1272 | 2978 | let timerClearScroll; |
| 1273 | 2979 | const $curriculum = $('#learn-press-course-curriculum'); |
| 1274 | 2980 | accordionExtraTab(); |
| @@ -1276,24 +2982,29 @@ | ||
| 1276 | 2982 | initCourseSidebar(); |
| 1277 | 2983 | enrollCourse(); |
| 1278 | 2984 | purchaseCourse(); |
| 1279 | 2985 | retakeCourse(); |
| 1280 | - courseProgress(); | |
| 2986 | + //courseProgress(); | |
| 1281 | 2987 | courseContinue(); |
| 1282 | - _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_3__["default"].init(); //courseCurriculumSkeleton(); | |
| 2988 | + _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_2__["default"].init(); | |
| 2989 | + (0,_material__WEBPACK_IMPORTED_MODULE_5__["default"])(); | |
| 2990 | + //courseCurriculumSkeleton(); | |
| 2991 | + (0,_tabs_scroll__WEBPACK_IMPORTED_MODULE_6__["default"])(); | |
| 2992 | + (0,_js_frontend_copy_to_clipboard_js__WEBPACK_IMPORTED_MODULE_10__["default"])(); | |
| 1283 | 2993 | }); |
| 1284 | 2994 | const detectedElCurriculum = setInterval(function () { |
| 1285 | 2995 | const elementCurriculum = document.querySelector('.learnpress-course-curriculum'); |
| 1286 | - | |
| 1287 | 2996 | if (elementCurriculum) { |
| 1288 | - (0,_single_curriculum_skeleton__WEBPACK_IMPORTED_MODULE_5__["default"])(); | |
| 2997 | + (0,_single_curriculum_skeleton__WEBPACK_IMPORTED_MODULE_4__["default"])(); | |
| 1289 | 2998 | clearInterval(detectedElCurriculum); |
| 1290 | 2999 | } |
| 1291 | -}, 1); // Add callback for Thimkits | |
| 3000 | +}, 1); | |
| 1292 | 3001 | |
| 3002 | +// Add callback for Thimkits | |
| 1293 | 3003 | LP.Hook.addAction('lp_course_curriculum_skeleton', function (id) { |
| 1294 | - (0,_single_curriculum_skeleton__WEBPACK_IMPORTED_MODULE_5__["default"])(id); | |
| 3004 | + (0,_single_curriculum_skeleton__WEBPACK_IMPORTED_MODULE_4__["default"])(id); | |
| 1295 | 3005 | }); |
| 1296 | -}(); | |
| 3006 | +})(); | |
| 3007 | + | |
| 1297 | 3008 | /******/ })() |
| 1298 | 3009 | ; |
| 1299 | 3010 | //# sourceMappingURL=single-course.js.map |