PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
learnpress / assets / js / dist / admin / pages / setup.js

setup.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.9, at assets/js/dist/admin/pages/setup.js

49 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (() => { // webpackBootstrap
2 /*!*************************************************!*\
3 !*** ./assets/src/apps/js/admin/pages/setup.js ***!
4 \*************************************************/
5 /**
6 * Setup Wizard Script
7 *
8 * @since 4.2.8.6
9 */
10 class SetupWizard {
11 static selectors = {
12 elSetupForm: '#learn-press-setup-form',
13 elPreviewPrice: '#preview-price'
14 };
15 init() {
16 this.elSetupForm = document.querySelector(SetupWizard.selectors.elSetupForm);
17 if (!this.elSetupForm) {
18 return;
19 }
20 this.events();
21 }
22 events() {
23 document.addEventListener('change', e => {
24 if (e.target.closest('input, select')) {
25 this.saveSettings();
26 }
27 });
28 }
29
30 /* Post form data to current url, update preview price html with response */
31 saveSettings() {
32 const formData = new FormData(this.elSetupForm);
33 fetch(window.location.href, {
34 method: 'POST',
35 body: formData
36 }).then(response => response.text()).then(html => {
37 const elPreviewPrice = document.querySelector(SetupWizard.selectors.elPreviewPrice);
38 if (elPreviewPrice) {
39 elPreviewPrice.innerHTML = html;
40 }
41 });
42 }
43 }
44 document.addEventListener('DOMContentLoaded', () => {
45 new SetupWizard().init();
46 });
47 /******/ })()
48 ;
49 //# sourceMappingURL=setup.js.map