Please banish jQuery/Ajax from outside view

Hi, i had a little bit trouble with the jQuery in the /zp-core/template-functions.php. Then I noticed that this is utter luxury for the view of pure visitors. Because, you have to load the jQuery file. A horror in mobile devices. The jQuery is not necessary for this at all.

One of the jQuery is for the Search. I have it outcommended. Because, rewriting in pure JavaScript it's not possible with full IE (older Android) compatibility. The other is for ".metadata_toggle". It's possible to rewrite it to pure JavaScript. And tha banish jQuery load in the theme, with "if logged_in".

Is this worth an issue in github?

Tags:

Comments

  • acrylian Administrator, Developer
    edited November 2019

    jQuery is used for lots of other plugins as well. So not at this time and not for 1.5.x anymore anyway. Besides we will not get rid of jQuery in general in the nearer future anyway.

  • I hope you understand. jQuery is default loaded for what? That is out of proportion. Plugins can reload this, if necessary.

  • acrylian Administrator, Developer

    Yes, it is because it is required for a lot of things and currently there is no facility for plugins or whatever to load it on request.

    If your site is slow on mobile loading jQuery itself will not be the actual problem. Your images alone cause much more overhead.

    If you don't want to load it you can remove it from the "theme_head" filter. If you are logged in you will need it as the admin toolbox also uses it.

  • ? The problem is the use of it in the template-function.php, thats the problem. I must modify the template-function.php. The one i have coded to pure JS, the other (for search) i have commended out.

  • acrylian Administrator, Developer

    I do understand what you mean but I don't agree it is an issue. Again lots of standard plugins use jQuery anyway so this is not much of an overhead for the normal users. Also again, this requires a new theme and plugin structure so those can load it if needed as this needs to avoid loading it multiple times. Plugins will break if they can't do this if not updated. This facility does not exist currently. So it will not be changed now. Perhaps in the future we might even be able to remove jQuery in general. We'll see.

    For now: As always if any theme function does nott fit your purpose, you can create custom versions within your theme's functions.php and use those instead.

Sign In or Register to comment.