Skip to content

Commit

Permalink
✨ Add a share link for the settings
Browse files Browse the repository at this point in the history
Easier than having to copy/paste the URL.
  • Loading branch information
foosel committed May 25, 2024
1 parent 43e1a7b commit 17c48a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/assets/cardfoldr.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,14 @@ document.getElementById("deletePreset").addEventListener("click", (event) => {
}
});

document.getElementById("shareLink").addEventListener("click", (event) => {
const query = generateQuery();
const url = `https://foosel.github.io/cardfoldr/?${query}`;
navigator.clipboard.writeText(url).then(() => {
alert(`Link copied to clipboard!`);
});
});

// --- Event listeners ---

const syncQueryParams = () => {
Expand Down
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ <h2>Step 2: Create Grid</h2>
<button id="updatePreset" class="pure-button" title="Save preset" disabled="true"><i class="fa fa-save"></i></button>
<button id="deletePreset" class="pure-button" title="Delete preset" disabled="true"><i class="fa fa-trash"></i></button>
<button id="saveNewPreset" class="pure-button" title="Save as..."><i class="fa fa-plus"></i></button>
<button id="shareLink" class="pure-button" title="Share preset by link"><i class="fa fa-share-alt"></i></button>
</div>
</fieldset>

Expand Down

0 comments on commit 17c48a2

Please sign in to comment.