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/frontend/material.js +36 -36 4.3.84.4.8 View file →
@@ -1,36 +1,36 @@
1 -import * as Util from '../../../js/utils.js';
2 -export default function lpMaterialsLoad() {
3 - document.addEventListener( 'click', function( e ) {
4 - const target = e.target;
5 - if ( target.classList.contains( 'lp-loadmore-material' ) ) {
6 - const loadMoreButton = target;
7 - const lpTarget = target.closest( '.lp-target' );
8 - const dataSend = window.lpAJAXG.getDataSetCurrent( lpTarget );
9 - dataSend.args.paged++;
10 -
11 - Util.lpSetLoadingEl( loadMoreButton, 1 );
12 - const callBack = {
13 - success: ( response ) => {
14 - const { status, message, data } = response;
15 - if ( status === 'success' ) {
16 - const tableBody = lpTarget.querySelector( 'table.course-material-table tbody' );
17 - tableBody.insertAdjacentHTML( 'beforeend', data.content );
18 - if ( data.paged === data.total_pages ) {
19 - loadMoreButton.remove();
20 - }
21 - window.lpAJAXG.setDataSetCurrent( lpTarget, dataSend );
22 - } else {
23 - console.error( message );
24 - }
25 - },
26 - error: ( error ) => {
27 - console.error( error );
28 - },
29 - completed: () => {
30 - Util.lpSetLoadingEl( loadMoreButton, 0 );
31 - },
32 - };
33 - window.lpAJAXG.fetchAJAX( dataSend, callBack );
34 - }
35 - } );
36 -}
1 +import * as Util from '../../../js/utils.js';
2 +export default function lpMaterialsLoad() {
3 + document.addEventListener( 'click', function( e ) {
4 + const target = e.target;
5 + if ( target.classList.contains( 'lp-loadmore-material' ) ) {
6 + const loadMoreButton = target;
7 + const lpTarget = target.closest( '.lp-target' );
8 + const dataSend = window.lpAJAXG.getDataSetCurrent( lpTarget );
9 + dataSend.args.paged++;
10 +
11 + Util.lpSetLoadingEl( loadMoreButton, 1 );
12 + const callBack = {
13 + success: ( response ) => {
14 + const { status, message, data } = response;
15 + if ( status === 'success' ) {
16 + const tableBody = lpTarget.querySelector( 'table.course-material-table tbody' );
17 + tableBody.insertAdjacentHTML( 'beforeend', data.content );
18 + if ( data.paged === data.total_pages ) {
19 + loadMoreButton.remove();
20 + }
21 + window.lpAJAXG.setDataSetCurrent( lpTarget, dataSend );
22 + } else {
23 + console.error( message );
24 + }
25 + },
26 + error: ( error ) => {
27 + console.error( error );
28 + },
29 + completed: () => {
30 + Util.lpSetLoadingEl( loadMoreButton, 0 );
31 + },
32 + };
33 + window.lpAJAXG.fetchAJAX( dataSend, callBack );
34 + }
35 + } );
36 +}