Tidy Assets Plugin - JS exclusion

Ralf Member

Hi,
I would like to exclude some js files and tried to add them to the 'Skip Elements' box.
Example:
zp-core/zp-extensions/openstreetmap/leaflet.js

But I cant get the leaflet.js excluded from beeing moved to the bottom of the page.

Not sure what exactly is the correct syntax for adding an js exclusion. Tried the full path like above or simply leaflet.js
But this does not work.

Any hints?
Ralf

Comments

  • Ralf Member
    edited April 2021

    To be a little more precise what is exactly the problem on my site:

    I have created a page which shows all geotagged images on a map by using this code:

    <?php $album = newAlbum("places/lokalisiert.alb"); if (is_object($album)) { makeAlbumCurrent($album); } ?>
    <?php printOpenStreetMap(NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, $album); ?>

    As soon as I enable the Tidy Assets plugin, the map will not be loaded.
    What makes me wondering:
    On the image page the map is displayed fine - even with the plugin enabled

  • acrylian Administrator, Developer
    edited April 2021

    Any JS errors perhaps? Btw, you either pass the album object or you make it current without passing it.

  • Ralf Member

    What I see in the console:
    Uncaught ReferenceError: L is not defined

    But I have no idea how to fix this.

  • acrylian Administrator, Developer

    Please remove all parameters when making the album current. That would be the normal album page usage.

  • Ralf Member

    makeAlbumCurrent()
    will not load the page.

    Could you point me in the right direction?

  • acrylian Administrator, Developer

    I was referring to the printOpenStreetMap() call. Either you pass an album object to it or you use the current album.

  • Ralf Member

    changed the code to:
    <?php $album = newAlbum("places/lokalisiert.alb"); printOpenStreetMap(NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, $album); ?>

    which makes the map display fine. Until I enable the plugin. Then the uncaught refereneError is back and no map is displayed

  • acrylian Administrator, Developer

    Sorry, I really can't help with the plugin itself as I never used it. I mean it has a disclaimer that it may not work with every script.

  • Ralf Member

    No Problem :-)

  • fretzl Administrator, Developer

    Have you tried the absolute URL to exclude leaflet.js?
    https://www.ralf-kerkhoff.de/zp-core/zp-extensions/openstreetmap/leaflet.js

  • Ralf Member

    Yes,
    but that doesnt fix the problem.

  • acrylian Administrator, Developer

    Probably the author @bic can help better here.

  • fretzl Administrator, Developer

    Just tried your setup with the zenpage theme, a dynamic album and the tidy-assets plugin enabled. Everything works like it should.

  • Ralf Member
    edited April 2021

    It seems, that it is the album.
    I have created the album this way:
    https://www.vincentbourganel.fr/news/map-of-geo-localized-pictures/

    If I choose another dynamic album the map is displayed fine.

  • acrylian Administrator, Developer

    Then your album respectively the images perhaps don't not have valid geodata available. In 1.5.8 then the map would not show.

  • Ralf Member

    mhh, without the tidy plugin activated the map displays fine.
    So my guess is that the "Word Criteria" which is * makes the problem.

  • acrylian Administrator, Developer

    Check perhaps if the album created has images at all.

  • Ralf Member

    it has about 2500 images.

  • fretzl Administrator, Developer
    edited April 2021

    Did you perhaps put the code to call the OpenStreetMap in the page codeblock 1 ?
    If so, remove it from codeblock 1 and copy it to codeblock 3
    The multiverse theme has printCodeblock(1) in the <head> section and since printOpenStreetMap() also prints a <div> element you could be in trouble because that is not allowed in the <head> section.
    If you look at pages.php in the multiverse theme you'll see that printCodeblock(3) is called after the page content.

  • Ralf Member

    hi,
    I will try it when I am back in my pc

  • Ralf Member

    That does not fix problem - Either it is because of the * as the search word or some of the images have invalid geo data. Will try to go deeper next weekend.

  • bic Member, Translator

    Hi @Ralf, sorry for the late reply, I don't visit this forum so often sadly and for some reasons notifications are not working at the moment. Anyway, I can't reproduce the issue. On my side, when I add that path to the exclusions the leaflet.js file is not moved at all. But even if it was moved, it should always be loaded before inline scripts, not giving that error anyway. Can you provide a link to your album? Even privately if you wish.

Sign In or Register to comment.