PluginProbe
Adminify – White Label, Admin Menu Editor, Login Customizer / 3.1.7
Adminify – White Label, Admin Menu Editor, Login Customizer v3.1.7
4.3.1 4.3.0 4.2.26 4.2.25 4.2.24 4.2.23 4.2.22 4.2.21 4.2.20 4.2.19 4.2.18 4.2.17 4.2.16 4.2.15 4.2.14 4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 4.1.17 All 164 releases
adminify / assets / js / wp-adminify-admin.js

wp-adminify-admin.js in Adminify – White Label, Admin Menu Editor, Login Customizer 3.1.7, at assets/js/wp-adminify-admin.js

210 lines 6.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function ($)
2 {
3
4 // Notice Hide
5 $('body').on('click', '.wp-adminify-upgrade-popup .popup-dismiss', function (evt)
6 {
7 evt.preventDefault();
8 $(this).closest('.wp-adminify-upgrade-popup').fadeOut(200);
9 });
10
11 // Notice Show
12 $('body').on('click', '.adminify-pro-notice', function (evt)
13 {
14 evt.preventDefault();
15 $('.wp-adminify-upgrade-popup').fadeIn(200);
16 });
17
18 // Recommended Plugins
19
20 // Install
21 $('body').on('click', '.plugin-action-buttons .install-now', function (e)
22 {
23 e.preventDefault();
24 if (!$(this).hasClass("updating-message"))
25 {
26 let plugin = $(this).attr("data-install-url");
27 installPlugin($(this), plugin);
28 }
29 });
30
31 // Active
32 $('body').on('click', '.plugin-action-buttons .activate-now', function ()
33 {
34 let file = $(this).attr("data-plugin-file");
35 activatePlugin($(this), file);
36 });
37
38 // Update
39 $('body').on('click', '.plugin-action-buttons .update-now', function ()
40 {
41 if (!$(this).hasClass("updating-message"))
42 {
43 const plugin = $(this).attr("data-plugin");
44 updatePlugin($(this), plugin);
45 }
46 });
47
48 // Tab
49 $('.filter-links').on('click', 'a', function (e)
50 {
51 e.preventDefault();
52 let cls = $(this).data('type');
53 $(this).addClass('current').parent().siblings().find('a').removeClass('current');
54 $('#the-list .plugin-card').each(function (i, el)
55 {
56 if (cls == 'all')
57 {
58 $(this).removeClass('hide');
59 } else
60 {
61 if ($(this).hasClass(cls))
62 {
63 $(this).removeClass('hide');
64 } else
65 {
66 $(this).addClass('hide');
67 }
68 }
69 });
70 });
71
72 // Search
73 $('.wp-adminify-search-plugins #search-plugins').on('keyup', function ()
74 {
75 var value = $(this).val();
76 var srch = new RegExp(value, "i");
77 $('#the-list .plugin-card').each(function ()
78 {
79 var $this = $(this);
80 if (!($this.find('.name h3 a, .desc p').text().search(srch) >= 0))
81 {
82 $this.addClass('hide');
83 }
84 if (($this.find('.name h3 a, .desc p').text().search(srch) >= 0))
85 {
86 $this.removeClass('hide');
87 }
88 });
89 });
90 })(jQuery);
91
92
93
94
95 function activatePlugin(element, file)
96 {
97 element.addClass("button-disabled");
98 element.attr("disabled", "disabled");
99 element.text("Processing...");
100 jQuery.ajax({
101 url: WP_ADMINIFYCORE.admin_ajax,
102 type: "POST",
103 data: {
104 action: "jltwp_adminify_recommended_activate_plugin",
105 file: file,
106 nonce: WP_ADMINIFYCORE.recommended_nonce
107 },
108 success: function (response)
109 {
110 if (response.success === true)
111 {
112 const pluginStatus = jQuery(".plugin-status .plugin-status-inactive[data-plugin-file='" + file + "']")
113 pluginStatus.text("Active");
114 pluginStatus.addClass("plugin-status-active");
115 pluginStatus.removeClass("plugin-status-inactive");
116 element.removeClass("active-now");
117 element.text("Activated");
118 } else
119 {
120 element.removeClass("button-disabled");
121 element.prop("disabled", false);
122 element.text("Activated");
123 }
124 },
125 })
126 }
127
128 function installPlugin(element, plugin)
129 {
130 element.removeClass("button-primary");
131 element.addClass("updating-message");
132 element.text("Installing...");
133 jQuery.ajax({
134 url: WP_ADMINIFYCORE.admin_ajax,
135 type: "POST",
136 data: {
137 action: "jltwp_adminify_recommended_upgrade_plugin",
138 type: 'install',
139 plugin: plugin,
140 nonce: WP_ADMINIFYCORE.recommended_nonce
141 },
142 success: function (response)
143 {
144 if (response.success === true)
145 {
146 element.removeClass("updating-message");
147 element.addClass("updated-message installed button-disabled");
148 element.attr("disabled", "disabled");
149 element.removeAttr("data-install-url");
150 element.text("Installed!");
151 setTimeout(() =>
152 {
153 const pluginStatus = jQuery(".plugin-status .plugin-status-not-install[data-plugin-url='" + plugin + "']")
154 pluginStatus.text("Active");
155 pluginStatus.addClass("plugin-status-active");
156 pluginStatus.removeClass("plugin-status-not-install");
157 pluginStatus.removeAttr("data-install-url");
158 element.removeClass("install-now updated-message installed");
159 element.text("Activated");
160 element.removeAttr("aria-label");
161 }, 500);
162
163 } else
164 {
165 element.removeClass("updating-message");
166 element.addClass("button-primary");
167 element.text("Install Now");
168 }
169 },
170 })
171 }
172
173 function updatePlugin(element, plugin)
174 {
175 element.addClass("updating-message");
176 element.text("Updating...");
177 jQuery.ajax({
178 url: WP_ADMINIFYCORE.admin_ajax,
179 type: "POST",
180 data: {
181 action: "jltwp_adminify_recommended_upgrade_plugin",
182 type: "update",
183 plugin: plugin,
184 nonce: WP_ADMINIFYCORE.recommended_nonce
185 },
186 success: function (response)
187 {
188 if (response.success === true)
189 {
190 element.removeClass("updating-message");
191 element.addClass("updated-message button-disabled");
192 element.attr("disabled", "disabled");
193 element.text("Updated!");
194 if (response.data.active === false)
195 {
196 const pluginStatus = jQuery(".plugin-status .plugin-status-inactive[data-plugin-file='" + plugin + "']");
197 pluginStatus.text("Active");
198 pluginStatus.addClass("plugin-status-active");
199 pluginStatus.removeClass("plugin-status-inactive");
200 pluginStatus.removeAttr("data-plugin-file");
201 }
202 } else
203 {
204 element.removeClass("updating-message");
205 element.text("Update Now");
206 }
207 },
208 })
209 }
210