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
← All changes | assets/src/apps/js/admin/pages/tools.js +2 -78 4.1.7.3 → 4.4.9 View file →
@@ -2,78 +2,11 @@
2 2 import createIndexes from './tools/database/create_indexs';
3 3 import reUpgradeDB from './tools/database/re-upgrade-db';
4 4 import cleanDatabases from './tools/database/clean_database';
5 5
6 -import resetData from './tools/reset-data';
7 -
8 6 ( function( $ ) {
9 7 const $doc = $( document );
10 - let isRunning = false;
11 8
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 - url: $button.attr( 'href' ),
31 - data: $( '.lp-install-sample__options' ).serializeJSON(),
32 - success( response ) {
33 - $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
34 - isRunning = false;
35 - $( response ).insertBefore( $button.parent() );
36 - },
37 - error() {
38 - $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
39 - isRunning = false;
40 - $( response ).insertBefore( $button.parent() );
41 - },
42 - } );
43 - };
44 -
45 - const uninstallSampleCourse = function uninstallSampleCourse( e ) {
46 - e.preventDefault();
47 -
48 - const $button = $( this );
49 -
50 - if ( isRunning ) {
51 - return;
52 - }
53 -
54 - if ( ! confirm( lpGlobalSettings.i18n.confirm_uninstall_sample_data ) ) {
55 - return;
56 - }
57 -
58 - $button.addClass( 'disabled' ).html( $button.data( 'uninstalling-text' ) );
59 - isRunning = true;
60 -
61 - $.ajax( {
62 - url: $button.attr( 'href' ),
63 - success( response ) {
64 - $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
65 - isRunning = false;
66 - $( response ).insertBefore( $button.parent() );
67 - },
68 - error() {
69 - $button.removeClass( 'disabled' ).html( $button.data( 'text' ) );
70 - isRunning = false;
71 - $( response ).insertBefore( $button.parent() );
72 - },
73 - } );
74 - };
75 -
76 9 const clearHardCache = function clearHardCache( e ) {
77 10 e.preventDefault();
78 11 const $button = $( this );
79 12
@@ -104,22 +37,13 @@
104 37 },
105 38 } );
106 39 };
107 40
108 - const toggleOptions = function toggleOptions( e ) {
109 - e.preventDefault();
110 - $( '.lp-install-sample__options' ).toggleClass( 'hide-if-js' );
111 - };
112 -
113 41 $( function() {
114 42 getStepsUpgradeStatus();
115 43 createIndexes();
116 44 reUpgradeDB();
117 - resetData();
118 45 cleanDatabases();
119 - $doc.on( 'click', '.lp-install-sample__install', installSampleCourse )
120 - .on( 'click', '.lp-install-sample__uninstall', uninstallSampleCourse )
121 - .on( 'click', '#learn-press-clear-cache', clearHardCache )
122 - .on( 'click', 'input[name="enable_hard_cache"]', toggleHardCache )
123 - .on( 'click', '.lp-install-sample__toggle-options', toggleOptions );
46 + $doc.on( 'click', '#learn-press-clear-cache', clearHardCache )
47 + .on( 'click', 'input[name="enable_hard_cache"]', toggleHardCache );
124 48 } );
125 49 }( jQuery ) );