Keyword

K2.css, .js and Magnific Popup Overrides

  • Roman Lipatov
  • Roman Lipatov's Avatar Topic Author
  • Offline
  • Premium Member
More
1 year 7 months ago - 1 year 7 months ago #169631 by Roman Lipatov
Roman Lipatov created the topic: K2.css, .js and Magnific Popup Overrides
Hello!
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&amp;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.
Last edit: 1 year 7 months ago by Roman Lipatov.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
1 year 7 months ago #169642 by Fotis
Fotis replied the topic: K2.css, .js and Magnific Popup Overrides
First off, please remove the URL from your signature. There are other ways to promote your site.

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.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • Roman Lipatov
  • Roman Lipatov's Avatar Topic Author
  • Offline
  • Premium Member
More
1 year 7 months ago - 1 year 7 months ago #169722 by Roman Lipatov
Roman Lipatov replied the topic: K2.css, .js and Magnific Popup Overrides

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:

Last edit: 1 year 7 months ago by Roman Lipatov.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
1 year 7 months ago #169758 by Fotis
Fotis replied the topic: K2.css, .js and Magnific Popup Overrides
K2 is usually the backbone of a Joomla site. So it's not any component. It's up to you to decide whether this is a real issue or just micro-optimization. The other way around is for us to check when K2 content is present and then add these includes which is seriously overkill.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

More
5 months 2 weeks ago #174052 by Simon Wells
Simon Wells replied the topic: K2.css, .js and Magnific Popup Overrides
Hey Fotis,

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.

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
5 months 2 weeks ago - 5 months 1 week ago #174053 by Fotis
Fotis replied the topic: K2.css, .js and Magnific Popup Overrides
Hey Simon. It's been a long time indeed :)

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 :)

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member
Last edit: 5 months 1 week ago by Fotis.

Please Log in or Create an account to join the conversation.

More
5 months 1 week ago #174114 by Simon Wells
Simon Wells replied the topic: K2.css, .js and Magnific Popup Overrides
hey Fotis.
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.

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
5 months 1 week ago #174121 by Fotis
Fotis replied the topic: K2.css, .js and Magnific Popup Overrides
Edit this file github.com/getk2/k2/blob/master/plugins/system/k2.php#L391 and add after line 391 the following to disable the K2 system plugin when on Chromoforms pages:
if (JRequest::getCmd('option') == 'com_chronoforms') {
    return;
}

Let me know.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

More
5 months 1 week ago #174122 by Simon Wells
Simon Wells replied the topic: K2.css, .js and Magnific Popup Overrides
You sir, are a legend!!
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.

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
5 months 1 week ago #174126 by Fotis
Fotis replied the topic: K2.css, .js and Magnific Popup Overrides
You're welcome Simon :)

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum