Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard v3/onboard fixing #207

Closed
wants to merge 278 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
278 commits
Select commit Hold shift + click to select a range
b3a5f36
dashboard v-3 updates
Sep 12, 2024
1a7d660
dashboard v-3 updates
Sep 12, 2024
48026db
Merge branch 'master' into feat/dashboard-v3
shakee93 Sep 12, 2024
677b9d3
feat: merge master into dashboard
shakee93 Sep 12, 2024
40cbdce
update build files
shakee93 Sep 12, 2024
ed066e1
feat: set rapidload legacy dash board accessible
shakee93 Sep 12, 2024
d053437
dashboard v-3 updates
Sep 13, 2024
1e299b9
Merge branch 'refs/heads/feat/dashboard-v3' into dashboard-v3/optimiz…
Sep 16, 2024
f65240d
dashboard v-3 updates
Sep 17, 2024
7d3bed1
update build files
shakee93 Sep 17, 2024
9a76cbc
update build files
shakee93 Sep 17, 2024
1bde91e
feta: add endpoint for fetch optimization data for urls and delete op…
shakee93 Sep 17, 2024
283ba35
feta: search posts and links, endpoint
shakee93 Sep 17, 2024
f0d55e8
remove logs
shakee93 Sep 17, 2024
9d7f505
dashboard v-3 updates
Sep 17, 2024
9d7c43f
Merge remote-tracking branch 'origin/dashboard-v3/optimize-pages' int…
Sep 17, 2024
700fe25
update build files
shakee93 Sep 17, 2024
fec33cb
dashboard v-3 updated the building environment for both windows and m…
Sep 17, 2024
afb8154
Merge remote-tracking branch 'origin/dashboard-v3/optimize-pages' int…
shakee93 Sep 17, 2024
91b1e95
update build files
shakee93 Sep 17, 2024
deee002
dashboard v-3 table updates
Sep 19, 2024
d160a0a
Merge remote-tracking branch 'origin/dashboard-v3/optimize-pages' int…
shakee93 Sep 19, 2024
e7ca04a
update build files
shakee93 Sep 19, 2024
1a7c3c0
dashboard v-3 fetchPages
Sep 20, 2024
92b7d4b
Merge remote-tracking branch 'origin/dashboard-v3/optimize-pages' int…
shakee93 Sep 20, 2024
c5037b4
fix rapidload_fetch_post_types_with_links endpoint return 0
shakee93 Sep 20, 2024
0b562c6
update build files
shakee93 Sep 20, 2024
3c42b83
dashboard v-3 add optimization
Sep 23, 2024
38a95ce
build files
shakee93 Sep 23, 2024
671d868
dashboard v-3 bug fixing
Sep 24, 2024
4df0271
dashboard v3 updates
Sep 25, 2024
2b52b48
update build files and exclude cart and checkout page from titan sear…
shakee93 Sep 25, 2024
a26e406
dashboard v3 updates
Sep 25, 2024
13d85f1
Merge remote-tracking branch 'origin/dashboard-v3/optimize-pages' int…
Sep 25, 2024
54c8298
dashboard v3 general settings updates
Sep 25, 2024
e85bf43
update build files
shakee93 Sep 25, 2024
7455588
dashboard v3 general settings updates
Sep 25, 2024
9a2b558
dashboard v3 general settings updates
Sep 25, 2024
fb87d05
update build files
shakee93 Sep 26, 2024
e424237
update build files
shakee93 Sep 26, 2024
b8ecfc1
dashboard v3 fixed loading and optimize button event
Sep 26, 2024
af4c5b9
dashboard v3 loading Skeleton fix
Sep 26, 2024
d57b089
update build files
shakee93 Sep 26, 2024
0d857cc
fix : fatal error handle woocommerce functions
shakee93 Sep 26, 2024
ad6bca3
dashboard v3 saveGeneralSettings form data changes
Sep 26, 2024
a80315a
Merge remote-tracking branch 'origin/dashboard-v3/optimize-pages' int…
Sep 26, 2024
d3fa9e3
dashboard v3 saveGeneralSettings data changes
Sep 26, 2024
fa70105
dashboard v3 optimizer redirection from page added to query
Sep 26, 2024
0a96326
dashboard v3 fetch page based on optimize-url
Sep 26, 2024
8bad801
feat: add One Click booster widget. with basic perf and chat widget
shakee93 Sep 26, 2024
0d6e8a5
dashboard v3 fetch page based on optimize-url
Sep 27, 2024
b5b3913
update build files
shakee93 Sep 27, 2024
d4a86f3
add search functionality for the data
shakee93 Sep 27, 2024
cdc0103
Merge remote-tracking branch 'origin/dashboard-v3/optimize-pages' int…
shakee93 Sep 27, 2024
ee9e540
dashboard v3 header url prioritize with current optimization url
Sep 27, 2024
5721d49
dashboard v3 header url prioritize with current optimization url
Sep 27, 2024
8e3e30a
dashboard v3 header url changes when optimizing from optimization table
Sep 27, 2024
77245e3
dashboard v3 search option for selected: pages posts, etc...
Sep 27, 2024
c80888c
dashboard v3 search option for selected: pages posts, etc...
Sep 27, 2024
c84e9fe
dashboard v3 fetch post and pages only once
Sep 27, 2024
39b2a85
dashboard v3 titan optimizer floating header
Sep 30, 2024
68f3b1e
dashboard v3 titan optimizer floating header ui updates
Sep 30, 2024
eac25f1
dashboard v3 header theme switcher
Sep 30, 2024
2e74c40
titan floating UI and dashboard optimization table search, delete opt…
Sep 30, 2024
b674c47
inline css page-optimizer
Sep 30, 2024
faa6ab6
inline css page-optimizer
Oct 1, 2024
71a039e
dashboard optimization table infinity loop
Oct 1, 2024
98b3380
dashboard optimization table search option and bug fixing for infinit…
Oct 1, 2024
6bc2acb
dashboard optimization table freshFetch Data updates and header UI fixes
Oct 2, 2024
fc17a76
dashboard optimization table freshFetch Data updates and header UI fixes
Oct 3, 2024
0be2631
dashboard v3 ui updates and report switch replacement
Oct 3, 2024
f44cd16
titan optimizer floating header with animation slide up and down
Oct 3, 2024
451dcc1
titan optimizer testMode absolute border
Oct 3, 2024
64df9a9
enabling test mode color code for dashboard
Oct 3, 2024
56ecca7
enabling test mode color code for dashboard
Oct 3, 2024
e2d3b64
testMode set to global dashboard v3 and titan
Oct 3, 2024
61d57d7
titan header replacement
Oct 4, 2024
e3089d9
titan ui adjusted based on admin page
Oct 4, 2024
6835c3c
merging widgets with dashboard optimize page
Oct 4, 2024
3182d5a
merging widgets with dashboard optimize page
Oct 4, 2024
b22a2d6
dashboard and titan ui replacement
Oct 7, 2024
c61e4e0
dashbaord and titan ui replacement
Oct 7, 2024
3b8337c
optimizer url center aligned
Oct 7, 2024
8517482
optimizer save settings changes on gear change
Oct 7, 2024
97de3a8
add function to change performance gear
shakee93 Oct 8, 2024
099732f
loading animation on gear change
Oct 8, 2024
92b2434
Merge remote-tracking branch 'origin/dashboard-v3/optimize-pages' int…
Oct 8, 2024
ac937f9
feat: align the new perf header
shakee93 Oct 8, 2024
f27d2f8
vite build
Oct 9, 2024
74aba32
change gear updates
Oct 9, 2024
278d4f7
new header UI updates
Oct 9, 2024
a3352f1
new header UI updates
Oct 9, 2024
e12f45c
dashboard performance ui
Oct 10, 2024
101efda
Dashboard performance has been adjusted to perfectly match the UI
Oct 11, 2024
bb90f55
Dashboard UI changes
Oct 14, 2024
ffc93e9
Dashboard UI changes
Oct 14, 2024
9e89fc0
Dashboard UI changes
Oct 14, 2024
e776310
dashboard UI updates
Oct 16, 2024
e7c3d96
dashboard UI updates
Oct 16, 2024
8be0d64
dashboard UI updates, dialog window table view and add optimization menu
Oct 17, 2024
f35bae4
dashboard UI updates
Oct 17, 2024
c774240
dashboard UI updates
Oct 17, 2024
4478e1b
dashboard UI updates
Oct 17, 2024
2aa3f28
dashboard UI font size and color
Oct 18, 2024
2a60843
Merge branch 'release/v2.3.5' into dashboard-v3/optimize-pages
shakee93 Oct 18, 2024
aed0103
dashboard AIBot updates
Oct 21, 2024
13b9ea0
Merge remote-tracking branch 'origin/dashboard-v3/optimize-pages' int…
Oct 21, 2024
2557230
update build files
shakee93 Oct 22, 2024
55ede0a
update build files
shakee93 Oct 22, 2024
241a645
update build files
shakee93 Oct 22, 2024
f8e2940
Merge remote-tracking branch 'origin/release/v2.3.6' into dashboard-v…
shakee93 Oct 22, 2024
c509504
dashboard AIBot updates
Oct 22, 2024
4fb2bad
see more if the settings length exceeded more than 6 lines
Oct 24, 2024
a00f16d
custom settings see more link
Oct 24, 2024
edb6ee5
custom settings see more link
Oct 24, 2024
0b29fe7
custom settings see more link
Oct 24, 2024
e85472d
AISpeedCoach updates
Oct 24, 2024
195625d
Merge remote-tracking branch 'origin/dashboard-v3/optimize-pages' int…
shakee93 Oct 29, 2024
fd2e6a7
Usage Summarry
Oct 29, 2024
62b7188
update build files
shakee93 Oct 29, 2024
9078172
Merge branch 'dashboard-v3/optimize-pages' of https://github.com/shak…
shakee93 Oct 29, 2024
0e70bfc
update build files
shakee93 Oct 29, 2024
4e7b19f
update response for cache sizes
shakee93 Oct 29, 2024
6874f3a
update cache size response
shakee93 Oct 29, 2024
693d616
Usage Summarry
Oct 29, 2024
053c0c8
Usage Summarry
Oct 29, 2024
6af1b53
update size text
shakee93 Oct 30, 2024
d91e2dc
Merge branch 'dashboard-v3/optimize-pages' of https://github.com/shak…
shakee93 Oct 30, 2024
dfe0c0f
update cache size fetch response
shakee93 Oct 30, 2024
c658e73
update resposne
shakee93 Oct 30, 2024
dbd1ca3
feat: add animation, refine ui spacing
shakee93 Oct 30, 2024
ac8b149
Usage Summarry
Oct 30, 2024
494712b
Usage Summarry
Oct 30, 2024
70ac796
rapidload onboard
Oct 30, 2024
acc80c6
rapidload onboard updates
Oct 30, 2024
ed340b9
rapidload onboard updates
Oct 30, 2024
19044de
rapidload onboard updates
Oct 30, 2024
9cd3a62
rapidload onboard updates
Oct 31, 2024
df052ef
rapidload onboard updates
Nov 1, 2024
55123d8
onboard flow
Nov 8, 2024
54b3db8
onboard flow compare performance gear bug fixed
Nov 8, 2024
9854e75
home page performance
Nov 11, 2024
9f46470
add endpoint for dashboard performance stats
shakee93 Nov 11, 2024
09873e1
clean code remove comments
shakee93 Nov 12, 2024
917840d
updated dashboard performance
Nov 13, 2024
ee0d4d6
Merge remote-tracking branch 'origin/dashboard-v3/onboard' into dashb…
shakee93 Nov 13, 2024
ae95abe
update build files
shakee93 Nov 14, 2024
ef6c9e3
licence reactivate
Nov 15, 2024
3c252e4
licence reactivate
Nov 15, 2024
4722a97
reconnect loading
Nov 15, 2024
d204d71
reconnect loading
Nov 15, 2024
35b634a
license reconnect
Nov 19, 2024
6ba84b3
merging
Nov 19, 2024
da86a73
merging 2.4.2 with onboard
Nov 19, 2024
91a349f
total cache size calculation
Nov 19, 2024
1d1686a
cache clear options url modifications
Nov 19, 2024
0d914e9
update clear cache links
shakee93 Nov 19, 2024
c331ec8
update clear cache links
shakee93 Nov 19, 2024
7465d53
fix : replace original css execution
shakee93 Nov 19, 2024
714effc
fix : update page loading time param in performance
shakee93 Nov 20, 2024
bab9d95
fix : option update on_board_completed
shakee93 Nov 20, 2024
6768eeb
onboard ui updates with loading
Nov 20, 2024
ba9de69
Merge remote-tracking branch 'origin/dashboard-v3/onboard-merge-2.4.2…
Nov 20, 2024
2c712f8
fix : option update on_board_completed
shakee93 Nov 20, 2024
01db749
Merge remote-tracking branch 'origin/dashboard-v3/onboard-merge-2.4.2…
shakee93 Nov 20, 2024
2b3d96b
onboard ui updates with loading
Nov 20, 2024
fcf7970
Merge remote-tracking branch 'origin/dashboard-v3/onboard-merge-2.4.2…
Nov 20, 2024
daabd49
update text
shakee93 Nov 20, 2024
13683e2
Merge remote-tracking branch 'origin/dashboard-v3/onboard-merge-2.4.2…
shakee93 Nov 20, 2024
d471dfa
home page score loading < 1
Nov 20, 2024
7efd5a4
Merge remote-tracking branch 'origin/dashboard-v3/onboard-merge-2.4.2…
Nov 20, 2024
1efd62c
fix known bugs
shakee93 Nov 21, 2024
f9b383b
build changes
Nov 21, 2024
53400ef
Merge remote-tracking branch 'origin/dashboard-v3/onboard-merge-2.4.2…
shakee93 Nov 21, 2024
21c13fd
onboard fixing
Nov 22, 2024
1c96fef
onboard flow updates fixing unwanted fetch requests
Nov 26, 2024
c2902ff
onboard flow updates fixing unwanted fetch requests
Nov 26, 2024
048a8c7
onboard flow updates fixing unwanted fetch requests
Nov 26, 2024
4a2b66d
onboard flow updates
Nov 27, 2024
6c2baa5
onboard flow updates
Nov 27, 2024
b2bfe9b
onboard flow updates
Nov 27, 2024
ed44df0
onboard flow updates
Nov 27, 2024
a6afd23
Merge branch 'refs/heads/release/2.4.2' into dashboard-v3/onboard-fixing
Nov 27, 2024
96f9f36
step one loading and ai loading
Nov 27, 2024
8ebb06c
fetch titan settings onboard
Nov 28, 2024
c33754f
Merge remote-tracking branch 'refs/remotes/origin/release/v2.4.3' int…
Nov 28, 2024
6c8e9a0
onboard when connecting license through app redirect to step 3
Nov 28, 2024
37c6c27
change active gear once settings success
Nov 28, 2024
8cae217
step 3 connect account updates bug fixed
Nov 29, 2024
9f2250f
step 3 connect account updates bug fixed
Nov 29, 2024
d6a5181
ui changes and onboard flow updates
Dec 2, 2024
619796e
update speed index
shakee93 Dec 4, 2024
fe63417
fix : update htaccess file action
shakee93 Dec 4, 2024
7fd10b5
fix : update htaccess file action
shakee93 Dec 5, 2024
7b05d8b
Onboard Latest Updates
Dec 6, 2024
77a0ecc
Onboard latest updates
Dec 6, 2024
29446d8
onboard
Dec 6, 2024
06ad20a
preload titan css file
shakee93 Dec 9, 2024
8bcf2e0
Add Test Mode Notification to Dashboard Header
shakee93 Dec 9, 2024
263be8e
onboard and dashbaord updates
Dec 10, 2024
1b045cd
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
Dec 10, 2024
91280d8
changing tabs wih new nav bar
Dec 11, 2024
741e799
filtering the related settings to show in optimization tab
Dec 11, 2024
f1b1e94
UI changes
Dec 11, 2024
70d07f1
UI changes
Dec 11, 2024
414cc5a
build
Dec 11, 2024
28bd475
update preview stat file
shakee93 Dec 16, 2024
f343a2f
step updates and ui changes and AI bot intergration
Dec 16, 2024
7a1164c
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
Dec 16, 2024
2ef563c
Iframe Speed test AI
Dec 16, 2024
2c0044f
update the optimizer stat
shakee93 Dec 17, 2024
e77490d
fix unused param
shakee93 Dec 17, 2024
b885c3c
update finding image redirection funtion
shakee93 Dec 17, 2024
7724c95
Herms ai with real time dyanmic prompts
Dec 17, 2024
5c6bcd7
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
Dec 17, 2024
b17ea2b
optimizer
Dec 17, 2024
48f0c33
with chact history panel
Dec 17, 2024
938d4ab
feat: update new prediction endpoint
shakee93 Dec 17, 2024
4295551
update css diagnose data
shakee93 Dec 18, 2024
9e82c4c
update js diagnose data
shakee93 Dec 18, 2024
c466b9c
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
shakee93 Dec 18, 2024
1ed2d60
update optimizer stat script
shakee93 Dec 18, 2024
3d5607f
Merge branch 'dashboard-v3/onboard-fixing' of github.com:shakee93/aut…
shakee93 Dec 18, 2024
e0a6ef1
Merge branch 'dashboard-v3/onboard-fixing' of github.com:shakee93/aut…
shakee93 Dec 18, 2024
322de39
UI changes
Dec 18, 2024
4779f70
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
Dec 18, 2024
b487c5a
update minified file
shakee93 Dec 18, 2024
6aadedb
loading stats and toast
Dec 18, 2024
05b31f9
move diagnose script from optimizer base
shakee93 Dec 18, 2024
19f63a7
update inline script content
shakee93 Dec 18, 2024
d49afdc
remove debugging
shakee93 Dec 18, 2024
d07ee7d
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
shakee93 Dec 18, 2024
47fed55
feat: update new AI endpoint
shakee93 Dec 18, 2024
be3dea7
build, audits data in step four
Dec 18, 2024
7fcd10a
no passed audits
Dec 18, 2024
075f807
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
Dec 18, 2024
9a3098c
feat: add new non prev AJAX actions for license management and update…
shakee93 Dec 18, 2024
28d003c
updates
Dec 19, 2024
8ee90da
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
Dec 19, 2024
6da9c18
feat: change url of AI root
shakee93 Dec 19, 2024
736e4bf
update diagnose object with respected keys
shakee93 Dec 19, 2024
49af8e4
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
shakee93 Dec 19, 2024
3f44810
error handeling updates
Dec 19, 2024
5190850
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
Dec 19, 2024
15750b3
preload optimizer css file
shakee93 Dec 19, 2024
b68f026
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
shakee93 Dec 19, 2024
8bd435e
compare our settings with iframe data
Dec 19, 2024
53d1d7d
add image optimization dianose
shakee93 Dec 20, 2024
1a30918
Merge branch 'dashboard-v3/onboard-fixing' of https://github.com/shak…
shakee93 Dec 20, 2024
ed9cd74
update minified script
shakee93 Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/rapidload.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"folders": [
{
"name": "royal-elementor-kit",
"path": "../../../themes/royal-elementor-kit"
},
{
"name": "autoptimize-unusedcss",
"path": ".."
},
{
"name": "rapidload-api",
"path": "../../../../../../../../Projects/rapidload/rapidload-api"
}
],
"settings": {}
}
21 changes: 21 additions & 0 deletions assets/css/uucss_global.css
Original file line number Diff line number Diff line change
Expand Up @@ -1032,4 +1032,25 @@ a.toplevel_page_rapidload img{

#wp-admin-bar-rapidload .rl-icon img{
width: 16px;
}

