PluginProbe
Hostinger Tools / 1.9.8
Hostinger Tools v1.9.8
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 All 108 releases
hostinger / src / js / requests.js

requests.js in Hostinger Tools 1.9.8, at src/js/requests.js

77 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import './amplitude-events'
2
3 ( function ( $ ) {
4 $( document ).on( 'ready', function () {
5 let publishBtn = $( '.hsr-publish-btn' );
6 let completedClass = 'completed';
7 let gotItBtn = $( '.hsr-got-it-btn' );
8 publishBtn.on( 'click', function ( e ) {
9 e.preventDefault();
10 $( '.hsr-modal' ).addClass( 'open' );
11 $( 'body' ).addClass( 'modal-open' );
12 $.ajax( {
13 type: 'post',
14 dataType: 'json',
15 url: hostingerContainer.url,
16 data: {
17 action: 'hostinger_publish_website',
18 maintenance: 0,
19 nonce: hostingerContainer.nonce,
20 },
21 success: function ( result ) {
22 const previewBtn = $( '.hsr-preview-btn' );
23 $( '.hsr-circular' ).addClass( 'hsr-hide' )
24 $( '.hsr-success-circular' ).addClass( 'hsr-show' )
25 $( '.hsr-publish-modal--footer' ).addClass( 'show' )
26 $( '.hsr-publish-modal--body h3' ).text( result.data.title );
27 $( '.hsr-publish-modal--body__description' ).text( result.data.description );
28 $( '.hsr-publish-btn' ).addClass( 'hsr-preview' )
29 previewBtn.addClass( 'hsr-preview' )
30 previewBtn.text( result.data.content.btn.text )
31 $( '.hsr-onboarding__title' ).text( result.data.content.title );
32 $( '.hsr-onboarding__description' ).text( result.data.content.description );
33 },
34 error: function ( xhr, status, error ) {
35 console.log( 'AJAX request failed: ' + error );
36 }
37 } )
38 } )
39
40 gotItBtn.on( 'click', function ( e ) {
41 e.preventDefault();
42 const element = $( this );
43 const step = $( this ).data( 'step' );
44 let remaining_tasks = $( '.hsr-onboarding-steps' ).data( 'remaining-tasks' );
45
46 $.ajax( {
47 type: 'post',
48 dataType: 'json',
49 url: hostingerContainer.url,
50 data: {
51 action: 'hostinger_complete_onboarding_step',
52 step: step,
53 nonce: hostingerContainer.nonce,
54 },
55 success: function () {
56 element.closest( '.hsr-onboarding-step--content' ).slideUp()
57 element.parents( '.hsr-onboarding-step' )
58 .find( '.hsr-onboarding-step--status' )
59 .addClass( completedClass )
60
61 if ( remaining_tasks > 0 ) {
62 remaining_tasks = remaining_tasks - 1;
63 $( '.hsr-onboarding-steps' ).data( 'remaining-tasks', remaining_tasks )
64
65 if ( remaining_tasks === 0 ) {
66 $( '.hsr-publish-btn' ).addClass( completedClass );
67 }
68
69 }
70 },
71 error: function ( xhr, status, error ) {
72 console.log( 'AJAX request failed: ' + error );
73 }
74 } )
75 } )
76 } );
77 } )( jQuery );