- Posts: 98
COMMUNITY FORUM
K2.css, .js and Magnific Popup Overrides
- Roman Lipatov
- Topic Author
- Offline
- Premium Member
I found on main page of my site this inline styles, js and css resources:
/* K2 - Magnific Popup Overrides */
.mfp-iframe-holder {padding:10px;}
.mfp-iframe-holder .mfp-content {max-width:100%;width:100%;height:100%;}
.mfp-iframe-scaler iframe {background:#fff;padding:10px;box-sizing:border-box;box-shadow:none;}
<link href="/templates/bpnet/css/k2.css?v=2.9.0" rel="stylesheet" />
<script src="/media/k2/assets/js/k2.frontend.js?v=2.9.0&sitepath=/"></script>
But main page is related to another component, it does not have any k2 modules.
And this problem appears on any NOT k2 page.
This is not normal.
We are fighting to speed up our sites. We are trying to minimize each byte on the page.
But K2 just loads own styles, css and js on any page.
How to change this behavior??
Thanks.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
- Posts: 6218
Secondly, the K2 system plugin loads a bare minimum of CSS and JS because K2 modules require them. And as you know, modules can exist along side other component's, e.g. a contact form (component) with a latest blog posts K2 Content module.
The things loaded directly from your server (K2's CSS) is only a few KBs (like, really a few). The rest come from jsDeliver.com which loads the assets via HTTP/2 which is super fast.
Client-side optimization is nice, but the problem is usually server-side optimization. K2's few KBs don't impose a performance issue to that extent.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Roman Lipatov
- Topic Author
- Offline
- Premium Member
- Posts: 98
Fotis wrote: Secondly, the K2 system plugin loads a bare minimum of CSS and JS because K2 modules require them
K2 loads styles, css and js on any page. Even if this page does not have any K2 modules.
(K2's CSS) is only a few KBs (like, really a few)
When each component will load own CSS styles on ALL site pages - we will have bulky sites.
I have many components on my site, but only K2 make this:
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
- Posts: 6218
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Simon Wells
- Offline
- Platinum Member
- Posts: 955
Long time no speak, hope you are well.
I have an issue relating tho this code too.
One site uses Chronoforms to collect form data and create a PDF of that data.
This used to work well until the last Joomla and K2 updates.
Now the PDF has injected into it
"/* K2 - Magnific Popup Overrides */ .mfp-iframe-holder
{padding:10px;} .mfp-iframe-holder .mfp-content
{max-width:100%;width:100%;height:100%;} .mfp-iframe-scaler
iframe {background:#fff;padding:10px;box-sizing:border-box;b
ox-shadow:none;} " and appears as Text.
For the life of me, I can not find how, where, why this is being injected.
The front end page doesnt even appear to load any K2 resources, so can only assume this is happening after form submission or when the PDF is generated.
Needle in a haystack, but do you have any suggestions?
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
- Posts: 6218
This CSS snippet is added as a <style> tag in the <head> from the K2 system plugin. If it's rendered as text it means Chronoforms does not properly parse the output from the document. If its developers can't do anything about it, I can send you a snippet to disable the plugin temporarily for Chronoforms pages only. But it's important to note that if you have any K2 modules in Chronoforms pages, these won't work properly with the K2 system plugin disabled.
Good to see you back here :)
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Simon Wells
- Offline
- Platinum Member
- Posts: 955
If you can send a snippet, that would be great.
We have no K2 modules on the page in question.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
- Posts: 6218
if (JRequest::getCmd('option') == 'com_chronoforms') {
return;
}
Let me know.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Simon Wells
- Offline
- Platinum Member
- Posts: 955
But we knew that anyway.
That's a confirmed fix for me, so thank you very much!
Greatly appreciated.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
- Posts: 6218
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.