body.rl-page-optimizer-loaded #wpbody-content>.notice{
display:none!important;
}

#wpadminbar .rl-input-wrapper-test-mode {
margin-left: 3px;
background-color: #ffaa34;
width: 69px;
border-radius: 5px;
margin-top: 4px;
max-height: 17px;
display: flex;
justify-content: center;
padding: 3px;
}

#wpadminbar .rl-input-test-mode{
line-height: 18px;
font-size: 13px;
}
265 changes: 265 additions & 0 deletions assets/js/rapidload-diagnose-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
(function (){

window.diagnose_data = {
cache: {
status: false,
key: 'uucss_enable_cache',
},
cpcss: {
status: false,
key: 'uucss_enable_cpcss',
},
uucss: {
non_optimized_css: [],
key: 'uucss_enable_uucss',
},
css_minify: {
non_minified_css: [] ,
key: 'uucss_minify',
},
js_minify: {
non_minified_js: [],
key: 'minify_js',
},
js_defer: {
non_deferred_js: [],
key: 'uucss_load_js_method',
},
js_delay: {
non_delayed_js: [],
key: 'delay_javascript',
},
cdn: {
status: false,
key: 'uucss_enable_cdn',
},
images: {
optimized_images: [],
redirected_images: [],
non_handled_images: [],
key: 'uucss_image_optimization',
},
};

function is_rapidload_preview() {
const urlParams = new URLSearchParams(window.location.search);
const params = [];
urlParams.forEach((value, key) => {
params.push(key)
});
return params.includes("rapidload_preview");
}

document.addEventListener('DOMContentLoaded', function (){
if (is_rapidload_preview()) {

// check cache served
const rapidload_cache_status_div_content = document.querySelector('#rapidload-cache-status');

if (rapidload_cache_status_div_content) {
window.diagnose_data.cache.status = true;
}else{
window.diagnose_data.cache.status = false;
}

// check cpcss

const rapidload_cpcss_style_content = document.querySelector('#rapidload-critical-css');

if(rapidload_cpcss_style_content){
window.diagnose_data.cpcss.status = true;
}else{
window.diagnose_data.cpcss.status = false;
}

// check uucss

const allStylesheets = document.querySelectorAll('link[type="text/css"]');
const nonOptimizedStylesheets = Array.from(allStylesheets).filter(sheet => !sheet.hasAttribute('data-rpd-uucss'));

if(nonOptimizedStylesheets.length > 0) {
window.diagnose_data.uucss.non_optimized_css = nonOptimizedStylesheets.map(sheet => sheet.href);
}else{
window.diagnose_data.uucss.non_optimized_css = [];
}

// check minify

const nonMinifiedStylesheets = Array.from(allStylesheets).filter(sheet => {
const href = sheet.href || '';
return !sheet.hasAttribute('data-rpd-minify') && !href.toString().includes('.min.css');
});

if(nonMinifiedStylesheets.length > 0) {
window.diagnose_data.css_minify.non_minified_css = nonMinifiedStylesheets.map(sheet => sheet.href);
}else{
window.diagnose_data.css_minify.non_minified_css = [];
}

// check js minify

const allScripts = document.querySelectorAll('script[src]');
const nonMinifiedScripts = Array.from(allScripts).filter(script => {
const src = script.src || '';
return !script.hasAttribute('data-rpd-minify-js') && !src.toString().includes('.min.js');
});

if(nonMinifiedScripts.length > 0) {
window.diagnose_data.js_minify.non_minified_js = nonMinifiedScripts.map(script => script.src);
}else{
window.diagnose_data.js_minify.non_minified_js = [];
}

// check non-deferred scripts

const nonDeferredScripts = Array.from(allScripts).filter(script => {
return !script.hasAttribute('data-rpd-strategy') && !script.hasAttribute('defer');
});

if(nonDeferredScripts.length > 0) {
window.diagnose_data.js_defer.non_deferred_js = nonDeferredScripts.map(script => script.src);
}else{
window.diagnose_data.js_defer.non_deferred_js = [];
}

// check non-delayed scripts
const nonDelayedScripts = Array.from(allScripts).filter(script => {
return !script.hasAttribute('data-rpd-strategy') || script.getAttribute('data-rpd-strategy') !== 'delay';
});

if(nonDelayedScripts.length > 0) {
window.diagnose_data.js_delay.non_delayed_js = nonDelayedScripts.map(script => script.src);
}else{
window.diagnose_data.js_delay.non_delayed_js = [];
}

// check cdn

const preconnectLink = document.querySelector('link[rel="preconnect"][crossorigin][href*=".rapidload-cdn.io"]');
if(preconnectLink) {
window.diagnose_data.cdn.status = true;
}else{
window.diagnose_data.cdn.status = false;
}

// check image optimization

// Create observer to track image loads
const imageObserver = new PerformanceObserver((list) => {
list.getEntries().forEach((entry) => {
if (entry.initiatorType === 'img') {
processImage(entry.name.toString());
} else if (entry.initiatorType === 'css' && entry.name.match(/\.(jpg|jpeg|png|gif|webp)$/i)) {
processImage(entry.name.toString());
}
});
});

imageObserver.observe({
entryTypes: ['resource']
});

// Process existing images
/*document.querySelectorAll('img').forEach(img => {
processImage(img);
});*/

function processImage(img) {
const imageUrl = img;

if (window.diagnose_data.images.non_handled_images.includes(imageUrl) ||
window.diagnose_data.images.optimized_images.includes(imageUrl)) {
return;
}

if (!imageUrl.includes('images.rapidload-cdn.io')) {
if (!window.diagnose_data.images.non_handled_images.includes(imageUrl)) {
window.diagnose_data.images.non_handled_images.push(imageUrl);
}
} else {
if (!window.diagnose_data.images.optimized_images.includes(imageUrl)) {
window.diagnose_data.images.optimized_images.push(imageUrl);
}
}
}
}

setTimeout(() => {

// Send AJAX request to check image optimization status
if (window.diagnose_data.images.optimized_images.length > 0) {
fetch(rapidload_diagnose_tool.ajaxurl, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
action: 'rapidload_image_optimization_status',
image_urls: JSON.stringify(window.diagnose_data.images.optimized_images),
_ajax_nonce: rapidload_diagnose_tool.nonce
})
})
.then(response => response.json())
.then(response => {
if (response.success && response.data) {
response.data.forEach(image => {
if (image.redirected && image.status === 307) {
const index = window.diagnose_data.images.optimized_images.indexOf(image.url);
if (index > -1) {
window.diagnose_data.images.optimized_images.splice(index, 1);
window.diagnose_data.images.redirected_images.push(image.url);
}
}
});
}
});
}

if (window.diagnose_data.images.optimized_images.length > 0) {
fetch(rapidload_diagnose_tool.ajaxurl, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
action: 'rapidload_image_optimization_status',
image_urls: JSON.stringify(window.diagnose_data.images.optimized_images),
_ajax_nonce: rapidload_diagnose_tool.nonce
})
})
.then(response => response.json())
.then(response => {
if (response.success && response.data) {
response.data.forEach(image => {
if (image.redirected && image.status === 307) {
const index = window.diagnose_data.images.optimized_images.indexOf(image.url);
if (index > -1) {
window.diagnose_data.images.optimized_images.splice(index, 1);
window.diagnose_data.images.redirected_images.push(image.url);
}
}
});
}
})
.finally(() => {
window.parent.postMessage(
{
type: "RAPIDLOAD_CHECK_RESULTS",
data: diagnose_data,
},
"*"
);
});
} else {
window.parent.postMessage(
{
type: "RAPIDLOAD_CHECK_RESULTS",
data: diagnose_data,
},
"*"
);
}
}, 5000);
})

})()
1 change: 1 addition & 0 deletions assets/js/rapidload-diagnose-script.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/rapidload.frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
})

if (!original) {
return;
continue;
}

let link = file.cloneNode()
Expand Down
Loading
Loading