Open QR codes in new tab w/o JS

dev
gravel 3 years ago
parent 9ed403e6f1
commit 66c5b77787
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -29,7 +29,8 @@ export const dom = {
details_modal_qr_code: () => document.getElementById('details-modal-qr-code'), details_modal_qr_code: () => document.getElementById('details-modal-qr-code'),
join_urls: () => document.getElementsByClassName("join_url_container"), join_urls: () => document.getElementsByClassName("join_url_container"),
servers_hidden: () => document.getElementById("servers_hidden"), servers_hidden: () => document.getElementById("servers_hidden"),
snackbar: () => document.getElementById("copy-snackbar") snackbar: () => document.getElementById("copy-snackbar"),
qr_code_buttons: () => document.querySelectorAll('.qr-code-button'),
} }
export const JOIN_URL_PASTE = "Copied URL to clipboard. Paste into Session app to join"; export const JOIN_URL_PASTE = "Copied URL to clipboard. Paste into Session app to join";

@ -159,6 +159,14 @@ function addQRModalHandlers() {
copyToClipboard(`@${staffId}`, 'Copied staff ID to clipboard.'); copyToClipboard(`@${staffId}`, 'Copied staff ID to clipboard.');
} }
) )
for (const anchor of dom.qr_code_buttons()) {
// Disable QR code links
anchor.setAttribute("href", "#");
anchor.removeAttribute("target");
anchor.addEventListener('click', (e) => { e.preventDefault(); return false });
}
} }
function createJoinLinkButtons() { function createJoinLinkButtons() {

@ -1,5 +1,5 @@
<?php <?php
include_once "$PROJECT_ROOT/php/utils/room-invites.php"; require_once "$PROJECT_ROOT/php/utils/room-invites.php";
?> ?>
<dialog id="details-modal"> <dialog id="details-modal">

@ -1,6 +1,7 @@
<?php <?php
require_once "$PROJECT_ROOT/php/utils/utils.php"; require_once "$PROJECT_ROOT/php/utils/utils.php";
require_once "$PROJECT_ROOT/php/utils/servers-rooms.php"; require_once "$PROJECT_ROOT/php/utils/servers-rooms.php";
require_once "$PROJECT_ROOT/php/utils/room-invites.php";
/** /**
* @var CommunityRoom[] $rooms * @var CommunityRoom[] $rooms
@ -103,12 +104,18 @@
</a> </a>
</td> </td>
<td class="td_qr_code"> <td class="td_qr_code">
<a
class="qr-code-button"
href="<?=room_qr_code($room)?>"
target="_blank"
>
<img <img
class="qr-code-icon" class="qr-code-icon"
src="qrcode-solid.svg" src="qrcode-solid.svg"
alt="Pictogram of a QR code" alt="Pictogram of a QR code"
title="Click here to view the QR Code for '<?=$name?>'" title="Click here to view the details for '<?=$name?>'"
> >
</a>
</td> </td>
<td class="td_server_icon" <td class="td_server_icon"
data-sort-by="<?=$pubkey?>" data-sort-by="<?=$pubkey?>"

Loading…
Cancel
Save