PluginProbe ʕ •ᴥ•ʔ
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization / 1.5.1
NitroPack – Performance, Page Speed & Cache Plugin for Core Web Vitals, CDN & Image Optimization v1.5.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 / diag.php
nitropack / view Last commit date
images 6 years ago javascript 5 years ago stylesheet 5 years ago admin.php 5 years ago connect.php 5 years ago dashboard.php 5 years ago diag.php 5 years ago help.php 6 years ago
diag.php
171 lines
1 <div>
2 <div class="row">
3 <div class="col-md-6 mb-3">
4 <div class="card-overlay-blurrable np-widget" id="diagnostic-widget">
5 <div class="card card-d-item">
6 <div class="card-body">
7 <h5 class="card-title">Diagnostics report</h5>
8 <ul class="list-group list-group-flush">
9 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
10 <span id="loading-general-info">
11 Include NitroPack info(version, methods, environment)
12 </span>
13 <span id="general-info-toggle">
14 <label id="general-info-slider" class="switch">
15 <input type="checkbox" class="diagnostic-option" id="general-info-status" checked>
16 <span class="slider"></span>
17 </label>
18 </span>
19 </li>
20 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
21 <span id="loading-plugins-status">
22 Include active plugins list
23 </span>
24 <span id="active-plugins-toggle">
25 <label id="active-plugins-slider" class="switch">
26 <input type="checkbox" class="diagnostic-option" id="active-plugins-status" checked>
27 <span class="slider"></span>
28 </label>
29 </span>
30 </li>
31 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
32 <span id="conflicting-plugins-info">
33 Include conflicting plugins list
34 </span>
35 <span id="conflicting-plugins-toggle">
36 <label id="conflicting-plugins-slider" class="switch">
37 <input type="checkbox" class="diagnostic-option" id="conflicting-plugins-status" checked>
38 <span class="slider"></span>
39 </label>
40 </span>
41 </li>
42 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
43 <span id="loading-user-config">
44 Include user config
45 </span>
46 <span id="user-config-toggle">
47 <label id="user-config-slider" class="switch">
48 <input type="checkbox" class="diagnostic-option" id="user-config-status" checked>
49 <span class="slider"></span>
50 </label>
51 </span>
52 </li>
53 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
54 <span id="loading-dir-info">
55 Include directory info(structure,permisions)
56 </span>
57 <span id="dir-info-toggle">
58 <label id="dir-info-slider" class="switch">
59 <input type="checkbox" class="diagnostic-option" id="dir-info-status" checked>
60 <span class="slider"></span>
61 </label>
62 </span>
63 </li>
64 <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
65 <span>
66 <a id="gen-report-btn" href="javascript:void(0);" class="btn btn-light btn-outline-secondary"><i class="fa fa-refresh fa-spin" style="display:none" id="diagnostics-loader"></i>&nbsp;&nbsp;Generate&nbsp;Report</a>
67 </span>
68 </li>
69 </ul>
70 <p class="mb-0 mt-2"><i class="fa fa-info-circle text-primary" aria-hidden="true"></i> The generated report will be saved to your computer and can later be attached to your ticket.</p>
71 </div>
72 </div>
73 </div>
74 </div>
75 </div>
76 </div>
77 <script>
78 /*
79 var toggled01 = {"general-info-status":document.getElementById("general-info-status").checked ,
80 "active-plugins-status":document.getElementById("active-plugins-status").checked ,
81 "user-config-status":document.getElementById("user-config-status").checked ,
82 "dir-info-status":document.getElementById("dir-info-status").checked
83 };function() {
84 Notification.success('Report generated');
85 }
86 */
87 ($ => {
88 let isReportGenerating = false;
89
90 $("#gen-report-btn").on("click", function(e) {
91 if (isReportGenerating) return;
92
93 $.ajax({
94 url: ajaxurl,
95 type: "POST",
96 dataType: "text",
97 data: {
98 action: 'nitropack_generate_report',
99 toggled: {
100 "general-info-status": $("#general-info-status:checked").length,
101 "active-plugins-status": $("#active-plugins-status:checked").length,
102 "conflicting-plugins-status": $("#conflicting-plugins-status:checked").length,
103 "user-config-status": $("#user-config-status:checked").length,
104 "dir-info-status": $("#dir-info-status:checked").length
105 }
106 },
107 beforeSend: function (xhr,sett) {
108 if ($(".diagnostic-option:checked").length > 0) {
109 $("#diagnostics-loader").show();
110 isReportGenerating = true;
111 return true;
112 } else {
113 alert('Please select at least one of the report options');
114 return false;
115 }
116 },
117 success: function(response, status, xhr) {
118 if (response.length > 1) {
119 var filename = "";
120 var disposition = xhr.getResponseHeader('Content-Disposition');
121 if (disposition && disposition.indexOf('attachment') !== -1) {
122 var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
123 var matches = filenameRegex.exec(disposition);
124 if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
125 }
126
127 var type = xhr.getResponseHeader('Content-Type');
128 var blob = new Blob([response], { type: type });
129
130 if (typeof window.navigator.msSaveBlob !== 'undefined') {
131 // IE workaround for "HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed."
132 window.navigator.msSaveBlob(blob, filename);
133 } else {
134 var URL = window.URL || window.webkitURL;
135 var downloadUrl = URL.createObjectURL(blob);
136
137 if (filename) {
138 // use HTML5 a[download] attribute to specify filename
139 var a = document.createElement("a");
140 // safari doesn't support this yet
141 if (typeof a.download === 'undefined') {
142 window.location.href = downloadUrl;
143 } else {
144 a.href = downloadUrl;
145 a.download = filename;
146 document.body.appendChild(a);
147 a.click();
148 }
149 } else {
150 window.location.href = downloadUrl;
151 }
152
153 setTimeout(function () { URL.revokeObjectURL(downloadUrl); }, 100);
154 }
155 Notification.success('Report generated successfully.');
156 } else {
157 Notification.error('Response is empty. Report generation failed.');
158 }
159 },
160 error: function() {
161 Notification.error('There was an error while generating the report.');
162 },
163 complete: function() {
164 $("#diagnostics-loader").hide();
165 isReportGenerating = false;
166 }
167 });
168 });
169 })(jQuery);
170 </script>
171