Skip to content

Commit

Permalink
copy pasta
Browse files Browse the repository at this point in the history
  • Loading branch information
qualityshepherd committed Aug 4, 2024
1 parent 029caa3 commit 3516f67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions assets/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ function toggleHamburger () {
links.style.display = 'block'
}
}


function copyTextToClipboard() {
let text = [...document.querySelectorAll('.copyToClipboard')].map(elm => `${elm.textContent}\n`).join('')
navigator.clipboard.writeText(text)
}
8 changes: 4 additions & 4 deletions src/views/rando.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ const rando = {
<div class="belief"><label>Belief</label> ${belief}</div>
<div>
<div class="sparks header">Sparks</div>
<div><label>Sparks</label> ${await r.sparks()}</div>
<div><label>Threat</label> ${threat}</div>
<div><label>Complication</label> ${complication}</div>
<div class="sparks header">Sparks <span class="copy dim small" title="copy text" onclick="copyTextToClipboard()">✁</span></div>
<div class="copyToClipboard"><label>Sparks</label> ${await r.sparks()}</div>
<div class="copyToClipboard"><label>Threat</label> ${threat}</div>
<div class="copyToClipboard"><label>Complication</label> ${complication}</div>
<div class="loot header">Loot</div>
<div><label>Coin</label> ${(r.d6() * r.d6() + r.d6())}</div>
Expand Down

0 comments on commit 3516f67

Please sign in to comment.