Skip to content

Commit

Permalink
add a small tip button on the leaderboard that opens the QR code for …
Browse files Browse the repository at this point in the history
…the users BCH address OWASP-BLT#1819
  • Loading branch information
Sarthak5598 committed Feb 28, 2024
1 parent b368ebd commit 73f43ac
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions website/templates/_leaderboard_widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
<span class="me-auto text-[10px] mb-[0.8px]">{{ forloop.counter|ordinal|slice:"1:" }}</span>
</span>
</a>
<div>
<button type="button" id="openModal" class="btn btn-danger w-full" style="color: black;">Send a Tip</button>
<dialog id="dialog">
<img id="qr-image" alt="QR Code" height="400" width="400">
<p id="bch-address">BCH: {{leader.userprofile.crypto_address }}</p>
</dialog>
</div>
{% endfor %}
</div>
<div>
Expand All @@ -60,6 +67,12 @@
</div>
{% comment %} positions the leaderboard rightmost {% endcomment %}
<script>
document.getElementById('openModal').addEventListener('click', function() {
var address = "{{ leader.userprofile.crypto_address }}";
var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?data=bitcoincash:" + address + "&size=400x400";
document.getElementById('qr-image').src = qrUrl;
document.getElementById('dialog').showModal();
});
document.addEventListener('DOMContentLoaded', function() {
const grid = document.querySelector('.hero-bugs-container');
const child = document.querySelector('.leaderboard-widget');
Expand Down

0 comments on commit 73f43ac

Please sign in to comment.