I was going to suggest the same but you already did it Nice work btw!
When I’ve compared what was done other RRD graph images and the one from WIO that could not be patched as the others, I was surprised to see the use of the iframe tag to display the images as they are just images, the most big deal is to update them regularly and that’s all
Woow that’s an awesome news! I can make a note in the project README on my side saying that the support for some add-on is currently limited and remove it when you’ve released your work.
What do you think?
Let me know if I can help aside of introducing myself to the dev team like helping you for testing my patch or anything else.
Thanks for the tip, I have written a mail in which I informed the operator about it, he will certainly be grateful.
Without an update since my last massage the SRI Hash is the same.
I send you a pm with the requested information.
Sorry but I didn`t know how to set the language to English in the web console, even Firefox is set to English
Thanks a lot again for your extensive testing and proof of work on MS Edge!
Regarding the last screenshots that have their backgrounds in white, I’ll explain you the reason why it does that:
I’ve deliberately injected the <script></script> line just before the </body> tag for these reasons:
When you place your scripts to the end of the page body, the browser will load them in lower priority
When you place your scripts in the <head></head> block, the browser will load them in high priority
What does it means exactly?
Scripts placed in <head></head> will block the page rendering until the browser has downloaded everything, applied all the defined changes in scripts on DOM elements and then starts rendering the page
In order to be able to let my code detecting the DOM elements that needs to have their style overridden, it needs to wait on the browser to have rendered all the DOM elements in each pages
For doing so, my code needs to be downloaded in low priority which unfortunately creates a loading / rendering delay until my code is triggered and the dark theme applied on the page…
I’ve made this choice for performance reason to avoid the following:
As my code needs to read the whole DOM to detect elements that needs to be styled differently, it will create the bad side effect to block the whole page rendering during the time the browser is downloading all the page resources to build the DOM and let my code doing it’s job…
As it would be quite annoying for the users (I mean you guys ) I’ve preferred to let the browser manage the download priorities and avoid unnecessary page redraw.
If you read the page you’ve shared me earlier called “Our top Core Web Vitals recommendations for 2023”, it is very well explained but it remains highly technical.
In general it’s always better to load the Javascript code from the </body> part instead of the <head></head> part to avoid blocking the page rendering but it has some disadvantages as you could see
Thanks for the tip, I have written a mail in which I informed the operator about it, he will certainly be grateful.
No problem, I’m glad if I could help to secure things better To be honest, detecting if a CSP is in place on a website is purely a side effect of my little “dark mode” bookmarklet
Without an update since my last massage the SRI Hash is the same.
I’ve updated the project README to remove this image and replaced it by the current SRI hash.
You could perhaps use preload tag to load relevant scripts before rendering the page. The downside is that the page will take a few milliseconds longer to load waiting for the scripts.
Yeah I thought about the the preload attribute and also defer + async but I’ve preferred to get a working code first and not do premature optimization. I think now I can try to add them but I’d like to finish the support of all WUI pages first then handle the tables content before doing such optimizations.
Hope you don’t mind but thanks again for your suggestion.
Sorry for my silence, I’m currently facing several unexpected issues that does not allow me to focus on this project as much as I want.
Yesterday, I’ve released the version 0.5.0 that includes the following changes:
Improved code isolation
Reduced flashing side effect when the white background got switched in dark
Added missing visual fixes (but might have changed things incorrectly so it will be fixed again in the next release)
Added --no-sri install / update option in patch.sh
@sec-con, I’ve moved the load of the JS file from the <body> to the <head> block and used the async and defer flags to make it loaded after all other JS files. This allows to the browser enough time to render and parse existing DOM elements to allow my code to detect and alter their styles.
I’ll try to use the preload flag but I’m pretty sure it will load the JS file before the others and create the bug I’ve observed that if the browser has not rendered / parsed all the DOM elements, my code is not able to inject the theme selector to the right of the traffic monitor because I’m using it’s current position to place it.
One last thing, regarding the --no-sri option added to the patch.sh script, you should not use it! It’s only useful for testing or debugging purposes and nothing else. The SRI feature has been put in place to ensure that the JS code is not tampered prior arriving to your browser, so even if normally we all running our IPFire boxes in a safe place, I don’t recommend to use that --no-sri option unless as said, for testing or debugging purposes only.
Thanks again to all of you for your support and appreciation of my work, it means a lot to me.
Werd. It is acting very randomly. Something is not right.
I do not get the switch icon nor can I change between dark/light mode.
I tried cleaning out the old by update -r and then deleting the ipfire-dark-theme directory, getting afresh download and installing it. Did not help. Tried in Edge as well. No diff.
The only way I see the dark theme now is if i go somewhere else and then click the browser Back button.
Normally it’s due to the quirk mode that browsers uses in case of broken HTML code that unfortunately the installer script introduced in the version 0.5.0…
It should be resolved with the new installer script version 0.5.2.