mastervanleeuwen / J-TrackGallery

GPS Track Gallery component for Joomla
https://mastervanleeuwen.github.io/J-TrackGallery/
6 stars 0 forks source link

Enhancement to copy JTRACKGALLERY script for track to Clipboard #54

Open noelada opened 1 year ago

noelada commented 1 year ago

Discussed in https://github.com/mastervanleeuwen/J-TrackGallery/discussions/53

Originally posted by **noelada** May 3, 2023 We have added a link in the Track Downloads area that when clicked copies the JTRACKGALLERY script to the clipboard: ![clipboardcopy1](https://user-images.githubusercontent.com/121601487/236587754-ec2a71be-6fed-4079-bd81-55191a5b409e.png) This enhancement makes it easy to add the track to the place it is to be displayed (simply by pasting the clipboard). Perhaps Marco you could include this option in a future release as I believe other users would find it helpful. Noel Adams.
mastervanleeuwen commented 1 year ago

Dear Noel,

Thanks for the suggestion this looks good to me. Could you post the code that you used to implement this? I can then add it to the track view.

Best regards, Marco.

noelada commented 1 year ago

Hi Marco,

You may wish to implement the new code as an option in Menu Default Settings – Track view. I have just added the code to the download GPX option. I have also used translations for the link text and option show_link = 1. The link text could be in the track view options (like you have done for the plugin). My changes to the download_gpx option are:

if ( (bool) $this->params->get("jtg_param_offer_download_gpx") )

            {

                            $download_buttons .= "<button class=\"btn btn-secondary jtg-download\" type=\"button\"

                            onclick=\"document.getElementById('format').value = 'gpx';Joomla.submitbutton('download')\">

                            GPX " . JText::_('COM_JTG_CONVERTED_FILE') ."</button>";

?>

<button class="btn btn-primary" type="button" onclick="setClipboard('<?php echo "{JTRACKGALLERYMAP} gpxfilename=",$this->track->file,JText::_('COM_JTG_SCRIPTOPTIONS'),"{/JTRACKGALLERYMAP}";?> ')"><?php echo JText::('COM_JTG_SCRIPT_CLIPBOARD');?>

<?php

            }

And in Translations I have:

COM_JTG_SCRIPT_CLIPBOARD="JTRACK script to Clipboard"

COM_JTG_SCRIPT_OPTIONS=", show_link=1"

I discovered the setClipboard function from google. There may be more elegant ways to do it but at least this seems to work.

Thanks for updating the plugin.

Best wishes,

Noel.

From: Marco van Leeuwen @.> Sent: Saturday, May 6, 2023 6:32 PM To: mastervanleeuwen/J-TrackGallery @.> Cc: noelada @.>; State change @.> Subject: Re: [mastervanleeuwen/J-TrackGallery] Enhancement to copy JTRACKGALLERY script for track to Clipboard (Issue #54)

Dear Noel,

Thanks for the suggestion this looks good to me. Could you post the code that you used to implement this? I can then add it to the track view.

Best regards, Marco.

— Reply to this email directly, view it on GitHub https://github.com/mastervanleeuwen/J-TrackGallery/issues/54#issuecomment-1537089774 , or unsubscribe https://github.com/notifications/unsubscribe-auth/A47X3TY7M244QAK4PQKX6N3XEYD7DANCNFSM6AAAAAAXT2YZ6U . You are receiving this because you modified the open/close state.Message ID: @.***>

mastervanleeuwen commented 1 year ago

Hi Noel,

Thanks for the code example. I have implement this button in the new release candidate here: https://github.com/mastervanleeuwen/J-TrackGallery/releases/tag/0.9.34-rc32

There is a configuration option in the 'track view' configuration panel (under Global Settings -> J TrackGallery). The button only appears when the user is logged in. I thought that makes sense, because it is only useful for users who can edit articles or post items on the blog. Let me know if that works for you.

I used a slightly different (shorter) piece of JavaScript to access the clipboard; the first time I used it, my browser showed a popup to ask permission, but since then it works without the popup.

Best regards, Marco.

noelada commented 1 year ago

Hi Marco,

Thanks for the update. It is fine that the script button only appears for logged in users. I am not sure if it is worth including the ability to specify parameter overrides somewhere such as show_info = 0. Some users may wish to show the track info only when they click the More GPS Track Information link. I had a language override for this just in case, however the current default settings are OK for us. There is another insignificant typo at the end of the Configuration Overview Map. It shows This introductory text appears at teh top of the overview map page . Next time you are working on that module, perhaps you could correct it?

Thanks again and best wishes from Australia.

Regards,

Noel.

PS: Can I make a donation for the time you have spent improving things?

From: Marco van Leeuwen @.> Sent: Sunday, May 28, 2023 4:36 AM To: mastervanleeuwen/J-TrackGallery @.> Cc: noelada @.>; State change @.> Subject: Re: [mastervanleeuwen/J-TrackGallery] Enhancement to copy JTRACKGALLERY script for track to Clipboard (Issue #54)

Hi Noel,

Thanks for the code example. I have implement this button in the new release candidate here: https://github.com/mastervanleeuwen/J-TrackGallery/releases/tag/0.9.34-rc32

There is a configuration option in the 'track view' configuration panel (under Global Settings -> J TrackGallery). The button only appears when the user is logged in. I thought that makes sense, because it is only useful for users who can edit articles or post items on the blog. Let me know if that works for you.

I used a slightly different (shorter) piece of JavaScript to access the clipboard; the first time I used it, my browser showed a popup to ask permission, but since then it works without the popup.

Best regards, Marco.

— Reply to this email directly, view it on GitHub https://github.com/mastervanleeuwen/J-TrackGallery/issues/54#issuecomment-1565639439 , or unsubscribe https://github.com/notifications/unsubscribe-auth/A47X3TZ2KV4755UM36EJDG3XIJCPFANCNFSM6AAAAAAXT2YZ6U . You are receiving this because you modified the open/close state.Message ID: @.***>