PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.18.5
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.18.5
1.19.8 1.19.7 1.19.6 1.19.5 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.11.0 1.12.0 1.13.0 1.14.0 1.15.0 1.15.1 1.15.2 1.15.3 1.16.0 1.16.1 1.16.2 1.16.3 1.16.4 1.16.5 1.16.6 1.16.7 1.16.8 1.17.0 1.17.6 1.17.7 1.17.8 1.17.9 1.18.0 1.18.1 1.18.2 1.18.3 1.18.4 1.18.5 1.18.6 1.18.7 1.18.8 1.18.9 1.19.0 1.19.1 1.19.2 1.19.3 1.19.4 1.3.19 1.3.20 1.4.0 1.4.1 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.16 1.5.17 1.5.18 1.5.19 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.8.1 1.8.3 1.9.0 1.9.1 1.9.2
nitropack / view / dashboard-oneclick.php
nitropack / view Last commit date
images 1 year ago javascript 11 months ago modals 10 months ago stylesheet 11 months ago templates 1 year ago admin.php 1 year ago connect-oneclick.php 1 year ago connect.php 1 year ago dashboard-oneclick.php 10 months ago dashboard.php 10 months ago oneclick.php 1 year ago system-report.php 1 year ago
dashboard-oneclick.php
521 lines
1 <?php
2 $settings = new \NitroPack\WordPress\Settings();
3 $notifications = new \NitroPack\WordPress\Notifications\Notifications();
4 $usage = '0 MB';
5 $max_usage = '1 GB';
6 $page_views = '0';
7 $max_page_views = '10000'; ?>
8
9 <?php
10 $conflictingPlugins = \NitroPack\WordPress\ConflictingPlugins::getInstance();
11 $conflictingPlugins_list = $conflictingPlugins->nitropack_get_conflicting_plugins();
12 if ( $conflictingPlugins_list ) {
13 require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-plugin-deactivate.php';
14 }
15 $notifications->nitropack_display_admin_notices(); ?>
16
17 <div class="grid grid-cols-2 gap-6 grid-col-1-tablet items-start nitropack-dashboard">
18 <div class="col-span-1">
19 <!-- Optimized Pages Card -->
20 <div class="card card-optimized-pages">
21 <div class="card-header">
22 <h3><?php esc_html_e( 'Optimized pages', 'nitropack' ); ?></h3>
23 <div class="flex flex-row items-center" style="display: none;" id="pending-optimizations-section">
24 <img src="<?php echo plugin_dir_url( __FILE__ ) . 'images/loading.svg'; ?>" alt="loading"
25 class="w-4 h-4">
26 <span class="ml-2 mr-1 text-primary"> <?php esc_html_e( 'Processing', 'nitropack' ); ?>
27 <span id="pending-optimizations-count">X</span>
28 <?php esc_html_e( 'page(s) in the background', 'nitropack' ); ?></span>
29 </div>
30 </div>
31 <div class="card-body">
32 <div class="card-body-inner">
33 <div class="optimized-pages"><span data-optimized-pages-total>0</span></div>
34 <div class="text-box">
35 <div class="time-ago"><?php esc_html_e( 'Last cache purge', 'nitropack' ); ?>: <span
36 data-last-cache-purge><?php esc_html_e( 'Never', 'nitropack' ); ?></span></div>
37 <div class="reason"><?php esc_html_e( 'Reason', 'nitropack' ); ?>: <span
38 data-purge-reason><?php esc_html_e( 'Unknown', 'nitropack' ); ?></span></div>
39 </div>
40 <button id="optimizations-purge-cache" type="button" class="btn btn-secondary"
41 data-modal-target="modal-purge-cache"
42 data-modal-toggle="modal-purge-cache"><?php esc_html_e( 'Purge cache', 'nitropack' ); ?></button>
43 </div>
44 </div>
45 <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-purge-cache.php'; ?>
46 </div>
47 <!-- Optimized Pages Card End -->
48 <!-- Optimization Mode Card -->
49 <div class="card card-optimization-mode">
50 <div class="card-header no-border mb-0">
51 <div class="flex items-center">
52 <h3 class="mb-0"><?php esc_html_e( 'Optimization mode', 'nitropack' ); ?></h3>
53 <span class="tooltip-icon" data-tooltip-target="tooltip-optimization">
54 <img src="<?php echo plugin_dir_url( __FILE__ ) . 'images/info.svg'; ?>">
55 </span>
56 <div id="tooltip-optimization" role="tooltip" class="tooltip-container hidden">
57 <?php esc_html_e( 'Select from our range of predefined optimization modes to boost your site\'s performance.', 'nitropack' );
58 ?>
59 <div class="tooltip-arrow" data-popper-arrow></div>
60 </div>
61 </div>
62 </div>
63 <?php $modes = array( 'standard' => esc_html__( 'Standard', 'nitropack' ), 'medium' => esc_html__( 'Medium', 'nitropack' ), 'strong' => esc_html__( 'Strong', 'nitropack' ), 'ludicrous' => esc_html__( 'Ludicrous', 'nitropack' ), 'custom' => esc_html__( 'Custom', 'nitropack' ) ); ?>
64 <div class="tabs-wrapper">
65 <div class="tabs" id="optimization-modes">
66 <?php foreach ( $modes as $mode_id => $mode ) :
67 $disabled = ( $mode_id === 'custom' ) ? 'disabled' : '';
68 ?>
69 <a class="btn tab-link btn-link <?php echo $disabled; ?>" data-mode="<?php echo $mode_id; ?>"
70 data-modal-target="modal-optimization-mode" data-modal-toggle="modal-optimization-mode" <?php echo $disabled; ?>><?php echo $mode; ?></a>
71 <?php endforeach; ?>
72 </div>
73 <p><?php esc_html_e( 'Active Mode', 'nitropack' ); ?>: <span class="active-mode"></span></p>
74 <div class="tab-content-wrapper">
75 <div class="hidden tab-content" role="tabpanel" data-tab="standard-tab">
76 <p class="text-secondary mt-2">
77 <?php esc_html_e( 'Standard optimization features enabled for your site. Ideal choice for maximum stability.', 'nitropack' ); ?>
78 </p>
79 </div>
80 <div class="hidden tab-content" role="tabpanel" data-tab="medium-tab">
81 <p class="text-secondary mt-2">
82 <?php esc_html_e( 'Adds image lazy loading to standard optimizations. Uses built-in browser techniques for loading resources.', 'nitropack' ); ?>
83 </p>
84 </div>
85 <div class="hidden tab-content" role="tabpanel" data-tab="strong-tab">
86 <p class="text-secondary mt-2">
87 <?php esc_html_e( 'Includes smart resource loading on top of Medium optimizations. Balances speed boost with stability.', 'nitropack' ); ?>
88 </p>
89 </div>
90 <div class="hidden tab-content" role="tabpanel" data-tab="ludicrous-tab">
91 <p class="text-secondary mt-2">
92 <?php esc_html_e( 'Applies deferred JS and advanced resource loading for optimal performance and Core Web Vitals.', 'nitropack' ); ?>
93 </p>
94 </div>
95 <div class="hidden tab-content" role="tabpanel" data-tab="custom-tab">
96 <p class="text-secondary mt-2">
97 <?php esc_html_e( 'Activated when manual setups are made. Ideal for advanced NitroPack optimizations.', 'nitropack' ); ?>
98 </p>
99 </div>
100 </div>
101 </div>
102 <div class="card-footer">
103 <div class="flex flex-row">
104 <p class=""><?php esc_html_e( 'Which optimization mode to choose?', 'nitropack' ); ?></p>
105 <a class="text-primary btn-link ml-auto see-modes" data-modal-target="modes-modal"
106 data-modal-toggle="modes-modal"><?php esc_html_e( 'See modes comparison', 'nitropack' ); ?></a>
107 <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-modes.php'; ?>
108 </div>
109 </div>
110 <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-optimization-mode.php'; ?>
111 </div>
112 <!-- Optimization Mode Card End -->
113 <!-- Automated Behavior Card -->
114 <div class="card card-automated-behavior">
115 <div class="card-header">
116 <h3><?php esc_html_e( 'Automated Behavior', 'nitropack' ); ?></h3>
117 </div>
118 <div class="card-body">
119 <div class="options-container">
120 <div class="nitro-option" id="purge-cache-widget">
121 <div class="nitro-option-main">
122 <div class="text-box">
123 <h6><?php esc_html_e( 'Purge cache', 'nitropack' ); ?></h6>
124 <p><?php esc_html_e( 'Purge affected cache when content is updated or published', 'nitropack' ); ?>
125 </p>
126 </div>
127 <label class="inline-flex items-center cursor-pointer ml-auto">
128 <input type="checkbox" value="" class="sr-only peer" name="purge_cache"
129 id="auto-purge-status" <?php if ( $autoCachePurge )
130 echo "checked"; ?>>
131 <div class="toggle"></div>
132 </label>
133 </div>
134 </div>
135 <div class="nitro-option" id="page-optimization-widget">
136 <div class="nitro-option-main">
137 <div class="text-box">
138 <h6><?php esc_html_e( 'Page optimization', 'nitropack' ); ?></h6>
139 <p><?php esc_html_e( 'Select what post/page types get optimized', 'nitropack' ); ?></p>
140 </div>
141 <a data-modal-target="modal-posttypes" data-modal-toggle="modal-posttypes"
142 class="btn btn-secondary btn-icon">
143 <img src="<?php echo plugin_dir_url( __FILE__ ); ?>images/setting-icon.svg">
144 </a>
145 </div>
146 <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-posttypes.php'; ?>
147 </div>
148 </div>
149 </div>
150 </div>
151 <!-- Automated Behavior Card End -->
152 <!-- Go to app Card -->
153 <div class="card exclusion-card">
154 <div class="card-header">
155 <h3><?php esc_html_e( 'Exclusions', 'nitropack' ); ?></h3>
156 </div>
157 <div class="card-body">
158 <div class="options-container">
159 <div class="nitro-option" id="ajax-shortcodes-widget">
160 <?php $settings->render_ajax_shortcodes_setting(); ?>
161 </div>
162 </div>
163 </div>
164 </div>
165 <!-- Go to app card End -->
166
167
168 </div>
169 <div class="col-span-1">
170 <!-- Subscription Card End -->
171 <!-- Basic Settings Card -->
172 <div class="card card-basic-settings">
173 <div class="card-header">
174 <h3><?php esc_html_e( 'Basic Settings', 'nitropack' ); ?></h3>
175 </div>
176 <div class="card-body">
177 <div class="options-container">
178 <div class="nitro-option" id="cache-warmup-widget">
179 <div class="nitro-option-main">
180 <div class="text-box" id="warmup-status-slider">
181
182 <?php $sitemap = get_option( 'np_warmup_sitemap', false );
183 $toolTipDisplayState = $sitemap ? '' : 'hidden'; ?>
184
185 <h6><?php esc_html_e( 'Cache warmup', 'nitropack' ); ?> <span
186 class="badge badge-primary ml-2"><?php esc_html_e( 'Recommended', 'nitropack' ); ?></span>
187 <span class="tooltip-icon <?php echo $toolTipDisplayState; ?>"
188 data-tooltip-target="tooltip-sitemap">
189 <img src="<?php echo plugin_dir_url( __FILE__ ) . 'images/info.svg'; ?>">
190 </span></h6>
191 <div id="tooltip-sitemap" role="tooltip" class="tooltip-container hidden">
192 <?php echo $sitemap; ?>
193 <div class="tooltip-arrow" data-popper-arrow></div>
194 </div>
195 <p><?php esc_html_e( 'Automatically pre-caches your website\'s page content', 'nitropack' ); ?>.
196 <a href="https://support.nitropack.io/en/articles/8390320-cache-warmup"
197 class="text-blue"
198 target="_blank"><?php esc_html_e( 'Learn more', 'nitropack' ); ?></a></p>
199 </div>
200 <label class="inline-flex items-center cursor-pointer ml-auto">
201 <input id="warmup-status" type="checkbox" class="sr-only peer">
202 <div class="toggle"></div>
203 </label>
204 </div>
205 <div class="msg-container" id="loading-warmup-status">
206 <img src="<?php echo plugin_dir_url( __FILE__ ) . 'images/loading.svg'; ?>" alt="loading"
207 class="icon">
208 <span class="msg"><?php esc_html_e( 'Loading cache warmup status', 'nitropack' ); ?></span>
209 </div>
210 </div>
211 <div class="nitro-option" id="test-mode-widget">
212 <div class="nitro-option-main">
213 <div class="text-box" id="safemode-status-slider">
214 <h6><?php esc_html_e( 'Test Mode', 'nitropack' ); ?></h6>
215 <p>
216 <?php esc_html_e( 'Test NitroPack\'s features without affecting your visitors\' experience', 'nitropack' ); ?>.
217 <a href="https://support.nitropack.io/en/articles/8390292-test-mode"
218 class="text-blue"
219 target="_blank"><?php esc_html_e( 'Learn more', 'nitropack' ); ?></a>
220 </p>
221 </div>
222
223 <label class="inline-flex items-center cursor-pointer ml-auto">
224 <input type="checkbox" class="sr-only peer" id="safemode-status">
225
226 <div class="toggle"></div>
227 </label>
228 </div>
229 <div class="msg-container" id="loading-safemode-status">
230 <img src="<?php echo plugin_dir_url( __FILE__ ) . 'images/loading.svg'; ?>" alt="loading"
231 class="icon">
232 <?php esc_html_e( 'Loading test mode status', 'nitropack' ); ?>
233 </div>
234 <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-test-mode.php'; ?>
235 </div>
236 <div class="nitro-option" id="compression-widget">
237 <div class="nitro-option-main">
238 <div class="text-box">
239 <h6><span
240 id="detected-compression"><?php esc_html_e( 'HTML Compression', 'nitropack' ); ?>
241 </span></h6>
242 <p>
243 <?php esc_html_e( 'Compressing the structure of your HTML, ensures faster page rendering and an optimized browsing experience for your users.', 'nitropack' ); ?>
244 <a href="https://support.nitropack.io/en/articles/8390333-nitropack-plugin-settings-in-wordpress#h_29b7ab4836"
245 class="text-blue"
246 target="_blank"><?php esc_html_e( 'Learn more', 'nitropack' ); ?></a>
247 </p>
248 </div>
249 <label class="inline-flex items-center cursor-pointer ml-auto">
250 <input type="checkbox" id="compression-status" class="sr-only peer" <?php echo (int) $enableCompression === 1 ? "checked" : ""; ?>>
251 <div class="toggle"></div>
252 </label>
253 </div>
254 <div class="mt-4 text-primary">
255 <a href="javascript:void(0);" id="compression-test-btn"
256 class="text-primary"><?php esc_html_e( 'Run compression test', 'nitropack' ); ?></a>
257 <div class="flex items-start msg-container hidden">
258 <span class="msg"></span>
259 </div>
260 </div>
261 </div>
262 <?php if ( \NitroPack\Integration\Plugin\BeaverBuilder::isActive() ) { ?>
263 <div class="nitro-option" id="beaver-builder-widget">
264 <div class="nitro-option-main">
265 <div class="text-box">
266 <h6><span
267 id="detected-compression"><?php esc_html_e( 'Sync NitroPack Purge with Beaver Builder', 'nitropack' ); ?>
268 </span></h6>
269 <p>
270 <?php esc_html_e( 'When Beaver Builder cache is purged, NitroPack will perform a full cache purge keeping your site\'s content up-to-date.', 'nitropack' ); ?>
271 </p>
272 </div>
273 <label class="inline-flex items-center cursor-pointer ml-auto">
274 <input type="checkbox" class="sr-only peer" id="bb-purge-status" <?php if ( $bbCacheSyncPurge )
275 echo "checked"; ?>>
276 <div class="toggle"></div>
277 </label>
278 </div>
279 </div>
280 <?php } ?>
281 <div class="nitro-option" id="can-editor-clear-cache-widget">
282 <div class="nitro-option-main">
283 <div class="text-box">
284 <h6><?php esc_html_e( 'Allow Editors to purge cache', 'nitropack' ); ?></h6>
285 <p><?php esc_html_e( 'Give Editors the right to purge cache when content is updated.', 'nitropack' ); ?>
286 </p>
287 </div>
288 <label class="inline-flex items-center cursor-pointer ml-auto">
289 <input type="checkbox" id="can-editor-clear-cache" class="sr-only peer" <?php echo (int) $canEditorClearCache === 1 ? "checked" : ""; ?>>
290 <div class="toggle"></div>
291 </label>
292 </div>
293 </div>
294 </div>
295 </div>
296 </div>
297 </div>
298 <?php $notOptimizedCPTs = nitropack_filter_non_optimized();
299 $notices = get_option( 'nitropack-dismissed-notices', [] );
300 $optimizedCPT_notice = in_array( 'OptimizeCPT', $notices, true ) ? true : false;
301 if ( ! $optimizedCPT_notice && ! empty( $notOptimizedCPTs ) )
302 require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-not-optimized-CPT.php'; ?>
303 </div>
304 <?php require_once NITROPACK_PLUGIN_DIR . 'view/modals/modal-unsaved-changes.php'; ?>
305 <script>
306 ($ => {
307 var getOptimizationsTimeout = null;
308 let isClearing = false;
309 var paid_plan = false;
310 $(window).on("load", function () {
311 getOptimizations();
312 getPlan();
313 <?php if ( $checkedCompression != 1 ) { ?>
314 autoDetectCompression();
315 <?php } ?>
316 });
317
318 /* Cache Purge begin */
319 window.performCachePurge = () => {
320 purgeCache();
321 }
322
323 let purgeCache = () => {
324 let purgeEvent = new Event("cache.purge.request");
325 window.dispatchEvent(purgeEvent);
326 }
327
328 var getOptimizations = _ => {
329 var url = '<?php echo $optimizationDetailsUrl; ?>';
330 ((s, e, f) => {
331 if (window.fetch) {
332 fetch(url)
333 .then(resp => resp.json())
334 .then(s)
335 .catch(e)
336 .finally(f);
337 } else {
338 $.ajax({
339 url: url,
340 type: 'GET',
341 dataType: 'json',
342 success: s,
343 error: e,
344 complete: f
345 })
346 }
347 })(data => {
348 $('[data-last-cache-purge]').text(data.last_cache_purge.timeAgo);
349 if (data.last_cache_purge.reason) {
350 $('[data-purge-reason]').text(data.last_cache_purge.reason);
351 $('[data-purge-reason]').attr('title', data.last_cache_purge.reason);
352 $('#last-cache-purge-reason').show();
353 } else {
354 $('#last-cache-purge-reason').hide();
355 }
356 if (data.pending_count) {
357 $("#pending-optimizations-count").text(data.pending_count);
358 $("#pending-optimizations-section").show();
359 } else {
360 $("#pending-optimizations-section").hide();
361 }
362
363 $('[data-optimized-pages-total]').text(data.optimized_pages.total);
364
365 }, __ => {
366 console.error("An error occurred while fetching data for optimized pages");
367 }, __ => {
368 if (!getOptimizationsTimeout) {
369 getOptimizationsTimeout = setTimeout(function () {
370 getOptimizationsTimeout = null;
371 getOptimizations();
372 }, 60000);
373 }
374 });
375 }
376
377 var getPlan = _ => {
378
379 var url = '<?php echo $planDetailsUrl; ?>';
380 ((s, e, f) => {
381 if (window.fetch) {
382 fetch(url)
383 .then(resp => resp.json())
384 .then(s)
385 .catch(e)
386 .finally(f);
387 } else {
388 $.ajax({
389 url: url,
390 type: 'GET',
391 dataType: 'json',
392 success: s,
393 error: e,
394 complete: f
395 })
396 }
397 })(data => {
398
399 $('.plan-name').text(data.plan_title);
400 $('[data-next-billing]').text(data.next_billing ? data.next_billing : 'N/A');
401 $('[data-next-reset]').text(data.next_reset ? data.next_reset : 'N/A');
402 $('[data-page-views]').text(data.page_views ? data.page_views : 'N/A');
403 $('[data-cdn-bandwidth]').text(data.cdn_bandwidth ? data.cdn_bandwidth + ' out of ' + data.max_cdn_bandwidth : 'N/A');
404
405 for (prop in data) {
406 if (prop.indexOf("show_") === 0) continue;
407 if (prop.indexOf("label_") === 0) continue;
408 if (prop.indexOf("max_") === 0) continue;
409 if (
410 typeof data["show_" + prop] != "undefined" &&
411 data["show_" + prop] &&
412 typeof data["label_" + prop] != "undefined" &&
413 typeof data["max_" + prop] != "undefined"
414 ) {
415 let propertyLabel = data["label_" + prop];
416 let propertyValue = data[prop];
417 let propertyLimit = data["max_" + prop];
418 $("#plan-quotas").append('<li class="list-group-item px-0 d-flex justify-content-between align-items-center">' + propertyLabel + ' <span><span data-optimizations>' + propertyValue + '</span> out of <span data-max-optimizations>' + propertyLimit + '</span></span></li>');
419 }
420 }
421
422 }, __ => {
423 NitropackUI.triggerToast('error', '<?php esc_html_e( 'Error while fetching plan data', 'nitropack' ); ?>');
424 }, __ => { });
425 }
426
427
428 $(document).on('click', "#compression-test-btn", e => {
429 e.preventDefault();
430 autoDetectCompression();
431 });
432 /* Compression end */
433
434 /* HTML Compression begin */
435 var autoDetectCompression = function () {
436 let msg_container = $('#compression-widget .msg-container'),
437 msg_icon = msg_container.find('.icon'),
438 msg_box = msg_container.find('.msg'),
439 compression_setting = $('#compression-status'),
440 compression_btn = $('#compression-test-btn');
441 //add spinner here
442 msg_box.html('<img src="<?php echo plugin_dir_url( __FILE__ ) . 'images/loading.svg'; ?>" alt="loading" class="icon"> <?php esc_html_e( 'Testing current compression status', 'nitropack' ); ?>');
443 compression_btn.addClass('hidden');
444 msg_container.removeClass('hidden');
445 $.post(ajaxurl, {
446 action: 'nitropack_test_compression_ajax',
447 nonce: nitroNonce
448 }, function (response) {
449 var resp = JSON.parse(response);
450
451 if (resp.status == "success") {
452 if (resp.hasCompression) { // compression already enabled
453 compression_setting.attr("checked", false);
454
455 msg_box.text('<?php esc_html_e( 'Compression is already enabled on your server! There is no need to enable it in NitroPack.', 'nitropack' ); ?>')
456 } else {
457 compression_setting.attr("checked", true);
458 msg_box.text('<?php esc_html_e( 'No compression was detected! We will now enable it in NitroPack.', 'nitropack' ); ?>');
459 }
460 NitropackUI.triggerToast(resp.type, resp.message);
461 } else {
462 msg_box.text('<?php esc_html_e( 'Could not determine compression status automatically. Please configure it manually.', 'nitropack' ); ?>');
463 }
464 setTimeout(function () {
465 msg_container.addClass('hidden');
466 compression_btn.removeClass('hidden');
467 }, 5000);
468 });
469 }
470
471
472 $("#compression-status").on("click", function (e) {
473 $.post(ajaxurl, {
474 action: 'nitropack_set_compression_ajax',
475 nonce: nitroNonce,
476 data: {
477 compressionStatus: $(this).is(":checked") ? 1 : 0
478 }
479 }, function (response) {
480 var resp = JSON.parse(response);
481 NitropackUI.triggerToast(resp.type, resp.message);
482 });
483 });
484 $("#can-editor-clear-cache").on("click", function (e) {
485 $.post(ajaxurl, {
486 action: 'nitropack_set_can_editor_clear_cache',
487 nonce: nitroNonce,
488 data: {
489 canEditorClearCache: $(this).is(":checked") ? 1 : 0
490 }
491 }, function (response) {
492 var resp = JSON.parse(response);
493 NitropackUI.triggerToast(resp.type, resp.message);
494 });
495 });
496
497 $("#auto-purge-status").on("click", function (e) {
498 $.post(ajaxurl, {
499 action: 'nitropack_set_auto_cache_purge_ajax',
500 nonce: nitroNonce,
501 autoCachePurgeStatus: $(this).is(":checked") ? 1 : 0
502 }, function (response) {
503 var resp = JSON.parse(response);
504 NitropackUI.triggerToast(resp.type, resp.message);
505 });
506 });
507
508 $("#bb-purge-status").on("click", function (e) {
509 $.post(ajaxurl, {
510 action: 'nitropack_set_bb_cache_purge_sync_ajax',
511 nonce: nitroNonce,
512 bbCachePurgeSyncStatus: $(this).is(":checked") ? 1 : 0
513 }, function (response) {
514 var resp = JSON.parse(response);
515 NitropackUI.triggerToast(resp.type, resp.message);
516 });
517 });
518
519
520 })(jQuery);
521 </script>