PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 3.1.9
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v3.1.9
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.9, at assets/js/admin/recommended-plugins.js

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