PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.9.1
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.9.1
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 / oneclick.php
nitropack / view Last commit date
images 3 years ago javascript 3 years ago stylesheet 2 years ago admin.php 2 years ago connect-oneclick.php 2 years ago connect.php 2 years ago dashboard-oneclick.php 2 years ago dashboard.php 2 years ago diag.php 3 years ago help.php 3 years ago oneclick.php 2 years ago safemode.php 2 years ago safemode.tpl 4 years ago
oneclick.php
133 lines
1 <div id="nitropack-container" class="wrap">
2 <div id="heading" class="mt-4">
3 <h5 class="font-weight-bold default-fonts npoc-title"><?php esc_html_e( 'NitroPack OneClick™', 'nitropack' ); ?></h5>
4 </div>
5
6 <form method="post" action="options.php" name="form">
7 <?php settings_fields( NITROPACK_OPTION_GROUP ); ?>
8 <?php do_settings_sections( NITROPACK_OPTION_GROUP ); ?>
9 <div class="tab-content" style="display:block">
10 <div id="dashboard" class="tab-pane hidden">
11 <?php require_once NITROPACK_PLUGIN_DIR . "view/dashboard-oneclick.php"; ?>
12 </div>
13 </div>
14 </form>
15 </div>
16 <script>
17 (function($) {
18 window.Notification = (_ => {
19 var timeout;
20
21 var display = (msg, type) => {
22 clearTimeout(timeout);
23 $('#nitropack-notification').remove();
24
25 $('[name="form"]').prepend('<div id="nitropack-notification" class="notice notice-' + type + '" is-dismissible"><p>' + msg + '</p></div>');
26
27 timeout = setTimeout(_ => {
28 $('#nitropack-notification').remove();
29 }, 10000);
30 loadDismissibleNotices();
31 }
32
33 return {
34 success: msg => {
35 display(msg, 'success');
36 },
37 error: msg => {
38 display(msg, 'error');
39 },
40 info: msg => {
41 display(msg, 'info');
42 },
43 warning: msg => {
44 display(msg, 'warning');
45 }
46 }
47 })();
48
49 const clearCacheHandler = clearCacheAction => {
50 return function(success, error) {
51 $.ajax({
52 url: ajaxurl,
53 type: 'GET',
54 data: {
55 action: "nitropack_" + clearCacheAction + "_cache"
56 },
57 dataType: 'json',
58 beforeSend: function() {
59 Notification.info("Loading. Please wait...");
60 $('#optimizations-purge-cache').hide();
61 $('#np-purge-cache-loading').show();
62 },
63 success: function(data) {
64 $('#np-purge-cache-loading').hide();
65 if (data.type === 'success') {
66 $('#np-purge-cache-success').show();
67 Notification[data.type](data.message);
68 cacheEvent = new Event("cache." + clearCacheAction + ".success");
69 } else {
70 $('#np-purge-cache-error').show();
71 Notification[data.type](data.message);
72 cacheEvent = new Event("cache." + clearCacheAction + ".error");
73 }
74 window.dispatchEvent(cacheEvent);
75 },
76 error: function(data) {
77 $('#np-purge-cache-loading').hide();
78 $('#np-purge-cache-error').show();
79 Notification[data.type](data.message);
80 cacheEvent = new Event("cache." + clearCacheAction + ".error");
81 window.dispatchEvent(cacheEvent);
82 },
83 complete: function() {
84 setTimeout(function(){$('#np-purge-cache-success').hide();$('#np-purge-cache-error').hide();$('#optimizations-purge-cache').show();}, 3000);
85 }
86 });
87 };
88 }
89
90 $(window).on("load", _ => {
91 //Remove styles from jobcareer and jobhunt plugins since they break our layout. They should not be loaded on our options page anyway.
92 $('link[href*="jobcareer"').remove();
93 $('link[href*="jobhunt"').remove();
94
95 $("#dashboard").addClass("show active");
96 window.addEventListener('cache.invalidate.request', clearCacheHandler("invalidate"));
97 window.addEventListener('cache.purge.request', clearCacheHandler("purge"));
98
99 NitroPack.QuickSetup.setChangeHandler(async function(value, success, error) {
100 success(value);
101 });
102 });
103
104 $("#nitro-restore-connection-btn").on("click", function() {
105 $.ajax({
106 url: ajaxurl,
107 type: 'GET',
108 data: {
109 action: "nitropack_reconfigure_webhooks"
110 },
111 dataType: 'json',
112 beforeSend: function() {
113 $("#nitro-restore-connection-btn").attr("disabled", true).html("<i class='fa fa-refresh fa-spin'></i>");
114 },
115 success: function(data) {
116 if (!data.status || data.status != "success") {
117 if (data.message) {
118 alert("<?php esc_html_e( 'Error:', 'nitropack' ); ?> " + data.message);
119 } else {
120 alert("<?php esc_html_e( 'Error: We were unable to restore the connection. Please contact our support team to get this resolved.', 'nitropack' ); ?>");
121 }
122 } else {
123 $("#nitro-restore-connection-btn").attr("disabled", true).html("<i class='fa fa-check'></i>");
124 }
125 },
126 complete: function() {
127 location.reload();
128 }
129 });
130 });
131 })(jQuery);
132 </script>
133