Want to change function onclick

Phoca Gallery - image gallery extension
Socrates_mx5
Phoca Member
Phoca Member
Posts: 37
Joined: 21 Sep 2020, 14:06

Want to change function onclick

Post by Socrates_mx5 »

I'm using Phoca Gallery with Photoswipe that works well.

I've started to use J!MailAlert with its Phoca Gallery extension to include latest photos in the Newsletter. The URL-link provided with in the Newsletter opens each photo in a different Detail View Window then Photoswipe. It's one of the viewers that I tested before Photoswipe became my choice. To start with the photo was opened on top of the web site, which didn't look that great. It treats the photo as a modal with out being a modal.

The URL-link from J!MailAlert ends with ?detail=0&buttons=1. I realized if one change the ending of the URL to the photo to ?tmpl=component, then it the website is not shown in the background, which looks better. The problem is clicking on the close button, then the photo doesn't close, because it's not opened in a modal. Instead the photo is just shown on top of the background of the web site, as it was when the URL ended with ?detail=0&buttons=1.

A workaround could be to change the onclick java script function to open a the URL to the Photo Gallery instead, but I can't find where this is located in the code.
Socrates_mx5
Phoca Member
Phoca Member
Posts: 37
Joined: 21 Sep 2020, 14:06

Re: Want to change function onclick

Post by Socrates_mx5 »

Socrates_mx5 wrote: 26 Nov 2020, 20:21 A workaround could be to change the onclick java script function to open a the URL to the Photo Gallery instead, but I can't find where this is located in the code.
This is the onclick function I would like to change to load the URL of the Photo Gallery instead:

Code: Select all

onclick="window.parent.SqueezeBox.close();"
Which can be found here in the code of the Close Window Button:

Code: Select all

<div class="pg-imgbgd"><a href="/en/social-club/photo-gallery/19-portugal/detail/232-assembleia-da-repubica-2-1231476-web" onclick="window.parent.SqueezeBox.close();" title="Close Window"><img src="/media/com_phocagallery/images/icon-exit.png" alt="Close Window"></a></div>
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Want to change function onclick

Post by Jan »

Hi, if you change some code, e.g. onclick part, then you need to load the popup libraries too. So it depends on in which view this onclick will be started. If e.g. in some other component, then in such component the popup feature from Phoca Gallery will just not load :idea: (because on such page Phoca Gallery is not active).

Jan
If you find Phoca extensions useful, please support the project
Socrates_mx5
Phoca Member
Phoca Member
Posts: 37
Joined: 21 Sep 2020, 14:06

Re: Want to change function onclick

Post by Socrates_mx5 »

Thanks Jan,

Then I better rethink.

How to create a link in a Newsletter that opens the selected image in a modal or viewer that looks good and functions well on the website?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Want to change function onclick

Post by Jan »

Hi, it is not so easy with opening modals when you link to some website.

Yes, Photoswipe can run automatically the modal window with help of the suffix parameters but if you add there tmpl=component, this mean, that only the component but not whole site will be loaded. So clicking on close button, you will see only component output, not the whole website output.

Another prolem is even, the component output mostly does not load all the website css or all the website javascript which can cause javascript errors on the site.

But I still don't understand the idea. if you go to page with tmpl=component and user clicks on close button, then your site just does not render completely so users does not have any menu links, etc. to navigate to other content of your website :idea:

Jan
If you find Phoca extensions useful, please support the project
Socrates_mx5
Phoca Member
Phoca Member
Posts: 37
Joined: 21 Sep 2020, 14:06

Re: Want to change function onclick

Post by Socrates_mx5 »

Jan wrote: 02 Dec 2020, 18:38 But I still don't understand the idea. if you go to page with tmpl=component and user clicks on close button, then your site just does not render completely so users does not have any menu links, etc. to navigate to other content of your website :idea:
Yes, one usually wants visitors to be able to navigate further on the web site. If it's not possible to link to a photo in the Gallery where one can navigate further, then the second best option is that one can click in the thumb nail photo in the Newsletter for the photo to be shown in a browser, without possibilities to navigate further. It looks good in the Newsletter to include the latest added photos from the Gallery, which is the reason why I'm trying to use the extension of J!MailAlert for Phoca Gallery. Those who's signed up for the Newsletter are registered users, so they've already "regulars" of the website.
Socrates_mx5
Phoca Member
Phoca Member
Posts: 37
Joined: 21 Sep 2020, 14:06

Re: Want to change function onclick

Post by Socrates_mx5 »

Simple solutions are beautiful solutions. I've found a simple solution to make it look better that does not require any alteration of the code of Phoca Gallery.

I just needed to alter translateY(-50%) in the css-code with the following code in user.css to make it look good.

Code: Select all

/* Newsletter Phoca Gallery detail view */
.pg-detail-view {
	transform: perspective(1px) translateY(0%) !important;
}
As mentioned in the first post if ?tmpl=component is used in the link from the Newsletter, then the image opens up nicely in the browser. When clicking on the "close icon" then the image is shown nicely on the website, after the alteration of the css-code.

Here is a link from the Newsletter to one of the photos where one can see what it looks like:

https://terrazas-del-rodeo.com/en/socia ... =component
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Want to change function onclick

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
Post Reply