Karmalakas / grav-plugin-photoswipe

Add Photoswipe gallery to your pages
MIT License
8 stars 1 forks source link

plugin clashes with Antispam plugin #11

Open skinofthesoul opened 1 year ago

skinofthesoul commented 1 year ago

Hello,

first off, I love this plugin! Super easy to set up, and makes really nice galleries. The only problem I have so far is that it clashes with my Antispam plugin. Somehow Photoswipe eats up the end tags of the javascript mailto anchors generated by Antispam, resulting in open links all over a page.

I haven't had time to dig deeper with this yet, but I have noticed that this also happens on pages where there isn't even a Photoswipe gallery. So the plugin must be doing something on every page that results in missing tags – maybe you can tell what's happening right off the bat?

Would be great if this could be resolved – I'm using Antispam in all my projects and I would love to add Photoswipe as a staple ingredient as well!

Karmalakas commented 1 year ago

This sounds really strange, because output is not manipulated in any way if there's no Photoswipe in any of the templates on the page 😕 I'll try to look into it maybe during the weekend (but no promise)

hughbris commented 1 year ago

I think this might be related, so I'll leave the comment here. I am also short of time to dig deeper right now, sorry.

I just noticed this plugin is not loading JS or CSS (so isn't working) on a production site only. In staging and dev, it worked beautifully (it really is a great plugin!).

So I looked at the differences and then disabled my Plausible plugin on prod. Photoswipe worked again. Luckily this client has shown no interest in metrics so it's mainly for me. I did test Plausible on staging but then turned it off. I guess I never tested the two plugins together on staging.

From a quick look, the Plausible plugin seems to use DOM injection in a similar way to this plugin. Hopefully that is a clue and hopefully the solution is simple. I'm happy to look into it if I remember and have time.

Karmalakas commented 1 year ago

I'm really sorry for dragging for so long, but I want to make use of good weather as much as possible, so I haven't been doing any work on my personal projects for a while now. Also have lots of other a bit more important stuff queued up already 😞

hughbris commented 1 year ago

After a long journey, my issue seems unrelated to this one. It is also not related to the Plausible plugin. It was modular caching (#1). This explains why I only noticed the error on production. I thought it was Plausible because the photoswipe worked when I uninstalled it. However, when gallery pages are refreshed, the photoswipe doesn't load. Took me a while to notice that :)

It's only because you linked to #1 from #3 that I saw this issue. Normally I search issues and have to manually remove the annoying Github default of open issues only. For some reason did not do that this time.

I also noticed my leaflet map module (using Map Marker Leaflet) required this fix for production too.

Thank you, enjoy the sunshine @Karmalakas, and sorry for hijacking your issue thread @skinofthesoul.

Karmalakas commented 1 year ago

@skinofthesoul, is this still an issue? Or maybe you've figured it out by any chance? Now that weather is usually not good and cold, I'll spend more time on my projects until spring. Should I still dig into this? 🙂

skinofthesoul commented 1 year ago

Well. I didn't have the time to go digging around in the code, so I resorted to using a different plugin. ¯_(ツ)_/¯ So the problem still exists, but I don't have to deal with it right now… I'd say this is one of the things that is likely to come back to bite you another time, but right now there's no pressure to fix it. ;-)