PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
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 4.2.0 All 139 releases
← All changes | assets/src/apps/js/admin/pages/tools.js +49 -147 4.3.84.4.8 View file →
@@ -1,147 +1,49 @@
1 -import getStepsUpgradeStatus from './tools/database/upgrade';
2 -import createIndexes from './tools/database/create_indexs';
3 -import reUpgradeDB from './tools/database/re-upgrade-db';
4 -import cleanDatabases from './tools/database/clean_database';
5 -
6 -import resetData from './tools/reset-data';
7 -
8 -( function( $ ) {
9 - const $doc = $( document );
10 - let isRunning = false;
11 -
12 - const installSampleCourse = function installSampleCourse( e ) {
13 - e.preventDefault();
14 -
15 - const $button = $( this );
16 -
17 - if ( isRunning ) {
18 - return;
19 - }
20 -
21 - if ( ! confirm( lpGlobalSettings.i18n.confirm_install_sample_data ) ) {
22 - return;
23 - }
24 -
25 - $button.addClass( 'disabled' ).html( $button.data( 'installing-text' ) );
26 - $( '.lp-install-sample__response' ).remove();
27 - isRunning = true;
28 -
29 - $.ajax( {
30 - method: 'POST',
31 - url: $button.attr( 'href' ),
32 - data: $( '.lp-install-sample__options' ).serializeJSON(),
33 - success( response ) {
34 - $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
35 - isRunning = false;
36 - $( response ).insertBefore( $button.parent() );
37 - },
38 - error() {
39 - $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
40 - isRunning = false;
41 - $( response ).insertBefore( $button.parent() );
42 - },
43 - } );
44 - };
45 -
46 - const uninstallSampleCourse = function uninstallSampleCourse( e ) {
47 - e.preventDefault();
48 -
49 - const $button = $( this );
50 -
51 - if ( isRunning ) {
52 - return;
53 - }
54 -
55 - if ( ! confirm( lpGlobalSettings.i18n.confirm_uninstall_sample_data ) ) {
56 - return;
57 - }
58 -
59 - $button.addClass( 'disabled' ).html( $button.data( 'uninstalling-text' ) );
60 - isRunning = true;
61 -
62 - $.ajax( {
63 - url: $button.attr( 'href' ),
64 - success( response ) {
65 - $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
66 - isRunning = false;
67 - $( response ).insertBefore( $button.parent() );
68 - },
69 - error() {
70 - $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
71 - isRunning = false;
72 - $( response ).insertBefore( $button.parent() );
73 - },
74 - } );
75 - };
76 -
77 - const clearHardCache = function clearHardCache( e ) {
78 - e.preventDefault();
79 - const $button = $( this );
80 -
81 - if ( $button.hasClass( 'disabled' ) ) {
82 - return;
83 - }
84 -
85 - $button.addClass( 'disabled' ).html( $button.data( 'cleaning-text' ) );
86 - $.ajax( {
87 - url: $button.attr( 'href' ),
88 - data: {},
89 - success( response ) {
90 - $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
91 - },
92 - error() {
93 - $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
94 - },
95 - } );
96 - };
97 -
98 - const toggleHardCache = function toggleHardCache() {
99 - $.ajax( {
100 - url: 'admin.php?page=lp-toggle-hard-cache-option',
101 - data: { v: this.checked ? 'yes' : 'no' },
102 - success( response ) {
103 - },
104 - error() {
105 - },
106 - } );
107 - };
108 -
109 - const toggleOptions = function toggleOptions( e ) {
110 - e.preventDefault();
111 - $( '.lp-install-sample__options' ).toggleClass( 'hide-if-js' );
112 - };
113 -
114 - const formatValueInput = ( e ) => {
115 - const input = $( e.target );
116 - let value = input.val();
117 - value = value.replace( /[^0-9]/g, '' );
118 -
119 - input.val( value );
120 -
121 - if ( parseInt( value, 10 ) < input.attr( 'min' ) ) {
122 - input.val( input.attr( 'min' ) );
123 - }
124 -
125 - if ( parseInt( value, 10 ) > input.attr( 'max' ) ) {
126 - input.val( input.attr( 'max' ) );
127 - }
128 - };
129 -
130 - $( function() {
131 - getStepsUpgradeStatus();
132 - createIndexes();
133 - reUpgradeDB();
134 - resetData();
135 - cleanDatabases();
136 - $doc.on( 'click', '.lp-install-sample__install', installSampleCourse )
137 - .on( 'click', '.lp-install-sample__uninstall', uninstallSampleCourse )
138 - .on( 'click', '#learn-press-clear-cache', clearHardCache )
139 - .on( 'click', 'input[name="enable_hard_cache"]', toggleHardCache )
140 - .on( 'click', '.lp-install-sample__toggle-options', toggleOptions )
141 - .on( 'change', 'input[name="section-range[]"]', formatValueInput )
142 - .on( 'change', 'input[name="item-range[]"]', formatValueInput )
143 - .on( 'change', 'input[name="question-range[]"]', formatValueInput )
144 - .on( 'change', 'input[name="answer-range[]"]', formatValueInput )
145 - .on( 'change', 'input[name="course-price"]', formatValueInput );
146 - } );
147 -}( jQuery ) );
1 +import getStepsUpgradeStatus from './tools/database/upgrade';
2 +import createIndexes from './tools/database/create_indexs';
3 +import reUpgradeDB from './tools/database/re-upgrade-db';
4 +import cleanDatabases from './tools/database/clean_database';
5 +
6 +( function( $ ) {
7 + const $doc = $( document );
8 +
9 + const clearHardCache = function clearHardCache( e ) {
10 + e.preventDefault();
11 + const $button = $( this );
12 +
13 + if ( $button.hasClass( 'disabled' ) ) {
14 + return;
15 + }
16 +
17 + $button.addClass( 'disabled' ).html( $button.data( 'cleaning-text' ) );
18 + $.ajax( {
19 + url: $button.attr( 'href' ),
20 + data: {},
21 + success( response ) {
22 + $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
23 + },
24 + error() {
25 + $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
26 + },
27 + } );
28 + };
29 +
30 + const toggleHardCache = function toggleHardCache() {
31 + $.ajax( {
32 + url: 'admin.php?page=lp-toggle-hard-cache-option',
33 + data: { v: this.checked ? 'yes' : 'no' },
34 + success( response ) {
35 + },
36 + error() {
37 + },
38 + } );
39 + };
40 +
41 + $( function() {
42 + getStepsUpgradeStatus();
43 + createIndexes();
44 + reUpgradeDB();
45 + cleanDatabases();
46 + $doc.on( 'click', '#learn-press-clear-cache', clearHardCache )
47 + .on( 'click', 'input[name="enable_hard_cache"]', toggleHardCache );
48 + } );
49 +}( jQuery ) );