Copy wishlist URL instead of opening tab

This commit is contained in:
Jay Trees 2022-03-15 10:01:56 +01:00
parent cc30745fa2
commit fa7cafb408
2 changed files with 23 additions and 2 deletions

View file

@ -91,9 +91,9 @@ $(function() {
/** Toasts */
$.fn.toast.settings.displayTime = 'auto';
$.fn.toast.settings.minDisplayTime = 3000;
$.fn.toast.settings.showProgress = true;
$.fn.toast.settings.showProgress = 'bottom';
$.fn.toast.settings.class = 'success';
$.fn.toast.settings.showIcon = 'check';
$.fn.toast.settings.showIcon = true;
$.fn.toast.settings.title = 'Success';
/**

View file

@ -163,6 +163,27 @@ $(function () {
});
}
/**
* Share Wishlist
*/
$(document).on('click', '.button.wishlist-share', function(event) {
event.preventDefault();
var wishlist_href = window.location.origin + $(event.currentTarget).attr('href');
navigator.clipboard.writeText(wishlist_href).then(function() {
$('body').toast({ message: 'Link copied to clipboard.' });
}, function() {
$('body').toast({
class : 'error',
title : 'Error',
message : 'Unable to copy to clipboard. There is likely a permission issue.'
});
});
});
/**
* Rename Wishlist
*/