PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / admin / assets / js / wpfnl-admin-common.js

wpfnl-admin-common.js in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.3, at admin/assets/js/wpfnl-admin-common.js

86 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* global jQuery, WPFunnelCommonJS */
2 ( function( $ ) {
3 'use strict';
4 var WPFunnelCommonJS = {
5 installPlugin: function(e) {
6 e.preventDefault();
7 $('.wpfnl-notice .wpfnl-notice-button .notice-loader').css('display', 'inline-block');
8
9 let slug = $(this).attr('data-slug');
10 wp.updates.queue.push( {
11 action: 'install-plugin', // Required action.
12 data: {
13 slug: slug,
14 },
15 } );
16 wp.updates.queueChecker();
17 },
18
19 installSuccess: function(e, response) {
20 e.preventDefault();
21 var pluginFile = 'woocommerce/woocommerce.php';
22 $.ajax( {
23 url: window.wpfnl_common_vars.ajaxurl,
24 type: 'POST',
25 data: {
26 action : 'plugin_install_success',
27 plugin_init : pluginFile,
28 security : window.wpfnl_common_vars.wpfnl_activate_plugin_nonce,
29 },
30 success: function(response) {
31 if(response.success) {
32 window.location.reload();
33 }
34 }
35 }).done( function ( request, status, XHR ) {
36 if(status.success) {
37 window.location.reload();
38 }
39 });
40 },
41
42 installError: function(e, response) {
43 e.preventDefault();
44 $('.wpfnl-notice-message').html(response.errorMessage);
45 $('.wpfnl-notice .wpfnl-notice-button .notice-loader').css('display', 'none');
46 },
47
48 activatePlugin: function(e) {
49 e.preventDefault();
50 var pluginFile = 'woocommerce/woocommerce.php';
51 $.ajax( {
52 url: window.wpfnl_common_vars.ajaxurl,
53 type: 'POST',
54 data: {
55 action : 'plugin_install_success',
56 plugin_init : pluginFile,
57 security : window.wpfnl_common_vars.wpfnl_activate_plugin_nonce,
58 },
59 success: function(response) {
60 if(response.success) {
61 window.location.reload();
62 }
63 }
64 }).done( function ( request, status, XHR ) {
65 if(status.data.success) {
66 window.location.reload();
67 }
68 });
69 },
70
71 init: function() {
72 $(document)
73 .on('click', '#wpfnl-install-plugin', this.installPlugin)
74 .on('click', '#wpfnl-activate-plugin', this.activatePlugin)
75 .on('wp-plugin-install-success', this.installSuccess)
76 .on('wp-plugin-install-error', this.installError)
77 },
78 }
79
80
81 $( function() {
82 WPFunnelCommonJS.init();
83 } );
84
85 }( jQuery ) );
86