kytta / shareon

📯 Lightweight, stylish, and ethical share buttons for popular social networks
https://shareon.js.org/
MIT License
465 stars 25 forks source link

Add "Copy URL" button #41

Closed ToogleLiu closed 1 year ago

ToogleLiu commented 1 year ago

Thank you for developing this project, it helped me a lot. Have you considered adding the function of copying link?

kytta commented 1 year ago

Thank you for developing this project, it helped me a lot.

Thank you for your kind words!

Have you considered adding the function of copying link?

I actually didn't! I considered something similar, that being the Share API that would open the share sheet on mobile devices. This sheet offers the "Copy link" functionality, but it isn't very present on the desktop yet. "Copy URL" would be an excellent addition!

c00kie123 commented 1 year ago

Can you share more info about the Copy URL button? Where do you want it?

kytta commented 1 year ago

Can you share more info about the Copy URL button? Where do you want it?

Well, I'd want to have a button, similar to how there already are buttons for social networks. It should have a neutral background (dark grey, I guess), a generic "link" icon (for example: Bootstrap Icons "link-45deg" icon), and by clicking it, the page url (location.href) should be copied to the clipboard

ToogleLiu commented 1 year ago

Can you share more info about the Copy URL button? Where do you want it?

Well, I'd want to have a button, similar to how there already are buttons for social networks. It should have a neutral background (dark grey, I guess), a generic "link" icon (for example: Bootstrap Icons "link-45deg" icon), and by clicking it, the page url (location.href) should be copied to the clipboard

Yes, what you describe is exactly what I want.

c00kie123 commented 1 year ago

So you want to add new button, next to the social networks button? This button will copies the current page url location.href to the clipboard?

ToogleLiu commented 1 year ago

So you want to add new button, next to the social networks button? This button will copies the current page url location.href to the clipboard?

Yes. Like this:

image

Just like the one on the https://medium.com/ website.

c00kie123 commented 1 year ago

Thanks for sharing! I have been looking through the code and it has been quite confusing for me. Can you share the files where I have to edit to add in this copy link button? Is it in index.html?

ToogleLiu commented 1 year ago

Thanks for sharing! I have been looking through the code and it has been quite confusing for me. Can you share the files where I have to edit to add in this copy link button? Is it in index.html?

Are you planning to add the Copy URL button in this open source project? Your question may require the author of this open source project to answer.

kytta commented 1 year ago

I think that explaining the code will take me more time than actually implementing the feature. I'll take a look at it today :)

kytta commented 1 year ago

To-do list for this issue:

kytta commented 1 year ago

Will release this shortly!

kytta commented 1 year ago

🚀 Released in v2.1.0! See it in action: https://shareon.js.org/

ToogleLiu commented 1 year ago

Great! Thanks.