Skip to content

Commit

Permalink
Url formatting that works
Browse files Browse the repository at this point in the history
  • Loading branch information
OfficiallySp authored Jan 29, 2024
1 parent 0bb305d commit dedb2e7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,18 @@ function generateShareableLink() {

checkboxes.forEach(function(checkbox) {
if (checkbox.checked) {
selectedTracks.push(checkbox.id);
selectedTracks.push(encodeURIComponent(checkbox.id));
}
});

var url = window.location.href.split('?')[0];
url += '?selectedTracks=' + selectedTracks.join(',') + ',';
var params = selectedTracks.join('%2E%2C'); // Encoding dot and comma

// Add the parameters to the URL
url += '?selectedTracks=' + params;

// Remove any trailing dot or comma for legacy URLs
url = url.replace(/[.,]$/, '');

navigator.clipboard.writeText(url).then(function() {
alert("Mix URL copied to clipboard!");
Expand Down

0 comments on commit dedb2e7

Please sign in to comment.