PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 3.1.2
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v3.1.2
3.2.2 3.2.3 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.9 trunk 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 All 174 releases
master-addons / assets / js / admin / recommended-plugins.js

recommended-plugins.js in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits 3.1.2, at assets/js/admin/recommended-plugins.js

147 lines 4.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function(){
2 (function($) {
3 $("body").on("click", ".jltma-plugin-action .install-now", function(e) {
4 e.preventDefault();
5 if (!$(this).hasClass("updating-message")) {
6 let plugin = $(this).attr("data-install-url");
7 installPlugin($(this), plugin);
8 }
9 });
10 $("body").on("click", ".jltma-plugin-action .activate-now", function() {
11 let file = $(this).attr("data-plugin-file");
12 activatePlugin($(this), file);
13 });
14 $("body").on("click", ".jltma-plugin-action .update-now", function() {
15 if (!$(this).hasClass("updating-message")) {
16 const plugin = $(this).attr("data-plugin");
17 updatePlugin($(this), plugin);
18 }
19 });
20 $(".jltma-filter-links").on("click", "a", function(e) {
21 e.preventDefault();
22 let cls = $(this).data("type");
23 $(this).addClass("current").parent().siblings().find("a").removeClass("current");
24 $(".jltma-plugins-grid .jltma-plugin-card").each(function(i, el) {
25 if (cls == "all") {
26 $(this).removeClass("hide");
27 } else {
28 if ($(this).hasClass(cls)) {
29 $(this).removeClass("hide");
30 } else {
31 $(this).addClass("hide");
32 }
33 }
34 });
35 });
36 $(".jltma-search-plugins #search-plugins").on("keyup", function() {
37 var value = $(this).val();
38 var srch = new RegExp(value, "i");
39 $(".jltma-plugins-grid .jltma-plugin-card").each(function() {
40 var $this = $(this);
41 if (!($this.find(".jltma-plugin-name a, .jltma-plugin-desc").text().search(srch) >= 0)) {
42 $this.addClass("hide");
43 }
44 if ($this.find(".jltma-plugin-name a, .jltma-plugin-desc").text().search(srch) >= 0) {
45 $this.removeClass("hide");
46 }
47 });
48 });
49 })(jQuery);
50 function activatePlugin(element, file) {
51 element.addClass("button-disabled");
52 element.attr("disabled", "disabled");
53 element.text("Processing...");
54 jQuery.ajax({
55 url: JLTMACORE.admin_ajax,
56 type: "POST",
57 data: {
58 action: "jltma_recommended_activate_plugin",
59 file,
60 nonce: JLTMACORE.recommended_nonce
61 },
62 success: function(response) {
63 if (response.success === true) {
64 const pluginStatus = jQuery(".jltma-plugin-status .jltma-status-inactive[data-plugin-file='" + file + "']");
65 pluginStatus.text("Active");
66 pluginStatus.addClass("jltma-status-active");
67 pluginStatus.removeClass("jltma-status-inactive");
68 element.removeClass("activate-now jltma-btn-success");
69 element.addClass("jltma-btn-activated");
70 element.text("Activated");
71 } else {
72 element.removeClass("button-disabled");
73 element.prop("disabled", false);
74 element.text("Activate");
75 }
76 }
77 });
78 }
79 function installPlugin(element, plugin) {
80 element.removeClass("jltma-btn-primary");
81 element.addClass("updating-message");
82 element.text("Installing...");
83 jQuery.ajax({
84 url: JLTMACORE.admin_ajax,
85 type: "POST",
86 data: {
87 action: "jltma_recommended_upgrade_plugin",
88 type: "install",
89 plugin,
90 nonce: JLTMACORE.recommended_nonce
91 },
92 success: function(response) {
93 if (response.success === true) {
94 element.removeClass("updating-message install-now");
95 element.addClass("jltma-btn-activated");
96 element.attr("disabled", "disabled");
97 element.removeAttr("data-install-url");
98 element.text("Activated");
99 setTimeout(() => {
100 const pluginStatus = jQuery(".jltma-plugin-status .jltma-status-not-installed[data-plugin-url='" + plugin + "']");
101 pluginStatus.text("Active");
102 pluginStatus.addClass("jltma-status-active");
103 pluginStatus.removeClass("jltma-status-not-installed");
104 pluginStatus.removeAttr("data-plugin-url");
105 }, 500);
106 } else {
107 element.removeClass("updating-message");
108 element.addClass("jltma-btn-primary");
109 element.text("Install");
110 }
111 }
112 });
113 }
114 function updatePlugin(element, plugin) {
115 element.addClass("updating-message");
116 element.text("Updating...");
117 jQuery.ajax({
118 url: JLTMACORE.admin_ajax,
119 type: "POST",
120 data: {
121 action: "jltma_recommended_upgrade_plugin",
122 type: "update",
123 plugin,
124 nonce: JLTMACORE.recommended_nonce
125 },
126 success: function(response) {
127 if (response.success === true) {
128 element.removeClass("updating-message update-now jltma-btn-warning");
129 element.addClass("jltma-btn-activated");
130 element.attr("disabled", "disabled");
131 element.text("Updated!");
132 if (response.data.active === false) {
133 const pluginStatus = jQuery(".jltma-plugin-status .jltma-status-inactive[data-plugin-file='" + plugin + "']");
134 pluginStatus.text("Active");
135 pluginStatus.addClass("jltma-status-active");
136 pluginStatus.removeClass("jltma-status-inactive");
137 pluginStatus.removeAttr("data-plugin-file");
138 }
139 } else {
140 element.removeClass("updating-message");
141 element.text("Update");
142 }
143 }
144 });
145 }
146 })();
147