Closed sal0max closed 3 years ago
Thanks for letting me know about this @sal0max , I will add a comment to your issue.
Looks like this issue was solved by disabling the my.js script, so closing this for now.
Yeah, it's solved for this case.
However, everyone who is using the Open Publishing theme and also the Shortcode Gallery++ plugin will run into the same issue.
How about that change I proposed in the other issue for js/my.js line 8? I tested it, it works:
$('#body-wrapper').on('click', 'a:not(.external-link):not([href^="#"]), a:not([class^="glightbox"])'), function (e) {
instead of just
$('#body-wrapper').on('click', 'a:not(.external-link):not([href^="#"])', function (e) {
Oh thanks for testing that possible fix, let me also verify on my end. If everything looks good I will release an update and give you credit for the fix🙂
Hi @sal0max , today I released an update with that fix for the Shortcode Gallery++ plugin but it caused unexpected issues on my online demo site (see below) home page, though my local test site was fine.
To be safe I have removed this fix as it looks like further testing is needed. If you happen to know what the issue might be please let me know (I do not know JS and someone on the Grav Discord helped me with that JS you see in the theme).
Thanks, Paul
That baffles me a bit, as I don't see where the change could break the site.
$('#body-wrapper').on('click', 'a:not(.external-link):not([href^="#"])', function (e) {
$('#body-wrapper')
is a jQuery selector. which basically selects the entire site: The enclosing div
with the id body-wrapper
.on()
attaches an event handler function to this div
'click'
defines the event type'a:not(.external-link):not([href^="#"])'
is again a selector to filter the descendants of the div
that trigger the event. In this case: everything, except a
elements with the class external-link
and also not with a href
attribute which begins with #
function (e)
just signals, that the following code inside {}
should be executed.My proposed modification just adds another selector filter: a:not([class^="glightbox"])
:
a
element with a class that begins with glightbox
. I couldn't see how this would affect anything other than the GLightbox links.I couldn't see anything being broken. You're sure you didn't ran into some caching issue, or had a typo in there?
$('#body-wrapper').on('click', 'a:not(.external-link, [href^="#"], [class^="glightbox"])', function (e) {
(This is also the correct syntax, according to https://stackoverflow.com/a/6166888/421140)
Thanks so much @sal0max for looking into what might have been causing the issue - your revised code looks to be working now🙂 https://demo.hibbittsdesign.org/grav-open-publishing-quark/
The homepage now displays correctly, and I manually updated that site's my.js file with your most recent code.
I will now update the theme and re-release🤞
Thanks again! Paul
Great news @sal0max the release looks good and I have tested it on https://demo.hibbittsdesign.org/grav-open-publishing-quark/ and all is working.
Thanks again for your revised code suggestion! Paul
Hi,
I got this issue opened for my Shortcode Gallery++ Plugin: https://github.com/sal0max/grav-plugin-shortcode-gallery-plusplus/issues/6
The lightbox doesn't work properly, as the
js/my.js
script in Quark Open Publishing intercepts the click on an image and opens it in a blank page. A possible workaround that could be done on your side is described in the linked issue. All links that should open with the GLightbox I'm using have a classglightbox-<random number>
.Maybe you want to have a look at it.
Cheers!