PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / trunk
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP vtrunk
1.2.73 1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 All 173 releases
userswp / admin / assets / js / setup-wizard.js

setup-wizard.js in UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP trunk, at admin/assets/js/setup-wizard.js

156 lines 5.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery( document ).ready(function() {
2
3 uwp_wizard_check_plugins();
4
5 jQuery(document).on('click', '.uwp_install_plugins', function () {
6 uwp_wizard_check_plugins();
7 });
8
9 });
10
11 function uwp_wizard_install_plugin( $slug,$nonce ) {
12
13 var data = {
14 'action': 'install-plugin',
15 '_ajax_nonce': $nonce,
16 'slug': $slug
17 };
18
19 jQuery.ajax({
20 type: "POST",
21 url: uwp_wizard_obj.ajaxurl,
22 data: data,
23 beforeSend: function() {
24 jQuery( "."+$slug + " .uwp-plugin-status").html(jQuery('#uwp-installing-text').val());
25 },
26 success: function(data) {
27 console.log(data);
28 if(data.success){
29 jQuery( "."+$slug + " .uwp-plugin-status").html(jQuery('#uwp-installed-text').val());
30 jQuery( "."+$slug + " input:checkbox").removeClass('uwp_install_plugins').prop("disabled", true);
31 uwp_wizard_check_plugins();
32 uwp_wizard_install_plugins($nonce);
33 if(data.data.activateUrl){
34 uwp_wizard_activate_plugin(data.data.activateUrl,$slug);
35 }
36 }else{
37 alert('something went wrong');
38 }
39 }
40 });
41
42 }
43
44 function uwp_wizard_activate_plugin($url,$slug){
45 jQuery.post($url, function(data, status){
46 console.log($slug+'plugin activated')
47 });
48 }
49
50 function uwp_wizard_install_plugins($nonce){
51 var $result = '';
52 jQuery('.uwp_install_plugins').each(function() {
53 if(this.checked){
54 $result = uwp_wizard_install_plugin(this.id,$nonce);
55 jQuery('.uwp-install-recommend').prop("disabled", true);
56 return false;
57 }
58 });
59 }
60
61 function uwp_wizard_check_plugins(){
62 var $install = '';
63 jQuery('.uwp_install_plugins').each(function() {
64 $install += this.checked ? "1," : "";
65 });
66
67 if($install){
68 jQuery('.uwp-install-recommend').show();
69 jQuery('.uwp-continue-recommend').hide();
70 }else{
71 jQuery('.uwp-install-recommend').hide();
72 jQuery('.uwp-continue-recommend').show();
73 }
74 }
75
76 function uwp_wizard_setup_menu($security){
77
78 var $menu_id = jQuery( "#uwp_wizard_menu_id" ).val();
79 var $menu_location = jQuery( "#uwp_wizard_menu_location" ).val();
80
81 var data = {
82 'action': 'uwp_wizard_setup_menu',
83 'security': $security,
84 'menu_id': $menu_id,
85 'menu_location': $menu_location
86 };
87
88 jQuery.ajax({
89 type: "POST",
90 url: uwp_wizard_obj.ajaxurl,
91 data: data,
92 beforeSend: function() {
93 jQuery( ".uwp-wizard-menu-result" ).html('<i class="fas fa-sync fa-spin" style="font-size:18px"></i>');
94 },
95 success: function(data) {
96 if(data.data){
97 jQuery( ".uwp-wizard-menu-result" ).text(data.data);
98 }
99 }
100 });
101
102 return false;
103 }
104
105 function uwp_wizard_setup_dummy_users($security, type) {
106 jQuery('.uwp_dummy_users_button').hide();
107 jQuery("#uwp_diagnose_add_dummy_users,#uwp_diagnose_remove_dummy_users").html('');
108 jQuery("#uwp_diagnose_pb_" + type).find('.progressBar').show().progressbar({value: 0});
109 uwp_wizard_process_diagnose_step( 0, type,$security );
110 }
111
112 function uwp_wizard_process_diagnose_step(step, type, security) {
113 jQuery.ajax({
114 url: uwp_wizard_obj.ajaxurl,
115 type: 'POST',
116 dataType: 'json',
117 data: {
118 action: 'uwp_process_diagnosis',
119 step: step,
120 type: type,
121 security: security,
122 },
123 beforeSend: function() {},
124 success: function(response, textStatus, xhr) {
125 if(response.done === true || response.error === true ) {
126 tools_progress(response.percent, type);
127 setTimeout(function(){
128 jQuery("#uwp_diagnose_pb_" + type).find('.progressBar').hide();
129 jQuery("#uwp_diagnose_" + type).html(response.message);
130
131 if( 'add_dummy_users' === type ) {
132 jQuery('.uwp_remove_dummy_users_button').show();
133 jQuery('.uwp_add_dummy_users_button').hide();
134 } else{
135 jQuery('.uwp_add_dummy_users_button').show();
136 jQuery('.uwp_remove_dummy_users_button').hide();
137 }
138 }, 1500);
139 } else {
140 setTimeout(function(){
141 tools_progress(response.percent, type);
142 uwp_wizard_process_diagnose_step(parseInt( response.step ), type,security)
143 }, 500);
144 }
145 },
146 error: function(xhr, textStatus, errorThrown) {
147 alert(textStatus);
148 }
149 });
150 }
151
152 function tools_progress(percent, type) {
153 $element = jQuery("#uwp_diagnose_pb_" + type).find('.progressBar');
154 var progressBarWidth = percent * $element.width() / 100;
155 $element.find('div').animate({ width: progressBarWidth }, 500).html(percent + "% ");
156 }